Search in sources :

Example 6 with Separator

use of org.eclipse.jface.action.Separator in project translationstudio8 by heartsome.

the class ApplicationActionBarAdvisor method createFileMenu.

/**
	 * 创建文件菜单
	 * @return 返回文件菜单的 menu manager;
	 */
private MenuManager createFileMenu() {
    MenuManager menu = new MenuManager(Messages.getString("ts.ApplicationActionBarAdvisor.menu.file"), // &File
    IWorkbenchActionConstants.M_FILE);
    menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START));
    // 添加 new.ext group,这样 IDE 中定义的 Open File... 可以显示在最顶端
    // menu.add(newAction);
    menu.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT));
    menu.add(new Separator());
    menu.add(closeAction);
    menu.add(closeAllAction);
    menu.add(refreshAction);
    // menu.add(new Separator("net.heartsome.cat.ts.ui.menu.file.separator"));
    menu.add(new GroupMarker("xliff.switch"));
    menu.add(new GroupMarker("rtf.switch"));
    menu.add(new GroupMarker("xliff.split"));
    menu.add(new Separator());
    // 设置保存文件记录条数为 5 条
    WorkbenchPlugin.getDefault().getPreferenceStore().setValue(IPreferenceConstants.RECENT_FILES, 5);
    // 添加文件访问列表
    ContributionItemFactory REOPEN_EDITORS = new //$NON-NLS-1$
    ContributionItemFactory(//$NON-NLS-1$
    "reopenEditors") {

        /* (non-javadoc) method declared on ContributionItemFactory */
        public IContributionItem create(IWorkbenchWindow window) {
            if (window == null) {
                throw new IllegalArgumentException();
            }
            return new ReopenEditorMenu(window, getId(), false);
        }
    };
    menu.add(REOPEN_EDITORS.create(window));
    menu.add(exitAction);
    menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END));
    return menu;
}
Also used : ContributionItemFactory(org.eclipse.ui.actions.ContributionItemFactory) IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) ReopenEditorMenu(org.eclipse.ui.internal.ReopenEditorMenu) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) GroupMarker(org.eclipse.jface.action.GroupMarker) Separator(org.eclipse.jface.action.Separator)

Example 7 with Separator

use of org.eclipse.jface.action.Separator in project translationstudio8 by heartsome.

the class PortingActionProvider method addImportMenu.

private void addImportMenu(IMenuManager aMenu) {
    importWizardActionGroup.setContext(getContext());
    if (importWizardActionGroup.getWizardActionIds().length == 0) {
        aMenu.appendToGroup(ICommonMenuConstants.GROUP_PORT, importAction);
        return;
    }
    IMenuManager submenu = new MenuManager(WorkbenchNavigatorMessages.PortingActionProvider_ImportResourcesMenu_label, COMMON_NAVIGATOR_IMPORT_MENU);
    importWizardActionGroup.fillContextMenu(submenu);
    submenu.add(new Separator(ICommonMenuConstants.GROUP_ADDITIONS));
    submenu.add(new Separator());
    submenu.add(importAction);
    aMenu.appendToGroup(ICommonMenuConstants.GROUP_PORT, submenu);
}
Also used : MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) Separator(org.eclipse.jface.action.Separator)

Example 8 with Separator

use of org.eclipse.jface.action.Separator in project translationstudio8 by heartsome.

the class WorkingSetRootModeActionGroup method addActions.

/**
	 * Adds the actions to the given menu manager.
	 */
protected void addActions(IMenuManager viewMenu) {
    if (actions == null)
        actions = createActions();
    viewMenu.add(new Separator());
    items = new MenuItem[actions.length];
    for (int i = 0; i < actions.length; i++) {
        final int j = i;
        viewMenu.add(new ContributionItem() {

            public void fill(Menu menu, int index) {
                int style = SWT.CHECK;
                if ((actions[j].getStyle() & IAction.AS_RADIO_BUTTON) != 0)
                    style = SWT.RADIO;
                final MenuItem mi = new MenuItem(menu, style, index);
                items[j] = mi;
                mi.setText(actions[j].getText());
                mi.setSelection(currentSelection == j);
                mi.addSelectionListener(new SelectionAdapter() {

                    public void widgetSelected(SelectionEvent e) {
                        if (currentSelection == j) {
                            items[currentSelection].setSelection(true);
                            return;
                        }
                        actions[j].run();
                        // Update checked state
                        items[currentSelection].setSelection(false);
                        currentSelection = j;
                        items[currentSelection].setSelection(true);
                    }
                });
            }

            public boolean isDynamic() {
                return false;
            }
        });
    }
}
Also used : SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) SelectionEvent(org.eclipse.swt.events.SelectionEvent) ContributionItem(org.eclipse.jface.action.ContributionItem) MenuItem(org.eclipse.swt.widgets.MenuItem) Menu(org.eclipse.swt.widgets.Menu) Separator(org.eclipse.jface.action.Separator)

Example 9 with Separator

use of org.eclipse.jface.action.Separator in project azure-tools-for-java by Microsoft.

the class ServiceExplorerView method fillLocalToolBar.

private void fillLocalToolBar(IToolBarManager manager) {
    manager.add(refreshAction);
    manager.add(signInOutAction);
    manager.add(selectSubscriptionAction);
    manager.add(new Separator());
}
Also used : Separator(org.eclipse.jface.action.Separator)

Example 10 with Separator

use of org.eclipse.jface.action.Separator 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)

Aggregations

Separator (org.eclipse.jface.action.Separator)89 MenuManager (org.eclipse.jface.action.MenuManager)39 IMenuManager (org.eclipse.jface.action.IMenuManager)37 IAction (org.eclipse.jface.action.IAction)14 Menu (org.eclipse.swt.widgets.Menu)10 Action (org.eclipse.jface.action.Action)9 IMenuListener (org.eclipse.jface.action.IMenuListener)9 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)9 ActionManager (com.cubrid.common.ui.spi.action.ActionManager)7 IToolBarManager (org.eclipse.jface.action.IToolBarManager)7 ActionContributionItem (org.eclipse.jface.action.ActionContributionItem)6 GroupMarker (org.eclipse.jface.action.GroupMarker)6 IContributionManager (org.eclipse.jface.action.IContributionManager)5 TreeViewer (org.eclipse.jface.viewers.TreeViewer)5 IActionBars (org.eclipse.ui.IActionBars)5 DBAServerSession (org.jkiss.dbeaver.model.admin.sessions.DBAServerSession)5 DBAServerSessionManager (org.jkiss.dbeaver.model.admin.sessions.DBAServerSessionManager)5 SessionManagerViewer (org.jkiss.dbeaver.ui.views.session.SessionManagerViewer)5 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)4 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)4