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;
// 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);
return true;
}
- @SuppressWarnings("rawtypes")
+ @SuppressWarnings("unchecked")
@Override
- public Object getAdapter(Class adapter) {
+ public <T> T getAdapter(Class<T> 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);