fOpenBrowserAction.setEnabled(input != null);
fOpenBrowserAction.setEnabled(input != null);
@Override protected void createActions() { super.createActions(); fSelectAllAction= new SelectAllAction(getControl(), (SelectionProvider) getSelectionProvider()); fBackAction= new BackAction(); fBackAction.setActionDefinitionId(IWorkbenchCommandConstants.NAVIGATE_BACK); fForthAction= new ForthAction(); fForthAction.setActionDefinitionId(IWorkbenchCommandConstants.NAVIGATE_FORWARD); fInputSelectionProvider= new SimpleSelectionProvider(); fOpenBrowserAction= new OpenInBrowserAction(getSite()); fOpenBrowserAction.setSpecialSelectionProvider(fInputSelectionProvider); fOpenBrowserAction.setImageDescriptor(JavaPluginImages.DESC_ELCL_OPEN_BROWSER); fOpenBrowserAction.setDisabledImageDescriptor(JavaPluginImages.DESC_DLCL_OPEN_BROWSER); fOpenBrowserAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_ATTACHED_JAVADOC); fInputSelectionProvider.addSelectionChangedListener(fOpenBrowserAction); IJavaElement input= getOrignalInput(); StructuredSelection selection; if (input != null) { selection= new StructuredSelection(input); } else { selection= new StructuredSelection(); } fInputSelectionProvider.setSelection(selection); }
@Override protected void createActions() { super.createActions(); fSelectAllAction= new SelectAllAction(getControl(), (SelectionProvider) getSelectionProvider()); fBackAction= new BackAction(); fBackAction.setActionDefinitionId(IWorkbenchCommandConstants.NAVIGATE_BACK); fForthAction= new ForthAction(); fForthAction.setActionDefinitionId(IWorkbenchCommandConstants.NAVIGATE_FORWARD); fInputSelectionProvider= new SimpleSelectionProvider(); fOpenBrowserAction= new OpenInBrowserAction(getSite()); fOpenBrowserAction.setSpecialSelectionProvider(fInputSelectionProvider); fOpenBrowserAction.setImageDescriptor(JavaPluginImages.DESC_ELCL_OPEN_BROWSER); fOpenBrowserAction.setDisabledImageDescriptor(JavaPluginImages.DESC_DLCL_OPEN_BROWSER); fOpenBrowserAction.setActionDefinitionId(IJavaEditorActionDefinitionIds.OPEN_ATTACHED_JAVADOC); fInputSelectionProvider.addSelectionChangedListener(fOpenBrowserAction); IJavaElement input= getOrignalInput(); StructuredSelection selection; if (input != null) { selection= new StructuredSelection(input); } else { selection= new StructuredSelection(); } fInputSelectionProvider.setSelection(selection); }
@Override public void selectionChanged(IStructuredSelection structuredSelection) { super.selectionChanged(structuredSelection); Object element= structuredSelection.getFirstElement(); if (element instanceof URL) { setText(InfoViewMessages.OpenInBrowserAction_url_label); setToolTipText(InfoViewMessages.OpenInBrowserAction_url_toolTip); } else { setText(ActionMessages.OpenAttachedJavadocAction_label); setToolTipText(ActionMessages.OpenAttachedJavadocAction_tooltip); } }
@Override public void run(IStructuredSelection selection) { if (!canEnableFor(selection)) return; Object element= selection.getFirstElement(); if (element instanceof IJavaElement) super.run(selection); else open((URL)element); }
@Override public void run(IStructuredSelection selection) { if (!canEnableFor(selection)) return; Object element= selection.getFirstElement(); if (element instanceof IJavaElement) super.run(selection); else open((URL)element); }
@Override public void selectionChanged(IStructuredSelection structuredSelection) { super.selectionChanged(structuredSelection); Object element= structuredSelection.getFirstElement(); if (element instanceof URL) { setText(InfoViewMessages.OpenInBrowserAction_url_label); setToolTipText(InfoViewMessages.OpenInBrowserAction_url_toolTip); } else { setText(ActionMessages.OpenAttachedJavadocAction_label); setToolTipText(ActionMessages.OpenAttachedJavadocAction_tooltip); } }