Skip to content

Commit 9e1a882

Browse files
committed
Welcome Page does not handle Editors Area correctly
fixes #3739
1 parent 89a19bf commit 9e1a882

File tree

2 files changed

+27
-8
lines changed

2 files changed

+27
-8
lines changed

bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/ViewIntroAdapterPart.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,16 @@
2020
import org.eclipse.core.runtime.Status;
2121
import org.eclipse.e4.core.services.events.IEventBroker;
2222
import org.eclipse.e4.ui.model.application.ui.MUIElement;
23+
import org.eclipse.e4.ui.model.application.ui.advanced.MArea;
24+
import org.eclipse.e4.ui.model.application.ui.advanced.MPlaceholder;
2325
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
2426
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
2527
import org.eclipse.e4.ui.workbench.IPresentationEngine;
2628
import org.eclipse.e4.ui.workbench.UIEvents;
2729
import org.eclipse.e4.ui.workbench.UIEvents.EventTags;
30+
import org.eclipse.e4.ui.workbench.addons.minmax.MinMaxAddonUtil;
2831
import org.eclipse.swt.custom.BusyIndicator;
32+
import org.eclipse.swt.custom.CTabFolder;
2933
import org.eclipse.swt.graphics.Image;
3034
import org.eclipse.swt.widgets.Composite;
3135
import org.eclipse.swt.widgets.Control;
@@ -59,12 +63,20 @@ public final class ViewIntroAdapterPart extends ViewPart {
5963
}
6064

6165
Object changedObj = event.getProperty(EventTags.ELEMENT);
62-
if (!(changedObj instanceof MPartStack)) {
66+
if (!(changedObj instanceof MPartStack) && !(changedObj instanceof MPlaceholder)) {
6367
return;
6468
}
6569

66-
if (changedObj != getIntroStack()) {
67-
return;
70+
MPartStack introStack = getIntroStack();
71+
if (changedObj != introStack) {
72+
MArea parentArea = MinMaxAddonUtil.getAreaFor(introStack);
73+
if (parentArea != null && !(parentArea.getWidget() instanceof CTabFolder)) {
74+
if (parentArea.getCurSharedRef() != changedObj) {
75+
return;
76+
}
77+
} else {
78+
return;
79+
}
6880
}
6981

7082
if (UIEvents.isADD(event)

bundles/org.eclipse.ui.workbench/eclipseui/org/eclipse/ui/internal/WorkbenchIntroManager.java

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,13 @@
2121
import org.eclipse.core.runtime.dynamichelpers.IExtensionChangeHandler;
2222
import org.eclipse.core.runtime.dynamichelpers.IExtensionTracker;
2323
import org.eclipse.e4.ui.model.application.ui.MUIElement;
24+
import org.eclipse.e4.ui.model.application.ui.advanced.MArea;
2425
import org.eclipse.e4.ui.model.application.ui.advanced.MPlaceholder;
2526
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
2627
import org.eclipse.e4.ui.model.application.ui.basic.MPartStack;
2728
import org.eclipse.e4.ui.workbench.IPresentationEngine;
29+
import org.eclipse.e4.ui.workbench.addons.minmax.MinMaxAddonUtil;
30+
import org.eclipse.swt.custom.CTabFolder;
2831
import org.eclipse.ui.IViewPart;
2932
import org.eclipse.ui.IViewReference;
3033
import org.eclipse.ui.IWorkbenchPage;
@@ -191,7 +194,7 @@ public void setIntroStandby(IIntroPart part, boolean standby) {
191194
return;
192195
}
193196

194-
MPartStack introStack = getIntroStack(viewIntroAdapterPart);
197+
MUIElement introStack = getIntroStack(viewIntroAdapterPart);
195198
if (introStack == null) {
196199
return;
197200
}
@@ -204,22 +207,26 @@ public void setIntroStandby(IIntroPart part, boolean standby) {
204207
}
205208
}
206209

207-
private MPartStack getIntroStack(ViewIntroAdapterPart introAdapter) {
210+
private MUIElement getIntroStack(ViewIntroAdapterPart introAdapter) {
208211
ViewSite site = (ViewSite) introAdapter.getViewSite();
209212

210213
MPart introModelPart = site.getModel();
211214
if (introModelPart.getCurSharedRef() != null) {
212215
MUIElement introPartParent = introModelPart.getCurSharedRef().getParent();
213-
if (introPartParent instanceof MPartStack) {
214-
return (MPartStack) introPartParent;
216+
if (introPartParent instanceof MPartStack parentStack) {
217+
MArea parentArea = MinMaxAddonUtil.getAreaFor(parentStack);
218+
if (parentArea != null && !(parentArea.getWidget() instanceof CTabFolder)) {
219+
return parentArea.getCurSharedRef();
220+
}
221+
return introPartParent;
215222
}
216223
}
217224

218225
return null;
219226
}
220227

221228
private boolean isIntroMaximized(ViewIntroAdapterPart introAdapter) {
222-
MPartStack introStack = getIntroStack(introAdapter);
229+
MUIElement introStack = getIntroStack(introAdapter);
223230
if (introStack == null) {
224231
return false;
225232
}

0 commit comments

Comments
 (0)