当前位置: 首页>>代码示例>>Java>>正文


Java IContributionRoot类代码示例

本文整理汇总了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) {
            }
        });
    }
}
 
开发者ID:eclipse,项目名称:cft,代码行数:22,代码来源:AbstractMenuContributionFactory.java

示例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) {
            }
        });
    }
}
 
开发者ID:osswangxining,项目名称:dockerfoundry,代码行数:22,代码来源:AbstractMenuContributionFactory.java

示例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);
    }
}
 
开发者ID:kasemir,项目名称:org.csstudio.display.builder,代码行数:22,代码来源:TopDisplaysToolbarItems.java

示例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);
  }
}
 
开发者ID:google,项目名称:git-appraise-eclipse,代码行数:17,代码来源:ReviewMarkerContributionFactory.java

示例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);
}
 
开发者ID:RichardBirenheide,项目名称:brainfuck,代码行数:19,代码来源:WatchpointExtensionFactory.java

示例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();
        }
    }
}
 
开发者ID:anb0s,项目名称:EasyShell,代码行数:21,代码来源:DefineCommands.java

示例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);
    }
}
 
开发者ID:nasa,项目名称:OpenSPIFe,代码行数:19,代码来源:PlanModifierContributionFactory.java

示例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);
}
 
开发者ID:google,项目名称:git-appraise-eclipse,代码行数:8,代码来源:TextEditorContextContributionFactory.java

示例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);
}
 
开发者ID:anb0s,项目名称:EasyShell,代码行数:12,代码来源:DefineCommands.java

示例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);
               }
   		}		
       }
}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:29,代码来源:PredefinedAnalysis.java

示例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);
}
 
开发者ID:markus1978,项目名称:clickwatch,代码行数:15,代码来源:PredefinedAnalysis.java

示例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);
}
 
开发者ID:xored,项目名称:q7.quality.mockups,代码行数:10,代码来源:MenuContribution.java

示例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);
    }
}
 
开发者ID:mondo-project,项目名称:mondo-demo-wt,代码行数:60,代码来源:CreateMenu.java

示例15: createContributionItems

import org.eclipse.ui.menus.IContributionRoot; //导入依赖的package包/类
@Override
public void createContributionItems(IServiceLocator serviceLocator, IContributionRoot additions) {

}
 
开发者ID:FoxBPM,项目名称:FoxBPM-Designer,代码行数:5,代码来源:FoxBPMMenuContribution.java


注:本文中的org.eclipse.ui.menus.IContributionRoot类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。