/** * Convenience method to add the action installed under the given action id to the given menu. * @param menu the menu to add the action to * @param actionId the id of the action to be added */ protected final void addAction(IMenuManager menu, String actionId) { IAction action= getAction(actionId); if (action != null) { if (action instanceof IUpdate) ((IUpdate) action).update(); menu.add(action); } }
/** * Convenience method to add the action installed under the given action id to the given menu. * @param menu the menu to add the action to * @param actionId the id of the action to be added */ protected final void addAction(IMenuManager menu, String actionId) { IAction action= getAction(actionId); if (action != null) { if (action instanceof IUpdate) ((IUpdate) action).update(); menu.add(action); } }
/** * Convenience method to add the action installed under the given action id to the given menu. * @param menu the menu to add the action to * @param actionId the id of the action to be added */ protected final void addAction(IMenuManager menu, String actionId) { IAction action= getAction(actionId); if (action != null) { if (action instanceof IUpdate) ((IUpdate) action).update(); menu.add(action); } }
private void updateInsertModeAction() { // this may be called before the part is fully initialized (see configureInsertMode) // drop out in this case. if (getSite() == null) return; IAction action= getAction(ITextEditorActionConstants.TOGGLE_INSERT_MODE); if (action != null) { action.setEnabled(!fIsOverwriting); action.setChecked(fInsertMode == SMART_INSERT); } }
private void updateInsertModeAction() { // this may be called before the part is fully initialized (see configureInsertMode) // drop out in this case. if (getSite() == null) return; IAction action= getAction(ITextEditorActionConstants.TOGGLE_INSERT_MODE); if (action != null) { action.setEnabled(!fIsOverwriting); action.setChecked(fInsertMode == SMART_INSERT); } }
private void updateInsertModeAction() { // this may be called before the part is fully initialized (see configureInsertMode) // drop out in this case. if (getSite() == null) return; IAction action= getAction(ITextEditorActionConstants.TOGGLE_INSERT_MODE); if (action != null) { action.setEnabled(!fIsOverwriting); action.setChecked(fInsertMode == SMART_INSERT); } }
/** * Convenience method to add the action installed under the given action id to the specified group of the menu. * @param menu the menu to add the action to * @param group the group in the menu * @param actionId the id of the action to add */ protected final void addAction(IMenuManager menu, String group, String actionId) { IAction action= getAction(actionId); if (action != null) { if (action instanceof IUpdate) ((IUpdate) action).update(); IMenuManager subMenu= menu.findMenuUsingPath(group); if (subMenu != null) subMenu.add(action); else menu.appendToGroup(group, action); } }
/** * Convenience method to add the action installed under the given action id to the specified group of the menu. * @param menu the menu to add the action to * @param group the group in the menu * @param actionId the id of the action to add */ protected final void addAction(IMenuManager menu, String group, String actionId) { IAction action= getAction(actionId); if (action != null) { if (action instanceof IUpdate) ((IUpdate) action).update(); IMenuManager subMenu= menu.findMenuUsingPath(group); if (subMenu != null) subMenu.add(action); else menu.appendToGroup(group, action); } }
/** * Convenience method to add the action installed under the given action id to the specified group of the menu. * @param menu the menu to add the action to * @param group the group in the menu * @param actionId the id of the action to add */ protected final void addAction(IMenuManager menu, String group, String actionId) { IAction action= getAction(actionId); if (action != null) { if (action instanceof IUpdate) ((IUpdate) action).update(); IMenuManager subMenu= menu.findMenuUsingPath(group); if (subMenu != null) subMenu.add(action); else menu.appendToGroup(group, action); } }
@Override public void verifyKey(VerifyEvent event) { ActionActivationCode code= null; int size= fActivationCodes.size(); for (int i= 0; i < size; i++) { code= fActivationCodes.get(i); if (code.matches(event)) { IAction action= getAction(code.fActionId); if (action != null) { if (action instanceof IUpdate) ((IUpdate) action).update(); if (!action.isEnabled() && action instanceof IReadOnlyDependent) { IReadOnlyDependent dependent= (IReadOnlyDependent) action; boolean writable= dependent.isEnabled(true); if (writable) { event.doit= false; return; } } else if (action.isEnabled()) { event.doit= false; action.run(); return; } } } } }
private void triggerAction(String actionID, MouseEvent e) { IAction action= getAction(actionID); if (action != null) { if (action instanceof IUpdate) ((IUpdate) action).update(); if (action.isEnabled()) { Event event= new Event(); event.type= fDoubleClicked ? SWT.MouseDoubleClick : SWT.MouseUp; event.display= e.display; event.widget= e.widget; event.time= e.time; event.data= e.data; event.x= e.x; event.y= e.y; event.button= e.button; event.stateMask= e.stateMask; event.count= e.count; action.runWithEvent(event); } } }
public void verifyKey(VerifyEvent event) { ActionActivationCode code= null; int size= fActivationCodes.size(); for (int i= 0; i < size; i++) { code= (ActionActivationCode) fActivationCodes.get(i); if (code.matches(event)) { IAction action= getAction(code.fActionId); if (action != null) { if (action instanceof IUpdate) ((IUpdate) action).update(); if (!action.isEnabled() && action instanceof IReadOnlyDependent) { IReadOnlyDependent dependent= (IReadOnlyDependent) action; boolean writable= dependent.isEnabled(true); if (writable) { event.doit= false; return; } } else if (action.isEnabled()) { event.doit= false; action.run(); return; } } } } }
@Override public void verifyKey(VerifyEvent event) { ActionActivationCode code= null; int size= fActivationCodes.size(); for (int i= 0; i < size; i++) { code= fActivationCodes.get(i); if (code.matches(event)) { IAction action= getAction(code.fActionId); if (action != null) { if (action instanceof IUpdate) ((IUpdate) action).update(); if (!action.isEnabled() && action instanceof IReadOnlyDependent) { IReadOnlyDependent dependent= (IReadOnlyDependent) action; boolean writable= dependent.isEnabled(true); if (writable) { event.doit= false; return; } } else if (action.isEnabled()) { event.doit= false; action.run(); return; } } } } }
private void triggerAction(String actionID, MouseEvent e) { IAction action= getAction(actionID); if (action != null) { if (action instanceof IUpdate) ((IUpdate) action).update(); if (action.isEnabled()) { Event event= new Event(); event.type= fDoubleClicked ? SWT.MouseDoubleClick : SWT.MouseUp; event.display= e.display; event.widget= e.widget; event.time= e.time; event.data= e.data; event.x= e.x; event.y= e.y; event.button= e.button; event.stateMask= e.stateMask; event.count= e.count; action.runWithEvent(event); } } }
/** * Registers the given undo/redo action under the given ID and * ensures that previously installed actions get disposed. It * also takes care of re-registering the new action with the * global action handler. * * @param actionId the action id under which to register the action * @param action the action to register * @since 3.1 */ private void registerUndoRedoAction(String actionId, OperationHistoryActionHandler action) { IAction oldAction= getAction(actionId); if (oldAction instanceof OperationHistoryActionHandler) ((OperationHistoryActionHandler)oldAction).dispose(); setAction(actionId, action); IActionBars actionBars= getEditorSite().getActionBars(); if (actionBars != null) actionBars.setGlobalActionHandler(actionId, action); }
/** * Registers the given undo/redo action under the given ID and ensures that previously installed * actions get disposed. It also takes care of re-registering the new action with the global * action handler. * * @param actionId the action id under which to register the action * @param action the action to register or <code>null</code> to dispose them * @since 3.1 */ private void registerUndoRedoAction(String actionId, OperationHistoryActionHandler action) { IAction oldAction= getAction(actionId); if (oldAction instanceof OperationHistoryActionHandler) ((OperationHistoryActionHandler)oldAction).dispose(); if (action == null) return; setAction(actionId, action); IActionBars actionBars= getEditorSite().getActionBars(); if (actionBars != null) actionBars.setGlobalActionHandler(actionId, action); }
/** * Registers the given undo/redo action under the given ID and ensures that previously installed * actions get disposed. It also takes care of re-registering the new action with the global * action handler. * * @param actionId the action id under which to register the action * @param action the action to register or <code>null</code> to dispose them * @since 3.1 */ private void registerUndoRedoAction(String actionId, OperationHistoryActionHandler action) { IAction oldAction= getAction(actionId); if (oldAction instanceof OperationHistoryActionHandler) ((OperationHistoryActionHandler)oldAction).dispose(); if (action == null) return; setAction(actionId, action); IActionBars actionBars= getEditorSite().getActionBars(); if (actionBars != null) actionBars.setGlobalActionHandler(actionId, action); }
if (getAction(ITextEditorActionConstants.UNDO) == null) { action= new TextOperationAction(EditorMessages.getBundleForConstructedKeys(), "Editor.Undo.", this, ITextOperationTarget.UNDO); //$NON-NLS-1$ action.setHelpContextId(IAbstractTextEditorHelpContextIds.UNDO_ACTION); if (getAction(ITextEditorActionConstants.REDO) == null) { action= new TextOperationAction(EditorMessages.getBundleForConstructedKeys(), "Editor.Redo.", this, ITextOperationTarget.REDO); //$NON-NLS-1$ action.setHelpContextId(IAbstractTextEditorHelpContextIds.REDO_ACTION);
addAction(menu, ITextEditorActionConstants.GROUP_COPY, ITextEditorActionConstants.COPY); addAction(menu, ITextEditorActionConstants.GROUP_COPY, ITextEditorActionConstants.PASTE); IAction action= getAction(ITextEditorActionConstants.QUICK_ASSIST); if (action != null && action.isEnabled()) addAction(menu, ITextEditorActionConstants.GROUP_EDIT, ITextEditorActionConstants.QUICK_ASSIST);
addAction(menu, ITextEditorActionConstants.GROUP_COPY, ITextEditorActionConstants.COPY); addAction(menu, ITextEditorActionConstants.GROUP_COPY, ITextEditorActionConstants.PASTE); IAction action= getAction(ITextEditorActionConstants.QUICK_ASSIST); if (action != null && action.isEnabled()) addAction(menu, ITextEditorActionConstants.GROUP_EDIT, ITextEditorActionConstants.QUICK_ASSIST);