use of com.cubrid.common.ui.common.control.SearchContributionComposite 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);
}
Aggregations