コード例 #1
0
  /* (non-Javadoc)
   * @see com.hundsun.ares.studio.jres.ui.pages.ColumnViewerBlock#setInput(java.lang.Object)
   */
  @Override
  public void setInput(Object input) {
    insertAction.setOwner((EObject) input);

    itemAddAction.setOwner((EObject) input);
    itemMoveUpAction.setOwner((EObject) input);
    itemMoveDownAction.setOwner((EObject) input);
    pasteAction.setOwner((EObject) input);
    pasteAction.setReference(MetadataPackage.Literals.MENU_ITEM__FUNCTION_PROXYS);
    super.setInput(input);
  }
コード例 #2
0
  @Override
  protected void createActions() {
    super.createActions();

    IAction action =
        itemAddAction =
            new ColumnViewerAddAction(
                getColumnViewer(),
                getEditingDomain(),
                null,
                MetadataPackage.Literals.MENU_ITEM__FUNCTION_PROXYS,
                MetadataPackage.Literals.FUNCTION_PROXY);
    getActionRegistry().registerAction(action);
    getSelectionActions().add(action.getId());

    insertAction =
        new ColumnViewerInsertAction(
            getColumnViewer(),
            getEditingDomain(),
            null,
            MetadataPackage.Literals.MENU_ITEM__FUNCTION_PROXYS,
            MetadataPackage.Literals.FUNCTION_PROXY);
    getActionRegistry().registerAction(insertAction);
    getSelectionActions().add(insertAction.getId());

    action = itemDeleteAction = new ColumnViewerDeleteAction(getColumnViewer(), getEditingDomain());
    getActionRegistry().registerAction(action);
    getSelectionActions().add(action.getId());

    action =
        itemMoveUpAction =
            new ColumnViewerMoveUpAction(
                getColumnViewer(),
                getEditingDomain(),
                null,
                MetadataPackage.Literals.MENU_ITEM__FUNCTION_PROXYS);
    getActionRegistry().registerAction(action);
    getSelectionActions().add(action.getId());
    getStackActions().add(action.getId());

    action =
        itemMoveDownAction =
            new ColumnViewerMoveDownAction(
                getColumnViewer(),
                getEditingDomain(),
                null,
                MetadataPackage.Literals.MENU_ITEM__FUNCTION_PROXYS);
    getActionRegistry().registerAction(action);
    getSelectionActions().add(action.getId());
    getStackActions().add(action.getId());

    IAction copyAction = new ColumnViewerCopyAction(getColumnViewer());
    getActionRegistry().registerAction(copyAction);
    getSelectionActions().add(copyAction.getId());

    IAction copyCellAction = new CopyCellAction(getColumnViewer());
    getActionRegistry().registerAction(copyCellAction);

    IAction copyColumnAction = new CopyColumnAction(getColumnViewer());
    getActionRegistry().registerAction(copyColumnAction);

    pasteAction = new ColumnViewerPasteAction(getColumnViewer(), getEditingDomain(), null, null);
    getActionRegistry().registerAction(pasteAction);
    getClipboardActions().add(pasteAction.getId());

    action = new BatchAddFunctionProxyAction(getColumnViewer(), getEditingDomain(), resource);
    getActionRegistry().registerAction(action);
    getSelectionActions().add(action.getId());

    IAction recoverAction =
        new RecoverRefMenuFunctionsAction(getColumnViewer(), getEditingDomain(), resource);
    getActionRegistry().registerAction(recoverAction);
    getSelectionActions().add(recoverAction.getId());

    getEditableControl().addEditableUnit(new ActionEditableUnit(itemAddAction));
    getEditableControl().addEditableUnit(new ActionEditableUnit(itemDeleteAction));
    getEditableControl().addEditableUnit(new ActionEditableUnit(itemMoveUpAction));
    getEditableControl().addEditableUnit(new ActionEditableUnit(itemMoveDownAction));
    getEditableControl().addEditableUnit(new ActionEditableUnit(action));
    getEditableControl().addEditableUnit(new ActionEditableUnit(recoverAction));
  }