Search in sources :

Example 11 with CommandContributionItemParameter

use of org.eclipse.ui.menus.CommandContributionItemParameter in project translationstudio8 by heartsome.

the class BodyMenuConfiguration method createMenu.

/**
	 * 编辑界面右键菜单
	 * @param menu
	 *            ;
	 */
private void createMenu() {
    MenuManager menuMgr = new MenuManager();
    bodyMenu = menuMgr.createContextMenu(table.getShell());
    if (!CommonFunction.checkEdition("L")) {
        menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, "net.heartsome.cat.database.ui.tm.command.ConcordanceSearch", Collections.EMPTY_MAP, Activator.getImageDescriptor(ImageConstant.TU_STATE_SEARCHTM), null, null, Messages.getString("menu.BodyMenuConfiguration.searchTM"), null, null, CommandContributionItem.STYLE_PUSH, null, false)));
        menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, "net.heartsome.cat.database.ui.tb.command.TermBaseSearch", Collections.EMPTY_MAP, Activator.getImageDescriptor(ImageConstant.TU_STATE_SEARCHTB), null, null, Messages.getString("menu.BodyMenuConfiguration.searchTermItem"), null, null, CommandContributionItem.STYLE_PUSH, null, false)));
        menuMgr.add(new Separator());
    }
    // add by yule -webSearch
    menuMgr.add(new Separator());
    menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, "net.heartsome.cat.ts.websearch.search", Collections.EMPTY_MAP, Activator.getImageDescriptor(ImageConstant.WEB_SEARCH), null, null, Messages.getString("menu.BodyMenuConfiguration.webSearch"), null, null, CommandContributionItem.STYLE_PUSH, null, false)));
    menuMgr.add(new Separator());
    menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, ActionFactory.CUT.getCommandId(), Collections.EMPTY_MAP, null, null, null, Messages.getString("menu.BodyMenuConfiguration.cut"), null, null, CommandContributionItem.STYLE_PUSH, null, false)));
    menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, ActionFactory.COPY.getCommandId(), Collections.EMPTY_MAP, null, null, null, Messages.getString("menu.BodyMenuConfiguration.copy"), null, null, CommandContributionItem.STYLE_PUSH, null, false)));
    menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, ActionFactory.PASTE.getCommandId(), Collections.EMPTY_MAP, null, null, null, Messages.getString("menu.BodyMenuConfiguration.paste"), null, null, CommandContributionItem.STYLE_PUSH, null, false)));
    menuMgr.add(new Separator());
    // 此处显示出来不做任何事情,是因为用户可以通过右键看到当前状态列中显示的图标是什么含义
    // 在状态列中,是无法知道某一图标的具体含义的
    menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, "net.heartsome.cat.ts.ui.xliffeditor.nattable.command.untranslated", Collections.EMPTY_MAP, Activator.getImageDescriptor("images/state/not-translated.png"), null, null, Messages.getString("menu.BodyMenuConfiguration.emptyTranslationItem"), null, null, CommandContributionItem.STYLE_PUSH, null, false)));
    menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, "net.heartsome.cat.ts.ui.xliffeditor.nattable.command.draft", Collections.EMPTY_MAP, Activator.getImageDescriptor("images/state/draft.png"), null, null, Messages.getString("menu.BodyMenuConfiguration.draftItem"), null, null, CommandContributionItem.STYLE_PUSH, null, false)));
    Map<String, String> mapParameter = new HashMap<String, String>();
    mapParameter.put("addSegmentToTM", "addToTM");
    menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, "net.heartsome.cat.ts.ui.xliffeditor.menu.translation.command.completeTranslation", mapParameter, Activator.getImageDescriptor("images/state/translated.png"), null, null, Messages.getString("menu.BodyMenuConfiguration.translatedItem"), null, null, CommandContributionItem.STYLE_PUSH, null, false)));
    mapParameter = new HashMap<String, String>();
    mapParameter.put("approveSegment", "approveSelectSegment");
    menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, "net.heartsome.cat.ts.ui.xliffeditor.nattable.command.ApproveSelectSegment", mapParameter, Activator.getImageDescriptor("images/state/approved.png"), null, null, Messages.getString("menu.BodyMenuConfiguration.approveItem"), null, null, CommandContributionItem.STYLE_PUSH, null, false)));
    menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, "net.heartsome.cat.ts.ui.xliffeditor.nattable.command.signedOff", Collections.EMPTY_MAP, Activator.getImageDescriptor("images/state/sign-off.png"), null, null, Messages.getString("menu.BodyMenuConfiguration.signItem"), null, null, CommandContributionItem.STYLE_PUSH, null, false)));
    menuMgr.add(new Separator());
    menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, "net.heartsome.cat.ts.ui.xliffeditor.menu.translation.lockSegment.command.lockSegment", Collections.EMPTY_MAP, Activator.getImageDescriptor("images/state/locked.png"), null, null, Messages.getString("menu.BodyMenuConfiguration.isLockItem"), null, null, CommandContributionItem.STYLE_PUSH, null, false)));
    menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, "net.heartsome.cat.ts.ui.xliffeditor.nattable.command.needReview", Collections.EMPTY_MAP, Activator.getImageDescriptor("images/state/questioning.png"), null, null, Messages.getString("menu.BodyMenuConfiguration.problemItem"), null, null, CommandContributionItem.STYLE_PUSH, null, false)));
    menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, "net.heartsome.cat.ts.ui.xliffeditor.nattable.command.notSendToTM", Collections.EMPTY_MAP, Activator.getImageDescriptor("images/state/not-sent-db.png"), null, null, Messages.getString("menu.BodyMenuConfiguration.disAddToTMItem"), null, null, CommandContributionItem.STYLE_PUSH, null, false)));
    menuMgr.add(new Separator());
    menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, "net.heartsome.cat.ts.ui.xliffeditor.nattable.command.AddNote", Collections.EMPTY_MAP, Activator.getImageDescriptor(ImageConstant.TU_STATE_ADDNOTE), null, null, Messages.getString("menu.BodyMenuConfiguration.addNoteItem"), null, null, CommandContributionItem.STYLE_PUSH, null, false)));
    menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, "net.heartsome.cat.ts.ui.xliffeditor.nattable.command.EditNote", Collections.EMPTY_MAP, Activator.getImageDescriptor(ImageConstant.TU_STATE_EDITNOTE), null, null, Messages.getString("menu.BodyMenuConfiguration.editNoteItem"), null, null, CommandContributionItem.STYLE_PUSH, null, false)));
    menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, "net.heartsome.cat.ts.ui.xliffeditor.menu.translateContent.command.deleteCurrentSegmentNotes", Collections.EMPTY_MAP, Activator.getImageDescriptor(ImageConstant.TU_STATE_DELETENOTE), null, null, Messages.getString("menu.BodyMenuConfiguration.deleteNoteItem"), null, null, CommandContributionItem.STYLE_PUSH, null, false)));
    menuMgr.add(new Separator());
    menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, "net.heartsome.cat.ts.ui.xliffeditor.menu.translateContent.command.deleteCurrentSegmentTranslations", Collections.EMPTY_MAP, Activator.getImageDescriptor(ImageConstant.TU_STATE_DELETETRANS), null, null, Messages.getString("menu.BodyMenuConfiguration.deleteTransItem"), null, null, CommandContributionItem.STYLE_PUSH, null, false)));
    if (CommonFunction.checkEdition("F") || CommonFunction.checkEdition("U")) {
        menuMgr.add(new Separator());
        menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, "net.heartsome.cat.ts.handlexlf.commands.setSplitPointByWordNumCommand", Collections.EMPTY_MAP, null, null, null, Messages.getString("menu.BodyMenuConfiguration.setSplitPointByWordNum"), null, null, CommandContributionItem.STYLE_PUSH, null, false)));
        menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, "net.heartsome.cat.ts.handlexlf.commands.nextSplitPointCommand", Collections.EMPTY_MAP, null, null, null, Messages.getString("menu.BodyMenuConfiguration.nextSplitPoint"), null, null, CommandContributionItem.STYLE_PUSH, null, false)));
        menuMgr.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(), null, "net.heartsome.cat.ts.ui.xliffeditor.nattable.command.splitXLIFFPoint", Collections.EMPTY_MAP, Activator.getImageDescriptor("images/state/cut-point.png"), null, null, Messages.getString("menu.BodyMenuConfiguration.splitPointItem"), null, null, CommandContributionItem.STYLE_PUSH, null, false)));
    }
}
Also used : HashMap(java.util.HashMap) CommandContributionItemParameter(org.eclipse.ui.menus.CommandContributionItemParameter) MenuManager(org.eclipse.jface.action.MenuManager) CommandContributionItem(org.eclipse.ui.menus.CommandContributionItem) Separator(org.eclipse.jface.action.Separator)

Example 12 with CommandContributionItemParameter

use of org.eclipse.ui.menus.CommandContributionItemParameter in project vorto by eclipse.

the class PopulateGeneratorsMenu method constructCommandForGenerator.

@SuppressWarnings("unchecked")
private CommandContributionItem constructCommandForGenerator(ExtensionMetaData extensionMetaData) {
    String extensionIdentifier = extensionMetaData.getExtensionIdentifier();
    if (StringUtils.isNotEmpty(extensionIdentifier)) {
        CommandContributionItemParameter generatorCommand = new CommandContributionItemParameter(PlatformUI.getWorkbench().getActiveWorkbenchWindow(), "org.eclipse.vorto.codegen.dynamic.menu.contribution.item.id", "org.eclipse.vorto.codegen.generator.command.id", SWT.NONE);
        CommandContributionItem generatorContributionItem;
        generatorCommand.label = extensionMetaData.getMenuLabel();
        String iconPath = extensionMetaData.getIconPath();
        Bundle bundle = Platform.getBundle(extensionMetaData.getGeneratorPluginId());
        if (iconPath == null) {
            // Load the defaults
            iconPath = "icons/generate.gif";
            bundle = Platform.getBundle(Activator.PLUGIN_ID);
        }
        IPath path = new Path(iconPath);
        generatorCommand.icon = ImageDescriptor.createFromURL(FileLocator.find(bundle, path, null));
        generatorCommand.parameters = new HashMap<String, String>();
        generatorCommand.parameters.put("org.eclipse.vorto.codegen.generator.commandParameter", extensionIdentifier);
        generatorContributionItem = new CommandContributionItem(generatorCommand);
        return generatorContributionItem;
    }
    return null;
}
Also used : IPath(org.eclipse.core.runtime.IPath) Path(org.eclipse.core.runtime.Path) IPath(org.eclipse.core.runtime.IPath) Bundle(org.osgi.framework.Bundle) CommandContributionItemParameter(org.eclipse.ui.menus.CommandContributionItemParameter) CommandContributionItem(org.eclipse.ui.menus.CommandContributionItem)

Example 13 with CommandContributionItemParameter

use of org.eclipse.ui.menus.CommandContributionItemParameter in project liferay-ide by liferay.

the class LaunchWorkspaceMenu method _newLaunchWorkspaceCommand.

@SuppressWarnings("unchecked")
private IContributionItem _newLaunchWorkspaceCommand(IServiceLocator serviceLocator, String label, String workspaceLocation) {
    CommandContributionItemParameter parameter = new CommandContributionItemParameter(serviceLocator, "", LaunchWorkspaceHandler.COMMAND_ID, CommandContributionItem.STYLE_PUSH);
    if (workspaceLocation != null) {
        parameter.parameters = new HashMap<>();
        parameter.parameters.put(LaunchWorkspaceHandler.PARAM_WORKSPACE_LOCATION, workspaceLocation);
    }
    parameter.label = label;
    CommandContributionItem launchWorkspaceCommand = new CommandContributionItem(parameter);
    launchWorkspaceCommand.setVisible(true);
    return launchWorkspaceCommand;
}
Also used : CommandContributionItemParameter(org.eclipse.ui.menus.CommandContributionItemParameter) CommandContributionItem(org.eclipse.ui.menus.CommandContributionItem)

Example 14 with CommandContributionItemParameter

use of org.eclipse.ui.menus.CommandContributionItemParameter in project core by jcryptool.

the class AlgorithmView method createContributionItem.

private CommandContributionItem createContributionItem(final String commandId, final ImageDescriptor icon, final String tooltip) {
    CommandContributionItemParameter param = new CommandContributionItemParameter(serviceLocator, null, commandId, SWT.PUSH);
    if (icon != null)
        param.icon = icon;
    if (tooltip != null && !tooltip.equals(""))
        param.tooltip = tooltip;
    CommandContributionItem item = new CommandContributionItem(param);
    return (item);
}
Also used : CommandContributionItemParameter(org.eclipse.ui.menus.CommandContributionItemParameter) CommandContributionItem(org.eclipse.ui.menus.CommandContributionItem)

Example 15 with CommandContributionItemParameter

use of org.eclipse.ui.menus.CommandContributionItemParameter in project core by jcryptool.

the class KeystoreView method addContributionItem.

private void addContributionItem(IContributionManager manager, final String commandId, final ImageDescriptor icon, final String tooltip) {
    CommandContributionItemParameter param = new CommandContributionItemParameter(serviceLocator, null, commandId, SWT.PUSH);
    if (icon != null)
        param.icon = icon;
    if (tooltip != null && !tooltip.equals(""))
        param.tooltip = tooltip;
    CommandContributionItem item = new CommandContributionItem(param);
    manager.add(item);
}
Also used : CommandContributionItemParameter(org.eclipse.ui.menus.CommandContributionItemParameter) CommandContributionItem(org.eclipse.ui.menus.CommandContributionItem)

Aggregations

CommandContributionItemParameter (org.eclipse.ui.menus.CommandContributionItemParameter)31 CommandContributionItem (org.eclipse.ui.menus.CommandContributionItem)30 HashMap (java.util.HashMap)9 IContributionItem (org.eclipse.jface.action.IContributionItem)4 ResultSetPanelDescriptor (org.jkiss.dbeaver.ui.controls.resultset.panel.ResultSetPanelDescriptor)4 DataTransferNodeDescriptor (org.jkiss.dbeaver.tools.transfer.registry.DataTransferNodeDescriptor)3 DataTransferProcessorDescriptor (org.jkiss.dbeaver.tools.transfer.registry.DataTransferProcessorDescriptor)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)2 DecimalFormat (java.text.DecimalFormat)2 java.util (java.util)2 List (java.util.List)2 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)2 IAdaptable (org.eclipse.core.runtime.IAdaptable)2 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)2 IStatus (org.eclipse.core.runtime.IStatus)2 Status (org.eclipse.core.runtime.Status)2 org.eclipse.jface.action (org.eclipse.jface.action)2 IDialogConstants (org.eclipse.jface.dialogs.IDialogConstants)2 IDialogSettings (org.eclipse.jface.dialogs.IDialogSettings)2 IFindReplaceTarget (org.eclipse.jface.text.IFindReplaceTarget)2