Package org.eclipse.core.expressions

Examples of org.eclipse.core.expressions.Expression


   * window.
   */
  private final void initializeDefaultServices() {
    serviceLocator.registerService(IWorkbenchWindow.class, this);
   
    final Expression defaultExpression = new WorkbenchWindowExpression(this);

    final IHandlerService parentHandlerService = (IHandlerService) serviceLocator
        .getService(IHandlerService.class);
    final IHandlerService handlerService = new SlaveHandlerService(
        parentHandlerService, defaultExpression);
View Full Code Here


      if ((newShell.getParent() != null)
          && (registeredWindows.get(newShell) == null)) {
        // This is a dialog by default.
        newActivations = new ArrayList();
        final Expression expression = new ActiveShellExpression(
            newShell);
        final IContextActivation dialogWindowActivation = new ContextActivation(
            IContextService.CONTEXT_ID_DIALOG_AND_WINDOW,
            expression, contextService);
        activateContext(dialogWindowActivation);
View Full Code Here

      Tracing.printTrace(TRACING_COMPONENT, buffer.toString());
    }

    // Build the list of submissions.
    final List activations = new ArrayList();
    Expression expression;
    IContextActivation dialogWindowActivation;
    switch (type) {
    case IContextService.TYPE_DIALOG:
      expression = new ActiveShellExpression(shell);
      dialogWindowActivation = new ContextActivation(
View Full Code Here

  private Map<String, Expression> expressions = new HashMap<String, Expression>();

  public boolean test(Object receiver, String property, Object[] args,
      Object expectedValue) {
    String delegateShortcutID = (String) args[0];
    Expression expr = expressions.get(delegateShortcutID);
    if (expr == null) {
      expr = createEnablementExpression(delegateShortcutID);
      expressions.put(delegateShortcutID, expr);
    }
    try {
      return expr.evaluate(createContext(receiver)) != EvaluationResult.FALSE;
    } catch (CoreException ce) {
      EclEmmaUIPlugin.log(ce);
      return false;
    }
  }
View Full Code Here

        return fConfig.getContributor().getName();
    }
   
    public boolean isEnabledFor(IConsole console) throws CoreException {
        EvaluationContext context = new EvaluationContext(null, console);
        Expression expression = getEnablementExpression();
        if (expression != null){
          EvaluationResult evaluationResult = expression.evaluate(context);
            return evaluationResult == EvaluationResult.TRUE; 
        }
        return true;
    }
View Full Code Here

    }

    private void initializeActions() {
      final ArrayList handlerActivations= new ArrayList(3);
      final IHandlerService handlerService= (IHandlerService)PlatformUI.getWorkbench().getAdapter(IHandlerService.class);
      final Expression expression= new ActiveShellExpression(fPatternEditor.getControl().getShell());

      getShell().addDisposeListener(new DisposeListener() {

        public void widgetDisposed(DisposeEvent e) {
          handlerService.deactivateHandlers(handlerActivations);
View Full Code Here

        return fConfig.getContributor().getName();
    }

    public boolean isEnabled() {
        try {
            Expression enablementExpression = getEnablementExpression();
            if (enablementExpression == null) {
                return true;
            }
            EvaluationContext context = new EvaluationContext(null, this);
            EvaluationResult evaluationResult = enablementExpression.evaluate(context);
            return evaluationResult != EvaluationResult.FALSE;
        } catch (CoreException e) {
            ConsolePlugin.log(e);
            return false;
        }
View Full Code Here

      public void widgetDisposed(DisposeEvent e) {
        handlerService.deactivateHandlers(handlerActivations);
      }
    });

    Expression expression = new ActiveShellExpression(fPatternEditor
        .getControl().getShell());

    TextViewerAction action = new TextViewerAction(fPatternEditor,
        ITextOperationTarget.UNDO);
    action.setText(PreferencesMessages.EditTemplateDialog_undo);
View Full Code Here

    uaElementToImport.element = elementToImport;
  }

  private boolean isEnabledByEnablementElement(Element enablement, IEvaluationContext context) {
    try {
      Expression expression = ExpressionConverter.getDefault().perform(enablement);
      return expression.evaluate(context) == EvaluationResult.TRUE;
    }
    catch (CoreException e) {
      /*
       * This can happen when attempting to resolve a UI variable (e.g. "workbench")
       * in a non-UI environment (infocenter mode). Fail silently.
View Full Code Here

  private Map<String, Expression> expressions = new HashMap<String, Expression>();

  public boolean test(Object receiver, String property, Object[] args,
      Object expectedValue) {
    String delegateShortcutID = (String) args[0];
    Expression expr = expressions.get(delegateShortcutID);
    if (expr == null) {
      expr = createEnablementExpression(delegateShortcutID);
      expressions.put(delegateShortcutID, expr);
    }
    try {
      return expr.evaluate(createContext(receiver)) != EvaluationResult.FALSE;
    } catch (CoreException ce) {
      EclEmmaUIPlugin.log(ce);
      return false;
    }
  }
View Full Code Here

TOP

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

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.