summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorDean Roberts2011-11-09 08:20:00 (EST)
committer Paul Webster2011-11-09 08:20:00 (EST)
commit5e15d8954551428c720c68600403d5ceb8fc74b6 (patch)
tree5993d1ed92ec7a650283ac4b78f8d65e5cf93b2f
parent5741edc97125f810477cdbcd0a3ba6701197320a (diff)
downloadeclipse.platform.ui-5e15d8954551428c720c68600403d5ceb8fc74b6.zip
eclipse.platform.ui-5e15d8954551428c720c68600403d5ceb8fc74b6.tar.gz
eclipse.platform.ui-5e15d8954551428c720c68600403d5ceb8fc74b6.tar.bz2
Bug 361460 - View hidden by capability filtering does not appear when
capability activated Add the view activator for a layout folder
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ModeledFolderLayout.java6
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ModeledPageLayout.java32
2 files changed, 24 insertions, 14 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ModeledFolderLayout.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ModeledFolderLayout.java
index 3a6256b..b436e2f 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ModeledFolderLayout.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ModeledFolderLayout.java
@@ -39,10 +39,10 @@ public class ModeledFolderLayout extends ModeledPlaceholderFolderLayout
parent = parent.getParent();
}
folderModel.setToBeRendered(true);
- boolean isViewVisible = layout.isViewVisible(viewId);
- if (!isViewVisible)
+ boolean isFiltered = layout.isViewFiltered(viewId);
+ if (isFiltered)
layout.addViewActivator(viewModel);
- viewModel.setToBeRendered(isViewVisible);
+ viewModel.setToBeRendered(!isFiltered);
folderModel.getChildren().add(viewModel);
}
}
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ModeledPageLayout.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ModeledPageLayout.java
index 9dabd15..a9ca320 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ModeledPageLayout.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/e4/compatibility/ModeledPageLayout.java
@@ -220,8 +220,7 @@ public class ModeledPageLayout implements IPageLayout {
public void addStandaloneView(String viewId, boolean showTitle,
int relationship, float ratio, String refId) {
- boolean isVisible = isViewVisible(viewId);
- insertView(viewId, relationship, ratio, refId, isVisible, false);
+ insertView(viewId, relationship, ratio, refId, true, false);
}
public void addStandaloneViewPlaceholder(String viewId, int relationship,
@@ -231,8 +230,7 @@ public class ModeledPageLayout implements IPageLayout {
}
public void addView(String viewId, int relationship, float ratio, String refId) {
- boolean isVisible = isViewVisible(viewId);
- insertView(viewId, relationship, ratio, refId, isVisible, true);
+ insertView(viewId, relationship, ratio, refId, true, true);
}
public void addView(String viewId, int relationship, float ratio, String refId,
@@ -243,20 +241,21 @@ public class ModeledPageLayout implements IPageLayout {
addView(viewId, relationship, ratio, refId);
}
- protected boolean isViewVisible(String viewID) {
+ protected boolean isViewFiltered(String viewID) {
IViewDescriptor viewDescriptor = viewRegistry.find(viewID);
if (viewDescriptor == null)
return false;
if (WorkbenchActivityHelper.restrictUseOf(viewDescriptor))
- return false;
- return !WorkbenchActivityHelper.filterItem(viewDescriptor);
+ return true;
+ return WorkbenchActivityHelper.filterItem(viewDescriptor);
}
protected void addViewActivator(MUIElement element) {
+ IPluginContribution contribution = (IPluginContribution) viewRegistry.find(element
+ .getElementId());
IWorkbenchActivitySupport support = PlatformUI.getWorkbench().getActivitySupport();
IIdentifier identifier = support.getActivityManager().getIdentifier(
- WorkbenchActivityHelper.createUnifiedId((IPluginContribution) descriptor));
-
+ WorkbenchActivityHelper.createUnifiedId(contribution));
identifier.addIdentifierListener(new ViewActivator(element));
}
@@ -386,16 +385,27 @@ public class ModeledPageLayout implements IPageLayout {
private void insertView(String viewId, int relationship, float ratio,
String refId, boolean visible, boolean withStack) {
- MStackElement viewModel = createViewModel(application, viewId, visible, page, partService,
+
+ // Hide views that are filtered by capabilities
+ boolean isFiltered = isViewFiltered(viewId);
+
+ MStackElement viewModel = createViewModel(application, viewId, visible && !isFiltered,
+ page, partService,
createReferences);
if (viewModel != null) {
if (withStack) {
String stackId = viewId + "MStack"; // Default id...basically unusable //$NON-NLS-1$
- MPartStack stack = insertStack(stackId, relationship, ratio, refId, visible);
+ MPartStack stack = insertStack(stackId, relationship, ratio, refId, visible
+ & !isFiltered);
stack.getChildren().add(viewModel);
} else {
insert(viewModel, findRefModel(refId), plRelToSwt(relationship), ratio);
}
+
+ }
+
+ if (isFiltered) {
+ addViewActivator(viewModel);
}
}