1 11 package org.eclipse.ui.internal.navigator.extensions; 12 13 20 public final class OverridePolicy { 21 22 26 public static final int InvokeOnlyIfSuppressedExtAlsoVisibleAndActive_VALUE = -1; 27 28 31 public static final int InvokeAlwaysRegardlessOfSuppressedExt_VALUE = 1; 32 33 37 public static final String InvokeOnlyIfSuppressedExtAlsoVisibleAndActive_LITERAL = "InvokeOnlyIfSuppressedExtAlsoVisibleAndActive"; 39 43 public static final String InvokeAlwaysRegardlessOfSuppressedExt_LITERAL = "InvokeAlwaysRegardlessOfSuppressedExt"; 45 49 public static final OverridePolicy InvokeOnlyIfSuppressedExtAlsoVisibleAndActive = new OverridePolicy( 50 InvokeOnlyIfSuppressedExtAlsoVisibleAndActive_VALUE, 51 InvokeOnlyIfSuppressedExtAlsoVisibleAndActive_LITERAL); 52 53 57 public static final OverridePolicy InvokeAlwaysRegardlessOfSuppressedExt = new OverridePolicy( 58 InvokeAlwaysRegardlessOfSuppressedExt_VALUE, 59 InvokeAlwaysRegardlessOfSuppressedExt_LITERAL); 60 61 64 public static final OverridePolicy[] ENUM_ARRAY = new OverridePolicy[] { 65 InvokeOnlyIfSuppressedExtAlsoVisibleAndActive, 66 InvokeAlwaysRegardlessOfSuppressedExt }; 67 68 82 public static OverridePolicy get(String aLiteral) { 83 for (int i = 0; i < ENUM_ARRAY.length; i++) { 84 if (ENUM_ARRAY[i].getLiteral().equals(aLiteral)) { 85 return ENUM_ARRAY[i]; 86 } 87 } 88 return InvokeAlwaysRegardlessOfSuppressedExt; 89 } 90 91 105 public static OverridePolicy get(int aValue) { 106 107 switch (aValue) { 108 case InvokeOnlyIfSuppressedExtAlsoVisibleAndActive_VALUE: 109 return InvokeOnlyIfSuppressedExtAlsoVisibleAndActive; 110 case InvokeAlwaysRegardlessOfSuppressedExt_VALUE: 111 default: 112 return InvokeAlwaysRegardlessOfSuppressedExt; 113 114 } 115 } 116 117 private final int value; 118 119 private final String literal; 120 121 protected OverridePolicy(int aValue, String aLiteral) { 122 value = aValue; 123 literal = aLiteral; 124 } 125 126 130 public String getLiteral() { 131 return literal; 132 } 133 134 138 public int getValue() { 139 return value; 140 } 141 } 142 | Popular Tags |