Search in sources :

Example 41 with MenuManager

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

the class PluginConfigManage method updataPluginMenu.

public void updataPluginMenu(PluginConfigBean bean) {
    String id = bean.getId();
    for (int i = 0; i < parentManager.getItems().length; i++) {
        if ("net.heartsome.cat.ts.ui.menu.plugin".equals(parentManager.getItems()[i].getId())) {
            MenuManager pluginMenu = (MenuManager) parentManager.getItems()[i];
            // 开始删除已经添加的菜单
            for (int j = 0; j < pluginMenu.getItems().length; j++) {
                String actionId = pluginMenu.getItems()[j].getId();
                if (id.equals(actionId)) {
                    pluginMenu.remove(id);
                    pluginMenu.update();
                    addPluginMenu(bean);
                }
            }
        }
    }
}
Also used : MenuManager(org.eclipse.jface.action.MenuManager)

Example 42 with MenuManager

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

the class PluginConfigManage method deletePluginMenu.

/**
	 * 删除配置插件的菜单
	 * @param idList
	 *            ;
	 */
public void deletePluginMenu(String deleteId) {
    for (int i = 0; i < parentManager.getItems().length; i++) {
        if ("net.heartsome.cat.ts.ui.menu.plugin".equals(parentManager.getItems()[i].getId())) {
            MenuManager pluginMenu = (MenuManager) parentManager.getItems()[i];
            // 开始删除已经添加的菜单
            for (int j = 0; j < pluginMenu.getItems().length; j++) {
                String actionId = pluginMenu.getItems()[j].getId();
                if (deleteId.equals(actionId)) {
                    pluginMenu.remove(actionId);
                }
            }
            pluginMenu.update();
        }
    }
}
Also used : MenuManager(org.eclipse.jface.action.MenuManager)

Example 43 with MenuManager

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

the class MatchViewerBodyMenu method createMenu.

private void createMenu() {
    MenuManager menuMgr = new MenuManager();
    bodyMenu = menuMgr.createContextMenu(view.gridTable);
    copyAction = new CopyAction();
    menuMgr.add(copyAction);
    editAction = new EditTmAction();
    menuMgr.add(editAction);
    deleteAction = new DeleteTmAction();
    menuMgr.add(deleteAction);
    acceptMatchAction = new AcceptMatchAction();
    menuMgr.add(acceptMatchAction);
// acceptMatchPureTextAction = new AcceptMatchPureTextAction();
// menuMgr.add(acceptMatchPureTextAction);
}
Also used : MenuManager(org.eclipse.jface.action.MenuManager)

Example 44 with MenuManager

use of org.eclipse.jface.action.MenuManager in project archi by archimatetool.

the class SearchWidget method setupToolBar.

protected void setupToolBar() {
    fActionFilterName = new Action(Messages.SearchWidget_0, IAction.AS_CHECK_BOX) {

        @Override
        public void run() {
            fSearchFilter.setFilterOnName(isChecked());
        }
    };
    fActionFilterName.setToolTipText(Messages.SearchWidget_1);
    fActionFilterName.setChecked(true);
    fSearchFilter.setFilterOnName(true);
    fActionFilterDoc = new Action(Messages.SearchWidget_2, IAction.AS_CHECK_BOX) {

        @Override
        public void run() {
            fSearchFilter.setFilterOnDocumentation(isChecked());
        }
    };
    fActionFilterDoc.setToolTipText(Messages.SearchWidget_3);
    final ToolBarManager toolBarmanager = new ToolBarManager(SWT.FLAT);
    toolBarmanager.createControl(this);
    AbstractDropDownAction dropDownAction = new AbstractDropDownAction(Messages.SearchWidget_4) {

        @Override
        public void run() {
            showMenu(toolBarmanager);
        }

        @Override
        public ImageDescriptor getImageDescriptor() {
            return IArchiImages.ImageFactory.getImageDescriptor(IArchiImages.ICON_FILTER);
        }
    };
    toolBarmanager.add(dropDownAction);
    // Name & Documentation
    dropDownAction.add(fActionFilterName);
    dropDownAction.add(fActionFilterDoc);
    // Properties
    fPropertiesMenu = new MenuManager(Messages.SearchWidget_5);
    dropDownAction.add(fPropertiesMenu);
    populatePropertiesMenu(fPropertiesMenu);
    dropDownAction.add(new Separator());
    MenuManager strategyMenu = new MenuManager(Messages.SearchWidget_15);
    dropDownAction.add(strategyMenu);
    for (EClass eClass : ArchimateModelUtils.getStrategyClasses()) {
        strategyMenu.add(createObjectAction(eClass));
    }
    MenuManager businessMenu = new MenuManager(Messages.SearchWidget_6);
    dropDownAction.add(businessMenu);
    for (EClass eClass : ArchimateModelUtils.getBusinessClasses()) {
        businessMenu.add(createObjectAction(eClass));
    }
    MenuManager applicationMenu = new MenuManager(Messages.SearchWidget_7);
    dropDownAction.add(applicationMenu);
    for (EClass eClass : ArchimateModelUtils.getApplicationClasses()) {
        applicationMenu.add(createObjectAction(eClass));
    }
    MenuManager technologyPhysicalMenu = new MenuManager(Messages.SearchWidget_8);
    dropDownAction.add(technologyPhysicalMenu);
    for (EClass eClass : ArchimateModelUtils.getTechnologyClasses()) {
        technologyPhysicalMenu.add(createObjectAction(eClass));
    }
    technologyPhysicalMenu.add(new Separator());
    for (EClass eClass : ArchimateModelUtils.getPhysicalClasses()) {
        technologyPhysicalMenu.add(createObjectAction(eClass));
    }
    MenuManager motivationMenu = new MenuManager(Messages.SearchWidget_9);
    dropDownAction.add(motivationMenu);
    for (EClass eClass : ArchimateModelUtils.getMotivationClasses()) {
        motivationMenu.add(createObjectAction(eClass));
    }
    MenuManager implementationMenu = new MenuManager(Messages.SearchWidget_10);
    dropDownAction.add(implementationMenu);
    for (EClass eClass : ArchimateModelUtils.getImplementationMigrationClasses()) {
        implementationMenu.add(createObjectAction(eClass));
    }
    MenuManager otherMenu = new MenuManager(Messages.SearchWidget_14);
    dropDownAction.add(otherMenu);
    for (EClass eClass : ArchimateModelUtils.getOtherClasses()) {
        otherMenu.add(createObjectAction(eClass));
    }
    otherMenu.add(new Separator());
    for (EClass eClass : ArchimateModelUtils.getConnectorClasses()) {
        otherMenu.add(createObjectAction(eClass));
    }
    MenuManager relationsMenu = new MenuManager(Messages.SearchWidget_11);
    dropDownAction.add(relationsMenu);
    for (EClass eClass : ArchimateModelUtils.getRelationsClasses()) {
        relationsMenu.add(createObjectAction(eClass));
    }
    dropDownAction.add(new Separator());
    IAction action = new Action(Messages.SearchWidget_12, IAction.AS_CHECK_BOX) {

        @Override
        public void run() {
            fSearchFilter.setShowAllFolders(isChecked());
        }
    };
    action.setChecked(fSearchFilter.isShowAllFolders());
    dropDownAction.add(action);
    dropDownAction.add(new Separator());
    action = new Action(Messages.SearchWidget_13) {

        @Override
        public void run() {
            reset();
        }
    };
    dropDownAction.add(action);
    toolBarmanager.update(true);
}
Also used : IAction(org.eclipse.jface.action.IAction) AbstractDropDownAction(com.archimatetool.editor.actions.AbstractDropDownAction) Action(org.eclipse.jface.action.Action) EClass(org.eclipse.emf.ecore.EClass) IAction(org.eclipse.jface.action.IAction) MenuManager(org.eclipse.jface.action.MenuManager) AbstractDropDownAction(com.archimatetool.editor.actions.AbstractDropDownAction) ToolBarManager(org.eclipse.jface.action.ToolBarManager) Separator(org.eclipse.jface.action.Separator)

Example 45 with MenuManager

use of org.eclipse.jface.action.MenuManager in project archi by archimatetool.

the class ArchiActionBarAdvisor method createFileMenu.

/**
 * Create the File menu
 * @return
 */
private MenuManager createFileMenu() {
    IWorkbenchWindow window = getActionBarConfigurer().getWindowConfigurer().getWindow();
    MenuManager menu = new MenuManager(Messages.ArchimateEditorActionBarAdvisor_8, IWorkbenchActionConstants.M_FILE);
    menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_START));
    // New
    // $NON-NLS-1$
    MenuManager newMenu = new MenuManager(Messages.ArchimateEditorActionBarAdvisor_9, "new_menu");
    menu.add(newMenu);
    newMenu.add(fActionNewArchimateModel);
    // $NON-NLS-1$
    newMenu.add(new GroupMarker("new_menu.ext"));
    menu.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT));
    menu.add(fActionOpenModel);
    // Open Recent
    MenuManager openRecentMenu = new MRUMenuManager(window);
    menu.add(openRecentMenu);
    menu.add(new Separator());
    menu.add(fActionOpenDiagram);
    menu.add(fActionCloseModel);
    menu.add(fActionCloseEditor);
    menu.add(fActionCloseAllEditors);
    menu.add(new GroupMarker(IWorkbenchActionConstants.CLOSE_EXT));
    menu.add(new Separator());
    menu.add(fActionSave);
    menu.add(fActionSaveAs);
    menu.add(new GroupMarker(IWorkbenchActionConstants.SAVE_EXT));
    menu.add(new Separator());
    menu.add(fActionPrint);
    menu.add(new Separator());
    // $NON-NLS-1$
    MenuManager importMenu = new MenuManager(Messages.ArchimateEditorActionBarAdvisor_10, "import_menu");
    menu.add(importMenu);
    addImportModelExtensionMenuItems(window, importMenu);
    // $NON-NLS-1$
    importMenu.add(new GroupMarker("import_ext"));
    importMenu.add(new Separator());
    // $NON-NLS-1$
    MenuManager exportMenu = new MenuManager(Messages.ArchimateEditorActionBarAdvisor_11, "export_menu");
    menu.add(exportMenu);
    addExportModelExtensionMenuItems(window, exportMenu);
    // $NON-NLS-1$
    exportMenu.add(new GroupMarker("export_ext"));
    exportMenu.add(new Separator());
    // $NON-NLS-1$
    MenuManager reportMenu = new MenuManager(Messages.ArchimateEditorActionBarAdvisor_12, "report_menu");
    menu.add(reportMenu);
    // $NON-NLS-1$
    reportMenu.add(new GroupMarker("report_ext"));
    menu.add(new Separator());
    menu.add(fActionProperties);
    menu.add(new Separator());
    // Quit action not needed on a Mac
    if (!PlatformUtils.isMac()) {
        menu.add(fActionQuit);
    }
    menu.add(new GroupMarker(IWorkbenchActionConstants.FILE_END));
    return menu;
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) GroupMarker(org.eclipse.jface.action.GroupMarker) Separator(org.eclipse.jface.action.Separator)

Aggregations

MenuManager (org.eclipse.jface.action.MenuManager)657 IMenuManager (org.eclipse.jface.action.IMenuManager)498 Menu (org.eclipse.swt.widgets.Menu)303 IMenuListener (org.eclipse.jface.action.IMenuListener)246 Separator (org.eclipse.jface.action.Separator)220 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)65 Point (org.eclipse.swt.graphics.Point)63 Action (org.eclipse.jface.action.Action)55 Composite (org.eclipse.swt.widgets.Composite)49 IAction (org.eclipse.jface.action.IAction)48 SelectionEvent (org.eclipse.swt.events.SelectionEvent)44 GridData (org.eclipse.swt.layout.GridData)44 GroupMarker (org.eclipse.jface.action.GroupMarker)43 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)43 Transfer (org.eclipse.swt.dnd.Transfer)35 GridLayout (org.eclipse.swt.layout.GridLayout)32 List (java.util.List)30 EditingDomainViewerDropAdapter (org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter)30 LocalTransfer (org.eclipse.emf.edit.ui.dnd.LocalTransfer)30 ViewerDragAdapter (org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter)30