1 11 12 package org.eclipse.core.internal.events; 13 14 import java.util.EventObject ; 15 import org.eclipse.core.resources.IPathVariableChangeEvent; 16 import org.eclipse.core.resources.IPathVariableManager; 17 import org.eclipse.core.runtime.IPath; 18 19 23 public class PathVariableChangeEvent extends EventObject implements IPathVariableChangeEvent { 24 private static final long serialVersionUID = 1L; 25 26 29 private String variableName; 30 31 34 private IPath value; 35 36 37 private int type; 38 39 42 public PathVariableChangeEvent(IPathVariableManager source, String variableName, IPath value, int type) { 43 super(source); 44 if (type < VARIABLE_CHANGED || type > VARIABLE_DELETED) 45 throw new IllegalArgumentException ("Invalid event type: " + type); this.variableName = variableName; 47 this.value = value; 48 this.type = type; 49 } 50 51 54 public IPath getValue() { 55 return value; 56 } 57 58 61 public String getVariableName() { 62 return variableName; 63 } 64 65 68 public int getType() { 69 return type; 70 } 71 72 75 public String toString() { 76 String [] typeStrings = {"VARIABLE_CHANGED", "VARIABLE_CREATED", "VARIABLE_DELETED"}; StringBuffer sb = new StringBuffer (getClass().getName()); 78 sb.append("[variable = "); sb.append(variableName); 80 sb.append(", type = "); sb.append(typeStrings[type - 1]); 82 if (type != VARIABLE_DELETED) { 83 sb.append(", value = "); sb.append(value); 85 } 86 sb.append("]"); return sb.toString(); 88 } 89 90 } 91 | Popular Tags |