Search in sources :

Example 1 with ActionGroup

use of org.eclipse.ui.actions.ActionGroup in project tdi-studio-se by Talend.

the class JobHierarchyViewPart method createPartControl.

@Override
public void createPartControl(Composite container) {
    fParent = container;
    addResizeListener(fParent);
    fPagebook = new PageBook(container, SWT.NONE);
    // page 1 of page book (no hierarchy label)
    fNoHierarchyShownLabel = new Label(fPagebook, SWT.TOP + SWT.LEFT + SWT.WRAP);
    fNoHierarchyShownLabel.setText(showEmptyLabel);
    // page 2 of page book (viewers)
    fTypeMethodsSplitter = new SashForm(fPagebook, SWT.VERTICAL);
    fTypeMethodsSplitter.setVisible(false);
    fTypeViewerViewForm = new ViewForm(fTypeMethodsSplitter, SWT.NONE);
    Control typeViewerControl = createTypeViewerControl(fTypeViewerViewForm);
    fTypeViewerViewForm.setContent(typeViewerControl);
    dependencyViewerViewForm = new ViewForm(fTypeMethodsSplitter, SWT.NONE);
    fTypeMethodsSplitter.setWeights(new int[] { 65, 35 });
    Control dependencyViewerPart = createMethodViewerControl(dependencyViewerViewForm);
    dependencyViewerViewForm.setContent(dependencyViewerPart);
    dependencyViewerPaneLabel = new CLabel(dependencyViewerViewForm, SWT.NONE);
    dependencyViewerViewForm.setTopLeft(dependencyViewerPaneLabel);
    ToolBar methodViewerToolBar = new ToolBar(dependencyViewerViewForm, SWT.FLAT | SWT.WRAP);
    dependencyViewerViewForm.setTopCenter(methodViewerToolBar);
    initDragAndDrop();
    MenuManager menu = new MenuManager();
    menu.add(focusOnTypeAction);
    fNoHierarchyShownLabel.setMenu(menu.createContextMenu(fNoHierarchyShownLabel));
    fPagebook.showPage(fNoHierarchyShownLabel);
    int layout;
    try {
        layout = fDialogSettings.getInt(DIALOGSTORE_VIEWLAYOUT);
        if (layout < 0 || layout > 3) {
            layout = VIEW_LAYOUT_AUTOMATIC;
        }
    } catch (NumberFormatException e) {
        layout = VIEW_LAYOUT_AUTOMATIC;
    }
    // force the update
    fCurrentLayout = -1;
    // will fill the main tool bar
    setViewLayout(layout);
    // set the filter menu items
    IActionBars actionBars = getViewSite().getActionBars();
    IMenuManager viewMenu = actionBars.getMenuManager();
    // for (int i = 0; i < fViewActions.length; i++) {
    // ToggleViewAction action = fViewActions[i];
    // viewMenu.add(action);
    // action.setEnabled(false);
    // }
    // viewMenu.add(new Separator());
    // IMenuManager layoutSubMenu = new MenuManager(TypeHierarchyMessages.TypeHierarchyViewPart_layout_submenu);
    //$NON-NLS-1$
    IMenuManager layoutSubMenu = new MenuManager(Messages.getString("FocusOnJobAction.TypeHierarchyViewPart_layout_submenu"));
    viewMenu.add(layoutSubMenu);
    for (int i = 0; i < fToggleOrientationActions.length; i++) {
        layoutSubMenu.add(fToggleOrientationActions[i]);
    }
    viewMenu.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
    // selection provider
    int nHierarchyViewers = fAllViewers.length;
    StructuredViewer[] trackedViewers = new StructuredViewer[nHierarchyViewers + 1];
    for (int i = 0; i < nHierarchyViewers; i++) {
        trackedViewers[i] = fAllViewers[i];
    }
    trackedViewers[nHierarchyViewers] = dependencyViewer;
    fSelectionProviderMediator = new SelectionProviderMediator(trackedViewers, getCurrentViewer());
    getSite().setSelectionProvider(fSelectionProviderMediator);
    ActionGroup[] actionGroups = new ActionGroup[] { new JobActionGroup() };
    fActionGroups = new CompositeActionGroup(actionGroups);
    fActionGroups.fillActionBars(actionBars);
}
Also used : CLabel(org.eclipse.swt.custom.CLabel) CompositeActionGroup(org.eclipse.jdt.internal.ui.actions.CompositeActionGroup) CLabel(org.eclipse.swt.custom.CLabel) Label(org.eclipse.swt.widgets.Label) SelectionProviderMediator(org.eclipse.jdt.internal.ui.viewsupport.SelectionProviderMediator) Point(org.eclipse.swt.graphics.Point) SashForm(org.eclipse.swt.custom.SashForm) ViewForm(org.eclipse.swt.custom.ViewForm) Control(org.eclipse.swt.widgets.Control) PageBook(org.eclipse.ui.part.PageBook) ActionGroup(org.eclipse.ui.actions.ActionGroup) CompositeActionGroup(org.eclipse.jdt.internal.ui.actions.CompositeActionGroup) ToolBar(org.eclipse.swt.widgets.ToolBar) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) StructuredViewer(org.eclipse.jface.viewers.StructuredViewer) IActionBars(org.eclipse.ui.IActionBars) Separator(org.eclipse.jface.action.Separator)

Example 2 with ActionGroup

use of org.eclipse.ui.actions.ActionGroup in project erlide_eclipse by erlang.

the class ErlangEditor method createActions.

@Override
protected void createActions() {
    super.createActions();
    ActionGroup esg;
    fActionGroups = new CompositeActionGroup(new ActionGroup[] { esg = new ErlangSearchActionGroup(this) });
    fContextMenuGroup = new CompositeActionGroup(new ActionGroup[] { esg });
    createCommonActions();
    compileAction = new CompileAction(getSite());
    compileAction.setActionDefinitionId(IErlangEditorActionDefinitionIds.COMPILE);
    setAction("compileFile", compileAction);
    if (getModule() != null) {
        cleanUpAction = new CleanUpAction(getModule().getResource());
        cleanUpAction.setActionDefinitionId(IErlangEditorActionDefinitionIds.CLEAN_UP);
        setAction("cleanUp", cleanUpAction);
    }
    callhierarchy = new CallHierarchyAction(this, getModule());
    callhierarchy.setActionDefinitionId(IErlangEditorActionDefinitionIds.CALLHIERARCHY);
    setAction("callHierarchy", callhierarchy);
    markAsStateDependentAction("CallHierarchy", true);
    markAsSelectionDependentAction("CallHierarchy", true);
    if (SystemConfiguration.getInstance().isClearCacheAvailable()) {
        setupClearCacheActions();
    // PlatformUI.getWorkbench().getHelpSystem().setHelp(indentAction,
    // IErlangHelpContextIds.INDENT_ACTION);
    }
    fShowOutline = new ShowOutlineAction(ErlangEditorMessages.getBundleForConstructedKeys(), "ShowOutline.", this);
    fShowOutline.setActionDefinitionId(IErlangEditorActionDefinitionIds.SHOW_OUTLINE);
    setAction(IErlangEditorActionDefinitionIds.SHOW_OUTLINE, fShowOutline);
    markAsContentDependentAction(IErlangEditorActionDefinitionIds.SHOW_OUTLINE, true);
    final Action action = new GotoMatchingBracketAction(this);
    action.setActionDefinitionId(IErlangEditorActionDefinitionIds.GOTO_MATCHING_BRACKET);
    setAction(GotoMatchingBracketAction.GOTO_MATCHING_BRACKET, action);
}
Also used : GotoMatchingBracketAction(org.erlide.ui.editors.erl.actions.GotoMatchingBracketAction) CompositeActionGroup(org.erlide.ui.actions.CompositeActionGroup) ErlangSearchActionGroup(org.erlide.ui.actions.ErlangSearchActionGroup) CallHierarchyAction(org.erlide.ui.editors.erl.actions.CallHierarchyAction) ShowOutlineAction(org.erlide.ui.editors.erl.actions.ShowOutlineAction) CleanUpAction(org.erlide.ui.editors.erl.actions.CleanUpAction) CallHierarchyAction(org.erlide.ui.editors.erl.actions.CallHierarchyAction) CompileAction(org.erlide.ui.editors.erl.actions.CompileAction) ShowOutlineAction(org.erlide.ui.editors.erl.actions.ShowOutlineAction) ClearCacheAction(org.erlide.ui.editors.erl.actions.ClearCacheAction) ClearAllCachesAction(org.erlide.ui.editors.erl.actions.ClearAllCachesAction) GotoMatchingBracketAction(org.erlide.ui.editors.erl.actions.GotoMatchingBracketAction) Action(org.eclipse.jface.action.Action) CompileAction(org.erlide.ui.editors.erl.actions.CompileAction) ErlangSearchActionGroup(org.erlide.ui.actions.ErlangSearchActionGroup) CompositeActionGroup(org.erlide.ui.actions.CompositeActionGroup) ActionGroup(org.eclipse.ui.actions.ActionGroup) CleanUpAction(org.erlide.ui.editors.erl.actions.CleanUpAction)

Example 3 with ActionGroup

use of org.eclipse.ui.actions.ActionGroup in project erlide_eclipse by erlang.

the class ErlangScratchPad method createActions.

@Override
protected void createActions() {
    super.createActions();
    ActionGroup esg;
    fActionGroups = new CompositeActionGroup(new ActionGroup[] { esg = new ErlangSearchActionGroup(this) });
    fContextMenuGroup = new CompositeActionGroup(new ActionGroup[] { esg });
    createCommonActions();
// if (ErlideUtil.isTest()) {
// testAction = new TestAction(ErlangEditorMessages
// .getBundleForConstructedKeys(), "Test.", this, getModule());
// testAction
// .setActionDefinitionId(IErlangEditorActionDefinitionIds.TEST);
// setAction("Test", testAction);
// markAsStateDependentAction("Test", true);
// markAsSelectionDependentAction("Test", true);
// // PlatformUI.getWorkbench().getHelpSystem().setHelp(indentAction,
// // IErlangHelpContextIds.INDENT_ACTION);
// }
}
Also used : CompositeActionGroup(org.erlide.ui.actions.CompositeActionGroup) ErlangSearchActionGroup(org.erlide.ui.actions.ErlangSearchActionGroup) ActionGroup(org.eclipse.ui.actions.ActionGroup) ErlangSearchActionGroup(org.erlide.ui.actions.ErlangSearchActionGroup) CompositeActionGroup(org.erlide.ui.actions.CompositeActionGroup)

Example 4 with ActionGroup

use of org.eclipse.ui.actions.ActionGroup in project mdw-designer by CenturyLinkCloud.

the class ProcessExplorerActionGroup method createExportActionGroup.

private ActionGroup createExportActionGroup() {
    exportMenu = new MenuManager("Export", MdwPlugin.getImageDescriptor("icons/export.gif"), MdwMenuManager.MDW_MENU_PREFIX + "menu.export");
    return new ActionGroup() {

        @Override
        public void fillContextMenu(IMenuManager menu) {
            exportMenu.removeAll();
            IStructuredSelection selection = getSelection();
            if (exportPackageApplies(selection))
                exportMenu.add(exportPackageAction);
            if (exportProcessApplies(selection))
                exportMenu.add(exportProcessAction);
            if (exportWorkflowAssetApplies(selection)) {
                WorkflowAsset asset = (WorkflowAsset) selection.getFirstElement();
                // menu item text and icon are dynamic
                exportWorkflowAssetAction.setId(MdwMenuManager.MDW_MENU_PREFIX + "export.to.file");
                exportWorkflowAssetAction.setText(asset.getTitle() + " to File...");
                exportWorkflowAssetAction.setImageDescriptor(MdwPlugin.getImageDescriptor(ICONS + asset.getIcon()));
                exportMenu.add(exportWorkflowAssetAction);
            }
            if (exportAttributesApplies(selection)) {
                List<IAction> exportAttrsActions = getExportAttributeActions(selection);
                if (!exportAttrsActions.isEmpty()) {
                    MenuManager attributesMenu = new MenuManager("Attributes", MdwPlugin.getImageDescriptor("icons/attribute.gif"), MdwMenuManager.MDW_MENU_PREFIX + "menu.export.attributes");
                    attributesMenu.removeAll();
                    for (IAction action : exportAttrsActions) attributesMenu.add(action);
                    exportMenu.add(attributesMenu);
                }
            }
            if (exportTaskTemplatesApplies(selection))
                exportMenu.add(exportTaskTemplateAction);
            exportMenu.add(new Separator(OTHER));
            IWorkbenchAction otherAction = ActionFactory.EXPORT.create(getViewSite().getWorkbenchWindow());
            otherAction.setId(MdwMenuManager.MDW_MENU_PREFIX + "export.other");
            otherAction.setText(OTHER_DOT);
            exportMenu.add(otherAction);
        }
    };
}
Also used : IAction(org.eclipse.jface.action.IAction) ActionGroup(org.eclipse.ui.actions.ActionGroup) IWorkbenchAction(org.eclipse.ui.actions.ActionFactory.IWorkbenchAction) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) MdwMenuManager(com.centurylink.mdw.plugin.actions.MdwMenuManager) WorkflowAsset(com.centurylink.mdw.plugin.designer.model.WorkflowAsset) IMenuManager(org.eclipse.jface.action.IMenuManager) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) Separator(org.eclipse.jface.action.Separator)

Example 5 with ActionGroup

use of org.eclipse.ui.actions.ActionGroup in project mdw-designer by CenturyLinkCloud.

the class ProcessExplorerActionGroup method createSwingActionGroup.

private ActionGroup createSwingActionGroup() {
    swingMenu = new MenuManager("Swing Tools", null, MdwMenuManager.MDW_MENU_PREFIX + "menu.swing.tools");
    return new ActionGroup() {

        @Override
        public void fillContextMenu(IMenuManager menu) {
            swingMenu.removeAll();
            IStructuredSelection selection = getSelection();
            if (swingLaunchApplies(selection)) {
                WorkflowProject project = (WorkflowProject) selection.getFirstElement();
                MdwSettings settings = MdwPlugin.getSettings();
                if (settings.isSwingLaunchEventManager() && project.isUserAuthorizedForSystemAdmin())
                    swingMenu.add(eventManagerAction);
                if (settings.isSwingLaunchThreadPoolManager() && project.isUserAuthorizedForSystemAdmin())
                    swingMenu.add(threadPoolManagerAction);
            }
        }
    };
}
Also used : ActionGroup(org.eclipse.ui.actions.ActionGroup) MdwSettings(com.centurylink.mdw.plugin.preferences.model.MdwSettings) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) MdwMenuManager(com.centurylink.mdw.plugin.actions.MdwMenuManager) WorkflowProject(com.centurylink.mdw.plugin.project.model.WorkflowProject) IMenuManager(org.eclipse.jface.action.IMenuManager) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection)

Aggregations

ActionGroup (org.eclipse.ui.actions.ActionGroup)13 IMenuManager (org.eclipse.jface.action.IMenuManager)11 MenuManager (org.eclipse.jface.action.MenuManager)11 MdwMenuManager (com.centurylink.mdw.plugin.actions.MdwMenuManager)9 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)8 Separator (org.eclipse.jface.action.Separator)5 WorkflowElement (com.centurylink.mdw.plugin.designer.model.WorkflowElement)4 WorkflowProject (com.centurylink.mdw.plugin.project.model.WorkflowProject)4 IWorkbenchAction (org.eclipse.ui.actions.ActionFactory.IWorkbenchAction)3 CompositeActionGroup (org.erlide.ui.actions.CompositeActionGroup)3 ErlangSearchActionGroup (org.erlide.ui.actions.ErlangSearchActionGroup)3 WorkflowAsset (com.centurylink.mdw.plugin.designer.model.WorkflowAsset)2 IAction (org.eclipse.jface.action.IAction)2 IActionBars (org.eclipse.ui.IActionBars)2 WorkflowProcess (com.centurylink.mdw.plugin.designer.model.WorkflowProcess)1 MdwSettings (com.centurylink.mdw.plugin.preferences.model.MdwSettings)1 File (java.io.File)1 CompositeActionGroup (org.eclipse.jdt.internal.ui.actions.CompositeActionGroup)1 SelectionProviderMediator (org.eclipse.jdt.internal.ui.viewsupport.SelectionProviderMediator)1 Action (org.eclipse.jface.action.Action)1