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

Improve 'EditorStack' detection in CTabRendering #1712

Merged
Merged
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 @@ -27,7 +27,11 @@
import org.eclipse.core.runtime.preferences.InstanceScope;
import org.eclipse.e4.ui.internal.css.swt.ICTabRendering;
import org.eclipse.e4.ui.internal.workbench.swt.AbstractPartRenderer;
import org.eclipse.e4.ui.model.application.ui.MContext;
import org.eclipse.e4.ui.model.application.ui.MUIElement;
import org.eclipse.e4.ui.workbench.modeling.EModelService;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.CTabFolder;
import org.eclipse.swt.custom.CTabFolderRenderer;
Expand Down Expand Up @@ -89,8 +93,6 @@ public class CTabRendering extends CTabFolderRenderer implements ICTabRendering,
private static int MIN_VIEW_CHARS = 1;
private static int MAX_VIEW_CHARS = 9999;

private static final String EditorTag = "EditorStack"; //$NON-NLS-1$

// Constants for circle drawing
static enum CirclePart {
LEFT_TOP, LEFT_BOTTOM, RIGHT_TOP, RIGHT_BOTTOM;
Expand Down Expand Up @@ -1330,7 +1332,15 @@ private IEclipsePreferences getSwtRendererPreferences() {

private boolean isPartOfEditorStack() {
MUIElement element = (MUIElement) parent.getData(AbstractPartRenderer.OWNING_ME);
return element != null && element.getTags().contains(EditorTag);
EObject root = EcoreUtil.getRootContainer((EObject) element, true);
if (root instanceof MContext context) {
EModelService eModelService = context.getContext().get(EModelService.class);
if (eModelService != null) {
int location = eModelService.getElementLocation(element);
return (location & EModelService.IN_SHARED_AREA) != 0;
}
}
return false;
}

private boolean getHideIconsForViewTabsPreference() {
Expand Down
Loading