/** * @return the {@link IDiagramEditor} diagram editor. */ protected IDiagramEditor getDiagramEditor() { IWorkbenchPart part = getPart(); if (part instanceof IContributedContentsView) { IContributedContentsView contributedView = (IContributedContentsView) part .getAdapter(IContributedContentsView.class); if (contributedView != null) { part = contributedView.getContributingPart(); } } if (part instanceof IDiagramEditor) { return (IDiagramEditor) part; } return null; }
@Override public boolean appliesTo(IWorkbenchPart part, ISelection selection) { if (part instanceof ContentOutline) { ContentOutline outline = (ContentOutline)part; IContributedContentsView v = (IContributedContentsView)outline.getAdapter(IContributedContentsView.class); if (v!=null) part = v.getContributingPart(); } editor = (DiagramEditor)part.getAdapter(DiagramEditor.class); if (editor!=null) { return true; } return false; }
@Override public Object getAdapter(@SuppressWarnings("rawtypes") Class adapter) { if (adapter == IContributedContentsView.class) { return this; } return super.getAdapter(adapter); }
public Object getAdapter( Class key ) { if ( key == IContributedContentsView.class ) return new IContributedContentsView( ) { public IWorkbenchPart getContributingPart( ) { return getCurrentContributingPart( ); } }; return super.getAdapter( key ); }
public Object getAdapter( Class key ) { if ( key == IContributedContentsView.class ) { return new IContributedContentsView( ) { public IWorkbenchPart getContributingPart( ) { return getCurrentContributingPart( ); } }; } return super.getAdapter( key ); }