summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorFlorina Craciunescu2012-01-10 09:41:32 (EST)
committer Paul Webster2012-01-10 09:41:32 (EST)
commit6ff718a9dcac80173bb42cdd670e66ed95847e20 (patch)
tree03208f5bc22c6f89a7a967d2f390c378021201bd
parent8cb43f9aa042e9f0c75102e013d3848d5388e720 (diff)
downloadeclipse.platform.ui-6ff718a9dcac80173bb42cdd670e66ed95847e20.zip
eclipse.platform.ui-6ff718a9dcac80173bb42cdd670e66ed95847e20.tar.gz
eclipse.platform.ui-6ff718a9dcac80173bb42cdd670e66ed95847e20.tar.bz2
Bug 367419 - Explicit cast to ViewActionsBars when disposing a view partv20120110-1441
Cast to the most abstract interface that works
-rw-r--r--bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewReference.java27
1 files changed, 19 insertions, 8 deletions
diff --git a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewReference.java b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewReference.java
index 99e662b..0c2ed54 100644
--- a/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewReference.java
+++ b/bundles/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/ViewReference.java
@@ -10,18 +10,19 @@
*******************************************************************************/
package org.eclipse.ui.internal;
-import org.eclipse.ui.internal.testing.ContributionInfoMessages;
-
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.dynamichelpers.IExtensionTracker;
import org.eclipse.jface.action.ContributionManager;
import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IKeyBindingService;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IViewPart;
@@ -32,9 +33,11 @@ import org.eclipse.ui.IWorkbenchPart2;
import org.eclipse.ui.IWorkbenchPart3;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.SubActionBars;
import org.eclipse.ui.internal.misc.StatusUtil;
import org.eclipse.ui.internal.misc.UIStats;
import org.eclipse.ui.internal.registry.ViewDescriptor;
+import org.eclipse.ui.internal.testing.ContributionInfoMessages;
import org.eclipse.ui.internal.util.Util;
import org.eclipse.ui.menus.IMenuService;
import org.eclipse.ui.part.IWorkbenchPartOrientation;
@@ -105,18 +108,26 @@ class ViewReference extends WorkbenchPartReference implements IViewReference {
if (view != null) {
// Free action bars, pane, etc.
PartSite site = (PartSite) view.getSite();
- ViewActionBars actionBars = (ViewActionBars) site.getActionBars();
+ IActionBars actionBars = site.getActionBars();
//
// 3.3 start
//
+
IMenuService menuService = (IMenuService) site
.getService(IMenuService.class);
- menuService.releaseContributions((ContributionManager) site.getActionBars()
- .getMenuManager());
- menuService.releaseContributions((ContributionManager) site.getActionBars()
- .getToolBarManager());
+ IMenuManager menuManager = actionBars.getMenuManager();
+ if (menuManager instanceof ContributionManager) {
+ menuService.releaseContributions((ContributionManager) menuManager);
+ }
+ IToolBarManager toolBarManager = actionBars.getToolBarManager();
+ if(toolBarManager instanceof ContributionManager)
+ {
+ menuService.releaseContributions((ContributionManager) toolBarManager);
+ }
// 3.3 end
- actionBars.dispose();
+ if (actionBars instanceof SubActionBars) {
+ ((SubActionBars) actionBars).dispose();
+ }
// and now dispose the delegates since the
// PluginActionContributionItem