/** * Returns the {@link ParameterType} for the parameter with the provided id * or <code>null</code> if this command does not have a parameter type * with the id. * * @param parameterId * The id of the parameter to retrieve the {@link ParameterType} * of. * @return The {@link ParameterType} for the parameter with the provided id * or <code>null</code> if this command does not have a parameter * type with the provided id. * @throws NotDefinedException * If the handle is not currently defined. * @since 3.2 */ public final ParameterType getParameterType(final String parameterId) throws NotDefinedException { final IParameter parameter = getParameter(parameterId); if (parameter instanceof ITypedParameter) { final ITypedParameter parameterWithType = (ITypedParameter) parameter; return parameterWithType.getParameterType(); } return null; }
IParameter parameter = null; parameter = command.getParameter(key);
/** * Returns the {@link ParameterType} for the parameter with the provided id * or <code>null</code> if this command does not have a parameter type * with the id. * * @param parameterId * The id of the parameter to retrieve the {@link ParameterType} * of. * @return The {@link ParameterType} for the parameter with the provided id * or <code>null</code> if this command does not have a parameter * type with the provided id. * @throws NotDefinedException * If the handle is not currently defined. * @since 3.2 */ public final ParameterType getParameterType(final String parameterId) throws NotDefinedException { final IParameter parameter = getParameter(parameterId); if (parameter instanceof ITypedParameter) { final ITypedParameter parameterWithType = (ITypedParameter) parameter; return parameterWithType.getParameterType(); } return null; }
IParameter parameter = null; parameter = command.getParameter(key);
/** * Returns the {@link ParameterType} for the parameter with the provided id * or <code>null</code> if this command does not have a parameter type * with the id. * * @param parameterId * The id of the parameter to retrieve the {@link ParameterType} * of. * @return The {@link ParameterType} for the parameter with the provided id * or <code>null</code> if this command does not have a parameter * type with the provided id. * @throws NotDefinedException * If the handle is not currently defined. * @since 3.2 */ public ParameterType getParameterType(final String parameterId) throws NotDefinedException { final IParameter parameter = getParameter(parameterId); if (parameter instanceof ITypedParameter) { final ITypedParameter parameterWithType = (ITypedParameter) parameter; return parameterWithType.getParameterType(); } return null; }
IParameter parameter = null; parameter = command.getParameter(key);
public static boolean openPreferencePage(String preferencePageId) { if (StringUtils.isEmpty(preferencePageId)) return false; IServiceLocator serviceLocator = PlatformUI.getWorkbench(); ICommandService commandService = (ICommandService) serviceLocator.getService(ICommandService.class); IHandlerService handlerService = (IHandlerService) serviceLocator.getService(IHandlerService.class); Command command = commandService.getCommand(IWorkbenchCommandConstants.WINDOW_PREFERENCES); IParameter parmDef = null; try { parmDef = command.getParameter(IWorkbenchCommandConstants.WINDOW_PREFERENCES_PARM_PAGEID); } catch (NotDefinedException e) { Logger.log(e); return false; } if (parmDef != null) { Parameterization[] params = new Parameterization[] { new Parameterization(parmDef, preferencePageId) }; ParameterizedCommand paramCommand = new ParameterizedCommand(command, params); try { handlerService.executeCommand(paramCommand, null); return true; } catch (Exception e) { Logger.log(e); return false; } } return false; }
/** * @param commandService * @param makeFast */ private ParameterizedCommand getCommand(ICommandService commandService, final boolean makeFast) { Command c = commandService.getCommand(IWorkbenchCommandConstants.VIEWS_SHOW_VIEW); Parameterization[] parms = null; if (makeFast) { try { IParameter parmDef = c .getParameter(IWorkbenchCommandConstants.VIEWS_SHOW_VIEW_PARM_FASTVIEW); parms = new Parameterization[] { new Parameterization(parmDef, "true") //$NON-NLS-1$ }; } catch (NotDefinedException e) { // this should never happen } } return new ParameterizedCommand(c, parms); }
for ( final Map.Entry<String, String> entry : eventData.entrySet () ) parameterizations[i] = new Parameterization ( command.getParameter ( entry.getKey () ), entry.getValue () ); i++;
for ( final Map.Entry<String, String> entry : eventData.entrySet () ) parameterizations[i] = new Parameterization ( command.getParameter ( entry.getKey () ), entry.getValue () ); i++;
try { IParameter parm = cmd .getParameter(HistoryViewCommands.COMPARE_MODE_PARAM); parms = new Parameterization[] { new Parameterization( parm, Boolean.TRUE.toString()) };
@Override public void apply(IDocument document) { try { IHandlerService handlerService = PlatformUI.getWorkbench().getService(IHandlerService.class); ICommandService commandService = PlatformUI.getWorkbench().getService(ICommandService.class); Command command = commandService.getCommand("org.eclipse.pde.ui.searchTargetRepositories"); //$NON-NLS-1$ IParameter parameter = command.getParameter("org.eclipse.pde.ui.searchTargetRepositories.term"); //$NON-NLS-1$ Parameterization parameterization = new Parameterization(parameter, fPackageName); ParameterizedCommand pc = new ParameterizedCommand(command, new Parameterization[] {parameterization}); handlerService.executeCommand(pc, null); } catch (ExecutionException e) { PDEPlugin.log(e); } catch (NotDefinedException e) { PDEPlugin.log(e); } catch (NotEnabledException e) { PDEPlugin.log(e); } catch (NotHandledException e) { PDEPlugin.log(e); } }