Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed a native crash on Linux when opening the file browser tree for the first time #1575

Merged
merged 2 commits into from
Dec 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@

import org.eclipse.chemclipse.processing.converter.ISupplier;
import org.eclipse.chemclipse.processing.converter.ISupplierFileIdentifier;
import org.eclipse.chemclipse.support.ui.workbench.DisplayUtils;
import org.eclipse.chemclipse.ux.extension.ui.Activator;
import org.eclipse.chemclipse.ux.extension.ui.l10n.Messages;
import org.eclipse.chemclipse.ux.extension.ui.listener.DataExplorerDragListener;
Expand Down Expand Up @@ -153,7 +154,8 @@ private TreeViewer createTreeViewer(Composite parent, Function<File, Map<ISuppli

private void setInput(TreeViewer treeViewer) {

treeViewer.setInput(dataExplorerTreeRoot.getRootContent());
// Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=573090
DisplayUtils.getDisplay().asyncExec(() -> treeViewer.setInput(dataExplorerTreeRoot.getRootContent()));
}

private int getNumberOfChildDirectories(File directory) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import javax.inject.Inject;

import org.eclipse.chemclipse.processing.converter.ISupplierFileIdentifier;
import org.eclipse.chemclipse.support.ui.workbench.DisplayUtils;
import org.eclipse.chemclipse.ux.extension.xxd.ui.Activator;
import org.eclipse.chemclipse.ux.extension.xxd.ui.swt.DataExplorerUI;
import org.eclipse.e4.core.contexts.IEclipseContext;
Expand All @@ -37,12 +36,7 @@ public class DataExplorerPart {
@PostConstruct
public void init(Composite parent, MPart part, IEclipseContext context) {

// Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=573090
DisplayUtils.getDisplay().asyncExec(() -> {
dataExplorerUI = new DataExplorerUI(parent, preferenceStore, context, supplierFileIdentifier);
dataExplorerUI.getControl().redraw();
dataExplorerUI.getControl().requestLayout();
});
dataExplorerUI = new DataExplorerUI(parent, preferenceStore, context, supplierFileIdentifier);
}

public DataExplorerUI getDataExplorerUI() {
Expand All @@ -53,8 +47,6 @@ public DataExplorerUI getDataExplorerUI() {
@Focus
public void focus() {

if(dataExplorerUI != null) {
dataExplorerUI.setFocus();
}
dataExplorerUI.setFocus();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ public void widgetDisposed(DisposeEvent e) {
@Override
public String getText(Object element) {

if(element instanceof File) {
return getName((File)element);
if(element instanceof File file) {
return getName(file);
}
return "-";
}
Expand All @@ -314,8 +314,8 @@ public Image getImage(Object element) {
@Override
public String getText(Object element) {

if(element instanceof File) {
return getPath((File)element);
if(element instanceof File file) {
return getPath(file);
}
return "-";
}
Expand Down