|
27 | 27 | import org.eclipse.core.runtime.preferences.InstanceScope; |
28 | 28 | import org.eclipse.e4.ui.internal.css.swt.ICTabRendering; |
29 | 29 | import org.eclipse.e4.ui.internal.workbench.swt.AbstractPartRenderer; |
| 30 | +import org.eclipse.e4.ui.model.application.ui.MContext; |
30 | 31 | import org.eclipse.e4.ui.model.application.ui.MUIElement; |
| 32 | +import org.eclipse.e4.ui.workbench.modeling.EModelService; |
| 33 | +import org.eclipse.emf.ecore.EObject; |
| 34 | +import org.eclipse.emf.ecore.util.EcoreUtil; |
31 | 35 | import org.eclipse.swt.SWT; |
32 | 36 | import org.eclipse.swt.custom.CTabFolder; |
33 | 37 | import org.eclipse.swt.custom.CTabFolderRenderer; |
@@ -89,8 +93,6 @@ public class CTabRendering extends CTabFolderRenderer implements ICTabRendering, |
89 | 93 | private static int MIN_VIEW_CHARS = 1; |
90 | 94 | private static int MAX_VIEW_CHARS = 9999; |
91 | 95 |
|
92 | | - private static final String EditorTag = "EditorStack"; //$NON-NLS-1$ |
93 | | - |
94 | 96 | // Constants for circle drawing |
95 | 97 | static enum CirclePart { |
96 | 98 | LEFT_TOP, LEFT_BOTTOM, RIGHT_TOP, RIGHT_BOTTOM; |
@@ -1330,7 +1332,15 @@ private IEclipsePreferences getSwtRendererPreferences() { |
1330 | 1332 |
|
1331 | 1333 | private boolean isPartOfEditorStack() { |
1332 | 1334 | MUIElement element = (MUIElement) parent.getData(AbstractPartRenderer.OWNING_ME); |
1333 | | - return element != null && element.getTags().contains(EditorTag); |
| 1335 | + EObject root = EcoreUtil.getRootContainer((EObject) element, true); |
| 1336 | + if (root instanceof MContext context) { |
| 1337 | + EModelService eModelService = context.getContext().get(EModelService.class); |
| 1338 | + if (eModelService != null) { |
| 1339 | + int location = eModelService.getElementLocation(element); |
| 1340 | + return (location & EModelService.IN_SHARED_AREA) != 0; |
| 1341 | + } |
| 1342 | + } |
| 1343 | + return false; |
1334 | 1344 | } |
1335 | 1345 |
|
1336 | 1346 | private boolean getHideIconsForViewTabsPreference() { |
|
0 commit comments