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


Java ParameterizedCommand.generateCommand方法代码示例

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


在下文中一共展示了ParameterizedCommand.generateCommand方法的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: 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

示例3: 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

示例4: createCommand

import org.eclipse.core.commands.ParameterizedCommand; //导入方法依赖的package包/类
/**
 * Build a command from the executable extension information.
 * 
 * @param commandService
 *            to get the Command object
 * @param commandId
 *            the command id for this action
 * @param parameterMap
 */
private void createCommand(ICommandService commandService,
		String commandId, Map parameterMap) {
	Command cmd = commandService.getCommand(commandId);
	if (!cmd.isDefined()) {
		WorkbenchPlugin.log("Command " + commandId + " is undefined"); //$NON-NLS-1$//$NON-NLS-2$
		return;
	}

	if (parameterMap == null) {
		parameterizedCommand = new ParameterizedCommand(cmd, null);
		return;
	}

	parameterizedCommand = ParameterizedCommand.generateCommand(cmd,
			parameterMap);
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:26,代码来源:CommandAction.java

示例5: executeCommand

import org.eclipse.core.commands.ParameterizedCommand; //导入方法依赖的package包/类
private static Object executeCommand(String commandId, Map<String,?> parameters, Event event, ICommandService ics, IHandlerService ihs)
throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException, CommandException {
	Object result = null;
	if (ics != null && ihs != null) {
		Command command = ics.getCommand(commandId);
		if (command != null) {
			try {
				MarkUtils.setIgnoreDispatchId(true);
				ParameterizedCommand pcommand = ParameterizedCommand.generateCommand(command, parameters);
				if (pcommand != null) {
					result = ihs.executeCommand(pcommand, event);
				}
			} finally {
				MarkUtils.setIgnoreDispatchId(false);
			}		
		}
	}
	return result;
}
 
开发者ID:MulgaSoft,项目名称:e4macs,代码行数:20,代码来源:EmacsPlusUtils.java

示例6: executeCommand

import org.eclipse.core.commands.ParameterizedCommand; //导入方法依赖的package包/类
public static void executeCommand(String commandId, Map<String, Object> parameters) {
	// Locals
	ParameterizedCommand customizeCommand = null;
   	Command command = null;

    try {
    	// 
    	command = ((ICommandService) PlatformUI.getWorkbench()
    										   .getService(ICommandService.class))
    										   .getCommand(commandId);
    	// Generate customize command
    	customizeCommand = ParameterizedCommand.generateCommand(command, parameters);

    	// Execute the customize command
    	((IHandlerService) PlatformUI.getWorkbench()
				 					 .getService(IHandlerService.class))
				 					 .executeCommand(customizeCommand, null);
    }
    catch (Exception e) {
    	e.printStackTrace();
    }
}
 
开发者ID:jaloncad,项目名称:redmine.rap,代码行数:23,代码来源:CommandUtils.java

示例7: executeWithParams

import org.eclipse.core.commands.ParameterizedCommand; //导入方法依赖的package包/类
public static void executeWithParams(PersistentObject parameter){
	try {
		// get the command
		IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
		ICommandService cmdService = (ICommandService) window.getService(ICommandService.class);
		Command cmd = cmdService.getCommand(EditEigenleistungUi.COMMANDID);
		// create the parameter
		HashMap<String, Object> param = new HashMap<String, Object>();
		param.put(EditEigenleistungUi.PARAMETERID, parameter);
		// build the parameterized command
		ParameterizedCommand pc = ParameterizedCommand.generateCommand(cmd, param);
		// execute the command
		IHandlerService handlerService =
			(IHandlerService) PlatformUI.getWorkbench().getActiveWorkbenchWindow()
				.getService(IHandlerService.class);
		handlerService.executeCommand(pc, null);
	} catch (Exception ex) {
		throw new RuntimeException(EditEigenleistungUi.COMMANDID, ex);
	}
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:21,代码来源:EditEigenleistungUi.java

示例8: executeWithParams

import org.eclipse.core.commands.ParameterizedCommand; //导入方法依赖的package包/类
public static void executeWithParams(PersistentObject parameter){
	try {
		// get the command
		IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
		ICommandService cmdService = (ICommandService) window.getService(ICommandService.class);
		Command cmd = cmdService.getCommand(EditEigenartikelUi.COMMANDID);
		// create the parameter
		HashMap<String, Object> param = new HashMap<String, Object>();
		param.put(EditEigenartikelUi.PARAMETERID, parameter);
		// build the parameterized command
		ParameterizedCommand pc = ParameterizedCommand.generateCommand(cmd, param);
		// execute the command
		IHandlerService handlerService =
			(IHandlerService) PlatformUI.getWorkbench().getActiveWorkbenchWindow()
				.getService(IHandlerService.class);
		handlerService.executeCommand(pc, null);
	} catch (Exception ex) {
		throw new RuntimeException(EditEigenleistungUi.COMMANDID, ex);
	}
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:21,代码来源:EditEigenartikelUi.java

示例9: executeWithParams

import org.eclipse.core.commands.ParameterizedCommand; //导入方法依赖的package包/类
public static void executeWithParams(PersistentObject parameter){
	try {
		// get the command
		IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
		ICommandService cmdService = (ICommandService) window.getService(ICommandService.class);
		Command cmd = cmdService.getCommand(COMMANDID);
		// create the parameter
		HashMap<String, Object> param = new HashMap<String, Object>();
		param.put(PARAMETERID, parameter);
		// build the parameterized command
		ParameterizedCommand pc = ParameterizedCommand.generateCommand(cmd, param);
		// execute the command
		IHandlerService handlerService =
			(IHandlerService) PlatformUI.getWorkbench().getActiveWorkbenchWindow()
				.getService(IHandlerService.class);
		handlerService.executeCommand(pc, null);
	} catch (Exception ex) {
		throw new RuntimeException(COMMANDID, ex);
	}
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:21,代码来源:EditLabItemUi.java

示例10: openSendMailDlg

import org.eclipse.core.commands.ParameterizedCommand; //导入方法依赖的package包/类
private boolean openSendMailDlg(Patient patient, List<?> iOutboxElements,
	ICommandService commandService,
	String attachmentsString)
	throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException{
	Command sendMailCommand =
		commandService.getCommand("ch.elexis.core.mail.ui.sendMail");
	
	HashMap<String, String> params = new HashMap<String, String>();
	params.put("ch.elexis.core.mail.ui.sendMail.attachments", attachmentsString);
	if (patient != null) {
		params.put("ch.elexis.core.mail.ui.sendMail.subject",
			"Patient: " + patient.getLabel());
	}
	
	ParameterizedCommand parametrizedCommmand =
		ParameterizedCommand.generateCommand(sendMailCommand, params);
	
	Object obj = PlatformUI.getWorkbench().getService(IHandlerService.class)
		.executeCommand(parametrizedCommmand, null);
	return Boolean.TRUE.equals(obj);
}
 
开发者ID:elexis,项目名称:elexis-3-base,代码行数:22,代码来源:OutboxSendHandler.java

示例11: modifyBindingsForAddChangeSet

import org.eclipse.core.commands.ParameterizedCommand; //导入方法依赖的package包/类
private void modifyBindingsForAddChangeSet(final KbaChangeSet changeSet,
    final KeyBindings bindings, final Scheme scheme) {
  for (KbaBinding toAdd : changeSet.getBindingList()) {
    Command commandToAdd = commandService.getCommand(toAdd.getCid());
    if (!commandToAdd.isDefined()) {
      log.logWarning("Command '" + toAdd.getCid() + "' does not exist. Skipping.");
      continue;
    }
    ParameterizedCommand parameterizedCommandToAdd =
        ParameterizedCommand.generateCommand(commandToAdd, toAdd.getParameters());

    KeySequence triggerSequence;
    try {
      triggerSequence = KeySequence.getInstance(toAdd.getKeySequence());
    } catch (ParseException e) {
      log.logError(e, "Invalid key sequence: %s", toAdd.getKeySequence());
      throw new RuntimeException(e);
    }

    bindings.addIfNotPresent(
        scheme, 
        changeSet.getPlatform(), 
        changeSet.getContextId(), 
        triggerSequence,
        parameterizedCommandToAdd);
  }
}
 
开发者ID:alfsch,项目名称:workspacemechanic,代码行数:28,代码来源:KeyboardBindingsTask.java

示例12: execute

import org.eclipse.core.commands.ParameterizedCommand; //导入方法依赖的package包/类
/**
 * 
 * Execute command with parameters.
 *
 * @param id : command id
 * @param param : array of parameters
 */
public boolean execute(String id, IEclipseContext staticContext, Map<String, String> param){
	Command command = commandService.getCommand(id);
	
	if(command == null){
		logger.warning("execute("+ id +"): Command with specified ID was not found!");
		return false;
	}
	
	try {
		if(command.getParameters() == null){
			return execute(id);
		}
	} 
	catch (NotDefinedException e1) {
		e1.printStackTrace();
	}
	
	ParameterizedCommand pc = ParameterizedCommand.generateCommand(command, param);
	if(pc == null){
		logger.warning("execute("+ id +"): Can not create parameterized command!");
		return false;
	}
	
	if(staticContext == null){
		if(handlerService.canExecute(pc)){
			handlerService.executeHandler(pc);
			return true;
		}
	}
	else{
		if(handlerService.canExecute(pc, staticContext)){
			handlerService.executeHandler(pc, staticContext);
			return true;
		}
	}
	
	return false;
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:46,代码来源:CommandExecutor.java

示例13: executeParameterizedCommand

import org.eclipse.core.commands.ParameterizedCommand; //导入方法依赖的package包/类
/**
 * Attempts to execute the command with the given Id using the given params.
 */
private void executeParameterizedCommand(String commandId,
		HashMap<String, String> params){
	
	Command command = commandService.getCommand(commandId);
	ParameterizedCommand parameterizedCmd = ParameterizedCommand.
			generateCommand(command, params);
	
	handlerService.executeHandler(parameterizedCmd);
}
 
开发者ID:Pro-Nouns,项目名称:LinGUIne,代码行数:13,代码来源:ProjectExplorer.java

示例14: execute

import org.eclipse.core.commands.ParameterizedCommand; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException{
	Brief brief = (Brief) ElexisEventDispatcher.getSelected(Brief.class);
	if (brief != null) {
		List<File> attachments = new ArrayList<File>();
		Optional<File> tmpFile = getTempFile(brief);
		if (tmpFile.isPresent()) {
			attachments.add(tmpFile.get());
			ICommandService commandService = (ICommandService) HandlerUtil
				.getActiveWorkbenchWindow(event).getService(ICommandService.class);
			try {
				String attachmentsString = getAttachmentsString(attachments);
				Command sendMailCommand =
					commandService.getCommand("ch.elexis.core.mail.ui.sendMail");
				
				HashMap<String, String> params = new HashMap<String, String>();
				params.put("ch.elexis.core.mail.ui.sendMail.attachments", attachmentsString);
				Patient patient = ElexisEventDispatcher.getSelectedPatient();
				if (patient != null) {
					params.put("ch.elexis.core.mail.ui.sendMail.subject",
						"Patient: " + patient.getLabel());
				}
				
				ParameterizedCommand parametrizedCommmand =
					ParameterizedCommand.generateCommand(sendMailCommand, params);
				PlatformUI.getWorkbench().getService(IHandlerService.class)
					.executeCommand(parametrizedCommmand, null);
			} catch (Exception ex) {
				throw new RuntimeException("ch.elexis.core.mail.ui.sendMail not found", ex);
			}
		}
		removeTempAttachments(attachments);
	}
	return null;
}
 
开发者ID:elexis,项目名称:elexis-3-core,代码行数:36,代码来源:SendBriefAsMailHandler.java

示例15: createXDM

import org.eclipse.core.commands.ParameterizedCommand; //导入方法依赖的package包/类
private Object createXDM(Patient patient, ICommandService commandService,
	String attachmentsString)
	throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException{
	Command xdmCommand = commandService
		.getCommand("at.medevit.elexis.ehc.ui.vacdoc.CreateXdmHandler");
	if (xdmCommand.isDefined()) {
		HashMap<String, String> params = new HashMap<String, String>();
		params.put("at.medevit.elexis.ehc.ui.vacdoc.tmp.dir",
			attachmentsFolder.getAbsolutePath());
		params.put("at.medevit.elexis.ehc.ui.vacdoc.attachments",
			attachmentsString);
		if (patient != null) {
			params.put("at.medevit.elexis.ehc.ui.vacdoc.patient.id", patient.getId());
		}
		ParameterizedCommand parametrizedCommmand =
			ParameterizedCommand.generateCommand(xdmCommand, params);
		if (parametrizedCommmand != null) {
			Object obj = PlatformUI.getWorkbench().getService(IHandlerService.class)
				.executeCommand(parametrizedCommmand, null);
			return obj;
		}
	}
	else {
		MessageDialog.openError(Display.getCurrent().getActiveShell(), "Fehler",
			"Es wurde kein Plugin zum erstellen von XDM Dateien gefunden.");
	}
	
	return null;
}
 
开发者ID:elexis,项目名称:elexis-3-base,代码行数:30,代码来源:OutboxSendHandler.java


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