Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexandra Buzila2017-04-13 15:37:36 +0000
committerJonas Helming2017-09-05 11:49:22 +0000
commit6ca4be665371fce8141336cd9f3cc624f3409cb1 (patch)
treec1f0903727acd7c1b3bcc1dea960f6a62e0f157b
parentd71311504fdaa11ff80ace67ce7aaf54c6b17ac4 (diff)
downloadeclipse.platform.ui-6ca4be665371fce8141336cd9f3cc624f3409cb1.tar.gz
eclipse.platform.ui-6ca4be665371fce8141336cd9f3cc624f3409cb1.tar.xz
eclipse.platform.ui-6ca4be665371fce8141336cd9f3cc624f3409cb1.zip
Bug 514935 - Reset of Perspective restores not restorable views I20170906-0225I20170905-2000
- Added new NO_RESTORE Tag - Adding this tag to PartDescriptors when parsing the 3x registrations - Setting Placeholders as invisible after clone if they have the tag - PartStack Renderer skips parts with NO_RESTORE tag when filling the tabfolder Change-Id: Ib5b13e7cba692efaf780bcfde3e7b8d095213393 Signed-off-by: Eugen Neufeld <eneufeld@eclipsesource.com> Signed-off-by: Alexandra Buzila <abuzila@eclipsesource.com>
-rw-r--r--bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/LazyStackRenderer.java2
-rw-r--r--bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/workbench/IPresentationEngine.java6
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java19
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewRegistry.java6
4 files changed, 31 insertions, 2 deletions
diff --git a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/LazyStackRenderer.java b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/LazyStackRenderer.java
index ecf17fa4ed9..9376cb40298 100644
--- a/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/LazyStackRenderer.java
+++ b/bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/LazyStackRenderer.java
@@ -122,6 +122,8 @@ public abstract class LazyStackRenderer extends SWTPartRenderer {
// part is already there...see bug 378138 for details
if (element instanceof MPlaceholder) {
MPlaceholder ph = (MPlaceholder) element;
+ if (ph.getRef().getTags().contains(IPresentationEngine.NO_RESTORE))
+ continue;
if (ph.getRef() instanceof MPart && ph.getRef().getWidget() != null) {
lazy = false;
}
diff --git a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/workbench/IPresentationEngine.java b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/workbench/IPresentationEngine.java
index a6a2b4ad2c3..40220b7f41d 100644
--- a/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/workbench/IPresentationEngine.java
+++ b/bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/workbench/IPresentationEngine.java
@@ -235,6 +235,12 @@ public interface IPresentationEngine {
public static final String ACTIVE = "active"; //$NON-NLS-1$
/**
+ * When applied as a tag to an MPartDescriptor marks the part as not
+ * restorable.
+ */
+ public static final String NO_RESTORE = "NoRestore"; //$NON-NLS-1$
+
+ /**
* Creates and returns the UI element for the given model element.
*
* @param element
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java
index 86e3cf4d8c0..0afe794acfb 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/WorkbenchPage.java
@@ -3951,7 +3951,24 @@ public class WorkbenchPage implements IWorkbenchPage {
visiblePerspective.setLabel(perspective.getLabel());
visiblePerspective.setTooltip(perspective.getLabel());
visiblePerspective.setElementId(perspective.getId());
- modelService.cloneElement(visiblePerspective, application);
+ MUIElement clone = modelService.cloneElement(visiblePerspective, application);
+ MWindow window = WorkbenchWindow.class.cast(getActivePart().getSite().getWorkbenchWindow()).getModel();
+ ModelServiceImpl.class.cast(modelService).getNullRefPlaceHolders(clone, window);
+ List<MPlaceholder> elementsToHide = modelService.findElements(clone, null, MPlaceholder.class, null);
+ for (MPlaceholder elementToHide : elementsToHide) {
+ if (elementToHide.getRef().getTags().contains(IPresentationEngine.NO_RESTORE)) {
+ elementToHide.setToBeRendered(false);
+ MElementContainer<MUIElement> phParent = elementToHide.getParent();
+ if (phParent.getSelectedElement() == elementToHide) {
+ phParent.setSelectedElement(null);
+ }
+ int vc = modelService.countRenderableChildren(phParent);
+ if (vc == 0) {
+ if (!modelService.isLastEditorStack(phParent))
+ phParent.setToBeRendered(false);
+ }
+ }
+ }
if (perspective instanceof PerspectiveDescriptor) {
((PerspectiveDescriptor) perspective).setHasCustomDefinition(true);
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewRegistry.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewRegistry.java
index 8dedc610cfe..880942e62c7 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewRegistry.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/registry/ViewRegistry.java
@@ -29,6 +29,7 @@ import org.eclipse.core.runtime.Platform;
import org.eclipse.e4.core.services.log.Logger;
import org.eclipse.e4.ui.model.application.MApplication;
import org.eclipse.e4.ui.model.application.descriptor.basic.MPartDescriptor;
+import org.eclipse.e4.ui.workbench.IPresentationEngine;
import org.eclipse.e4.ui.workbench.modeling.EModelService;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.IWorkbench;
@@ -194,8 +195,11 @@ public class ViewRegistry implements IViewRegistry {
tags.add("categoryTag:" + category.getLabel()); //$NON-NLS-1$
descriptor.setCategory(category.getLabel());
}
+ String restorable = element.getAttribute(IWorkbenchRegistryConstants.ATT_RESTORABLE);
+ if (!(restorable == null ? true : Boolean.parseBoolean(restorable))) {
+ descriptor.getTags().add(IPresentationEngine.NO_RESTORE);
+ }
// ==> End of update descriptor
-
ViewDescriptor viewDescriptor = new ViewDescriptor(application, descriptor, element);
descriptors.put(descriptor.getElementId(), viewDescriptor);
if (category != null) {

Back to the top