1 11 package org.eclipse.core.internal.expressions; 12 13 import org.eclipse.core.runtime.Assert; 14 import org.eclipse.core.runtime.CoreException; 15 16 import org.eclipse.core.expressions.IEvaluationContext; 17 18 24 public final class DefaultVariable implements IEvaluationContext { 25 26 private Object fDefaultVariable; 27 private IEvaluationContext fParent; 28 private IEvaluationContext fManagedPool; 29 30 37 public DefaultVariable(IEvaluationContext parent, Object defaultVariable) { 38 Assert.isNotNull(parent); 39 Assert.isNotNull(defaultVariable); 40 fParent= parent; 41 while (parent instanceof DefaultVariable) { 42 parent= parent.getParent(); 43 } 44 fManagedPool= parent; 45 fDefaultVariable= defaultVariable; 46 } 47 48 51 public IEvaluationContext getParent() { 52 return fParent; 53 } 54 55 58 public IEvaluationContext getRoot() { 59 return fParent.getRoot(); 60 } 61 62 65 public Object getDefaultVariable() { 66 return fDefaultVariable; 67 } 68 69 72 public void setAllowPluginActivation(boolean value) { 73 fParent.setAllowPluginActivation(value); 74 } 75 76 79 public boolean getAllowPluginActivation() { 80 return fParent.getAllowPluginActivation(); 81 } 82 83 86 public void addVariable(String name, Object value) { 87 fManagedPool.addVariable(name, value); 88 } 89 90 93 public Object removeVariable(String name) { 94 return fManagedPool.removeVariable(name); 95 } 96 97 100 public Object getVariable(String name) { 101 return fManagedPool.getVariable(name); 102 } 103 104 107 public Object resolveVariable(String name, Object [] args) throws CoreException { 108 return fManagedPool.resolveVariable(name, args); 109 } 110 } 111 | Popular Tags |