Search in sources :

Example 61 with IMenuManager

use of org.eclipse.jface.action.IMenuManager in project cubrid-manager by CUBRID.

the class PerspectiveChangedListener method hidePerspectiveHide.

public void hidePerspectiveHide(PerspectiveChangeEvent event) {
    WorkbenchWindow window = (WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window != null) {
        ICoolBarManager coolBarManager = window.getCoolBarManager2();
        IMenuManager menuManager = window.getMenuBarManager();
        ActionAdvisor.getInstance().hideToolbar(coolBarManager);
        ActionAdvisor.getInstance().hideMenu(menuManager);
    }
}
Also used : WorkbenchWindow(org.eclipse.ui.internal.WorkbenchWindow) IMenuManager(org.eclipse.jface.action.IMenuManager) ICoolBarManager(org.eclipse.jface.action.ICoolBarManager)

Example 62 with IMenuManager

use of org.eclipse.jface.action.IMenuManager in project cubrid-manager by CUBRID.

the class TextEditorContributor method contributeToMenu.

/**
	 * Contributes to the given menu.
	 *
	 * @param menuManager the manager that controls the menu
	 */
public void contributeToMenu(IMenuManager menuManager) {
    super.contributeToMenu(menuManager);
    MenuManager drawMenu = new MenuManager("&Edit", IWorkbenchActionConstants.M_EDIT);
    menuManager.add(drawMenu);
    drawMenu.add(getAction(ActionFactory.UNDO.getId()));
    drawMenu.add(getAction(ActionFactory.REDO.getId()));
    drawMenu.add(new Separator());
    drawMenu.add(getAction(ActionFactory.COPY.getId()));
    drawMenu.add(getAction(ActionFactory.CUT.getId()));
    drawMenu.add(getAction(ActionFactory.PASTE.getId()));
    drawMenu.add(new Separator());
    drawMenu.add(getAction(ActionFactory.FIND.getId()));
    IAction action = getAction(ActionConstants.ACTION_FORMAT);
    if (action != null) {
        drawMenu.add(new Separator());
        drawMenu.add(getAction(ActionConstants.ACTION_FORMAT));
    }
}
Also used : IAction(org.eclipse.jface.action.IAction) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) Separator(org.eclipse.jface.action.Separator)

Example 63 with IMenuManager

use of org.eclipse.jface.action.IMenuManager in project cubrid-manager by CUBRID.

the class ActionAdvisor method showMenu.

public void showMenu(IMenuManager menuManager) {
    ActionManager manager = ActionManager.getInstance();
    MenuManager fileMenu = new MenuManager(Messages.mnu_fileMenuName, IActionConstants.MENU_FILE);
    MenuManager editMenu = new MenuManager(Messages.mnu_editMenuName, IActionConstants.MENU_EDIT);
    MenuManager toolsMenu = new MenuManager(Messages.mnu_toolsMenuName, IActionConstants.MENU_TOOLS);
    MenuManager actionMenu = new MenuManager(Messages.mnu_actionMenuName, IActionConstants.MENU_ACTION);
    // fill in file menu
    fileMenu.add(manager.getAction(OpenQueryConnAction.ID));
    fileMenu.add(manager.getAction(CloseQueryConnAction.ID));
    fileMenu.add(new Separator());
    fileMenu.add(manager.getAction(NewQueryConnAction.ID));
    fileMenu.add(manager.getAction(EditQueryConnAction.ID));
    fileMenu.add(manager.getAction(DeleteQueryConnAction.ID));
    fileMenu.add(new Separator());
    fileMenu.add(manager.getAction(ConnectionUrlImportAction.ID));
    fileMenu.add(manager.getAction(ConnectionUrlExportAction.ID));
    fileMenu.add(new Separator());
    fileMenu.add(manager.getAction(ConnectionImportAction.ID));
    fileMenu.add(manager.getAction(ConnectionExportAction.ID));
    fileMenu.add(new Separator());
    fileMenu.add(closeAction);
    fileMenu.add(closeAllAction);
    fileMenu.add(new Separator());
    fileMenu.add(manager.getAction(OpenQueryAction.ID));
    fileMenu.add(saveAction);
    fileMenu.add(saveasAction);
    fileMenu.add(saveAllAction);
    fileMenu.add(new Separator());
    fileMenu.add(manager.getAction(RestoreQueryEditorAction.ID));
    fileMenu.add(new Separator());
    fileMenu.add(manager.getAction(ImportConnsAction.ID));
    fileMenu.add(SelectWorkspaceDialog.getWorkspaceMenu(ApplicationType.CUBRID_QUERY_BROWSER.getShortName(), Version.buildVersionId));
    fileMenu.add(new Separator());
    ActionContributionItem preferencesActionItem = new ActionContributionItem(preferenceAction);
    fileMenu.add(preferencesActionItem);
    if (Util.isMac()) {
    }
    fileMenu.add(manager.getAction(RefreshAction.ID));
    fileMenu.add(new Separator());
    fileMenu.add(quitAction);
    fileMenu.add(new Separator());
    // fill in edit menu
    editMenu.add(undoRetargetAction);
    editMenu.add(redoRetargetAction);
    editMenu.add(new Separator());
    editMenu.add(copyRetargetAction);
    editMenu.add(cutRetargetAction);
    editMenu.add(pasteRetargetAction);
    editMenu.add(new Separator());
    editMenu.add(findRetargetAction);
    editMenu.add(manager.getAction(GotoLineAction.ID));
    // fill in the tools menu
    toolsMenu.add(manager.getAction(QueryNewAction.ID));
    toolsMenu.add(manager.getAction(QueryNewCustomAction.ID));
    toolsMenu.add(new Separator());
    toolsMenu.add(manager.getAction(OIDNavigatorAction.ID));
    toolsMenu.add(new Separator());
    toolsMenu.add(manager.getAction(NewTableAction.ID));
    toolsMenu.add(manager.getAction(CreateViewAction.ID));
    toolsMenu.add(new Separator());
    toolsMenu.add(manager.getAction(CreateSerialAction.ID));
    toolsMenu.add(new Separator());
    toolsMenu.add(manager.getAction(NewTriggerAction.ID));
    toolsMenu.add(new Separator());
    toolsMenu.add(manager.getAction(AddFunctionAction.ID));
    toolsMenu.add(manager.getAction(AddProcedureAction.ID));
    toolsMenu.add(new Separator());
    toolsMenu.add(manager.getAction(ExportWizardAction.ID));
    toolsMenu.add(manager.getAction(ImportWizardAction.ID));
    //		toolsMenu.add(new Separator());
    //		fileMenu.add(manager.getAction(OpenSchemaEditorAction.ID));
    fileMenu.add(new Separator());
    IMenuManager perparedMenu = new MenuManager(com.cubrid.common.ui.spi.Messages.preparedTableDataMenuName);
    toolsMenu.add(perparedMenu);
    perparedMenu.add(manager.getAction(PstmtOneDataAction.ID));
    perparedMenu.add(manager.getAction(PstmtMultiDataAction.ID));
    toolsMenu.add(new Separator());
    toolsMenu.add(manager.getAction(BrokerLogParserAction.ID));
    toolsMenu.add(manager.getAction(BrokerLogTopMergeAction.ID));
    toolsMenu.add(manager.getAction(BrokerConfOpenFileAction.ID));
    toolsMenu.add(new Separator());
    toolsMenu.add(manager.getAction(SchemaCommentInstallAction.ID));
    menuManager.insertBefore(getMenuInsertPoint(menuManager), fileMenu);
    menuManager.insertBefore(getMenuInsertPoint(menuManager), editMenu);
    menuManager.insertBefore(getMenuInsertPoint(menuManager), toolsMenu);
    menuManager.insertBefore(getMenuInsertPoint(menuManager), actionMenu);
    menuManager.update(true);
}
Also used : ActionManager(com.cubrid.common.ui.spi.action.ActionManager) ActionContributionItem(org.eclipse.jface.action.ActionContributionItem) 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 64 with IMenuManager

use of org.eclipse.jface.action.IMenuManager in project cubrid-manager by CUBRID.

the class PerspectiveChangedListener method showPerspective.

public void showPerspective(PerspectiveChangeEvent event) {
    WorkbenchWindow window = (WorkbenchWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (window != null) {
        ICoolBarManager coolBarManager = window.getCoolBarManager2();
        IMenuManager menuManager = window.getMenuBarManager();
        ActionAdvisor.getInstance().showToolbar(coolBarManager);
        ActionAdvisor.getInstance().showMenu(menuManager);
    }
    ActionManager.getInstance().setMenuProvider(menuProvider);
    LayoutManager.getInstance().setStatusLineContrItem(cubridStatusLineContrItem);
    LayoutManager.getInstance().setTitleLineContrItem(cubridTitleLineContrItem);
    cubridTitleLineContrItem.changeTitleForNavigator(null);
    LayoutManager.getInstance().setWorkbenchContrItem(cubridWorkbenchContrItem);
    CubridNavigatorView navigatorView = CubridNavigatorView.findNavigationView();
    if (navigatorView != null) {
        navigatorView.setFocus();
        if (navigatorView.getViewer() != null) {
            navigatorView.getViewer().refresh(true);
        }
    }
}
Also used : WorkbenchWindow(org.eclipse.ui.internal.WorkbenchWindow) CubridNavigatorView(com.cubrid.common.ui.common.navigator.CubridNavigatorView) IMenuManager(org.eclipse.jface.action.IMenuManager) ICoolBarManager(org.eclipse.jface.action.ICoolBarManager)

Example 65 with IMenuManager

use of org.eclipse.jface.action.IMenuManager in project cubrid-manager by CUBRID.

the class ApplicationWorkbenchWindowAdvisor method removePlatformDependencyActions.

private void removePlatformDependencyActions() {
    // remove some menu items
    IMenuManager mm = getWindowConfigurer().getActionBarConfigurer().getMenuManager();
    for (IContributionItem item : mm.getItems()) {
        if (item == null) {
            continue;
        }
        MenuManager sm = (MenuManager) item;
        for (IContributionItem sitem : sm.getItems()) {
            if (sitem == null || sitem.getId() == null) {
                continue;
            }
            if (sitem.getId().equals("org.eclipse.ui.actions.showKeyAssistHandler") || sitem.getId().equals("com.cubrid.common.update.p2.menu.install") || sitem.getId().equals("converstLineDelimitersTo") || sitem.getId().equals("save.ext") || sitem.getId().equals("org.eclipse.ui.openLocalFile") || sitem.getId().equals("new.ext")) {
                sm.remove(sitem.getId());
                sm.update(true);
                mm.update(true);
            }
        }
    }
    // remove some tool bar items
    ICoolBarManager cm = getWindowConfigurer().getActionBarConfigurer().getCoolBarManager();
    for (IContributionItem item : cm.getItems()) {
        if (item == null || item.getId() == null) {
            continue;
        }
        if (item.getId().equals("org.eclipse.ui.edit.text.actionSet.annotationNavigation") || item.getId().equals("org.eclipse.ui.edit.text.actionSet.navigation")) {
            cm.remove(item.getId());
            cm.update(true);
        }
    }
    // remove some preference items
    PreferenceManager pm = getWindowConfigurer().getWindow().getWorkbench().getPreferenceManager();
    for (IPreferenceNode item : pm.getRootSubNodes()) {
        if (item.getId().equals("org.eclipse.help.ui.browsersPreferencePage") || item.getId().equals("org.eclipse.ui.preferencePages.Workbench")) {
            pm.remove(item.getId());
        }
    }
}
Also used : IContributionItem(org.eclipse.jface.action.IContributionItem) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) IPreferenceNode(org.eclipse.jface.preference.IPreferenceNode) PreferenceManager(org.eclipse.jface.preference.PreferenceManager) ICoolBarManager(org.eclipse.jface.action.ICoolBarManager)

Aggregations

IMenuManager (org.eclipse.jface.action.IMenuManager)88 MenuManager (org.eclipse.jface.action.MenuManager)72 IMenuListener (org.eclipse.jface.action.IMenuListener)48 Menu (org.eclipse.swt.widgets.Menu)43 Separator (org.eclipse.jface.action.Separator)31 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)16 IAction (org.eclipse.jface.action.IAction)9 TreeViewer (org.eclipse.jface.viewers.TreeViewer)9 ISelectionChangedListener (org.eclipse.jface.viewers.ISelectionChangedListener)8 GridData (org.eclipse.swt.layout.GridData)8 Action (org.eclipse.jface.action.Action)7 SelectionChangedEvent (org.eclipse.jface.viewers.SelectionChangedEvent)7 Composite (org.eclipse.swt.widgets.Composite)7 GridLayout (org.eclipse.swt.layout.GridLayout)6 List (java.util.List)5 ICoolBarManager (org.eclipse.jface.action.ICoolBarManager)5 FocusEvent (org.eclipse.swt.events.FocusEvent)5 ActionManager (com.cubrid.common.ui.spi.action.ActionManager)4 IContributionItem (org.eclipse.jface.action.IContributionItem)4 Point (org.eclipse.swt.graphics.Point)4