1 11 12 package org.eclipse.ui.internal.keys; 13 14 import java.util.Comparator ; 15 import java.util.ResourceBundle ; 16 17 import org.eclipse.ui.internal.util.Util; 18 import org.eclipse.ui.keys.KeySequence; 19 import org.eclipse.ui.keys.KeyStroke; 20 import org.eclipse.ui.keys.ModifierKey; 21 22 public final class KdeKeyFormatter extends AbstractKeyFormatter { 23 24 private final static class KdeModifierKeyComparator extends 25 AbstractModifierKeyComparator { 26 27 protected int rank(ModifierKey modifierKey) { 28 if (ModifierKey.ALT.equals(modifierKey)) { 29 return 0; 30 } 31 32 if (ModifierKey.CTRL.equals(modifierKey)) { 33 return 1; 34 } 35 36 if (ModifierKey.SHIFT.equals(modifierKey)) { 37 return 2; 38 } 39 40 return Integer.MAX_VALUE; 41 } 42 } 43 44 private final static Comparator MODIFIER_KEY_COMPARATOR = new KdeModifierKeyComparator(); 45 46 private final static ResourceBundle RESOURCE_BUNDLE = ResourceBundle 47 .getBundle(KdeKeyFormatter.class.getName()); 48 49 protected String getKeyDelimiter() { 50 return Util.translateString(RESOURCE_BUNDLE, KEY_DELIMITER_KEY, 51 KeyStroke.KEY_DELIMITER, false, false); 52 } 53 54 protected String getKeyStrokeDelimiter() { 55 return Util.translateString(RESOURCE_BUNDLE, KEY_STROKE_DELIMITER_KEY, 56 KeySequence.KEY_STROKE_DELIMITER, false, false); 57 } 58 59 protected Comparator getModifierKeyComparator() { 60 return MODIFIER_KEY_COMPARATOR; 61 } 62 } 63 | Popular Tags |