Java Code Examples for org.eclipse.gef.ui.actions.ActionRegistry#registerAction()

The following examples show how to use org.eclipse.gef.ui.actions.ActionRegistry#registerAction() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ERDiagramOutlinePage.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
private void registerAction(TreeViewer treeViewer,
		ActionRegistry actionRegistry) {
	IAction[] actions = { new CreateIndexAction(treeViewer),
			new CreateSequenceAction(treeViewer),
			new CreateTriggerAction(treeViewer),
			new CreateTablespaceAction(treeViewer),
			new ChangeOutlineViewToPhysicalAction(treeViewer),
			new ChangeOutlineViewToLogicalAction(treeViewer),
			new ChangeOutlineViewToBothAction(treeViewer),
			new ChangeOutlineViewOrderByPhysicalNameAction(treeViewer),
			new ChangeOutlineViewOrderByLogicalNameAction(treeViewer),
			new ChangeNameAction(treeViewer),
	};

	for (IAction action : actions) {
		actionRegistry.registerAction(action);
	}
}
 
Example 2
Source File: EROneDiagramEditor.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
@Override
	protected void createActions() {
		super.createActions();

		ActionRegistry registry = this.getActionRegistry();
//		List<String> selectionActionList = this.getSelectionActions();

		List<IAction> actionList = new ArrayList<IAction>(Arrays
				.asList(new IAction[] {
						new PlaceTableAction(this),
						new VGroupManageAction(this),
				}));

		for (IAction action : actionList) {
			registry.registerAction(action);
		}
	}
 
Example 3
Source File: ERDiagramOutlinePage.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
private void registerAction(final TreeViewer treeViewer, final ActionRegistry actionRegistry) {
    final IAction[] actions = {new CreateIndexAction(treeViewer), new CreateSequenceAction(treeViewer), new CreateTriggerAction(treeViewer), new CreateTablespaceAction(treeViewer), new ChangeOutlineViewToPhysicalAction(treeViewer), new ChangeOutlineViewToLogicalAction(treeViewer), new ChangeOutlineViewToBothAction(treeViewer), new ChangeOutlineViewOrderByPhysicalNameAction(treeViewer), new ChangeOutlineViewOrderByLogicalNameAction(treeViewer)};

    for (final IAction action : actions) {
        actionRegistry.registerAction(action);
    }
}
 
Example 4
Source File: VirtualDiagramEditor.java    From erflute with Apache License 2.0 5 votes vote down vote up
@Override
protected void createActions() {
    super.createActions();
    final ActionRegistry registry = getActionRegistry();
    final List<IAction> actionList =
            new ArrayList<>(Arrays.asList(new IAction[] { new PlaceTableAction(this), new WalkerGroupManageAction(this), }));
    for (final IAction action : actionList) {
        registry.registerAction(action);
    }
}
 
Example 5
Source File: ERDiagramOutlinePage.java    From erflute with Apache License 2.0 5 votes vote down vote up
private void registerAction(TreeViewer treeViewer, ActionRegistry actionRegistry) {
    final IAction[] actions = { new CreateIndexAction(treeViewer), new CreateSequenceAction(treeViewer),
            new CreateTriggerAction(treeViewer), new CreateTablespaceAction(treeViewer),
            new ChangeOutlineViewToPhysicalAction(treeViewer), new ChangeOutlineViewToLogicalAction(treeViewer),
            new ChangeOutlineViewToBothAction(treeViewer), new ChangeOutlineViewOrderByPhysicalNameAction(treeViewer),
            new ChangeOutlineViewOrderByLogicalNameAction(treeViewer), new ChangeVirtualDiagramNameAction(treeViewer),
            new DeleteVirtualDiagramAction(treeViewer), };
    for (final IAction action : actions) {
        actionRegistry.registerAction(action);
    }
}
 
Example 6
Source File: LocalWSDLEditor.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
@Override
protected void createActions() {
    super.createActions();
    ActionRegistry registry = getActionRegistry();
    BaseSelectionAction action = new OpenInNewEditor(this) {

        @Override
        public void run() {

            if (getSelectedObjects().size() > 0) {
                Object o = getSelectedObjects().get(0);
                // should make this generic and be able to get the owner from a facade object
                if (o instanceof WSDLBaseAdapter) {
                    WSDLBaseAdapter baseAdapter = (WSDLBaseAdapter) o;
                    IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
                    IEditorPart editorPart = workbenchWindow.getActivePage().getActiveEditor();
                    Object object = editorPart.getAdapter(org.eclipse.wst.wsdl.Definition.class);
                    if (object instanceof org.eclipse.wst.wsdl.Definition) {
                        EObject eObject = (EObject) baseAdapter.getTarget();
                        OpenOnSelectionHelper openHelper = new OpenOnSelectionHelper(
                                (org.eclipse.wst.wsdl.Definition) object);
                        openHelper.openEditor(eObject);
                    }
                }
            }
        }
    };
    action.setSelectionProvider(getSelectionManager());
    registry.registerAction(action);
}
 
Example 7
Source File: MainDiagramEditor.java    From erflute with Apache License 2.0 4 votes vote down vote up
@Override
@SuppressWarnings({ "unchecked", "unlikely-arg-type" })
protected void createActions() {
    super.createActions();
    final ActionRegistry registry = getActionRegistry();
    final List<String> selectionActionList = getSelectionActions();
    final List<IAction> actionList = new ArrayList<>(Arrays.asList(new IAction[] { new ChangeViewToLogicalAction(this),
            new ChangeViewToPhysicalAction(this), new ChangeViewToBothAction(this), new ChangeToIENotationAction(this),
            new ChangeToIDEF1XNotationAction(this), new ChangeNotationLevelToColumnAction(this),
            new ChangeNotationLevelToExcludeTypeAction(this), new ChangeNotationLevelToDetailAction(this),
            new ChangeNotationLevelToOnlyTitleAction(this), new ChangeNotationLevelToOnlyKeyAction(this),
            new ChangeNotationLevelToNameAndKeyAction(this), new ChangeNotationExpandGroupAction(this),
            new ChangeDesignToFunnyAction(this), new ChangeDesignToFrameAction(this), new ChangeDesignToSimpleAction(this),
            new ChangeCapitalAction(this), new ChangeStampAction(this), new ColumnGroupManageAction(this),
            /* #deleted new ChangeTrackingAction(this), */new OptionSettingAction(this),
            /* #deleted new CategoryManageAction(this), */new ChangeFreeLayoutAction(this),
            new ChangeShowReferredTablesAction(this), /* #deleted new TranslationManageAction(this), */
            /* #deleted new TestDataCreateAction(this), */new ImportFromDBAction(this), new ImportFromFileAction(this),
            new ExportToImageAction(this), /* #deleted new ExportToExcelAction(this), */
            /* #deleted new ExportToHtmlAction(this), new ExportToJavaAction(this), */new ExportToDDLAction(this),
            /* #deleted new ExportToDictionaryAction(this), new ExportToTranslationDictionaryAction(this), */
            /* #deleted new ExportToTestDataAction(this), */new PageSettingAction(this),
            /* #deleted new EditAllAttributesAction(this), */
            new DirectEditAction((IWorkbenchPart) this), new ERDiagramAlignmentAction(this, PositionConstants.LEFT),
            new ERDiagramAlignmentAction(this, PositionConstants.CENTER), new ERDiagramAlignmentAction(this, PositionConstants.RIGHT),
            new ERDiagramAlignmentAction(this, PositionConstants.TOP), new ERDiagramAlignmentAction(this, PositionConstants.MIDDLE),
            new ERDiagramAlignmentAction(this, PositionConstants.BOTTOM), new ERDiagramMatchWidthAction(this),
            new ERDiagramMatchHeightAction(this), new HorizontalLineAction(this), new VerticalLineAction(this),
            new RightAngleLineAction(this), new DefaultLineAction(this), new CopyAction(this), new PasteAction(this),
            new SearchAction(this), new ResizeModelAction(this), new PrintImageAction(this), new DeleteWithoutUpdateAction(this),
            new SelectAllContentsAction(this), new VirtualDiagramAddAction(this), new ERDiagramQuickOutlineAction(this), }));
    Activator.debug(this, "createActions()", "...Preparing diagram actions: " + actionList.size());
    actionList.addAll(extensionLoader.createExtendedActions());
    for (final IAction action : actionList) {
        if (action instanceof SelectionAction) {
            final IAction originalAction = registry.getAction(action.getId());
            if (originalAction != null) {
                selectionActionList.remove(originalAction); // unlikely-arg-type
            }
            selectionActionList.add(action.getId());
        }
        registry.registerAction(action);
    }
    addKeyHandler(registry.getAction(SearchAction.ID));
    addKeyHandler(registry.getAction(ERDiagramQuickOutlineAction.ID));
}
 
Example 8
Source File: ERDiagramEditor.java    From ermaster-b with Apache License 2.0 4 votes vote down vote up
/**
	 * {@inheritDoc}
	 */
	@Override
	@SuppressWarnings("unchecked")
	protected void createActions() {
		super.createActions();

		ActionRegistry registry = this.getActionRegistry();
		List<String> selectionActionList = this.getSelectionActions();

		List<IAction> actionList = new ArrayList<IAction>(Arrays
				.asList(new IAction[] {
						new ChangeViewToLogicalAction(this),
						new ChangeViewToPhysicalAction(this),
						new ChangeViewToBothAction(this),
						new ChangeToIENotationAction(this),
						new ChangeToIDEF1XNotationAction(this),
						new ChangeNotationLevelToColumnAction(this),
						new ChangeNotationLevelToExcludeTypeAction(this),
						new ChangeNotationLevelToDetailAction(this),
						new ChangeNotationLevelToOnlyTitleAction(this),
						new ChangeNotationLevelToOnlyKeyAction(this),
						new ChangeNotationLevelToNameAndKeyAction(this),
						new ChangeNotationExpandGroupAction(this),
						new ChangeDesignToFunnyAction(this),
						new ChangeDesignToFrameAction(this),
						new ChangeDesignToSimpleAction(this),
						new ChangeCapitalAction(this),
						new ChangeTitleFontSizeAction(this),
						new ChangeStampAction(this),
						new GroupManageAction(this),
						new ChangeTrackingAction(this),
						new OptionSettingAction(this),
						new CategoryManageAction(this),
						new ChangeFreeLayoutAction(this),
						new ChangeShowReferredTablesAction(this),
						new TranslationManageAction(this),
						new TestDataCreateAction(this),
						new ImportFromDBAction(this),
						new ImportFromFileAction(this),
						new ExportToImageAction(this),
						new ExportToExcelAction(this),
						new ExportToHtmlAction(this),
						new ExportToJavaAction(this),
						new ExportToDDLAction(this),
						new ExportToDictionaryAction(this),
						new ExportToTranslationDictionaryAction(this),
						new ExportToTestDataAction(this),
						new PageSettingAction(this),
						new EditAllAttributesAction(this),
						new DirectEditAction((IWorkbenchPart) this),
						new ERDiagramAlignmentAction((IWorkbenchPart) this,
								PositionConstants.LEFT),
						new ERDiagramAlignmentAction((IWorkbenchPart) this,
								PositionConstants.CENTER),
						new ERDiagramAlignmentAction((IWorkbenchPart) this,
								PositionConstants.RIGHT),
						new ERDiagramAlignmentAction((IWorkbenchPart) this,
								PositionConstants.TOP),
						new ERDiagramAlignmentAction((IWorkbenchPart) this,
								PositionConstants.MIDDLE),
						new ERDiagramAlignmentAction((IWorkbenchPart) this,
								PositionConstants.BOTTOM),
						new ERDiagramMatchWidthAction(this),
						new ERDiagramMatchHeightAction(this),
						new HorizontalLineAction(this),
						new VerticalLineAction(this),
						new RightAngleLineAction(this),
						new DefaultLineAction(this), new CopyAction(this),
						new PasteAction(this), new SearchAction(this),
						new ResizeModelAction(this),
						new PrintImageAction(this),
						new DeleteWithoutUpdateAction(this),
						new SelectAllContentsAction(this),
						new ERModelAddAction(this),
						new ERModelQuickOutlineAction(this),
//						new ChangeNameAction(this),
						}));

		actionList.addAll(this.extensionLoader.createExtendedActions());

		for (IAction action : actionList) {
			if (action instanceof SelectionAction) {
				IAction originalAction = registry.getAction(action.getId());

				if (originalAction != null) {
					selectionActionList.remove(originalAction);
				}
				selectionActionList.add(action.getId());
			}

			registry.registerAction(action);

		}

		this.addKeyHandler(registry.getAction(SearchAction.ID));
		this.addKeyHandler(registry.getAction(ERModelQuickOutlineAction.ID));
	}