Package org.eclipse.core.expressions

Examples of org.eclipse.core.expressions.IEvaluationContext


  @SuppressWarnings("rawtypes")
  @Override
  public Object execute(ExecutionEvent event) throws ExecutionException {
    final String commandId = event.getCommand().getId();
    final IEvaluationContext context = (IEvaluationContext) event.getApplicationContext();
   
    final PHPStructuredEditor editor = (PHPStructuredEditor) context.getVariable(ISources.ACTIVE_PART_NAME);
    final ITextSelection selection = (ITextSelection) editor.getSelectionProvider().getSelection();
   
    final StructuredTextInvocationContext assistInvocation = new StructuredTextInvocationContext(editor.getViewer(), selection.getOffset(), selection.getLength(), new HashMap());
   
    final ICompletionProposal[] proposals = phpCorrectionProcessor.computeQuickAssistProposals(assistInvocation);
View Full Code Here


 
  @Override
  public void setEnabled(Object evaluationContext) {
   
    try {
      IEvaluationContext context = (IEvaluationContext) evaluationContext;
      if (!(context.getVariable(ISources.ACTIVE_PART_NAME) instanceof PHPStructuredEditor)) {
        throw new IllegalArgumentException();
      }
      PHPStructuredEditor editor = (PHPStructuredEditor) context.getVariable(ISources.ACTIVE_PART_NAME);
     
      final ISelection selection = editor.getSelectionProvider().getSelection();
      if (!(selection instanceof ITextSelection)) {
        throw new IllegalArgumentException();
      }
View Full Code Here

  public IEvaluationContext getFullContextSnapshot() {
    return fillInContext(true);
  }
 
  private IEvaluationContext fillInContext(boolean fullContext) {
    IEvaluationContext tmpContext = getCurrentState();

    EvaluationContext context = null;
    if (fullContext) {
      context = new EvaluationContext(null, tmpContext.getDefaultVariable());
      copyVariable(context, tmpContext, ISources.ACTIVE_CURRENT_SELECTION_NAME);
      copyVariable(context, tmpContext, ISources.ACTIVE_FOCUS_CONTROL_ID_NAME);
      copyVariable(context, tmpContext, ISources.ACTIVE_FOCUS_CONTROL_NAME);
      copyVariable(context, tmpContext, ISources.ACTIVE_MENU_EDITOR_INPUT_NAME);
      copyVariable(context, tmpContext, ISources.ACTIVE_MENU_NAME);
View Full Code Here

      final Object trigger = event.getTrigger();

      // Attempt to update the selection.
      final Object applicationContext = event.getApplicationContext();
      if (applicationContext instanceof IEvaluationContext) {
        final IEvaluationContext context = (IEvaluationContext) applicationContext;
        updateDelegate(action, context);
      }

      // Decide what type of delegate we have.
      if ((delegate instanceof IActionDelegate2)
View Full Code Here

  }

  public final boolean isEnabled() {
    final IHandlerService service = (IHandlerService) window
        .getService(IHandlerService.class);
    IEvaluationContext context = service.getCurrentState();
    return isEnabled(context);
  }
View Full Code Here

{
  public static void openModel(EObject model)
  {
    IHandlerService handlerService  = (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class);

        IEvaluationContext context = handlerService.getCurrentState();
        context.addVariable(ActionHelper.ME_TO_OPEN_EVALUATIONCONTEXT_VARIABLE, model);

        try
        {
          context.addVariable(ActionHelper.MECONTEXT_EVALUATIONCONTEXT_VARIABLE, ECPWorkspaceManager.getInstance().getWorkSpace().getProject(model));
            handlerService.executeCommand(ActionHelper.MEEDITOR_OPENMODELELEMENT_COMMAND_ID, null);
        }
        catch (ExecutionException e)
        {
          DialogHandler.showExceptionDialog(e);
View Full Code Here

      return false;
    }
  }
 
  private IEvaluationContext createContext(Object selection) {
    IEvaluationContext context = new EvaluationContext(null, selection);
    context.addVariable("selection", selection); //$NON-NLS-1$
    return context;
  }
View Full Code Here

          return result;
        }
            }
            if (enablement != null) {
                try {
                    IEvaluationContext context = new EvaluationContext(null,
                            object);
                    context.setAllowPluginActivation(true);
                    context.addVariable("selection", object); //$NON-NLS-1$
                    EvaluationResult evalResult = enablement.evaluate(context);
                    if (evalResult == EvaluationResult.FALSE) {
            return false;
          }
                } catch (CoreException e) {
View Full Code Here

   *            <code>null</code>.
   * @return <code>true</code> if the expression evaluates to
   *         <code>true</code>; <code>false</code> otherwise.
   */
  protected final boolean evaluate(final IEvaluationResultCache expression) {
    final IEvaluationContext contextWithDefaultVariable = getCurrentState();
    return expression.evaluate(contextWithDefaultVariable);
  }
View Full Code Here

   */
  public final IEvaluationContext getCurrentState() {
    if (currentState == null) {
      final Object defaultVariable = context
          .getVariable(ISources.ACTIVE_CURRENT_SELECTION_NAME);
      final IEvaluationContext contextWithDefaultVariable;
      if (defaultVariable instanceof IStructuredSelection) {
        final IStructuredSelection selection = (IStructuredSelection) defaultVariable;
        contextWithDefaultVariable = new EvaluationContext(context,
            selection.toList());
      } else if ((defaultVariable instanceof ISelection)
View Full Code Here

TOP

Related Classes of org.eclipse.core.expressions.IEvaluationContext

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.