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);
// 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);
}
use of org.eclipse.jface.action.ActionContributionItem in project sling by apache.
the class ServersActionModeFiddlerActionDelegate method init.
@Override
public void init(IViewPart view) {
this.view = view;
actionBars = view.getViewSite().getActionBars();
initToolbarContributedActions();
for (ActionContributionItem actionContributionItem : prependedToolbarActions) {
// TODO - this looks wrong
IAction action = (IAction) actionContributionItem;
final ActionContributionItem contribution = new ActionContributionItem(action);
actionBars.getToolBarManager().add(contribution);
}
}
use of org.eclipse.jface.action.ActionContributionItem in project bndtools by bndtools.
the class OpenExtConfigsContributionItem method getContributionItems.
@Override
protected IContributionItem[] getContributionItems() {
try {
IFile buildFile = Central.getWorkspaceBuildFile();
if (buildFile == null)
return EMPTY;
IContainer cnfDir = buildFile.getParent();
IFolder extDir = cnfDir.getFolder(new Path("ext"));
if (extDir == null || !extDir.exists())
return EMPTY;
IResource[] extFiles = extDir.members();
List<IContributionItem> result = new ArrayList<IContributionItem>(extFiles.length);
for (final IResource extFile : extFiles) {
if (extFile.getType() == IResource.FILE && "bnd".equalsIgnoreCase(extFile.getFileExtension())) {
Action action = new Action() {
@Override
public void run() {
try {
FileEditorInput input = new FileEditorInput((IFile) extFile);
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
page.openEditor(input, "bndtools.bndWorkspaceConfigEditor", true);
} catch (PartInitException e) {
ErrorDialog.openError(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Error", "Unable to open editor", e.getStatus());
}
}
};
action.setText("Open " + extFile.getProjectRelativePath());
action.setImageDescriptor(extFileImg);
result.add(new ActionContributionItem(action));
}
}
return result.toArray(new IContributionItem[0]);
} catch (Exception e) {
logger.logError("Unable to find default config files", e);
return EMPTY;
}
}
use of org.eclipse.jface.action.ActionContributionItem in project translationstudio8 by heartsome.
the class ApplicationActionBarAdvisor method fillCoolBar.
@Override
protected void fillCoolBar(ICoolBarManager coolBar) {
// Set up the context Menu
coolbarPopupMenuManager = new MenuManager();
coolbarPopupMenuManager.add(new ActionContributionItem(lockToolBarAction));
coolBar.setContextMenuManager(coolbarPopupMenuManager);
IMenuService menuService = (IMenuService) window.getService(IMenuService.class);
menuService.populateContributionManager(coolbarPopupMenuManager, "popup:windowCoolbarContextMenu");
coolBar.add(new GroupMarker("group.file"));
// File Group
// IToolBarManager fileToolBar = new ToolBarManager(coolBar.getStyle());
// fileToolBar.add(new Separator(IWorkbenchActionConstants.NEW_GROUP));
// fileToolBar.add(new GroupMarker(IWorkbenchActionConstants.OPEN_EXT));
// fileToolBar.add(new GroupMarker(IWorkbenchActionConstants.SAVE_GROUP));
// // 为了使工具栏和菜单中的图片大小不一样,重新创建新建 Action
// newAction = ActionFactory.NEW_WIZARD_DROP_DOWN.create(window);
// register(newAction);
// ImageDescriptor newImage =
// net.heartsome.cat.ts.ui.Activator.getImageDescriptor(ImageConstant.TOOL_NEW_PROJECT);
// newAction.setImageDescriptor(newImage);
// // 解决在 Windows 下图片显示错误的问题
// newAction.setDisabledImageDescriptor(newImage);
// newAction.setToolTipText(Messages.getString("ts.ApplicationActionBarAdvisor.newAction"));
// fileToolBar.add(newAction);
// saveAction = ActionFactory.SAVE.create(window);
// register(saveAction);
// saveAction.setImageDescriptor(net.heartsome.cat.ts.ui.Activator.getImageDescriptor(ImageConstant.TOOL_SAVE));
// saveAction.setToolTipText("保存");
// fileToolBar.add(saveAction);
// undoAction = ActionFactory.UNDO.create(window);
// register(undoAction);
// undoAction.setImageDescriptor(net.heartsome.cat.ts.ui.Activator.getImageDescriptor(ImageConstant.TOOL_UNDO));
// undoAction.setToolTipText("撤销");
// fileToolBar.add(undoAction);
//
// redoAction = ActionFactory.REDO.create(window);
// register(redoAction);
// redoAction.setImageDescriptor(net.heartsome.cat.ts.ui.Activator.getImageDescriptor(ImageConstant.TOOL_REDO));
// redoAction.setToolTipText("重做");
// fileToolBar.add(redoAction);
// fileToolBar.add(new GroupMarker(IWorkbenchActionConstants.SAVE_EXT));
// fileToolBar.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
// Add to the cool bar manager
// coolBar.add(new ToolBarContributionItem(fileToolBar, IWorkbenchActionConstants.TOOLBAR_FILE));
coolBar.add(new GroupMarker("group.new.menu"));
coolBar.add(new GroupMarker("group.undoredo"));
coolBar.add(new GroupMarker("group.copySource"));
coolBar.add(new GroupMarker("group.search"));
//createToolItem(coolBar);
coolBar.add(new GroupMarker("group.findreplace"));
coolBar.add(new GroupMarker("group.completeTranslation"));
coolBar.add(new GroupMarker("group.approve"));
coolBar.add(new GroupMarker("group.addTerm"));
coolBar.add(new GroupMarker("group.preview"));
coolBar.add(new GroupMarker("group.tagoperation"));
coolBar.add(new GroupMarker("group.sourceoperation"));
coolBar.add(new GroupMarker("group.deleteTrans"));
coolBar.add(new GroupMarker("group.changeLayout"));
coolBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
coolBar.add(new GroupMarker(IWorkbenchActionConstants.GROUP_EDITOR));
coolBar.add(new GroupMarker(IWorkbenchActionConstants.GROUP_HELP));
// Help group
// IToolBarManager helpToolBar = new ToolBarManager(coolBar.getStyle());
// helpToolBar.add(new Separator(IWorkbenchActionConstants.GROUP_HELP));
// // 按照设计文档的要求,先注释 helpSearchAction
// // helpToolBar.add(helpSearchAction);
// // Add the group for applications to contribute
// helpToolBar.add(new GroupMarker("tagoperation"));
// helpToolBar.add(new GroupMarker("pretranslation"));
//
// // Add to the cool bar manager
// coolBar.add(new ToolBarContributionItem(helpToolBar, IWorkbenchActionConstants.TOOLBAR_HELP));
//coolBar.add(createToolItem(coolBar));
}
use of org.eclipse.jface.action.ActionContributionItem 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);
}
Aggregations