use of org.eclipse.ui.menus.CommandContributionItem in project erlide_eclipse by erlang.
the class UserRefacContribution method getContributionItems.
@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
protected IContributionItem[] getContributionItems() {
final List<UserRefactoringInfo> refacs = UserRefactoringsManager.getInstance().getElementary();
final IContributionItem[] items = new IContributionItem[refacs.size()];
int i = 0;
for (final UserRefactoringInfo info : refacs) {
final CommandContributionItemParameter param = new CommandContributionItemParameter(PlatformUI.getWorkbench(), info.getCallback(), "org.erlide.wrangler.refactoring.gen_refac", CommandContributionItem.STYLE_PUSH);
param.label = info.getLabel();
param.parameters = new HashMap();
param.parameters.put("org.erlide.wrangler.refactoring.gen_refac.callback", info.getCallback());
param.parameters.put("org.erlide.wrangler.refactoring.gen_refac.name", info.getLabel());
items[i] = new CommandContributionItem(param);
i++;
}
return items;
}
use of org.eclipse.ui.menus.CommandContributionItem 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;
}
use of org.eclipse.ui.menus.CommandContributionItem in project liferay-ide by liferay.
the class LaunchWorkspaceMenu method createContributionItems.
@Override
public void createContributionItems(IServiceLocator serviceLocator, IContributionRoot additions) {
MenuManager menu = new MenuManager("Launch Workspace");
IContributionItem[] workspaceHistoryItems = _buildWorkspaceHistory(serviceLocator);
for (IContributionItem workspaceHistoryItem : workspaceHistoryItems) {
if (workspaceHistoryItem instanceof CommandContributionItem) {
CommandContributionItem commandItem = (CommandContributionItem) workspaceHistoryItem;
if ("Other...".equals(commandItem.getData().label)) {
menu.add(new Separator());
}
}
menu.add(workspaceHistoryItem);
}
additions.addContributionItem(menu, null);
}
use of org.eclipse.ui.menus.CommandContributionItem 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;
}
use of org.eclipse.ui.menus.CommandContributionItem 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);
}
Aggregations