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

The following examples show how to use org.eclipse.gef.ui.actions.ActionRegistry. 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: 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 #2
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 #3
Source File: ERDiagramOutlinePage.java    From ermaster-b with Apache License 2.0 6 votes vote down vote up
private void resetAction(ActionRegistry registry) {
	// �A�E�g���C���E�y�[�W�ŗL���ɂ���A�N�V����
	if (getSite() == null) {
		return;
	}
	IActionBars bars = this.getSite().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));

	bars.updateActionBars();
}
 
Example #4
Source File: ERDiagramOutlinePage.java    From erflute with Apache License 2.0 6 votes vote down vote up
private void resetAction(ActionRegistry registry) {
    if (getSite() == null) {
        return;
    }
    final IActionBars bars = getSite().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));

    bars.updateActionBars();
}
 
Example #5
Source File: TableCellKeyDelegate.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Default Constuctor.
 */
public TableCellKeyDelegate( GraphicalViewer viewer,ActionRegistry actionRegistry  )
{
	super( viewer );
	//this.actionRegistry = actionRegistry;
	put( KeyStroke.getPressed('r', 114, SWT.ALT|SWT.SHIFT  ),
			actionRegistry.getAction( SelectRowAction.ID) );
	put( KeyStroke.getPressed('R', 114, SWT.ALT|SWT.SHIFT  ),
			actionRegistry.getAction( SelectRowAction.ID) );
	
	put( KeyStroke.getPressed('c', 99, SWT.ALT|SWT.SHIFT  ),
			actionRegistry.getAction( SelectColumnAction.ID) );
	put( KeyStroke.getPressed('C', 99, SWT.ALT|SWT.SHIFT  ),
			actionRegistry.getAction( SelectColumnAction.ID) );

}
 
Example #6
Source File: ImageMenuAdapterFactory.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
public Object getAdapter( final Object adaptableObject, Class adapterType )
{
	if ( ( adaptableObject instanceof ImageHandle )
			&& adapterType == IMenuListener.class )
	{

		return new ISchematicMenuListener( ) {

			public void menuAboutToShow( IMenuManager manager )
			{
				manager.appendToGroup( GEFActionConstants.GROUP_EDIT,
						new ReloadImageAction( adaptableObject ) );
			}

			public void setActionRegistry( ActionRegistry actionRegistry )
			{
			}
		};
	}
	return null;
}
 
Example #7
Source File: CrosstabMenuAdapterFactory.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public Object getAdapter( Object adaptableObject, Class adapterType )
{
	if ( adaptableObject instanceof ExtendedItemHandle
			&& ( (ExtendedItemHandle) adaptableObject ).getExtensionName( )
					.equals( "Crosstab" )
			&& adapterType == IMenuListener.class )
	{
		final ExtendedItemHandle handle = (ExtendedItemHandle)adaptableObject;
		
		return new ISchematicMenuListener( ) {

			public void menuAboutToShow( IMenuManager manager )
			{
				CrosstabReportItemHandle crosstab = null;
				try
				{
					crosstab = (CrosstabReportItemHandle)( (ExtendedItemHandle) handle ).getReportItem( );
				}
				catch ( ExtendedElementException e )
				{
					return;
				}
				//manager.appendToGroup( "additions", new AddComputedMeasureAction(  ); //$NON-NLS-1$
				manager.appendToGroup( GEFActionConstants.GROUP_VIEW,
						new AddComputedMeasureAction( crosstab ) );
				manager.appendToGroup( GEFActionConstants.GROUP_VIEW,
						new AddRelativeTimePeriodAction( handle ) );
			}

			public void setActionRegistry( ActionRegistry actionRegistry )
			{

			}
		};
	}
	return null;
}
 
Example #8
Source File: ERDiagramOutlinePage.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
public ERDiagramOutlinePage(final ERDiagram diagram) {
    // GEFツリービューワを使用する
    super(new TreeViewer());

    viewer = (TreeViewer) getViewer();
    this.diagram = diagram;

    outlineActionRegistory = new ActionRegistry();
    registerAction(viewer, outlineActionRegistory);
}
 
Example #9
Source File: ReportScriptFormPage.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public Object getAdapter( Class adapter )
{
	if ( adapter.equals( ITextEditor.class ) )
	{
		if ( jsEditor != null )
		{
			return jsEditor.getAdapter( adapter );
		}
		return null;
	}
	else if ( adapter == ActionRegistry.class )
	{
		return jsEditor.getAdapter( ActionRegistry.class );
	}
	else if ( adapter == PalettePage.class )
	{
		return jsEditor.getAdapter( PalettePage.class );
	}
	else if ( adapter == IContentOutlinePage.class )
	{
		DesignerOutlinePage outlinePage = new DesignerOutlinePage( getModel( ) );
		getModelEventManager( ).addModelEventProcessor( outlinePage.getModelProcessor( ) );
		return outlinePage;
	}
	else if ( adapter == IDataViewPage.class )
	{
		DataViewTreeViewerPage page = new DataViewTreeViewerPage( getModel( ) );
		getModelEventManager( ).addModelEventProcessor( page.getModelProcessor( ) );
		return page;
	}
	else if ( adapter == IPropertySheetPage.class )
	{
		ReportPropertySheetPage sheetPage = new ReportPropertySheetPage( getModel( ) );
		return sheetPage;
	}
	return jsEditor.getAdapter( adapter );
}
 
Example #10
Source File: ReportEditorWithPalette.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected void configureGraphicalViewer( )
{
	super.configureGraphicalViewer( );

	GraphicalViewer viewer = getGraphicalViewer( );
	ActionRegistry actionRegistry = getActionRegistry( );
	ReportRootEditPart root = new ReportRootEditPart( );
	viewer.setRootEditPart( root );

	// hook zoom actions
	hookZoom( root );

	// set key events
	viewer.setKeyHandler( new ReportViewerKeyHandler( viewer,
			actionRegistry ) );

	// configure the context menu
	ContextMenuProvider provider = new SchematicContextMenuProvider( viewer,
			actionRegistry );
	viewer.setContextMenu( provider );

	// hook the viewer into the EditDomain TODO create a function
	getEditDomain( ).addViewer( viewer );
	// acticate the viewer as selection provider for Eclipse
	getSite( ).setSelectionProvider( viewer );

	// initialize the viewer with input
	viewer.setEditPartFactory( getEditPartFactory( ) );

	ModuleHandle model = getModel( );
	WrapperCommandStack commandStack = new WrapperCommandStack( model == null ? null
			: model.getCommandStack( ) );

	viewer.getEditDomain( ).setCommandStack( commandStack );

}
 
Example #11
Source File: ReportPreviewFormPage.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public Object getAdapter( Class adapter )
{
	if ( adapter.equals( ActionRegistry.class ) )
	{
		return new ActionRegistry( );
	}
	return super.getAdapter( adapter );
}
 
Example #12
Source File: ReportPreviewEditor.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public Object getAdapter( Class adapter )
{
	if ( adapter.equals( ActionRegistry.class ) )
	{
		new ActionRegistry( );
	}
	return super.getAdapter( adapter );
}
 
Example #13
Source File: ReportPreviewFormPage.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
public Object getAdapter( Class adapter )
{
	if ( adapter.equals( ActionRegistry.class ) )
	{
		return new ActionRegistry( );
	}
	return super.getAdapter( adapter );
}
 
Example #14
Source File: ReportViewerKeyHandler.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Constructor of KeyHandler
 * 
 * @param viewer
 * @param actionRegistry
 */
public ReportViewerKeyHandler( GraphicalViewer viewer,
		ActionRegistry actionRegistry )
{
	super( viewer );
	this.actionRegistry = actionRegistry;

	put( KeyStroke.getPressed( SWT.F2, 0 ),
			actionRegistry.getAction( GEFActionConstants.DIRECT_EDIT ) );
	tableDelgate = new TableCellKeyDelegate( viewer, actionRegistry );
}
 
Example #15
Source File: ProcessDiagramEditor.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
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));
	bars.updateActionBars();

	// Toolbar refresh to solve linux defect RATLC525198
	bars.getToolBarManager().markDirty();
}
 
Example #16
Source File: ExtensionLoader.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
public void addERDiagramPopupMenu(MenuManager menuMgr,
		ActionRegistry actionregistry) {
	for (ExtendPopupMenu extendPopupMenu : this.extendPopupMenuList) {
		menuMgr.findMenuUsingPath(extendPopupMenu.getPath()).add(
				extendPopupMenu.getAction());
	}
}
 
Example #17
Source File: ERDiagramOutlinePage.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
public ERDiagramOutlinePage(ERDiagram diagram) {
	// GEF�c���[�r���[�����g�p����
	super(new TreeViewer());

	this.viewer = (TreeViewer) this.getViewer();
	this.diagram = diagram;

	this.outlineActionRegistory = new ActionRegistry();
	this.registerAction(this.viewer, outlineActionRegistory);
}
 
Example #18
Source File: ERDiagramOutlinePage.java    From ermaster-b with Apache License 2.0 5 votes vote down vote up
public void setCategory(EditDomain editDomain,
		GraphicalViewer graphicalViewer, MenuManager outlineMenuMgr,
		ActionRegistry registry) {
	this.graphicalViewer = graphicalViewer;
	this.viewer.setContextMenu(outlineMenuMgr);

	// �G�f�B�b�g�E�h���C���̐ݒ�
	this.viewer.setEditDomain(editDomain);
	this.registry = registry;

	if (this.getSite() != null) {
		this.resetView(registry);
	}
}
 
Example #19
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 #20
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 #21
Source File: ERDiagramOutlinePage.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
private void resetAction(final ActionRegistry registry) {
    // アウトライン・ページで有効にするアクション
    final IActionBars bars = getSite().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));

    bars.updateActionBars();
}
 
Example #22
Source File: ERDiagramOutlinePage.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
public void setCategory(final EditDomain editDomain, final GraphicalViewer graphicalViewer, final MenuManager outlineMenuMgr, final ActionRegistry registry) {
    this.graphicalViewer = graphicalViewer;
    viewer.setContextMenu(outlineMenuMgr);

    // エディット・ドメインの設定
    viewer.setEditDomain(editDomain);
    this.registry = registry;

    if (getSite() != null) {
        resetView(registry);
    }
}
 
Example #23
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 #24
Source File: ERDiagramOutlinePage.java    From erflute with Apache License 2.0 5 votes vote down vote up
public ERDiagramOutlinePage(ERDiagram diagram) {
    super(new TreeViewer());
    this.viewer = (TreeViewer) getViewer();
    this.diagram = diagram;
    this.outlineActionRegistory = new ActionRegistry();
    registerAction(viewer, outlineActionRegistory);
}
 
Example #25
Source File: ERDiagramOutlinePage.java    From erflute with Apache License 2.0 5 votes vote down vote up
public void setCategory(EditDomain editDomain, GraphicalViewer graphicalViewer, ActionRegistry registry) {
    this.graphicalViewer = graphicalViewer;

    viewer.setEditDomain(editDomain);
    this.registry = registry;

    if (getSite() != null) {
        resetView(registry);
    }
}
 
Example #26
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 #27
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));
	}
 
Example #28
Source File: ERDiagramEditor.java    From ermaster-b with Apache License 2.0 4 votes vote down vote up
public ActionRegistry getDefaultActionRegistry() {
	return getActionRegistry();
}
 
Example #29
Source File: ERDiagramOutlinePage.java    From ermaster-b with Apache License 2.0 4 votes vote down vote up
public ActionRegistry getOutlineActionRegistory() {
	return outlineActionRegistory;
}
 
Example #30
Source File: EROneDiagramEditor.java    From ermaster-b with Apache License 2.0 4 votes vote down vote up
public ActionRegistry getDefaultActionRegistry() {
	return getActionRegistry();
}