Skip to content

Commit

Permalink
Merge pull request #1617 from Mailaender/treeviewer-label-provider-crash
Browse files Browse the repository at this point in the history
Try to fix a native crash in SWT TreeViewer icon setting on Linux
  • Loading branch information
eselmeister authored Jan 26, 2024
2 parents e4b37dc + 9507c84 commit 7a58a18
Showing 1 changed file with 10 additions and 17 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019, 2023 Lablicate GmbH.
* Copyright (c) 2019, 2024 Lablicate GmbH.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
Expand Down Expand Up @@ -167,29 +167,22 @@ private void createTreeViewer(Composite parent, Function<File, Map<ISupplierFile
treeViewer.setUseHashlookup(true);
treeViewer.setExpandPreCheckFilters(true);
treeViewer.setContentProvider(new DataExplorerContentProvider(identifier));
treeViewer.setLabelProvider(new DataExplorerLabelProvider(identifier));
DisplayUtils.getDisplay().asyncExec(() -> {
// Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=573090
treeViewer.setLabelProvider(new DataExplorerLabelProvider(identifier));
});
setInput(treeViewer);
//
treeViewerControl.set(treeViewer);
}

private void setInput(TreeViewer treeViewer) {

/*
* Workaround for https://bugs.eclipse.org/bugs/show_bug.cgi?id=573090
*/
DisplayUtils.getDisplay().asyncExec(new Runnable() {

@Override
public void run() {

treeViewer.setInput(dataExplorerTreeRoot.getRootContent());
updateDirectory();
if(preferenceStore != null && preferenceKey != null) {
expandLastDirectoryPath(preferenceStore, preferenceKey);
}
}
});
treeViewer.setInput(dataExplorerTreeRoot.getRootContent());
updateDirectory();
if(preferenceStore != null && preferenceKey != null) {
expandLastDirectoryPath(preferenceStore, preferenceKey);
}
}

private void updateDirectory() {
Expand Down

0 comments on commit 7a58a18

Please sign in to comment.