本文整理汇总了Java中org.eclipse.ui.menus.IContributionRoot类的典型用法代码示例。如果您正苦于以下问题:Java IContributionRoot类的具体用法?Java IContributionRoot怎么用?Java IContributionRoot使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IContributionRoot类属于org.eclipse.ui.menus包,在下文中一共展示了IContributionRoot类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createContributionItems
import org.eclipse.ui.menus.IContributionRoot; //导入依赖的package包/类
@Override
public void createContributionItems(IServiceLocator serviceLocator, IContributionRoot additions) {
IMenuService menuService = (IMenuService) serviceLocator.getService(IMenuService.class);
if (menuService == null) {
CloudFoundryPlugin
.logError("Unable to retrieve Eclipse menu service. Cannot add Cloud Foundry context menus."); //$NON-NLS-1$
return;
}
List<IAction> debugActions = getActions(menuService);
for (IAction action : debugActions) {
additions.addContributionItem(new ActionContributionItem(action), new Expression() {
public EvaluationResult evaluate(IEvaluationContext context) {
return EvaluationResult.TRUE;
}
public void collectExpressionInfo(ExpressionInfo info) {
}
});
}
}
示例2: createContributionItems
import org.eclipse.ui.menus.IContributionRoot; //导入依赖的package包/类
@Override
public void createContributionItems(IServiceLocator serviceLocator, IContributionRoot additions) {
IMenuService menuService = (IMenuService) serviceLocator.getService(IMenuService.class);
if (menuService == null) {
DockerFoundryPlugin
.logError("Unable to retrieve Eclipse menu service. Cannot add Cloud Foundry context menus."); //$NON-NLS-1$
return;
}
List<IAction> debugActions = getActions(menuService);
for (IAction action : debugActions) {
additions.addContributionItem(new ActionContributionItem(action), new Expression() {
public EvaluationResult evaluate(IEvaluationContext context) {
return EvaluationResult.TRUE;
}
public void collectExpressionInfo(ExpressionInfo info) {
}
});
}
}
示例3: createContributionItems
import org.eclipse.ui.menus.IContributionRoot; //导入依赖的package包/类
@Override
public void createContributionItems(final IServiceLocator serviceLocator,
final IContributionRoot additions)
{ // See http://blog.vogella.com/2009/12/03/commands-menu-runtime
// for ExtensionContributionFactory example
try
{
final String setting = Preferences.getTopDisplays();
final List<DisplayInfo> displays = DisplayInfoXMLUtil.fromDisplaysXML(setting);
for (DisplayInfo display : displays)
{
final IAction action = new OpenDisplayAction(display);
final IContributionItem item = new ActionContributionItem(action);
additions.addContributionItem(item, null);
}
}
catch (Exception ex)
{
logger.log(Level.WARNING, "Cannot create 'top displays'", ex);
}
}
示例4: createContributionItems
import org.eclipse.ui.menus.IContributionRoot; //导入依赖的package包/类
@Override
public void createContributionItems(IServiceLocator serviceLocator, IContributionRoot additions) {
ITextEditor editor = (ITextEditor)
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();
IVerticalRulerInfo rulerInfo = editor.getAdapter(IVerticalRulerInfo.class);
try {
List<IMarker> markers = getMarkers(editor, rulerInfo);
additions.addContributionItem(new ReviewMarkerMenuContribution(editor, markers), null);
if (!markers.isEmpty()) {
additions.addContributionItem(new Separator(), null);
}
} catch (CoreException e) {
AppraiseUiPlugin.logError("Error creating marker context menus", e);
}
}
示例5: createContributionItems
import org.eclipse.ui.menus.IContributionRoot; //导入依赖的package包/类
@Override
public void createContributionItems(IServiceLocator serviceLocator,
IContributionRoot additions) {
CommandContributionItemParameter toggleWatchpointParam = new CommandContributionItemParameter(serviceLocator, null, "org.eclipse.debug.ui.commands.ToggleWatchpoint", CommandContributionItem.STYLE_PUSH);
toggleWatchpointParam.icon = DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_WATCHPOINT);
toggleWatchpointParam.disabledIcon = DebugUITools.getImageDescriptor(IDebugUIConstants.IMG_OBJS_WATCHPOINT_DISABLED);
toggleWatchpointParam.label = "Add Watchpoint";
CommandContributionItem toggleWatchpoint = new CommandContributionItem(toggleWatchpointParam);
Expression toggleWatchpointVisible = new Expression() {
@Override
public EvaluationResult evaluate(IEvaluationContext context)
throws CoreException {
return EvaluationResult.valueOf((context.getVariable("activeEditor") instanceof BfEditor));
}
};
additions.addContributionItem(toggleWatchpoint, toggleWatchpointVisible);
}
示例6: createContributionItems
import org.eclipse.ui.menus.IContributionRoot; //导入依赖的package包/类
@Override
public void createContributionItems(IServiceLocator serviceLocator, IContributionRoot additions) {
MenuDataList items = MenuDataStore.instance().getEnabledCommandMenuDataList();
for (MenuData item : items) {
ResourceType resTypeWanted = getWantedResourceType();
ResourceType resTypeSupported;
try {
resTypeSupported = item.getCommandData().getResourceType();
if ((resTypeSupported == ResourceType.resourceTypeFileOrDirectory)
|| (resTypeSupported == resTypeWanted)) {
addItem(serviceLocator, additions, item.getNameExpanded(),
"de.anbos.eclipse.easyshell.plugin.commands.execute",
Utils.getParameterMapFromMenuData(item), item.getImageId(),
true);
}
} catch (UnknownCommandID e) {
e.logInternalError();
}
}
}
示例7: createContributionItems
import org.eclipse.ui.menus.IContributionRoot; //导入依赖的package包/类
@Override
public void createContributionItems(IServiceLocator serviceLocator, IContributionRoot additions) {
for (PlanModifierFactory factory : PlanModifierRegistry.getInstance().getModifierFactories()) {
String name = factory.getName();
ImageDescriptor imageDescriptor = factory.getImageDescriptor();
String id = null;
String commandId = TEMPORAL_MODIFICATION_COMMAND_ID;
Map<?, ?> parameters = Collections.singletonMap("name", name);
ImageDescriptor icon = imageDescriptor;
String label = name;
String tooltip = name;
FactoryServiceLocator locator = new FactoryServiceLocator(serviceLocator, factory);
CommandContributionItemParameter parameter = new CommandContributionItemParameter(locator, id, commandId, parameters, icon, null, null, label, null, tooltip, SWT.RADIO, null, false);
IContributionItem item = new CommandContributionItem(parameter);
Expression visibleWhen = null;
additions.addContributionItem(item, visibleWhen);
}
}
示例8: createContributionItems
import org.eclipse.ui.menus.IContributionRoot; //导入依赖的package包/类
@Override
public void createContributionItems(IServiceLocator serviceLocator, IContributionRoot additions) {
ITextEditor editor = (ITextEditor)
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart();
additions.addContributionItem(new TextEditorContextMenuContribution(editor), null);
}
示例9: addItem
import org.eclipse.ui.menus.IContributionRoot; //导入依赖的package包/类
private void addItem(IServiceLocator serviceLocator, IContributionRoot additions, String commandLabel,
String commandId, Map<String, Object> commandParamametersMap, String commandImageId, boolean visible) {
CommandContributionItemParameter param = new CommandContributionItemParameter(serviceLocator, "", commandId,
SWT.PUSH);
param.label = commandLabel;
param.icon = Activator.getImageDescriptor(commandImageId);
param.parameters = commandParamametersMap;
CommandContributionItem item = new CommandContributionItem(param);
item.setVisible(visible);
additions.addContributionItem(item, null);
}
示例10: createContributionItems
import org.eclipse.ui.menus.IContributionRoot; //导入依赖的package包/类
@Override
public void createContributionItems(IServiceLocator serviceLocator,
IContributionRoot additions) {
IProject project = retrieveSelectedProject();
// Now check if project is a CMakeProject
if(CMakeNature.isCMakeProject(project)) {
additions.addContributionItem(new CMakeContributionMenu(), null);
} else if(CMakeNature.canConvertProject(project))
additions.addContributionItem(new CMakeSetupContributionMenu(), null);
}
开发者ID:USESystemEngineeringBV,项目名称:cmake-eclipse-helper,代码行数:12,代码来源:ProjectExplorerExtensionContributionFactory.java
示例11: createContributionItems
import org.eclipse.ui.menus.IContributionRoot; //导入依赖的package包/类
@Override
public void createContributionItems(IServiceLocator serviceLocator,
IContributionRoot additions) {
ISelectionService service = (ISelectionService)serviceLocator.getService(ISelectionService.class);
ISelection selection = service.getSelection();
if (selection instanceof IStructuredSelection) {
// TODO check for all elements in the selection
Object selectedObject = ((IStructuredSelection)selection).getFirstElement();
Map<String, IConfigurationElement> extensions = extensionPointLauncher.getExtensions();
for (String name: extensions.keySet()) {
IConfigurationElement extension = extensions.get(name);
String enableFor = extension.getAttribute("enableFor");
if (enableFor != null) {
try {
Class<?> enableForClass = Thread.currentThread().getContextClassLoader().loadClass(enableFor);
if (enableForClass.isAssignableFrom(selectedObject.getClass())) {
addCommand(serviceLocator, additions, name);
}
} catch (ClassNotFoundException e) {
logger.log(ILogger.WARNING, "enablefor class " + enableFor + " could not found.", e);
}
} else {
addCommand(serviceLocator, additions, name);
}
}
}
}
示例12: addCommand
import org.eclipse.ui.menus.IContributionRoot; //导入依赖的package包/类
@SuppressWarnings({ "unchecked" })
private void addCommand(IServiceLocator serviceLocator, IContributionRoot additions, String id) {
CommandContributionItemParameter p = new CommandContributionItemParameter(
serviceLocator, id, CommandId, SWT.PUSH);
p.label = id;
if (p.parameters == null) {
p.parameters = new HashMap<Object, Object>();
}
p.parameters.put("id", id);
CommandContributionItem item = new CommandContributionItem(p);
item.setVisible(true);
additions.addContributionItem(item, null);
}
示例13: createContributionItems
import org.eclipse.ui.menus.IContributionRoot; //导入依赖的package包/类
@Override
public void createContributionItems(IServiceLocator serviceLocator, IContributionRoot additions) {
CommandContributionItemParameter p = new CommandContributionItemParameter(
serviceLocator, "","org.eclipse.ui.file.exit", SWT.PUSH);
p.label = "Exit the application";
CommandContributionItem item = new CommandContributionItem(p);
item.setVisible(true);
}
示例14: createContributionItems
import org.eclipse.ui.menus.IContributionRoot; //导入依赖的package包/类
@Override
public void createContributionItems(IServiceLocator serviceLocator,
IContributionRoot additions) {
// TODO Auto-generated method stub
ISelectionService serv = (ISelectionService) serviceLocator.getService(ISelectionService.class);
ISelection selection = serv.getSelection();
TreeSelection treeselection = (TreeSelection)selection;
Object firstelement = treeselection.getFirstElement();
if(firstelement instanceof IProject || firstelement instanceof IFolder){
IProject pro = null;
if(firstelement instanceof IProject)
pro = (IProject)firstelement;
if(firstelement instanceof IFolder)
pro = ((IFolder)firstelement).getProject();
try {
IProjectNature nature = pro.getNature(WTNewProjectNature.ID);
if(nature==null)
return;
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
MenuManager menu = new MenuManager();
menu.setMenuText("New WT");
if(firstelement instanceof IProject)
{
CommandContributionItemParameter pcommand = new CommandContributionItemParameter(serviceLocator,
"", "org.eclipse.ui.newWizard", CommandContributionItem.STYLE_PUSH);
pcommand.parameters = new HashMap<String,String>();
pcommand.parameters.put("newWizardId", "org.mondo.wt.cstudy.collectioninputoutput.collectioninputoutputNewFile");
CommandContributionItem itemitsInputOutput = new CommandContributionItem(pcommand);
menu.add(itemitsInputOutput);
pcommand.parameters.put("newWizardId", "org.mondo.wt.cstudy.mainsubsystem.mainsubsystemNewFile");
CommandContributionItem itemitsSubsystems = new CommandContributionItem(pcommand);
menu.add(itemitsSubsystems);
}
else if(firstelement instanceof IFolder)
{
IFolder fol = (IFolder)firstelement;
IPath filePath = fol.getFullPath().append("/"+fol.getName().concat(".xmi"));
XMI_File file = new XMI_File(URI.createPlatformResourceURI(filePath.toString(), true), true);
EObject root = null;
try {
root = file.Get_Root();
} catch (IOException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}
if(root!=null)
{
}
}
additions.addContributionItem(menu, null);
}
}
示例15: createContributionItems
import org.eclipse.ui.menus.IContributionRoot; //导入依赖的package包/类
@Override
public void createContributionItems(IServiceLocator serviceLocator, IContributionRoot additions) {
}