1 11 12 package org.eclipse.ui.keys; 13 14 import org.eclipse.jface.bindings.keys.IKeyLookup; 15 import org.eclipse.jface.bindings.keys.KeyLookupFactory; 16 import org.eclipse.ui.internal.util.Util; 17 18 41 public abstract class Key implements Comparable { 42 43 47 protected final int key; 48 49 57 Key(final int key) { 58 this.key = key; 59 } 60 61 64 public final int compareTo(final Object object) { 65 return Util.compare(key, ((Key) object).key); 66 } 67 68 71 public final boolean equals(final Object object) { 72 if (!(object instanceof Key)) { 73 return false; 74 } 75 76 return key == ((Key) object).key; 77 } 78 79 82 public final int hashCode() { 83 return Util.hashCode(key); 84 } 85 86 93 public final String toString() { 94 final IKeyLookup lookup = KeyLookupFactory.getDefault(); 95 return lookup.formalNameLookup(key); 96 } 97 } 98 | Popular Tags |