Search in sources :

Example 16 with ActionManager

use of com.cubrid.common.ui.spi.action.ActionManager 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);
    // MenuManager helpMenu = new MenuManager(Messages.mnu_helpMneuName,
    // IWorkbenchActionConstants.M_HELP);
    // fill in file menu
    fileMenu.add(manager.getAction(ConnectHostAction.ID));
    fileMenu.add(manager.getAction(DisConnectHostAction.ID));
    fileMenu.add(new Separator());
    fileMenu.add(manager.getAction(AddHostAction.ID));
    fileMenu.add(manager.getAction(EditHostAction.ID));
    fileMenu.add(manager.getAction(DeleteHostAction.ID));
    fileMenu.add(new Separator());
    fileMenu.add(manager.getAction(CubridServerImportAction.ID));
    fileMenu.add(manager.getAction(CubridServerExportAction.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(OpenSchemaEditorAction.ID));
    //		fileMenu.add(new Separator());
    fileMenu.add(manager.getAction(RestoreQueryEditorAction.ID));
    fileMenu.add(new Separator());
    fileMenu.add(manager.getAction(ImportHostsAction.ID));
    fileMenu.add(SelectWorkspaceDialog.getWorkspaceMenu(ApplicationType.CUBRID_MANAGER.getShortName(), Version.buildVersionId));
    fileMenu.add(new Separator());
    ActionContributionItem preferencesActionItem = new ActionContributionItem(preferenceAction);
    fileMenu.add(preferencesActionItem);
    if (Util.isMac()) {
        preferencesActionItem.setVisible(false);
    }
    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 run menu
    toolsMenu.add(manager.getAction(QueryNewAction.ID));
    toolsMenu.add(manager.getAction(QueryNewCustomAction.ID));
    toolsMenu.add(new Separator());
    toolsMenu.add(manager.getAction(StartServiceAction.ID));
    toolsMenu.add(manager.getAction(StopServiceAction.ID));
    toolsMenu.add(new Separator());
    toolsMenu.add(manager.getAction(StartDatabaseAction.ID));
    toolsMenu.add(manager.getAction(StopDatabaseAction.ID));
    toolsMenu.add(new Separator());
    toolsMenu.add(manager.getAction(StartBrokerEnvAction.ID));
    toolsMenu.add(manager.getAction(StopBrokerEnvAction.ID));
    toolsMenu.add(new Separator());
    toolsMenu.add(manager.getAction(ChangeManagerPasswordAction.ID));
    toolsMenu.add(manager.getAction(UserManagementAction.ID));
    toolsMenu.add(new Separator());
    toolsMenu.add(manager.getAction(BrokerLogParserAction.ID));
    toolsMenu.add(manager.getAction(BrokerLogTopMergeAction.ID));
    toolsMenu.add(new Separator());
    toolsMenu.add(manager.getAction(SchemaCommentInstallAction.ID));
    toolsMenu.add(manager.getAction(ServiceDashboardAction.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) Separator(org.eclipse.jface.action.Separator)

Example 17 with ActionManager

use of com.cubrid.common.ui.spi.action.ActionManager in project cubrid-manager by CUBRID.

the class CubridStatusLineContrItem method updateStatusLineForRestoreQueryEditor.

private void updateStatusLineForRestoreQueryEditor() {
    final int countOfRestorableQueryEditors = ApplicationPersistUtil.getInstance().countOfRestorableQueryEditorsAtLastSession();
    if (countOfRestorableQueryEditors <= 0) {
        return;
    }
    IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    StatusLineManager statusLineManager = null;
    if (window instanceof WorkbenchWindow) {
        statusLineManager = ((WorkbenchWindow) window).getStatusLineManager();
    }
    if (statusLineManager == null) {
        return;
    }
    IContributionItem scaleItem = new ControlContribution(RESTORE_QUERY_EDITORS_CONTR_ID) {

        protected Control createControl(Composite parent) {
            Button btn = new Button(parent, SWT.None);
            String buttonTitle = Messages.bind(com.cubrid.common.ui.common.Messages.restoreQueryEditorTitle, countOfRestorableQueryEditors);
            btn.setText(buttonTitle);
            btn.addSelectionListener(new SelectionAdapter() {

                public void widgetSelected(SelectionEvent e) {
                    ActionManager manager = ActionManager.getInstance();
                    IAction action = manager.getAction(RestoreQueryEditorAction.ID);
                    if (action != null && action instanceof RestoreQueryEditorAction) {
                        action.run();
                    }
                }
            });
            return btn;
        }

        ;
    };
    statusLineManager.add(scaleItem);
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) WorkbenchWindow(org.eclipse.ui.internal.WorkbenchWindow) IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) Composite(org.eclipse.swt.widgets.Composite) IAction(org.eclipse.jface.action.IAction) StatusLineManager(org.eclipse.jface.action.StatusLineManager) IContributionItem(org.eclipse.jface.action.IContributionItem) SelectionAdapter(org.eclipse.swt.events.SelectionAdapter) ControlContribution(org.eclipse.jface.action.ControlContribution) ActionManager(com.cubrid.common.ui.spi.action.ActionManager) RestoreQueryEditorAction(com.cubrid.common.ui.common.action.RestoreQueryEditorAction) Button(org.eclipse.swt.widgets.Button) SelectionEvent(org.eclipse.swt.events.SelectionEvent)

Example 18 with ActionManager

use of com.cubrid.common.ui.spi.action.ActionManager in project cubrid-manager by CUBRID.

the class ApplicationActionBarAdvisor method fillMenuBar.

/**
	 * Fills the menu bar with the main menus for the window.
	 *
	 * @param menuBar the menu bar manager
	 */
protected void fillMenuBar(IMenuManager menuManager) {
    ActionManager manager = ActionManager.getInstance();
    MenuManager helpMenu = new MenuManager(Messages.mnu_helpMneuName, IWorkbenchActionConstants.M_HELP);
    helpMenu.add(manager.getAction(HelpDocumentAction.ID));
    // fill in help menu
    if ("ko".equals(Messages.language)) {
        helpMenu.add(newFeatureAction);
    }
    helpMenu.add(new Separator());
    helpMenu.add(reportBugAction);
    helpMenu.add(new Separator());
    helpMenu.add(cubridOnlineForumAction);
    helpMenu.add(cubridProjectSiteAction);
    helpMenu.add(new Separator());
    helpMenu.add(new GroupMarker("updates"));
    helpMenu.add(new Separator());
    helpMenu.add(manager.getAction(ViewServerVersionAction.ID));
    helpMenu.add(new Separator());
    ActionContributionItem aboutActionItem = new ActionContributionItem(aboutAction);
    helpMenu.add(aboutActionItem);
    if (Util.isMac()) {
        aboutActionItem.setVisible(false);
    }
    menuManager.add(helpMenu);
}
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) GroupMarker(org.eclipse.jface.action.GroupMarker) Separator(org.eclipse.jface.action.Separator)

Example 19 with ActionManager

use of com.cubrid.common.ui.spi.action.ActionManager in project cubrid-manager by CUBRID.

the class ApplicationActionBarAdvisor method makeActions.

/**
	 * Instantiates the actions used in the fill methods.
	 *
	 * @see org.eclipse.ui.application.ActionBarAdvisor#makeActions(org.eclipse
	 *      .ui.IWorkbenchWindow)
	 *
	 * @param window the window containing the action bars
	 */
protected void makeActions(IWorkbenchWindow window) {
    ActionManager manager = ActionManager.getInstance();
    CubridActionBuilder.init();
    serviceDashboardAction = (ServiceDashboardAction) manager.getAction(ServiceDashboardAction.ID);
    if (serviceDashboardAction != null) {
        serviceDashboardAction.setText(com.cubrid.common.ui.spi.Messages.serviceDashboardActionName);
        register(serviceDashboardAction);
    }
    // customized actions for CUBRID Manager
    //common action
    preferenceAction = new OpenPreferenceAction(window.getShell(), Messages.openPreferenceActionName, null);
    register(preferenceAction);
    // It must be needed to use a Preferences Menu of an Application Menu on Mac.
    preferenceAction.setId("preferences");
    manager.registerAction(preferenceAction);
    quitAction = new QuitAction(Messages.exitActionName);
    cubridOnlineForumAction = new CubridOnlineForumAction(Messages.cubridOnlineForumActionName);
    cubridProjectSiteAction = new CubridProjectSiteAction(Messages.cubridProjectSiteActionName);
    aboutAction = new AboutAction(Messages.aboutActionName, Version.productName, Version.buildVersionId, CubridManagerAppPlugin.getImageDescriptor("icons/cubridmanager16.gif"), CubridManagerAppPlugin.getImageDescriptor("icons/about.gif"));
    // It must be needed to use a About Menu of an Application Menu on Mac.
    aboutAction.setId("about");
    clientVersionAction = new AboutAction(Messages.clientVersionActionName, Version.productName, Version.buildVersionId, CubridManagerAppPlugin.getImageDescriptor("icons/cubridmanager16.gif"), CubridManagerAppPlugin.getImageDescriptor("icons/about.gif"));
    newFeatureAction = new NewFeaturesAction(com.cubrid.common.ui.common.Messages.msgNewFeatures);
    reportBugAction = (ReportBugAction) manager.getAction(ReportBugAction.ID);
    reportBugAction.setCurrentVersion(Version.buildVersionId);
}
Also used : ActionManager(com.cubrid.common.ui.spi.action.ActionManager) QuitAction(com.cubrid.cubridmanager.ui.common.action.QuitAction) NewFeaturesAction(com.cubrid.common.ui.common.action.NewFeaturesAction) AboutAction(com.cubrid.common.ui.common.action.AboutAction) CubridProjectSiteAction(com.cubrid.common.ui.common.action.CubridProjectSiteAction) CubridOnlineForumAction(com.cubrid.common.ui.common.action.CubridOnlineForumAction) OpenPreferenceAction(com.cubrid.common.ui.common.action.OpenPreferenceAction)

Aggregations

ActionManager (com.cubrid.common.ui.spi.action.ActionManager)19 ActionContributionItem (org.eclipse.jface.action.ActionContributionItem)7 IMenuManager (org.eclipse.jface.action.IMenuManager)7 MenuManager (org.eclipse.jface.action.MenuManager)7 Separator (org.eclipse.jface.action.Separator)7 IAction (org.eclipse.jface.action.IAction)6 SelectionEvent (org.eclipse.swt.events.SelectionEvent)5 DropDownAction (com.cubrid.common.ui.common.action.DropDownAction)3 IToolBarManager (org.eclipse.jface.action.IToolBarManager)3 Composite (org.eclipse.swt.widgets.Composite)3 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)3 GroupSettingAction (com.cubrid.common.ui.common.action.GroupSettingAction)2 OpenPreferenceAction (com.cubrid.common.ui.common.action.OpenPreferenceAction)2 RestoreQueryEditorAction (com.cubrid.common.ui.common.action.RestoreQueryEditorAction)2 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)2 QuitAction (com.cubrid.cubridmanager.ui.common.action.QuitAction)2 ControlContribution (org.eclipse.jface.action.ControlContribution)2 IContributionItem (org.eclipse.jface.action.IContributionItem)2 StatusLineManager (org.eclipse.jface.action.StatusLineManager)2 SelectionAdapter (org.eclipse.swt.events.SelectionAdapter)2