X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.browsing.ui.swt%2Fsrc%2Forg%2Fsimantics%2Fbrowsing%2Fui%2Fswt%2FGraphExplorerViewBase.java;h=4b1d8ffef94c1e59d4756ddb994bfd3b293df6af;hb=HEAD;hp=72307b32f22ec8371841ed96ef4c469e7d85453a;hpb=0ae2b770234dfc3cbb18bd38f324125cf0faca07;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/GraphExplorerViewBase.java b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/GraphExplorerViewBase.java index 72307b32f..4b1d8ffef 100644 --- a/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/GraphExplorerViewBase.java +++ b/bundles/org.simantics.browsing.ui.swt/src/org/simantics/browsing/ui/swt/GraphExplorerViewBase.java @@ -27,6 +27,7 @@ import org.eclipse.ui.IViewSite; import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.PartInitException; import org.eclipse.ui.part.ViewPart; +import org.eclipse.ui.services.IDisposable; import org.simantics.browsing.ui.Column; import org.simantics.browsing.ui.GraphExplorer; import org.simantics.browsing.ui.NodeContext; @@ -298,6 +299,8 @@ public abstract class GraphExplorerViewBase extends ViewPart { // Remember to remove the installed workbench selection listener if (workbenchSelectionListener != null) { getSite().getWorkbenchWindow().getSelectionService().removePostSelectionListener(workbenchSelectionListener); + if (workbenchSelectionListener instanceof IDisposable) + ((IDisposable) workbenchSelectionListener).dispose(); workbenchSelectionListener = null; getSite().setSelectionProvider(null); @@ -520,16 +523,16 @@ public abstract class GraphExplorerViewBase extends ViewPart { return true; } - @SuppressWarnings("rawtypes") + @SuppressWarnings("unchecked") @Override - public Object getAdapter(Class adapter) { + public T getAdapter(Class adapter) { if (GraphExplorer.class == adapter) - return explorer; + return (T) explorer; else if(ISessionContextProvider.class == adapter) - return getSessionContextProvider(); + return (T) getSessionContextProvider(); else if(IPropertyPage.class == adapter) - return getPropertyPage(); + return (T) getPropertyPage(); return super.getAdapter(adapter);