/** * Returns the action registered with the given text editor. * * @param editor the editor, or <code>null</code> * @param actionId the action id * @return the action, or <code>null</code> if none */ protected final IAction getAction(ITextEditor editor, String actionId) { return (editor == null || actionId == null ? null : editor.getAction(actionId)); }
/** * Returns the action registed with the given text editor. * @return IAction or null if editor is null. */ protected IAction getAction(ITextEditor editor, String actionID) { return (editor == null ? null : editor.getAction(actionID)); } /* (non-JavaDoc)
/** * Creates a new instance. * * @param bundle the resource bundle * @param prefix a prefix to be prepended to the various resource keys (described in * <code>ResourceAction</code> constructor), or <code>null</code> if none * @param editor the text editor */ public AddBlockCommentAction(ResourceBundle bundle, String prefix, ITextEditor editor) { super(bundle, prefix, editor); action= editor.getAction("Format"); //$NON-NLS-1$ }
/** * Returns the action registered with the given text editor. * * @param editor the editor, or <code>null</code> * @param actionId the action id * @return the action, or <code>null</code> if none */ protected final IAction getAction(ITextEditor editor, String actionId) { return (editor == null || actionId == null ? null : editor.getAction(actionId)); }
/** * Returns the action registed with the given text editor. * * @return IAction or null if editor is null. */ protected IAction getAction(ITextEditor editor, String actionID) { return (editor == null ? null : editor.getAction(actionID)); }
/** * Returns the action registered with the given text editor. * * @param editor the editor, or <code>null</code> * @param actionId the action id * @return the action, or <code>null</code> if none */ protected final IAction getAction(ITextEditor editor, String actionId) { return (editor == null || actionId == null ? null : editor.getAction(actionId)); }
/** * Returns the action registed with the given text editor. * @return IAction or null if editor is null. */ protected IAction getAction(ITextEditor editor, String actionID) { return (editor == null ? null : editor.getAction(actionID)); } /* (non-JavaDoc)
/** * Gets the action 1. * * @param editor the editor * @param actionID the action ID * @return the action 1 */ protected IAction getAction1(ITextEditor editor, String actionID) { return (editor == null ? null : editor.getAction(actionID)); }
protected final IAction getAction(ITextEditor editor, String actionId) { return (editor == null ? null : editor.getAction(actionId)); }
/** * Returns the action registed with the given text editor. * * @param editor the editor * @param actionID the action ID * @return IAction or null if editor is null. */ protected IAction getAction(MultiPageEditorPart editor, String actionID) { ITextEditor txtEditor = ((MultiPageEditor) editor).getSourcePageEditor(); return (txtEditor == null ? null : txtEditor.getAction(actionID)); }
/** * Updates all actions of this action group. */ public void update() { if (fTextEditor == null) return; IAction a= fTextEditor.getAction(IEncodingActionsConstants.SYSTEM); if (a instanceof IUpdate) ((IUpdate) a).update(); for (int i= 0; i < ENCODINGS.length; i++) { a= fTextEditor.getAction(ENCODINGS[i][0]); if (a instanceof IUpdate) ((IUpdate) a).update(); } a= fTextEditor.getAction(IEncodingActionsConstants.CUSTOM); if (a instanceof IUpdate) ((IUpdate) a).update(); }
/** * Retargets this action group to the given editor. * * @param editor the text editor to which the group should be retargeted */ public void retarget(ITextEditor editor) { fTextEditor= editor; Iterator e= fRetargetActions.iterator(); while (e.hasNext()) { RetargetTextEditorAction a= (RetargetTextEditorAction) e.next(); a.setAction(editor == null ? null : editor.getAction(a.getId())); } }
/** * Updates all actions of this action group. */ public void update() { if (fTextEditor == null) return; IAction a= fTextEditor.getAction(IEncodingActionsConstants.SYSTEM); if (a instanceof IUpdate) ((IUpdate) a).update(); for (int i= 0; i < ENCODINGS.length; i++) { a= fTextEditor.getAction(ENCODINGS[i][0]); if (a instanceof IUpdate) ((IUpdate) a).update(); } a= fTextEditor.getAction(IEncodingActionsConstants.CUSTOM); if (a instanceof IUpdate) ((IUpdate) a).update(); }
/** * Retargets this action group to the given editor. * * @param editor the text editor to which the group should be retargeted */ public void retarget(ITextEditor editor) { fTextEditor= editor; Iterator<RetargetTextEditorAction> e= fRetargetActions.iterator(); while (e.hasNext()) { RetargetTextEditorAction a= e.next(); a.setAction(editor == null ? null : editor.getAction(a.getId())); } }
private void triggerAction(String actionID) { IAction action= getTextEditor().getAction(actionID); if (action != null) { if (action instanceof IUpdate) ((IUpdate) action).update(); // hack to propagate line change if (action instanceof ISelectionListener) { ((ISelectionListener)action).selectionChanged(null, null); } if (action.isEnabled()) action.run(); } }
private void triggerAction(String actionID, Event event) { IAction action= getTextEditor().getAction(actionID); if (action != null) { if (action instanceof IUpdate) ((IUpdate) action).update(); // hack to propagate line change if (action instanceof ISelectionListener) { ((ISelectionListener)action).selectionChanged(null, null); } if (action.isEnabled()) { if (event == null) { action.run(); } else { event.type= SWT.MouseDoubleClick; event.count= 2; action.runWithEvent(event); } } } }
private void triggerAction(String actionID, Event event) { IAction action= getTextEditor().getAction(actionID); if (action != null) { if (action instanceof IUpdate) ((IUpdate) action).update(); // hack to propagate line change if (action instanceof ISelectionListener) { ((ISelectionListener)action).selectionChanged(null, null); } if (action.isEnabled()) { if (event == null) { action.run(); } else { event.type= SWT.MouseDoubleClick; event.count= 2; action.runWithEvent(event); } } } }
public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) { if (region == null || canShowMultipleHyperlinks || !(fTextEditor instanceof AspectJEditor)) { return null; } IAction openAction = fTextEditor.getAction("OpenEditor"); //$NON-NLS-1$ if (openAction == null) { return null; } int offset = region.getOffset(); IJavaElement input = SelectionConverter .getInput((JavaEditor) fTextEditor); if (input instanceof ICompilationUnit) { input = AJCompilationUnitManager.mapToAJCompilationUnit((ICompilationUnit)input); } if (input instanceof AJCompilationUnit) { String source = PointcutUtilities.isInPointcutContext((AJCompilationUnit)input,offset); if (source != null) { IRegion reg = selectWord(source, offset); if (reg != null) { return new IHyperlink[] { new JavaElementHyperlink( reg, openAction) }; } } } return null; }
public IHyperlink[] detectHyperlinks(ITextViewer textViewer, IRegion region, boolean canShowMultipleHyperlinks) { ITextEditor textEditor= (ITextEditor)getAdapter(ITextEditor.class); if (region == null || canShowMultipleHyperlinks || !(textEditor instanceof JavaEditor)) return null; IAction openAction= textEditor.getAction("OpenEditor"); //$NON-NLS-1$ if (openAction == null) return null; int offset= region.getOffset(); IJavaElement input= EditorUtility.getEditorInputJavaElement(textEditor, false); if (input == null) return null; try { IDocument document= textEditor.getDocumentProvider().getDocument(textEditor.getEditorInput()); IRegion wordRegion= JavaWordFinder.findWord(document, offset); if (wordRegion == null) return null; IJavaElement[] elements= null; elements= ((ICodeAssist) input).codeSelect(wordRegion.getOffset(), wordRegion.getLength()); if (elements != null && elements.length > 0) return new IHyperlink[] {new JavaElementHyperlink(wordRegion, openAction)}; } catch (JavaModelException e) { return null; } return null; }