From 5d49f6dc93139ab3b2de6963c421c777afba1af1 Mon Sep 17 00:00:00 2001 From: Maximilian Wittmer Date: Mon, 11 Mar 2024 11:54:45 +0100 Subject: [PATCH] Automatically Expand Paths of single children #1063 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit In these cases, I expect all folders to open recursively when clicking on com.wittmaxi.plugin com.wittmaxi.plugin └─src └─org.foo.com └─Bar.java A new feature in SWT allows for this feature, this PR enables that feature in the Package-Explorer. Implements https://github.com/eclipse-platform/eclipse.platform.ui/issues/1063 --- .../jdt/internal/ui/packageview/PackageExplorerPart.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java index 9fd9317c069..b78dcdbf78c 100644 --- a/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java +++ b/org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/packageview/PackageExplorerPart.java @@ -250,12 +250,20 @@ public void treeExpanded(TreeExpansionEvent event) { private class PackageExplorerProblemTreeViewer extends ProblemTreeViewer { + /** + * Number of levels to automatically expand when an element only has a single + * child. + * + * @see AbstractTreeViewer#setAutoExpandOnSingleChildLevels(int) + */ + private static final int AUTO_EXPAND_ON_SINGLE_CHILD_LEVELS= 10; // fix for 64372 Projects showing up in Package Explorer twice [package explorer] private final List fPendingRefreshes; public PackageExplorerProblemTreeViewer(Composite parent, int style) { super(parent, style); fPendingRefreshes= Collections.synchronizedList(new ArrayList<>()); + setAutoExpandOnSingleChildLevels(AUTO_EXPAND_ON_SINGLE_CHILD_LEVELS); } @Override public void add(Object parentElement, Object... childElements) {