private void createSiteActions(IWorkbenchSite site, ISelectionProvider specialProvider) { fOpenImplementation = new OpenImplementationAction(site); fOpenImplementation.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_IMPLEMENTATION); fOpenImplementation.setSpecialSelectionProvider(specialProvider); fOpenSuperImplementation = new OpenSuperImplementationAction(site); fOpenSuperImplementation.setActionDefinitionId( IJavaEditorActionDefinitionIds.OPEN_SUPER_IMPLEMENTATION); fOpenSuperImplementation.setSpecialSelectionProvider(specialProvider); fOpenAttachedJavadoc = new OpenAttachedJavadocAction(site); fOpenAttachedJavadoc.setActionDefinitionId( IJavaEditorActionDefinitionIds.OPEN_ATTACHED_JAVADOC); fOpenAttachedJavadoc.setSpecialSelectionProvider(specialProvider); fOpenTypeHierarchy = new OpenTypeHierarchyAction(site); fOpenTypeHierarchy.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_TYPE_HIERARCHY); fOpenTypeHierarchy.setSpecialSelectionProvider(specialProvider); fOpenCallHierarchy = new OpenCallHierarchyAction(site); fOpenCallHierarchy.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_CALL_HIERARCHY); fOpenCallHierarchy.setSpecialSelectionProvider(specialProvider); ISelectionProvider provider = specialProvider != null ? specialProvider : site.getSelectionProvider(); fOpenPropertiesDialog = new PropertyDialogAction(site, provider); fOpenPropertiesDialog.setActionDefinitionId(IWorkbenchCommandConstants.FILE_PROPERTIES); initialize(provider); }
/** * Note: This constructor is for internal use only. Clients should not call this constructor. * * @param part the editor part * @noreference This constructor is not intended to be referenced by clients. */ public OpenViewActionGroup(JavaEditor part) { fEditorIsOwner = true; fShowShowInMenu = false; fOpenImplementation = new OpenImplementationAction(part); fOpenImplementation.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_IMPLEMENTATION); part.setAction("OpenImplementation", fOpenImplementation); // $NON-NLS-1$ fOpenSuperImplementation = new OpenSuperImplementationAction(part); fOpenSuperImplementation.setActionDefinitionId( IJavaEditorActionDefinitionIds.OPEN_SUPER_IMPLEMENTATION); part.setAction("OpenSuperImplementation", fOpenSuperImplementation); // $NON-NLS-1$ fOpenAttachedJavadoc = new OpenAttachedJavadocAction(part); fOpenAttachedJavadoc.setActionDefinitionId( IJavaEditorActionDefinitionIds.OPEN_ATTACHED_JAVADOC); part.setAction("OpenAttachedJavadoc", fOpenAttachedJavadoc); // $NON-NLS-1$ fOpenTypeHierarchy = new OpenTypeHierarchyAction(part); fOpenTypeHierarchy.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_TYPE_HIERARCHY); part.setAction("OpenTypeHierarchy", fOpenTypeHierarchy); // $NON-NLS-1$ fOpenCallHierarchy = new OpenCallHierarchyAction(part); fOpenCallHierarchy.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_CALL_HIERARCHY); part.setAction("OpenCallHierarchy", fOpenCallHierarchy); // $NON-NLS-1$ initialize(part.getEditorSite().getSelectionProvider()); }
private void initialize(ISelectionProvider provider) { fSelectionProvider = provider; ISelection selection = provider.getSelection(); fOpenImplementation.update(selection); fOpenSuperImplementation.update(selection); fOpenAttachedJavadoc.update(selection); fOpenTypeHierarchy.update(selection); fOpenCallHierarchy.update(selection); if (!fEditorIsOwner) { if (fShowOpenPropertiesAction) { if (selection instanceof IStructuredSelection) { fOpenPropertiesDialog.selectionChanged((IStructuredSelection) selection); } else { fOpenPropertiesDialog.selectionChanged(selection); } } provider.addSelectionChangedListener(fOpenImplementation); provider.addSelectionChangedListener(fOpenSuperImplementation); provider.addSelectionChangedListener(fOpenAttachedJavadoc); provider.addSelectionChangedListener(fOpenTypeHierarchy); provider.addSelectionChangedListener(fOpenCallHierarchy); // no need to register the open properties dialog action since it registers itself } }