Search in sources :

Example 1 with ActionContributionItem

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

the class ApplicationActionBarAdvisor method createItem.

/**
	 * Create action contribution item for action for show text and icon
	 *
	 * @param id action ID
	 * @return ActionContributionItem
	 */
private ActionContributionItem createItem(String id) {
    ActionManager manager = ActionManager.getInstance();
    IAction action = manager.getAction(id);
    if (action == null) {
        return null;
    }
    ActionContributionItem item = new ActionContributionItem(action);
    item.setMode(ActionContributionItem.MODE_FORCE_TEXT);
    return item;
}
Also used : ActionManager(com.cubrid.common.ui.spi.action.ActionManager) ActionContributionItem(org.eclipse.jface.action.ActionContributionItem) IAction(org.eclipse.jface.action.IAction)

Example 2 with ActionContributionItem

use of org.eclipse.jface.action.ActionContributionItem 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 3 with ActionContributionItem

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

the class ActionAdvisor method createItem.

/**
	 *
	 * Create action contribution item for action for show text and icon
	 *
	 * @param id
	 *            action ID
	 * @return ActionContributionItem
	 */
private ActionContributionItem createItem(String id) {
    IAction action = ActionManager.getInstance().getAction(id + ProxyAction.POSTFIX_ID);
    if (action == null) {
        return null;
    }
    ActionContributionItem item = new ActionContributionItem(action);
    item.setMode(ActionContributionItem.MODE_FORCE_TEXT);
    return item;
}
Also used : ActionContributionItem(org.eclipse.jface.action.ActionContributionItem) IAction(org.eclipse.jface.action.IAction)

Example 4 with ActionContributionItem

use of org.eclipse.jface.action.ActionContributionItem 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 5 with ActionContributionItem

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

the class ActionAdvisor method createItem.

/**
	 *
	 * Create action contribution item for action for show text and icon
	 *
	 * @param id
	 *            action ID
	 * @return ActionContributionItem
	 */
private ActionContributionItem createItem(String id) {
    IAction action = ActionManager.getInstance().getAction(id);
    if (action == null) {
        return null;
    }
    ActionContributionItem item = new ActionContributionItem(action);
    item.setMode(ActionContributionItem.MODE_FORCE_TEXT);
    return item;
}
Also used : ActionContributionItem(org.eclipse.jface.action.ActionContributionItem) IAction(org.eclipse.jface.action.IAction)

Aggregations

ActionContributionItem (org.eclipse.jface.action.ActionContributionItem)17 IAction (org.eclipse.jface.action.IAction)8 ActionManager (com.cubrid.common.ui.spi.action.ActionManager)7 IMenuManager (org.eclipse.jface.action.IMenuManager)7 MenuManager (org.eclipse.jface.action.MenuManager)7 Separator (org.eclipse.jface.action.Separator)6 IToolBarManager (org.eclipse.jface.action.IToolBarManager)4 DropDownAction (com.cubrid.common.ui.common.action.DropDownAction)3 IContributionItem (org.eclipse.jface.action.IContributionItem)3 Action (org.eclipse.jface.action.Action)2 GroupMarker (org.eclipse.jface.action.GroupMarker)2 Composite (org.eclipse.swt.widgets.Composite)2 Workspace (aQute.bnd.build.Workspace)1 MDSashForm (bndtools.editor.common.MDSashForm)1 AvailableBundlesPart (bndtools.editor.project.AvailableBundlesPart)1 RepositorySelectionPart (bndtools.editor.project.RepositorySelectionPart)1 RunBlacklistPart (bndtools.editor.project.RunBlacklistPart)1 RunBundlesPart (bndtools.editor.project.RunBundlesPart)1 RunFrameworkPart (bndtools.editor.project.RunFrameworkPart)1 RunPropertiesPart (bndtools.editor.project.RunPropertiesPart)1