Search in sources :

Example 1 with EvaluationReference

use of org.eclipse.ui.internal.services.EvaluationReference in project eclipse.platform.ui by eclipse-platform.

the class WorkbenchWindow method liftRestrictions.

void liftRestrictions() {
    if (menuRestrictions.isEmpty()) {
        return;
    }
    EvaluationReference[] refs = menuRestrictions.toArray(new EvaluationReference[menuRestrictions.size()]);
    IEvaluationService es = serviceLocator.getService(IEvaluationService.class);
    IEvaluationContext currentState = es.getCurrentState();
    for (EvaluationReference reference : refs) {
        reference.setPostingChanges(true);
        boolean os = reference.evaluate(currentState);
        reference.clearResult();
        boolean ns = reference.evaluate(currentState);
        if (os != ns) {
            reference.getListener().propertyChange(new PropertyChangeEvent(reference, reference.getProperty(), valueOf(os), valueOf(ns)));
        }
    }
}
Also used : PropertyChangeEvent(org.eclipse.jface.util.PropertyChangeEvent) IEvaluationContext(org.eclipse.core.expressions.IEvaluationContext) EvaluationReference(org.eclipse.ui.internal.services.EvaluationReference) IEvaluationService(org.eclipse.ui.services.IEvaluationService)

Example 2 with EvaluationReference

use of org.eclipse.ui.internal.services.EvaluationReference in project eclipse.platform.ui by eclipse-platform.

the class WorkbenchWindow method imposeRestrictions.

void imposeRestrictions() {
    Iterator<?> i = menuRestrictions.iterator();
    while (i.hasNext()) {
        EvaluationReference ref = (EvaluationReference) i.next();
        ref.setPostingChanges(false);
    }
}
Also used : EvaluationReference(org.eclipse.ui.internal.services.EvaluationReference)

Aggregations

EvaluationReference (org.eclipse.ui.internal.services.EvaluationReference)2 IEvaluationContext (org.eclipse.core.expressions.IEvaluationContext)1 PropertyChangeEvent (org.eclipse.jface.util.PropertyChangeEvent)1 IEvaluationService (org.eclipse.ui.services.IEvaluationService)1