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


Java ParameterizedCommand类代码示例

本文整理汇总了Java中org.eclipse.core.commands.ParameterizedCommand的典型用法代码示例。如果您正苦于以下问题:Java ParameterizedCommand类的具体用法?Java ParameterizedCommand怎么用?Java ParameterizedCommand使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


ParameterizedCommand类属于org.eclipse.core.commands包,在下文中一共展示了ParameterizedCommand类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getParameterizedCommand

import org.eclipse.core.commands.ParameterizedCommand; //导入依赖的package包/类
public ParameterizedCommand getParameterizedCommand() {
	IWorkbenchWindow activeWorkbenchWindow = Activator.getDefault()
			.getWorkbench().getActiveWorkbenchWindow();

	if (activeWorkbenchWindow != null) {
		ICommandService commandService = (ICommandService) activeWorkbenchWindow
				.getService(ICommandService.class);
		if (commandService != null) {
			ParameterizedCommand parameterizedCommand = ParameterizedCommand
					.generateCommand(commandService.getCommand(_commandID),
							_params);
			return parameterizedCommand;
		}
	}
	return null;
}
 
开发者ID:tmfev,项目名称:IDRT-Import-and-Mapping-Tool,代码行数:17,代码来源:ActionCommand.java

示例2: convertAlarmNotifier

import org.eclipse.core.commands.ParameterizedCommand; //导入依赖的package包/类
private static AlarmNotifierConfiguration convertAlarmNotifier ( final IConfigurationElement ele )
{
    try
    {
        final String connectionId = ele.getAttribute ( "connectionId" ); //$NON-NLS-1$
        final String prefix = ele.getAttribute ( "prefix" ) == null ? "ae.server.info" : ele.getAttribute ( "prefix" ); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ $NON-NLS-2$
        final URL soundFile = Platform.getBundle ( ele.getContributor ().getName () ).getEntry ( ele.getAttribute ( "soundFile" ) ); //$NON-NLS-1$
        final ParameterizedCommand ackAlarmsAvailableCommand = convertCommand ( ele.getChildren ( "ackAlarmsAvailableCommand" )[0] ); //$NON-NLS-1$
        final ParameterizedCommand alarmsAvailableCommand = convertCommand ( ele.getChildren ( "alarmsAvailableCommand" )[0] ); //$NON-NLS-1$
        return new AlarmNotifierConfiguration ( connectionId, prefix, soundFile, ackAlarmsAvailableCommand, alarmsAvailableCommand );
    }
    catch ( final Exception e )
    {
        logger.warn ( "Failed to convert alarm notifier configuration: {}", ele ); //$NON-NLS-1$
        return null;
    }
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:18,代码来源:ConfigurationHelper.java

示例3: execute

import org.eclipse.core.commands.ParameterizedCommand; //导入依赖的package包/类
/**
 * @param ji
 * @param job
 * @return <code>true</code> if Action or Command is executed
 */
private boolean execute(JobInfo ji, Job job) {

	Object prop = job.getProperty(IProgressConstants.ACTION_PROPERTY);
	if (prop instanceof IAction && ((IAction) prop).isEnabled()) {
		IAction action = (IAction) prop;
		action.run();
		removeTopElement(ji);
		return true;
	}

	prop = job.getProperty(IProgressConstants.COMMAND_PROPERTY);
	if (prop instanceof ParameterizedCommand) {
		ParameterizedCommand command = (ParameterizedCommand) prop;
		getEHandlerService().executeHandler(command);
		removeTopElement(ji);
		return true;
	}
	return false;
}
 
开发者ID:termsuite,项目名称:termsuite-ui,代码行数:25,代码来源:ProgressAnimationItem.java

示例4: executeTrigger

import org.eclipse.core.commands.ParameterizedCommand; //导入依赖的package包/类
public void executeTrigger() {

		Object data = link.getData(TRIGGER_KEY);
		if (data instanceof IAction) {
			IAction action = (IAction) data;
			if (action.isEnabled())
				action.run();
			updateTrigger(action, link);
		} else if (data instanceof ParameterizedCommand) {
			getEHandlerService().executeHandler((ParameterizedCommand) data);
		}

		if (link.isDisposed()) {
			return;
		}

		Object text = link.getData(TEXT_KEY);
		if (text == null)
			return;

		// Refresh the text as enablement might have changed
		updateText((String) text, link);
	}
 
开发者ID:termsuite,项目名称:termsuite-ui,代码行数:24,代码来源:ProgressInfoItem.java

示例5: createContents

import org.eclipse.core.commands.ParameterizedCommand; //导入依赖的package包/类
@PostConstruct
public Control createContents(Composite parent, NLPService nlpService, ECommandService commandService, EHandlerService handlerService) {
	l = new Label(parent, SWT.None);
	int size = 0;
	updateSize(nlpService);
	Button b = new Button(parent, SWT.PUSH);
	b.setImage(TermSuiteUI.getImg(TermSuiteUI.IMG_CLEAR_CO).createImage());
	b.setSize(50, -1);
	b.setToolTipText("Clear all preprocessed corpus save in cache");
	b.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			Command command = commandService.getCommand(TermSuiteUI.COMMAND_CLEAR_CACHE_ID);
		    ParameterizedCommand pCmd = new ParameterizedCommand(command, null);
		    if (handlerService.canExecute(pCmd)) 
		    	handlerService.executeHandler(pCmd);
		}
	});
	return parent;
}
 
开发者ID:termsuite,项目名称:termsuite-ui,代码行数:21,代码来源:WorskpaceSizeControl.java

示例6: execute

import org.eclipse.core.commands.ParameterizedCommand; //导入依赖的package包/类
@Execute
public void execute(ParameterizedCommand command, 
		@Optional @Named(IServiceConstants.ACTIVE_SELECTION) EPipeline selectedPipeline,
		@Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
		NLPService extractorService,
		ResourceService resourceService) {
	Map<String, Object> parameterMap = command.getParameterMap();
	boolean useCache = parameterMap.containsKey(TermSuiteUI.COMMAND_RUN_PIPELINE_PARAMETER_USE_CACHE)
			&& Boolean.parseBoolean((String) parameterMap.get(TermSuiteUI.COMMAND_RUN_PIPELINE_PARAMETER_USE_CACHE));
	if(!parameterMap.containsKey(TermSuiteUI.COMMAND_RUN_PIPELINE_PARAMETER_PIPELINE_ID)
			&& selectedPipeline != null) {
		// run handler from selected pipeline
		runPipeline(shell, extractorService, resourceService, selectedPipeline, useCache);
	} else {
		// run handler from parameterized command
		String pipelineName = parameterMap.get(TermSuiteUI.COMMAND_RUN_PIPELINE_PARAMETER_PIPELINE_ID).toString();
		java.util.Optional<EPipeline> pipeline = resourceService.getPipeline(pipelineName);
		if(pipeline.isPresent()) 
			runPipeline(shell, extractorService, resourceService, pipeline.get(), useCache);
	}
}
 
开发者ID:termsuite,项目名称:termsuite-ui,代码行数:22,代码来源:RunPipelineHandler.java

示例7: canExecute

import org.eclipse.core.commands.ParameterizedCommand; //导入依赖的package包/类
@CanExecute
public boolean canExecute(
		@Optional ParameterizedCommand command, 
		@Optional @Named(IServiceConstants.ACTIVE_SELECTION) EPipeline selectedPipeline,
		ResourceService resourceService,
		NLPService extractorService) {
	if(command == null || command.getParameterMap().isEmpty()) {
		// try to run handler from selected EPipeline
		if(selectedPipeline != null)
			return extractorService.isPipelineValid(selectedPipeline);
		else 
			return false;
	} else {
		// try to run handler from parameterized command
		Map<String, Object> parameterMap = command.getParameterMap();
		Object pipelineName = parameterMap.get(TermSuiteUI.COMMAND_RUN_PIPELINE_PARAMETER_PIPELINE_ID);
		return pipelineName != null
					&& resourceService.getPipeline(pipelineName.toString()).isPresent()
					&& extractorService.isPipelineValid(resourceService.getPipeline(pipelineName.toString()).get())
					;
	}
}
 
开发者ID:termsuite,项目名称:termsuite-ui,代码行数:23,代码来源:RunPipelineHandler.java

示例8: execute

import org.eclipse.core.commands.ParameterizedCommand; //导入依赖的package包/类
public Object execute(ExecutionEvent event) throws ExecutionException {

    final IWorkbenchSite site = HandlerUtil.getActiveSite(event);
    final ICommandService cs = (ICommandService) site
        .getService(ICommandService.class);
    final IHandlerService hs = (IHandlerService) site
        .getService(IHandlerService.class);
    final Command command = cs
        .getCommand(IWorkbenchCommandConstants.FILE_IMPORT);

    try {
      hs.executeCommand(ParameterizedCommand.generateCommand(command,
          Collections.singletonMap(
              IWorkbenchCommandConstants.FILE_IMPORT_PARM_WIZARDID,
              SessionImportWizard.ID)),
          null);
    } catch (CommandException e) {
      EclEmmaUIPlugin.log(e);
    }

    return null;
  }
 
开发者ID:eclipse,项目名称:eclemma,代码行数:23,代码来源:ImportSessionHandler.java

示例9: execute

import org.eclipse.core.commands.ParameterizedCommand; //导入依赖的package包/类
public Object execute(ExecutionEvent event) throws ExecutionException {

    final IWorkbenchSite site = HandlerUtil.getActiveSite(event);
    final ICommandService cs = (ICommandService) site
        .getService(ICommandService.class);
    final IHandlerService hs = (IHandlerService) site
        .getService(IHandlerService.class);
    final Command command = cs
        .getCommand(IWorkbenchCommandConstants.FILE_EXPORT);

    try {
      hs.executeCommand(ParameterizedCommand.generateCommand(command,
          Collections.singletonMap(
              IWorkbenchCommandConstants.FILE_EXPORT_PARM_WIZARDID,
              SessionExportWizard.ID)),
          null);
    } catch (CommandException e) {
      EclEmmaUIPlugin.log(e);
    }

    return null;
  }
 
开发者ID:eclipse,项目名称:eclemma,代码行数:23,代码来源:ExportSessionHandler.java

示例10: addSaveAsMenuItem

import org.eclipse.core.commands.ParameterizedCommand; //导入依赖的package包/类
private void addSaveAsMenuItem(Menu menu) {
	final MenuItem menuItem = new MenuItem(menu, SWT.Activate);
	menuItem.setText(E4WorkbenchCommandConstants.PERSPECTIVES_SAVE_AS$_NAME);

	// TODO: Integrate into help system

	menuItem.addSelectionListener(new SelectionAdapter() {

		@Override
		public void widgetSelected(SelectionEvent event) {
			ParameterizedCommand command = commandService.createCommand(
					E4WorkbenchCommandConstants.PERSPECTIVES_SAVE_AS,
					Collections.EMPTY_MAP);
			handlerService.executeHandler(command);
		}
	});
}
 
开发者ID:cplutte,项目名称:bts,代码行数:18,代码来源:PerspectiveSwitcherSwtTrim.java

示例11: addResetMenuItem

import org.eclipse.core.commands.ParameterizedCommand; //导入依赖的package包/类
private void addResetMenuItem(Menu menu) {
	final MenuItem menuItem = new MenuItem(menu, SWT.Activate);
	menuItem.setText(E4WorkbenchCommandConstants.PERSPECTIVES_RESET$_NAME);

	// TODO: Integrate into help system

	menuItem.addSelectionListener(new SelectionAdapter() {

		@Override
		public void widgetSelected(SelectionEvent event) {
			ParameterizedCommand command = commandService.createCommand(
					E4WorkbenchCommandConstants.PERSPECTIVES_RESET,
					Collections.EMPTY_MAP);
			handlerService.executeHandler(command);
		}
	});
}
 
开发者ID:cplutte,项目名称:bts,代码行数:18,代码来源:PerspectiveSwitcherSwtTrim.java

示例12: addCloseMenuItem

import org.eclipse.core.commands.ParameterizedCommand; //导入依赖的package包/类
private void addCloseMenuItem(Menu menu) {
	final MenuItem menuItem = new MenuItem(menu, SWT.Activate);
	menuItem.setText(E4WorkbenchCommandConstants.PERSPECTIVES_CLOSE$_NAME);

	// TODO: Integrate into help system

	menuItem.addSelectionListener(new SelectionAdapter() {

		@Override
		public void widgetSelected(SelectionEvent event) {
			ParameterizedCommand command = commandService.createCommand(
					E4WorkbenchCommandConstants.PERSPECTIVES_CLOSE,
					Collections.EMPTY_MAP);
			handlerService.executeHandler(command);
		}
	});
}
 
开发者ID:cplutte,项目名称:bts,代码行数:18,代码来源:PerspectiveSwitcherSwtTrim.java

示例13: addShowTextMenuItem

import org.eclipse.core.commands.ParameterizedCommand; //导入依赖的package包/类
private void addShowTextMenuItem(Menu menu) {
	final MenuItem menuItem = new MenuItem(menu, SWT.Activate | SWT.CHECK);
	menuItem.setText(E4WorkbenchCommandConstants.PERSPECTIVES_SHOW_TEXT$_NAME);
	menuItem.setSelection(showShortcutText);

	// TODO: Integrate into help system

	menuItem.addSelectionListener(new SelectionAdapter() {

		@Override
		public void widgetSelected(SelectionEvent event) {
			Map<String, Object> parameters = new HashMap<String, Object>(3);
			ParameterizedCommand command = commandService.createCommand(
					E4WorkbenchCommandConstants.PERSPECTIVES_SHOW_TEXT,
					parameters);
			handlerService.executeHandler(command);
		}
	});
}
 
开发者ID:cplutte,项目名称:bts,代码行数:20,代码来源:PerspectiveSwitcherSwtTrim.java

示例14: executeCommand

import org.eclipse.core.commands.ParameterizedCommand; //导入依赖的package包/类
private static void executeCommand(IWorkbench workbench, String commandName, Map<String, Object> params) {
    if (workbench == null) {
        workbench = PlatformUI.getWorkbench();
    }
    // get command
    ICommandService commandService = (ICommandService)workbench.getService(ICommandService.class);
    Command command = commandService != null ? commandService.getCommand(commandName) : null;
    // get handler service
    //IBindingService bindingService = (IBindingService)workbench.getService(IBindingService.class);
    //TriggerSequence[] triggerSequenceArray = bindingService.getActiveBindingsFor("de.anbos.eclipse.easyshell.plugin.commands.open");
    IHandlerService handlerService = (IHandlerService)workbench.getService(IHandlerService.class);
    if (command != null && handlerService != null) {
        ParameterizedCommand paramCommand = ParameterizedCommand.generateCommand(command, params);
        try {
            handlerService.executeCommand(paramCommand, null);
        } catch (Exception e) {
            Activator.logError(Activator.getResourceString("easyshell.message.error.handlerservice.execution"), paramCommand.toString(), e, true);
        }
    }
}
 
开发者ID:anb0s,项目名称:EasyShell,代码行数:21,代码来源:Utils.java

示例15: getCommand

import org.eclipse.core.commands.ParameterizedCommand; //导入依赖的package包/类
public ParameterizedCommand getCommand() {
	IWorkbenchWindow activeWorkbenchWindow = Activator.getDefault()
			.getWorkbench().getActiveWorkbenchWindow();

	
	if (activeWorkbenchWindow != null) {

		ICommandService commandService = (ICommandService) activeWorkbenchWindow
				.getService(ICommandService.class);


		if (commandService != null) {


			// commandService.
			ParameterizedCommand parameterizedCommand = ParameterizedCommand
					.generateCommand(commandService.getCommand(_commandID),
							_params);
			return parameterizedCommand;
		}
	}
	return null;
}
 
开发者ID:tmfev,项目名称:IDRT-Import-and-Mapping-Tool,代码行数:24,代码来源:ActionCommand.java


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