1 11 package org.eclipse.ui.commands; 12 13 import java.util.Map ; 14 15 import org.eclipse.ui.internal.util.Util; 16 17 28 public final class HandlerEvent { 29 30 33 private final boolean attributeValuesByNameChanged; 34 35 38 private final IHandler handler; 39 40 44 private Map previousAttributeValuesByName; 45 46 58 private final Map originalPreviousAttributeValuesByName; 59 60 75 public HandlerEvent(IHandler handler, boolean attributeValuesByNameChanged, 76 Map previousAttributeValuesByName) { 77 if (handler == null) { 78 throw new NullPointerException (); 79 } 80 81 if (!attributeValuesByNameChanged 82 && previousAttributeValuesByName != null) { 83 throw new IllegalArgumentException (); 84 } 85 86 if (attributeValuesByNameChanged) { 87 this.originalPreviousAttributeValuesByName = previousAttributeValuesByName; 88 } else { 89 this.originalPreviousAttributeValuesByName = null; 90 } 91 92 this.handler = handler; 93 this.attributeValuesByNameChanged = attributeValuesByNameChanged; 94 } 95 96 102 public IHandler getHandler() { 103 return handler; 104 } 105 106 117 public Map getPreviousAttributeValuesByName() { 118 if (originalPreviousAttributeValuesByName == null) { 119 return null; 120 } 121 122 if (previousAttributeValuesByName == null) { 123 previousAttributeValuesByName = Util.safeCopy( 124 originalPreviousAttributeValuesByName, String .class, Object .class, 125 false, true); 126 } 127 128 return previousAttributeValuesByName; 129 } 130 131 136 public boolean haveAttributeValuesByNameChanged() { 137 return attributeValuesByNameChanged; 138 } 139 } 140 | Popular Tags |