@Override public Object getVariable(String name) { return fParent.getVariable(name); } @Override
private void copyVariable(IEvaluationContext context, IEvaluationContext tmpContext, String var) { Object o = tmpContext.getVariable(var); if (o != null) { context.addVariable(var, o); } }
/** * {@inheritDoc} */ @Override public void setAllowPluginActivation(boolean value) { fParent.setAllowPluginActivation(value); }
/** * Changes the variable of the given name. If the <code>value</code> is * <code>null</code>, then the variable is removed. * * @param name * The name of the variable to change; must not be * <code>null</code>. * @param value * The new value; the variable should be removed if this is * <code>null</code>. */ protected final void changeVariable(final String name, final Object value) { if (value == null) { context.removeVariable(name); } else { context.addVariable(name, value); } }
/** * Constructs a new instance of <code>ExpressionAuthority</code>. */ protected ExpressionAuthority() { context = new EvaluationContext(null, this); context.setAllowPluginActivation(true); context.addVariable("org.eclipse.core.runtime.Platform", Platform.class); //$NON-NLS-1$ // this is not as useful as it appears // context.addVariable("java.lang.System", System.class); //$NON-NLS-1$ }
@Override public void addVariable(String name, Object value) { fParent.addVariable(name, value); } @Override
@Override public EvaluationResult evaluate(IEvaluationContext context) throws CoreException { Object element= context.getDefaultVariable(); return EvaluationResult.valueOf(element.equals(fExpectedValue)); }
public EvaluationResult evaluate(IEvaluationContext context) throws CoreException { Object element= context.getDefaultVariable(); if (System.class.equals(element)) { String str= System.getProperty(fProperty); if (str == null) return EvaluationResult.FALSE; return EvaluationResult.valueOf(str.equals(fArgs[0])); } Property property= fgTypeExtensionManager.getProperty(element, fNamespace, fProperty, context.getAllowPluginActivation() && fForcePluginActivation); if (!property.isInstantiated()) return EvaluationResult.NOT_LOADED; return EvaluationResult.valueOf(property.test(element, fArgs, fExpectedValue)); }
/** * Constructs a new variable pool for a single default variable. * * @param parent the parent context for the default variable. Must not * be <code>null</code>. * @param defaultVariable the default variable */ public DefaultVariable(IEvaluationContext parent, Object defaultVariable) { Assert.isNotNull(parent); Assert.isNotNull(defaultVariable); fParent= parent; while (parent instanceof DefaultVariable) { parent= parent.getParent(); } fManagedPool= parent; fDefaultVariable= defaultVariable; }
/** * {@inheritDoc} */ @Override public Object removeVariable(String name) { return fManagedPool.removeVariable(name); }
/** * {@inheritDoc} */ public boolean getAllowPluginActivation() { return fParent.getAllowPluginActivation(); }
/** * {@inheritDoc} */ @Override public IEvaluationContext getRoot() { return fParent.getRoot(); }
/** * @return an Evaluation context with default variable = selection */ private IEvaluationContext createContext() { IStructuredSelection ss = SelectedResourceManager.getDefault().getCurrentSelection(); Object o = ss.getFirstElement(); List<IEditorInput> list = new ArrayList<>(0); if(o instanceof IEditorPart) { list.add(((IEditorPart)o).getEditorInput()); } else { list.addAll(ss.toList()); } IEvaluationContext context = DebugUIPlugin.createEvaluationContext(list); context.setAllowPluginActivation(true); context.addVariable("selection", list); //$NON-NLS-1$ return context; }
/** * {@inheritDoc} */ public void addVariable(String name, Object value) { fManagedPool.addVariable(name, value); }
@Override public EvaluationResult evaluate(IEvaluationContext context) throws CoreException { Object element= context.getDefaultVariable(); return EvaluationResult.valueOf(element.equals(fExpectedValue)); }
@Override public EvaluationResult evaluate(IEvaluationContext context) throws CoreException { Object element= context.getDefaultVariable(); if (System.class.equals(element)) { String str= System.getProperty(fProperty); if (str == null) return EvaluationResult.FALSE; return EvaluationResult.valueOf(str.equals(fArgs[0])); } Property property= fgTypeExtensionManager.getProperty(element, fNamespace, fProperty, context.getAllowPluginActivation() && fForcePluginActivation); if (!property.isInstantiated()) return EvaluationResult.NOT_LOADED; return EvaluationResult.valueOf(property.test(element, fArgs, fExpectedValue)); }
/** * Constructs a new variable pool for a single default variable. * * @param parent the parent context for the default variable. Must not * be <code>null</code>. * @param defaultVariable the default variable */ public DefaultVariable(IEvaluationContext parent, Object defaultVariable) { Assert.isNotNull(parent); Assert.isNotNull(defaultVariable); fParent= parent; while (parent instanceof DefaultVariable) { parent= parent.getParent(); } fManagedPool= parent; fDefaultVariable= defaultVariable; }
@Override public Object removeVariable(String name) { return fParent.removeVariable(name); } @Override
@Override public boolean getAllowPluginActivation() { return fParent.getAllowPluginActivation(); } @Override
/** * {@inheritDoc} */ public IEvaluationContext getRoot() { return fParent.getRoot(); }