Search in sources :

Example 1 with DropDownAction

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

the class ApplicationActionBarAdvisor method fillCoolBar.

/**
	 * Fills the cool bar with the main toolbars for the window.
	 *
	 * @param coolBar the cool bar manager
	 */
protected void fillCoolBar(ICoolBarManager coolBarManager) {
    ActionManager manager = ActionManager.getInstance();
    coolBarManager.setLockLayout(true);
    IToolBarManager toolbarManager = new ToolBarManager(SWT.FLAT | SWT.WRAP | SWT.BOTTOM);
    coolBarManager.add(new ToolBarContributionItem(toolbarManager, IActionConstants.TOOL_NEW1));
    Bundle cqbBundle = Platform.getBundle(ApplicationUtil.CQB_PLUGIN_ID);
    /* Active the CQB plugin */
    if (cqbBundle != null) {
        try {
            cqbBundle.start();
        } catch (Exception e) {
            LOGGER.error(e.getMessage());
        }
    }
    Bundle cmBundle = Platform.getBundle(ApplicationUtil.CM_PLUGIN_ID);
    /* Active the CM plugin */
    if (cmBundle != null) {
        try {
            cmBundle.start();
        } catch (Exception e) {
            LOGGER.error(e.getMessage());
        }
    }
    // Change view actions
    if (cqbBundle != null) {
        DropDownAction viewAction = new DropDownAction(Messages.modeActionBig, IAction.AS_DROP_DOWN_MENU, CubridManagerAppPlugin.getImageDescriptor("icons/cubridmanager32.gif"));
        viewAction.setDisabledImageDescriptor(CubridManagerAppPlugin.getImageDescriptor("icons/cubridmanager32.gif"));
        MenuManager viewActionManager = viewAction.getMenuManager();
        viewActionManager.add(manager.getAction(OpenCMPerspectiveAction.ID));
        viewActionManager.add(manager.getAction(OpenCQBPerspectiveAction.ID));
        ActionContributionItem viewItems = new ActionContributionItem(viewAction);
        viewItems.setMode(ActionContributionItem.MODE_FORCE_TEXT);
        viewItems.setId(IPerspectiveConstance.PERSPECTIVE_ACTION_CONTRIBUTION_ID);
        toolbarManager.add(viewItems);
        toolbarManager.add(new Separator());
    }
    /*TOOLS-3988 There still is the install option after installing cmt plugin.*/
    Bundle bundle = Platform.getBundle(ApplicationUtil.CMT_PLUGIN_ID);
    if (bundle == null) {
        toolbarManager.add(new Separator());
        IAction action = ActionManager.getInstance().getAction(InstallMigrationToolkitAction.ID);
        if (action != null) {
            ActionContributionItem item = new ActionContributionItem(action);
            item.setMode(ActionContributionItem.MODE_FORCE_TEXT);
            toolbarManager.add(item);
            item.setId(IPerspectiveConstance.MIGRATION_ACTION_CONTRIBUTION_ID);
        }
    } else {
        /*Active the CMT plugin */
        try {
            bundle.start();
        } catch (Exception e) {
            LOGGER.error(e.getMessage());
        }
    }
    // Help
    toolbarManager.add(new Separator());
    DropDownAction helpDropAction = new DropDownAction(Messages.helpActionNameBig, IAction.AS_DROP_DOWN_MENU, CubridManagerUIPlugin.getImageDescriptor("icons/action/help_big.png"));
    helpDropAction.setDisabledImageDescriptor(CubridManagerUIPlugin.getImageDescriptor("icons/action/help_big.png"));
    MenuManager helpActionManager = helpDropAction.getMenuManager();
    helpActionManager.add(manager.getAction(HelpDocumentAction.ID));
    if ("ko".equals(Messages.language)) {
        helpActionManager.add(newFeatureAction);
    }
    helpActionManager.add(new Separator());
    helpActionManager.add(createItem(ReportBugAction.ID));
    helpActionManager.add(new Separator());
    helpActionManager.add(manager.getAction(ViewServerVersionAction.ID));
    helpActionManager.add(clientVersionAction);
    ActionContributionItem helpItems = new ActionContributionItem(helpDropAction);
    helpItems.setMode(ActionContributionItem.MODE_FORCE_TEXT);
    helpItems.setId(IPerspectiveConstance.HELP_ACTION_CONTRIBUTION_ID);
    toolbarManager.add(helpItems);
    ControlContribution searchContribution = new ControlContribution(SearchContributionComposite.class.getName()) {

        protected Control createControl(Composite parent) {
            return new SearchContributionComposite(parent, SWT.None);
        }
    };
    searchContribution.setId(IPerspectiveConstance.SEARCH_ACTION_CONTRIBUTION_ID);
    toolbarManager.add(new Separator());
    toolbarManager.add(searchContribution);
}
Also used : IAction(org.eclipse.jface.action.IAction) SearchContributionComposite(com.cubrid.common.ui.common.control.SearchContributionComposite) Composite(org.eclipse.swt.widgets.Composite) Bundle(org.osgi.framework.Bundle) ControlContribution(org.eclipse.jface.action.ControlContribution) IToolBarManager(org.eclipse.jface.action.IToolBarManager) ToolBarManager(org.eclipse.jface.action.ToolBarManager) ActionManager(com.cubrid.common.ui.spi.action.ActionManager) ToolBarContributionItem(org.eclipse.jface.action.ToolBarContributionItem) ActionContributionItem(org.eclipse.jface.action.ActionContributionItem) DropDownAction(com.cubrid.common.ui.common.action.DropDownAction) IToolBarManager(org.eclipse.jface.action.IToolBarManager) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) SearchContributionComposite(com.cubrid.common.ui.common.control.SearchContributionComposite) Separator(org.eclipse.jface.action.Separator)

Example 2 with DropDownAction

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

the class ActionAdvisor method showToolbar.

public void showToolbar(ICoolBarManager coolBarManager) {
    IToolBarManager newToolbarManager = getToolbarManaeger(coolBarManager);
    ActionManager manager = ActionManager.getInstance();
    String insertPoint = getToolbarInsertPoint(coolBarManager);
    newToolbarManager.insertBefore(insertPoint, createItem(NewQueryConnAction.ID));
    newToolbarManager.insertBefore(insertPoint, (createItem(QueryNewAction.ID)));
    newToolbarManager.insertBefore(insertPoint, (new Separator()));
    newToolbarManager.insertBefore(insertPoint, (createItem(RefreshAction.ID)));
    newToolbarManager.insertBefore(insertPoint, (new Separator()));
    newToolbarManager.insertBefore(insertPoint, (createItem(NewTableAction.ID)));
    newToolbarManager.insertBefore(insertPoint, (createItem(CreateViewAction.ID)));
    newToolbarManager.insertBefore(insertPoint, (new Separator()));
    newToolbarManager.insertBefore(insertPoint, (createItem(ImportWizardAction.ID)));
    newToolbarManager.insertBefore(insertPoint, (createItem(ExportWizardAction.ID)));
    newToolbarManager.insertBefore(insertPoint, (new Separator()));
    DropDownAction toolsDropAction = new DropDownAction(com.cubrid.common.ui.spi.Messages.toolsActionName, IAction.AS_DROP_DOWN_MENU, Activator.getImageDescriptor("icons/toolbar/qb_tools_on.png"));
    toolsDropAction.setDisabledImageDescriptor(Activator.getImageDescriptor("icons/toolbar/qb_tools_off.png"));
    MenuManager toolsActionManager = toolsDropAction.getMenuManager();
    toolsActionManager.add(manager.getAction(SchemaCompareWizardAction.ID));
    toolsActionManager.add(manager.getAction(DataCompareWizardAction.ID));
    toolsActionManager.add(new Separator());
    toolsActionManager.add(manager.getAction(OpenSchemaEditorAction.ID));
    toolsActionManager.add(new Separator());
    toolsActionManager.add(manager.getAction(ExportERwinAction.ID));
    toolsActionManager.add(manager.getAction(ImportERwinAction.ID));
    toolsActionManager.add(new Separator());
    toolsActionManager.add(manager.getAction(QueryTunerAction.ID));
    ActionContributionItem toolsItem = new ActionContributionItem(toolsDropAction);
    toolsItem.setMode(ActionContributionItem.MODE_FORCE_TEXT);
    newToolbarManager.insertBefore(insertPoint, toolsItem);
    newToolbarManager.insertBefore(insertPoint, new Separator());
    newToolbarManager.update(true);
    coolBarManager.update(true);
}
Also used : ActionManager(com.cubrid.common.ui.spi.action.ActionManager) ActionContributionItem(org.eclipse.jface.action.ActionContributionItem) DropDownAction(com.cubrid.common.ui.common.action.DropDownAction) IToolBarManager(org.eclipse.jface.action.IToolBarManager) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) Separator(org.eclipse.jface.action.Separator)

Example 3 with DropDownAction

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

the class ActionAdvisor method showToolbar.

public void showToolbar(ICoolBarManager coolBarManager) {
    IToolBarManager newToolbarManager = getToolbarManaeger(coolBarManager);
    ActionManager manager = ActionManager.getInstance();
    String insertPoint = getToolbarInsertPoint(coolBarManager);
    // Add host action
    newToolbarManager.insertBefore(insertPoint, createItem(AddHostAction.ID_BIG));
    newToolbarManager.insertBefore(insertPoint, new Separator());
    // Start action
    newToolbarManager.insertBefore(insertPoint, createItem(StartRetargetAction.ID_BIG));
    newToolbarManager.insertBefore(insertPoint, new Separator());
    // Open queryEditor
    newToolbarManager.insertBefore(insertPoint, createItem(DatabaseQueryNewAction.ID_BIG));
    // Schema actions
    newToolbarManager.insertBefore(insertPoint, new Separator());
    DropDownAction schemaDropAction = new DropDownAction(Messages.schemaActionNameBig, IAction.AS_DROP_DOWN_MENU, Activator.getImageDescriptor("icons/toolbar/schema_big.png"));
    schemaDropAction.setDisabledImageDescriptor(Activator.getImageDescriptor("icons/toolbar/schema_big.png"));
    MenuManager schemaActionManager = schemaDropAction.getMenuManager();
    schemaActionManager.add(manager.getAction(NewTableAction.ID));
    schemaActionManager.add(manager.getAction(CreateViewAction.ID));
    schemaActionManager.add(manager.getAction(CreateSerialAction.ID));
    schemaActionManager.add(manager.getAction(NewTriggerAction.ID));
    ActionContributionItem schemaItems = new ActionContributionItem(schemaDropAction);
    schemaItems.setMode(ActionContributionItem.MODE_FORCE_TEXT);
    newToolbarManager.insertBefore(insertPoint, schemaItems);
    newToolbarManager.insertBefore(insertPoint, new Separator());
    // Import and export
    DropDownAction dataDropAction = new DropDownAction(Messages.dataActionNameBig, IAction.AS_DROP_DOWN_MENU, Activator.getImageDescriptor("icons/toolbar/data_big.png"));
    dataDropAction.setDisabledImageDescriptor(Activator.getImageDescriptor("icons/toolbar/data_big.png"));
    MenuManager dataActionManager = dataDropAction.getMenuManager();
    dataActionManager.add(manager.getAction(ExportWizardAction.ID));
    dataActionManager.add(manager.getAction(ImportWizardAction.ID));
    ActionContributionItem dataItems = new ActionContributionItem(dataDropAction);
    dataItems.setMode(ActionContributionItem.MODE_FORCE_TEXT);
    newToolbarManager.insertBefore(insertPoint, dataItems);
    newToolbarManager.insertBefore(insertPoint, new Separator());
    DropDownAction toolsDropAction = new DropDownAction(com.cubrid.common.ui.spi.Messages.toolsActionName, IAction.AS_DROP_DOWN_MENU, Activator.getImageDescriptor("icons/toolbar/qb_tools_on.png"));
    toolsDropAction.setDisabledImageDescriptor(Activator.getImageDescriptor("icons/toolbar/qb_tools_off.png"));
    MenuManager toolsActionManager = toolsDropAction.getMenuManager();
    toolsActionManager.add(ActionManager.getInstance().getAction(SchemaCompareWizardAction.ID));
    toolsActionManager.add(ActionManager.getInstance().getAction(DataCompareWizardAction.ID));
    toolsActionManager.add(new Separator());
    toolsActionManager.add(manager.getAction(OpenSchemaEditorAction.ID));
    toolsActionManager.add(new Separator());
    toolsActionManager.add(ActionManager.getInstance().getAction(ExportERwinAction.ID));
    toolsActionManager.add(ActionManager.getInstance().getAction(ImportERwinAction.ID));
    toolsActionManager.add(new Separator());
    // toolsActionManager.add(ActionManager.getInstance().getAction(RunSQLFileAction.ID));
    toolsActionManager.add(ActionManager.getInstance().getAction(UnifyHostConfigAction.ID));
    toolsActionManager.add(ActionManager.getInstance().getAction(QueryTunerAction.ID));
    toolsActionManager.add(new Separator());
    //		toolsActionManager.add(ActionManager.getInstance().getAction(
    //				LaunchBrowserAction.ID));
    // Action for CM service analysis
    // toolsActionManager.add(ActionManager.getInstance().getAction(CMServiceAnalysisAction.ID));
    ActionContributionItem toolsItem = new ActionContributionItem(toolsDropAction);
    toolsItem.setMode(ActionContributionItem.MODE_FORCE_TEXT);
    newToolbarManager.insertBefore(insertPoint, toolsItem);
    newToolbarManager.insertBefore(insertPoint, new Separator());
    // User Management
    DropDownAction usersDropAction = new DropDownAction(Messages.userActionNameBig, IAction.AS_DROP_DOWN_MENU, Activator.getImageDescriptor("icons/toolbar/user_big.png"));
    usersDropAction.setDisabledImageDescriptor(Activator.getImageDescriptor("icons/toolbar/user_big.png"));
    MenuManager userActionManager = usersDropAction.getMenuManager();
    userActionManager.add(manager.getAction(UserManagementAction.ID));
    userActionManager.add(manager.getAction(ChangeManagerPasswordAction.ID));
    userActionManager.add(new Separator());
    userActionManager.add(manager.getAction(AddUserAction.ID));
    userActionManager.add(manager.getAction(EditUserAction.ID));
    userActionManager.add(manager.getAction(DeleteUserAction.ID));
    ActionContributionItem usersItems = new ActionContributionItem(usersDropAction);
    usersItems.setMode(ActionContributionItem.MODE_FORCE_TEXT);
    newToolbarManager.insertBefore(insertPoint, usersItems);
    // Management actions
    DropDownAction manageAction = new DropDownAction(Messages.manageActionNameBig, IAction.AS_DROP_DOWN_MENU, Activator.getImageDescriptor("icons/toolbar/db_management_big.png"));
    manageAction.setDisabledImageDescriptor(Activator.getImageDescriptor("icons/toolbar/db_management_big.png"));
    MenuManager manageActionManager = manageAction.getMenuManager();
    manageActionManager.add(manager.getAction(UnloadDatabaseAction.ID));
    manageActionManager.add(manager.getAction(LoadDatabaseAction.ID));
    manageActionManager.add(manager.getAction(BackupDatabaseAction.ID));
    manageActionManager.add(manager.getAction(RestoreDatabaseAction.ID));
    manageActionManager.add(manager.getAction(OptimizeAction.ID));
    manageActionManager.add(manager.getAction(CheckDatabaseAction.ID));
    manageActionManager.add(new Separator());
    manageActionManager.add(manager.getAction(TransactionInfoAction.ID));
    manageActionManager.add(manager.getAction(LockInfoAction.ID));
    ActionContributionItem manageItems = new ActionContributionItem(manageAction);
    manageItems.setMode(ActionContributionItem.MODE_FORCE_TEXT);
    newToolbarManager.insertBefore(insertPoint, manageItems);
    newToolbarManager.insertBefore(insertPoint, new Separator());
    newToolbarManager.update(true);
    coolBarManager.update(true);
}
Also used : ActionManager(com.cubrid.common.ui.spi.action.ActionManager) ActionContributionItem(org.eclipse.jface.action.ActionContributionItem) DropDownAction(com.cubrid.common.ui.common.action.DropDownAction) IToolBarManager(org.eclipse.jface.action.IToolBarManager) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) Separator(org.eclipse.jface.action.Separator)

Aggregations

DropDownAction (com.cubrid.common.ui.common.action.DropDownAction)3 ActionManager (com.cubrid.common.ui.spi.action.ActionManager)3 ActionContributionItem (org.eclipse.jface.action.ActionContributionItem)3 IMenuManager (org.eclipse.jface.action.IMenuManager)3 IToolBarManager (org.eclipse.jface.action.IToolBarManager)3 MenuManager (org.eclipse.jface.action.MenuManager)3 Separator (org.eclipse.jface.action.Separator)3 SearchContributionComposite (com.cubrid.common.ui.common.control.SearchContributionComposite)1 ControlContribution (org.eclipse.jface.action.ControlContribution)1 IAction (org.eclipse.jface.action.IAction)1 ToolBarContributionItem (org.eclipse.jface.action.ToolBarContributionItem)1 ToolBarManager (org.eclipse.jface.action.ToolBarManager)1 Composite (org.eclipse.swt.widgets.Composite)1 Bundle (org.osgi.framework.Bundle)1