/** * Extract the variable. * * @param event * The execution event that contains the application context * @param name * The variable name to extract. * @return The object from the application context, or <code>null</code> * if it could not be found. */ public static Object getVariable(ExecutionEvent event, String name) { if (event.getApplicationContext() instanceof IEvaluationContext) { Object var = ((IEvaluationContext) event.getApplicationContext()).getVariable(name); return var == IEvaluationContext.UNDEFINED_VARIABLE ? null : var; } return null; }
@Override public Object execute(ExecutionEvent event) throws ExecutionException { IEvaluationContext context = (IEvaluationContext) event.getApplicationContext(); IWorkbench workbench = (IWorkbench) context.getVariable(IWorkbench.class.getName()); if (TRUE.equals(event.getParameter(COMMAND_PARAMETER_ID_MAY_PROMPT))) { workbench.getDisplay().close(); } else { workbench.close(); } return null; } }
/** * {@inheritDoc} */ @Override public Object execute(ExecutionEvent event) throws ExecutionException { // Get the input definition out of the context IEvaluationContext context = (IEvaluationContext) event.getApplicationContext(); Item column = (Item) context.getVariable(COLUMN_PARAM); Boolean visible = (Boolean) context.getVariable(VISIBLE_PARAM); Class<?> inputControllerClass = (Class<?>) context.getVariable(CONTROLLER_CLASS_PARAM); showHideColumn(column, column.getText(), visible.booleanValue(), inputControllerClass); return null; }
/** * Creates {@link ExecutionEvent} based on current selection * * @return {@link ExecutionEvent} with current selection */ protected ExecutionEvent createExecutionEvent() { IServiceLocator locator = getServiceLocator(); ICommandService srv = (ICommandService) locator .getService(ICommandService.class); IHandlerService hsrv = (IHandlerService) locator .getService(IHandlerService.class); Command command = srv.getCommand(commandId); ExecutionEvent event = hsrv.createExecutionEvent(command, null); if (event.getApplicationContext() instanceof IEvaluationContext) ((IEvaluationContext) event.getApplicationContext()).addVariable( ISources.ACTIVE_CURRENT_SELECTION_NAME, mySelection); return event; }
public Object execute(ExecutionEvent event) throws ExecutionException { RebaseCurrentRefCommand rebaseCurrent = new RebaseCurrentRefCommand(); rebaseCurrent.setEnabled(event.getApplicationContext()); // Because the enabled state is for both starting a new rebase as well // as working with an existing rebase, it can be that this is executed // even though starting a new rebase is not possible. So check enabled // state again here. See also isEnabled. if (rebaseCurrent.isEnabled()) return rebaseCurrent.execute(event); else return null; }
public Object execute(ExecutionEvent event) { IEvaluationContext context = (IEvaluationContext) event.getApplicationContext(); Collection<?> selectedProjects = (Collection<?>) context.getDefaultVariable(); List<IProject> projects = new ArrayList<IProject>();
public Object execute(ExecutionEvent event) { IEvaluationContext context = (IEvaluationContext)event.getApplicationContext(); Collection<?> selectedProjects = (Collection<?>) context.getDefaultVariable(); List<IProject> projects = new ArrayList<IProject>();
/** * {@inheritDoc} */ @Override public Object execute(ExecutionEvent event) throws ExecutionException { // Get the view IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event); IWorkbenchPage page = window.getActivePage(); // Get the input definition out of the context IEvaluationContext context = (IEvaluationContext) event.getApplicationContext(); InputDefinition inputDefinition = (InputDefinition) context.getVariable(INPUT); // open the view if the input definition is set if (null != inputDefinition) { RootEditorInput input = new RootEditorInput(inputDefinition); try { page.openEditor(input, FormRootEditor.ID); } catch (PartInitException e) { throw new ExecutionException("Exception occurred trying to open the editor.", e); } } return null; } }
IEvaluationContext context = (IEvaluationContext) executionEvent.getApplicationContext(); context.addVariable(ExceptionSupportHandler.INPUT, throwable);
@Override public Object execute(ExecutionEvent event) throws ExecutionException { IEclipseContext executionContext = getExecutionContext(event.getApplicationContext()); if (executionContext == null) { throw new ExecutionException(FAILED_TO_FIND_HANDLER_DURING_EXECUTION,
IEvaluationContext context = (IEvaluationContext) executionEvent.getApplicationContext(); context.addVariable(OpenViewHandler.INPUT, inputDefinition);
@Override public Object execute(ExecutionEvent event) throws ExecutionException { // Get the repository definition and agent out of the context IEvaluationContext context = (IEvaluationContext) event.getApplicationContext(); RepositoryDefinition repositoryDefinition = (RepositoryDefinition) context.getVariable(REPOSITORY_DEFINITION); PlatformIdent platformIdent = (PlatformIdent) context.getVariable(AGENT); if (null != repositoryDefinition) { // find view IWorkbenchWindow workbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event); if (null == workbenchWindow) { workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); } IViewPart viewPart = workbenchWindow.getActivePage().findView(DataExplorerView.VIEW_ID); if (viewPart == null) { try { viewPart = workbenchWindow.getActivePage().showView(DataExplorerView.VIEW_ID); } catch (PartInitException e) { return null; } } if (viewPart instanceof DataExplorerView) { workbenchWindow.getActivePage().activate(viewPart); ((DataExplorerView) viewPart).showRepository(repositoryDefinition, platformIdent); } } return null; }
final Object applicationContext = event.getApplicationContext(); if (applicationContext instanceof IEvaluationContext) { final IEvaluationContext context = (IEvaluationContext) applicationContext;
IEvaluationContext context = (IEvaluationContext) executionEvent.getApplicationContext(); context.addVariable(OpenViewHandler.INPUT, inputDefinition);
IEvaluationContext context = (IEvaluationContext) executionEvent.getApplicationContext(); context.addVariable(OpenViewHandler.INPUT, ((Component) element).getInputDefinition());
public Object execute(ExecutionEvent event) throws ExecutionException { IEvaluationContext context = (IEvaluationContext) event.getApplicationContext(); List<AbstractStorageLabel<?>> inputList = (List<AbstractStorageLabel<?>>) context.getVariable(INPUT);
IEvaluationContext context = (IEvaluationContext) executionEvent.getApplicationContext(); context.addVariable(OpenViewHandler.INPUT, inputDefinition);
IEvaluationContext context = (IEvaluationContext) executionEvent.getApplicationContext(); context.addVariable(OpenViewHandler.INPUT, inputDefinition);
IEvaluationContext context = (IEvaluationContext) executionEvent.getApplicationContext(); context.addVariable(OpenViewHandler.INPUT, inputDefinition);
IEvaluationContext context = (IEvaluationContext) executionEvent.getApplicationContext(); context.addVariable(OpenViewHandler.INPUT, inputDefinition);