Package org.eclipse.gef.ui.actions

Examples of org.eclipse.gef.ui.actions.ActionRegistry


  protected void createActions() {
    // create actions that will be used inside the editor, for instance in a
    // contextual menu
    super.createActions();

    ActionRegistry registry = getActionRegistry();
    Class<?> actions[] = { CopyAction.class, CutAction.class,
        PasteAction.class, PrintAction.class, SelectAllAction.class,
        SetRefinementAction.class };

    // Constructs all actions
    for (Class<?> clz : actions) {
      try {
        Constructor<?> ctor = clz.getConstructor(IWorkbenchPart.class);

        IAction action = (IAction) ctor.newInstance(this);
        registry.registerAction(action);
        getSelectionActions().add(action.getId());
      } catch (Exception e) {
        e.printStackTrace();
      }
    }
View Full Code Here


  @Override
  public void buildContextMenu(IMenuManager menu) {
    IAction action;

    GEFActionConstants.addStandardActionGroups(menu);
    ActionRegistry registry = getActionRegistry();

    addIfEnabled(registry, menu, SetRefinementAction.getActionId());

    action = registry.getAction(ActionFactory.UNDO.getId());
    menu.appendToGroup(GEFActionConstants.GROUP_UNDO, action);

    action = registry.getAction(ActionFactory.REDO.getId());
    menu.appendToGroup(GEFActionConstants.GROUP_UNDO, action);

    action = registry.getAction(ActionFactory.CUT.getId());
    menu.appendToGroup(GEFActionConstants.GROUP_COPY, action);

    action = registry.getAction(ActionFactory.COPY.getId());
    menu.appendToGroup(GEFActionConstants.GROUP_COPY, action);

    action = registry.getAction(ActionFactory.PASTE.getId());
    menu.appendToGroup(GEFActionConstants.GROUP_COPY, action);

    action = registry.getAction(ActionFactory.DELETE.getId());
    menu.appendToGroup(GEFActionConstants.GROUP_EDIT, action);
  }
View Full Code Here

        /**
         * @see org.eclipse.ui.part.IPageBookViewPage#init(org.eclipse.ui.part.IPageSite)
         */
        public void init(IPageSite pageSite) {
            super.init(pageSite);
            ActionRegistry registry = getActionRegistry();
            IActionBars bars = pageSite.getActionBars();
            String id = ActionFactory.UNDO.getId();
            bars.setGlobalActionHandler(id, registry.getAction(id));
            id = ActionFactory.REDO.getId();
            bars.setGlobalActionHandler(id, registry.getAction(id));
            id = ActionFactory.DELETE.getId();
            bars.setGlobalActionHandler(id, registry.getAction(id));
        }
View Full Code Here

        return model;
    }

    protected void createActions() {
        super.createActions();
        ActionRegistry registry = getActionRegistry();

        IAction action = new DirectEditAction((IWorkbenchPart) this);
        registry.registerAction(action);
        getSelectionActions().add(action.getId());

        action = new AlignmentAction((IWorkbenchPart) this,
                PositionConstants.LEFT);
        registry.registerAction(action);
        getSelectionActions().add(action.getId());

        action = new AlignmentAction((IWorkbenchPart) this,
                PositionConstants.CENTER);
        registry.registerAction(action);
        getSelectionActions().add(action.getId());

        action = new AlignmentAction((IWorkbenchPart) this,
                PositionConstants.RIGHT);
        registry.registerAction(action);
        getSelectionActions().add(action.getId());

        action = new AlignmentAction((IWorkbenchPart) this,
                PositionConstants.TOP);
        registry.registerAction(action);
        getSelectionActions().add(action.getId());

        action = new AlignmentAction((IWorkbenchPart) this,
                PositionConstants.MIDDLE);
        registry.registerAction(action);
        getSelectionActions().add(action.getId());

        action = new AlignmentAction((IWorkbenchPart) this,
                PositionConstants.BOTTOM);
        registry.registerAction(action);
        getSelectionActions().add(action.getId());
    }
View Full Code Here

   
    this.editorInput = null;
    this.activeConfig = null;

    // dispose the ActionRegistry (will dispose all actions)
    ActionRegistry actionRegistry = getActionRegistry();
    if (actionRegistry != null) {
      actionRegistry.dispose();
    }
    // important: always call super implementation of dispose
    if (getDiagramTypeProvider() != null)
      super.dispose();
  }
View Full Code Here

        getGraphicalViewer(), TextTransfer.getInstance()));
}

protected void createActions() {
  super.createActions();
  ActionRegistry registry = getActionRegistry();
  IAction action;
 
  action = new CopyTemplateAction(this);
  registry.registerAction(action);

  action = new MatchWidthAction(this);
  registry.registerAction(action);
  getSelectionActions().add(action.getId());
 
  action = new MatchHeightAction(this);
  registry.registerAction(action);
  getSelectionActions().add(action.getId());
 
  action = new LogicPasteTemplateAction(this);
  registry.registerAction(action);
  getSelectionActions().add(action.getId());

  action = new IncrementDecrementAction(this, true);
  registry.registerAction(action);
  getSelectionActions().add(action.getId());

  action = new IncrementDecrementAction(this, false);
  registry.registerAction(action);
  getSelectionActions().add(action.getId());

  action = new DirectEditAction((IWorkbenchPart)this);
  registry.registerAction(action);
  getSelectionActions().add(action.getId());

  action = new AlignmentAction((IWorkbenchPart)this, PositionConstants.LEFT);
  registry.registerAction(action);
  getSelectionActions().add(action.getId());

  action = new AlignmentAction((IWorkbenchPart)this, PositionConstants.RIGHT);
  registry.registerAction(action);
  getSelectionActions().add(action.getId());

  action = new AlignmentAction((IWorkbenchPart)this, PositionConstants.TOP);
  registry.registerAction(action);
  getSelectionActions().add(action.getId());

  action = new AlignmentAction((IWorkbenchPart)this, PositionConstants.BOTTOM);
  registry.registerAction(action);
  getSelectionActions().add(action.getId());

  action = new AlignmentAction((IWorkbenchPart)this, PositionConstants.CENTER);
  registry.registerAction(action);
  getSelectionActions().add(action.getId());

  action = new AlignmentAction((IWorkbenchPart)this, PositionConstants.MIDDLE);
  registry.registerAction(action);
  getSelectionActions().add(action.getId());
}
View Full Code Here

  public OutlinePage(EditPartViewer viewer){
    super(viewer);
  }
  public void init(IPageSite pageSite) {
    super.init(pageSite);
    ActionRegistry registry = getActionRegistry();
    IActionBars bars = pageSite.getActionBars();
    String id = ActionFactory.UNDO.getId();
    bars.setGlobalActionHandler(id, registry.getAction(id));
    id = ActionFactory.REDO.getId();
    bars.setGlobalActionHandler(id, registry.getAction(id));
    id = ActionFactory.DELETE.getId();
    bars.setGlobalActionHandler(id, registry.getAction(id));
    id = IncrementDecrementAction.INCREMENT;
    bars.setGlobalActionHandler(id, registry.getAction(id));
    id = IncrementDecrementAction.DECREMENT;
    bars.setGlobalActionHandler(id, registry.getAction(id));
    bars.updateActionBars();
  }
View Full Code Here

   *
   * @param actionId
   *          the id of the action to run
   */
  public static final void runAction(final String actionId) {
    final ActionRegistry registry = getActionRegistry();
    if (registry != null) {
      final IAction action = registry.getAction(actionId);
      if (action != null) {
        action.run();
      }
    }
  }
View Full Code Here

  }

  @Override
  protected void createActions() {
    super.createActions();
    ActionRegistry registry = getActionRegistry();
    IAction action;

    action = new DirectEditAction((IWorkbenchPart) this);
    registry.registerAction(action);
    getSelectionActions().add(action.getId());

    action = new PrintAction(this);
    registry.registerAction(action);

    action = new ExportAction(this);
    registry.registerAction(action);

    action = new ShowPropertiesAction(this);
    registry.registerAction(action);
    getSelectionActions().add(action.getId());

    action = new ShowSourceAction(this);
    registry.registerAction(action);
    getSelectionActions().add(action.getId());

    action = new ResetManualLayoutAction(this);
    registry.registerAction(action);
    getSelectionActions().add(action.getId());
  }
View Full Code Here

  /**
   * Creates actions for this editor and registers them with the {@link ActionRegistry}.
   */
  protected void createActions() {
    ActionRegistry registry = getActionRegistry();
    IAction action;

    action = new ExportAction(this);
    registry.registerAction(action);

    action = new OpenJavaType(this);
    registry.registerAction(action);

    action = new OpenConfigFile(this);
    registry.registerAction(action);

    action = new PrintAction(this);
    registry.registerAction(action);
  }
View Full Code Here

TOP

Related Classes of org.eclipse.gef.ui.actions.ActionRegistry

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.