Java 类org.eclipse.ui.texteditor.IUpdate 实例源码

项目:bts    文件:EmbeddedEditorFactory.java   
protected OperationHistoryListener installUndoRedoSupport(SourceViewer viewer, IDocument document, final EmbeddedEditorActions actions) {
            IDocumentUndoManager undoManager = DocumentUndoManagerRegistry.getDocumentUndoManager(document);
            final IUndoContext context = undoManager.getUndoContext();

            // XXX cp uncommented

//          IOperationHistory operationHistory = PlatformUI.getWorkbench().getOperationSupport().getOperationHistory();
            OperationHistoryListener operationHistoryListener = new OperationHistoryListener(context, new IUpdate() {
                public void update() {
                    actions.updateAction(ITextEditorActionConstants.REDO);
                    actions.updateAction(ITextEditorActionConstants.UNDO);
                }
            });
            viewer.addTextListener(new ITextListener() {

                public void textChanged(TextEvent event) {
                    actions.updateAction(ITextEditorActionConstants.REDO);
                    actions.updateAction(ITextEditorActionConstants.UNDO);

                }
            });
//          
//          operationHistory.addOperationHistoryListener(operationHistoryListener);
            return operationHistoryListener;
        }
项目:Eclipse-Postfix-Code-Completion    文件:JavaSelectMarkerRulerAction2.java   
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);
            }
        }
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaOutlinePage.java   
/**
 * Convenience method to add the action installed under the given actionID to the
 * specified group of the menu.
 *
 * @param menu      the menu manager
 * @param group     the group to which to add the action
 * @param actionID  the ID of the new action
 */
protected void addAction(IMenuManager menu, String group, String actionID) {
    IAction action= getAction(actionID);
    if (action != null) {
        if (action instanceof IUpdate)
            ((IUpdate) action).update();

        if (action.isEnabled()) {
            IMenuManager subMenu= menu.findMenuUsingPath(group);
            if (subMenu != null)
                subMenu.add(action);
            else
                menu.appendToGroup(group, action);
        }
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:GenerateBuildPathActionGroup.java   
private void fillViewSubMenu(IMenuManager source) {
      int added= 0;
      int i=0;
      for (Iterator<Action> iter= fActions.iterator(); iter.hasNext();) {
    Action action= iter.next();
    if (action instanceof IUpdate)
        ((IUpdate) action).update();

          if (i == 2)
              source.add(new Separator(GROUP_BUILDPATH));
          else if (i == 8)
              source.add(new Separator(GROUP_FILTER));
          else if (i == 10)
              source.add(new Separator(GROUP_CUSTOMIZE));
          added+= addAction(source, action);
          i++;
}

      if (added == 0) {
        source.add(fNoActionAvailable);
      }
  }
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaSelectMarkerRulerAction2.java   
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);
            }
        }
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaOutlinePage.java   
/**
 * Convenience method to add the action installed under the given actionID to the
 * specified group of the menu.
 *
 * @param menu      the menu manager
 * @param group     the group to which to add the action
 * @param actionID  the ID of the new action
 */
protected void addAction(IMenuManager menu, String group, String actionID) {
    IAction action= getAction(actionID);
    if (action != null) {
        if (action instanceof IUpdate)
            ((IUpdate) action).update();

        if (action.isEnabled()) {
            IMenuManager subMenu= menu.findMenuUsingPath(group);
            if (subMenu != null)
                subMenu.add(action);
            else
                menu.appendToGroup(group, action);
        }
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:GenerateBuildPathActionGroup.java   
private void fillViewSubMenu(IMenuManager source) {
      int added= 0;
      int i=0;
      for (Iterator<Action> iter= fActions.iterator(); iter.hasNext();) {
    Action action= iter.next();
    if (action instanceof IUpdate)
        ((IUpdate) action).update();

          if (i == 2)
              source.add(new Separator(GROUP_BUILDPATH));
          else if (i == 8)
              source.add(new Separator(GROUP_FILTER));
          else if (i == 10)
              source.add(new Separator(GROUP_CUSTOMIZE));
          added+= addAction(source, action);
          i++;
}

      if (added == 0) {
        source.add(fNoActionAvailable);
      }
  }
项目:jsbuild-eclipse    文件:JSBuildFileView.java   
/**
 * Updates the enabled state of all <code>IUpdate</code> actions associated
 * with the project viewer.
 */
private void updateProjectActions() {
    Iterator iter = updateProjectActions.iterator();
    while (iter.hasNext()) {
        ((IUpdate) iter.next()).update();
    }
}
项目:bts    文件:ActivationCodeTrigger.java   
public void verifyKey(VerifyEvent event) {

        ActionActivationCode code= null;
        int size= activationCodes.size();
        for (int i= 0; i < size; i++) {
            code= activationCodes.get(i);
            if (code.matches(event)) {
                IAction action= actions.get(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;
                    }
                }
            }
        }
    }
项目:Eclipse-Postfix-Code-Completion    文件:GenerateActionGroup.java   
private int addEditorAction(IMenuManager menu, String actionID) {
    if (fEditor == null)
        return 0;
    IAction action= fEditor.getAction(actionID);
    if (action == null)
        return 0;
    if (action instanceof IUpdate)
        ((IUpdate)action).update();
    if (action.isEnabled()) {
        menu.add(action);
        return 1;
    }
    return 0;
}
项目:Eclipse-Postfix-Code-Completion    文件:JavaEditor.java   
@Override
protected IVerticalRulerColumn createAnnotationRulerColumn(CompositeRuler ruler) {
    if (!getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_ANNOTATION_ROLL_OVER))
        return super.createAnnotationRulerColumn(ruler);

    AnnotationRulerColumn column= new AnnotationRulerColumn(VERTICAL_RULER_WIDTH, getAnnotationAccess());
    column.setHover(new JavaExpandHover(ruler, getAnnotationAccess(), new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent event) {
            // for now: just invoke ruler double click action
            triggerAction(ITextEditorActionConstants.RULER_DOUBLE_CLICK);
        }

        private void triggerAction(String actionID) {
            IAction action= 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();
            }
        }

    }));

    return column;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:GenerateActionGroup.java   
private int addEditorAction(IMenuManager menu, String actionID) {
    if (fEditor == null)
        return 0;
    IAction action= fEditor.getAction(actionID);
    if (action == null)
        return 0;
    if (action instanceof IUpdate)
        ((IUpdate)action).update();
    if (action.isEnabled()) {
        menu.add(action);
        return 1;
    }
    return 0;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:JavaEditor.java   
@Override
protected IVerticalRulerColumn createAnnotationRulerColumn(CompositeRuler ruler) {
    if (!getPreferenceStore().getBoolean(PreferenceConstants.EDITOR_ANNOTATION_ROLL_OVER))
        return super.createAnnotationRulerColumn(ruler);

    AnnotationRulerColumn column= new AnnotationRulerColumn(VERTICAL_RULER_WIDTH, getAnnotationAccess());
    column.setHover(new JavaExpandHover(ruler, getAnnotationAccess(), new IDoubleClickListener() {

        public void doubleClick(DoubleClickEvent event) {
            // for now: just invoke ruler double click action
            triggerAction(ITextEditorActionConstants.RULER_DOUBLE_CLICK);
        }

        private void triggerAction(String actionID) {
            IAction action= 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();
            }
        }

    }));

    return column;
}
项目:birt    文件:DecoratedScriptEditor.java   
/**
 * Set the specified action enabled.
 * 
 * @param action
 *            the specified action to set enable.
 */
private void enableAction( IAction action )
{
    if ( action instanceof IUpdate )
    {
        ( (IUpdate) action ).update( );
    }
    else
    {
        ISourceViewer viewer = getViewer( );

        action.setEnabled( viewer instanceof ProjectionViewer ? ( (ProjectionViewer) viewer ).isProjectionMode( )
                : true );
    }
}
项目:Pydev    文件:PromptOverlayReplaceGlobalActionHandlers.java   
protected void updateSelectionDependentActions() {
    for (String string : selectionDependentActionIds) {
        IAction action = newActions.get(string);
        if (action instanceof IUpdate) {
            ((IUpdate) action).update();
        }
    }
}
项目:typescript.java    文件:EditTemplateDialog.java   
protected void updateUndoAction() {
    IAction action = (IAction) fGlobalActions.get(ITextEditorActionConstants.UNDO);
    if (action instanceof IUpdate)
        ((IUpdate) action).update();
}
项目:typescript.java    文件:EditTemplateDialog.java   
protected void updateAction(String actionId) {
    IAction action = (IAction) fGlobalActions.get(actionId);
    if (action instanceof IUpdate)
        ((IUpdate) action).update();
}
项目:bts    文件:E4TemplatePreferencePage.java   
private void updateAction(String actionId) {
    IAction action= (IAction) fGlobalActions.get(actionId);
    if (action instanceof IUpdate)
        ((IUpdate) action).update();
}
项目:bts    文件:OperationHistoryListener.java   
public OperationHistoryListener(IUndoContext context, IUpdate update) {
    this.context = context;
    this.update = update;
}
项目:bts    文件:EmbeddedEditorActions.java   
private void update(IAction action) {
    if (action instanceof IUpdate)
        ((IUpdate) action).update();
}
项目:Eclipse-Postfix-Code-Completion    文件:EditTemplateDialog.java   
protected void updateAction(String actionId) {
    IAction action= fGlobalActions.get(actionId);
    if (action instanceof IUpdate)
        ((IUpdate) action).update();
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:EditTemplateDialog.java   
protected void updateAction(String actionId) {
    IAction action= fGlobalActions.get(actionId);
    if (action instanceof IUpdate)
        ((IUpdate) action).update();
}
项目:e4macs    文件:KillRingListeners.java   
/**
 * @see org.eclipse.ui.texteditor.IUpdate#update()
 */
public void update() {
    if (action instanceof IUpdate) {
        ((IUpdate)action).update();
    }
}