1 11 package org.eclipse.ui.commands; 12 13 import org.eclipse.core.expressions.Expression; 14 import org.eclipse.ui.ISources; 15 import org.eclipse.ui.internal.util.Util; 16 17 45 public final class Priority implements Comparable { 46 47 50 public final static Priority LEGACY = new Priority(ISources.LEGACY_LEGACY); 51 52 55 public final static Priority LOW = new Priority(ISources.LEGACY_LOW); 56 57 60 public final static Priority MEDIUM = new Priority(ISources.LEGACY_MEDIUM); 61 62 66 private transient String string = null; 67 68 72 private int value; 73 74 83 private Priority(int value) { 84 this.value = value; 85 } 86 87 90 public int compareTo(Object object) { 91 Priority castedObject = (Priority) object; 92 int compareTo = Util.compare(value, castedObject.value); 93 return compareTo; 94 } 95 96 102 int getValue() { 103 return value; 104 } 105 106 109 public String toString() { 110 if (string == null) { 111 final StringBuffer stringBuffer = new StringBuffer (); 112 stringBuffer.append("[value="); stringBuffer.append(value); 114 stringBuffer.append(']'); 115 string = stringBuffer.toString(); 116 } 117 118 return string; 119 } 120 } 121 | Popular Tags |