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