/**
   * Maps the localized modifier name to a code in the same manner as #findModifier.
   *
   * @param modifierName the modifier name
   * @return the SWT modifier bit, or <code>0</code> if no match was found
   */
  private static final int findLocalizedModifier(String modifierName) {
    if (modifierName == null) return 0;

    if (modifierName.equalsIgnoreCase(Action.findModifierString(SWT.CTRL))) return SWT.CTRL;
    if (modifierName.equalsIgnoreCase(Action.findModifierString(SWT.SHIFT))) return SWT.SHIFT;
    if (modifierName.equalsIgnoreCase(Action.findModifierString(SWT.ALT))) return SWT.ALT;
    if (modifierName.equalsIgnoreCase(Action.findModifierString(SWT.COMMAND))) return SWT.COMMAND;

    return 0;
  }
예제 #2
0
 /**
  * Creates a new editor configuration.
  *
  * @param resourceProvider the provider for the resource (usually this is the editor)
  * @param colorManager the color manager to use
  */
 public TestmodelSourceViewerConfiguration(
     edu.ustb.sei.mde.testing.testdefinition.resource.testmodel.ITestmodelResourceProvider
         resourceProvider,
     edu.ustb.sei.mde.testing.testdefinition.resource.testmodel.ui
             .ITestmodelAnnotationModelProvider
         annotationModelProvider,
     edu.ustb.sei.mde.testing.testdefinition.resource.testmodel.ui.ITestmodelBracketHandlerProvider
         bracketHandlerProvider,
     edu.ustb.sei.mde.testing.testdefinition.resource.testmodel.ui.TestmodelColorManager
         colorManager) {
   super(
       edu.ustb.sei.mde.testing.testdefinition.resource.testmodel.ui.TestmodelUIPlugin.getDefault()
           .getPreferenceStore());
   this.fPreferenceStore.setDefault(
       org.eclipse.ui.texteditor.spelling.SpellingService.PREFERENCE_SPELLING_ENABLED, true);
   this.fPreferenceStore.setDefault(
       org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH,
       4);
   this.fPreferenceStore.setDefault(
       org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants
           .EDITOR_HYPERLINK_KEY_MODIFIER,
       org.eclipse.jface.action.Action.findModifierString(org.eclipse.swt.SWT.MOD1));
   this.resourceProvider = resourceProvider;
   this.annotationModelProvider = annotationModelProvider;
   this.bracketHandlerProvider = bracketHandlerProvider;
   this.colorManager = colorManager;
 }
 /**
  * Appends to modifier string of the given SWT modifier bit to the given modifierString.
  *
  * @param modifierString the modifier string
  * @param modifier an int with SWT modifier bit
  * @return the concatenated modifier string
  */
 private static final String appendModifierString(String modifierString, int modifier) {
   if (modifierString == null) modifierString = ""; // $NON-NLS-1$
   String newModifierString = Action.findModifierString(modifier);
   if (modifierString.length() == 0) return newModifierString;
   return NLSUtility.format(
       TextEditorMessages.HyperlinkKeyModifier_concatModifierStrings,
       new String[] {modifierString, newModifierString});
 }
예제 #4
0
  /**
   * Maps the localized modifier name to a code in the same manner as #findModifier.
   *
   * @param modifierName the modifier name
   * @return the SWT modifier bit, or <code>0</code> if no match was found
   * @since 2.1.1
   */
  public static int findLocalizedModifier(final String modifierName) {
    if (modifierName == null) {
      return 0;
    }

    if (modifierName.equalsIgnoreCase(Action.findModifierString(SWT.CTRL))) {
      return SWT.CTRL;
    }
    if (modifierName.equalsIgnoreCase(Action.findModifierString(SWT.SHIFT))) {
      return SWT.SHIFT;
    }
    if (modifierName.equalsIgnoreCase(Action.findModifierString(SWT.ALT))) {
      return SWT.ALT;
    }
    if (modifierName.equalsIgnoreCase(Action.findModifierString(SWT.COMMAND))) {
      return SWT.COMMAND;
    }

    return 0;
  }
예제 #5
0
 /**
  * Appends to modifier string of the given SWT modifier bit to the given modifierString.
  *
  * @param modifierString the modifier string
  * @param modifier an int with SWT modifier bit
  * @return the concatenated modifier string
  */
 private static String appendModifierString(String modifierString, int modifier) {
   if (modifierString == null) {
     modifierString = ""; // $NON-NLS-1$
   }
   String newModifierString = Action.findModifierString(modifier);
   if (modifierString.length() == 0) {
     return newModifierString;
   }
   return Messages.format(
       DartEditorMessages.EditorUtility_concatModifierStrings,
       new String[] {modifierString, newModifierString});
 }