@Override
 protected void setUp() throws Exception {
   super.setUp();
   GroovyPlugin.getDefault()
       .getPreferenceStore()
       .setValue(PreferenceConstants.GROOVY_CONTENT_ASSIST_NOPARENS, false);
 }
 public static String lastWord(final IDocument doc, final int offset) {
   try {
     for (int n = offset - 1; n >= 0; n--) {
       final char c = doc.getChar(n);
       if (!Character.isJavaIdentifierPart(c)) return doc.get(n + 1, offset - n - 1);
     }
   } catch (final BadLocationException e) {
     GroovyPlugin.getPlugin().logException(e.getMessage(), e);
   }
   return "";
 }
 public static String lastIndent(final IDocument doc, final int offset) {
   try {
     int start = offset - 1;
     while (start >= 0 && doc.getChar(start) != '\n') start--;
     int end = start;
     while (end < offset && Character.isSpaceChar(doc.getChar(end))) end++;
     return doc.get(start + 1, end - start - 1);
   } catch (final BadLocationException e) {
     GroovyPlugin.getPlugin().logException(e.getMessage(), e);
   }
   return "";
 }
Exemplo n.º 4
0
  public GroovyEditor() {
    super();

    setPreferenceStore(
        new ChainedPreferenceStore(
            new IPreferenceStore[] {
              getPreferenceStore(),
              JavaPlugin.getDefault().getPreferenceStore(),
              GroovyPlugin.getDefault().getPreferenceStore()
            }));

    colorManager = new ColorManager();
    GroovyConfiguration groovyConfiguration = new GroovyConfiguration(colorManager);
    groovyConfiguration.setEditor(this);
    setSourceViewerConfiguration(groovyConfiguration);
  }
 public FormatterPreferencesPage() {
   super(GRID);
   setPreferenceStore(GroovyPlugin.getDefault().getPreferenceStore());
   new FormatterPreferenceInitializer().initializeDefaultPreferences();
 }