Search in sources :

Example 1 with ActionRegistry

use of org.eclipse.gef.ui.actions.ActionRegistry in project cubrid-manager by CUBRID.

the class ReplicationEditor method createActions.

/**
	 * @see org.eclipse.gef.ui.parts.GraphicalEditor#createActions()
	 */
@SuppressWarnings("unchecked")
protected void createActions() {
    super.createActions();
    ActionRegistry registry = getActionRegistry();
    IAction 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.CENTER);
    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());
    action = new AlignmentAction((IWorkbenchPart) this, PositionConstants.TOP);
    registry.registerAction(action);
    getSelectionActions().add(action.getId());
    action = new EditAction((IWorkbenchPart) this);
    registry.registerAction(action);
    getSelectionActions().add(action.getId());
}
Also used : IAction(org.eclipse.jface.action.IAction) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) AlignmentAction(org.eclipse.gef.ui.actions.AlignmentAction) EditAction(com.cubrid.cubridmanager.ui.replication.editor.action.EditAction) ActionRegistry(org.eclipse.gef.ui.actions.ActionRegistry)

Example 2 with ActionRegistry

use of org.eclipse.gef.ui.actions.ActionRegistry in project tesb-studio-se by Talend.

the class LocalWSDLEditor method createActions.

@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);
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) Definition(javax.wsdl.Definition) IEditorPart(org.eclipse.ui.IEditorPart) ActionRegistry(org.eclipse.gef.ui.actions.ActionRegistry) BaseSelectionAction(org.eclipse.wst.wsdl.ui.internal.asd.actions.BaseSelectionAction) OpenInNewEditor(org.eclipse.wst.wsdl.ui.internal.actions.OpenInNewEditor) WSDLBaseAdapter(org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter) EObject(org.eclipse.emf.ecore.EObject) EObject(org.eclipse.emf.ecore.EObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject)

Aggregations

ActionRegistry (org.eclipse.gef.ui.actions.ActionRegistry)2 EditAction (com.cubrid.cubridmanager.ui.replication.editor.action.EditAction)1 Definition (javax.wsdl.Definition)1 EObject (org.eclipse.emf.ecore.EObject)1 AlignmentAction (org.eclipse.gef.ui.actions.AlignmentAction)1 IAction (org.eclipse.jface.action.IAction)1 IEditorPart (org.eclipse.ui.IEditorPart)1 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)1 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)1 OpenInNewEditor (org.eclipse.wst.wsdl.ui.internal.actions.OpenInNewEditor)1 WSDLBaseAdapter (org.eclipse.wst.wsdl.ui.internal.adapters.WSDLBaseAdapter)1 BaseSelectionAction (org.eclipse.wst.wsdl.ui.internal.asd.actions.BaseSelectionAction)1 IRepositoryViewObject (org.talend.core.model.repository.IRepositoryViewObject)1