Package cbg.editor.jedit

Examples of cbg.editor.jedit.Mode$ModeSyntaxListener


      add(rule, type, factory, rules);
    }
  }
  public static void add(final Rule rule, final Type type, ITokenFactory factory, final List rules) {
    final IToken token = factory.makeToken(type);
    final Mode mode = rule.getMode();
    final boolean ignoreCase = rule.getIgnoreCase();
    type.accept(new IVisitor() {
      public void acceptSpan(Span span) {
        IToken defaultToken = token;
        if(span.hasDelegate()) {
          Rule delegateRule = mode.getRule(span.getDelegate());
          defaultToken = new DelegateToken(type, delegateRule, span.getEnd());
        }
        /* Using a PatternRule instead of a MultiLineRule because
         * PatternRule exposes the break on newline behavior. */
        PatternRule pat = new CasedPatternRule(span.getStart(), span.getEnd(),
          defaultToken, mode.getDefaultRuleSet().getEscape(), span.noLineBreak(),
          ignoreCase);
        rules.add(pat);
      }
      public void acceptTextSequence(TextSequence text) {
        /* If the text sequence can be recognized as a word, don't
View Full Code Here


        if (category == null) return;
        if (category.equals(EditorPlugin.STATUS_CATEGORY_MODE)) {
            IStatusField field = getStatusField(category);
            if (field != null) {
                field.setImage(EditorPlugin.getImage("box"));
                Mode mode = ((ColoringSourceViewerConfiguration) getSourceViewerConfiguration()).getMode();
                String text = mode == null ? "No mode" : mode.getDisplayName();
                field.setText(text);
                return;
            }
        }
        super.updateStatusField(category);
View Full Code Here

  private String filenameToModeName(String filename) {
    Mode[] localModes = getModeList();
    if(localModes == null) return null;
    for (int i = 0; i < localModes.length; i++) {
      Mode mode = localModes[i];
      if(mode.matches(filename)) return mode.getFilename();
    }
    return null;
  }
View Full Code Here

  protected void loadCatalog() {
    CatalogReader reader = new CatalogReader();
    modeList = reader.read("modes/catalog");
    for (int i = 0; i < modeList.length; i++) {
      Mode mode = modeList[i];
      modes.put(mode.getFilename(), mode);
    }
  }
View Full Code Here

    loadIfNecessary(name);
    return (Mode) modes.get(name);
  }

  private void loadIfNecessary(String name) {
    Mode hull = (Mode) modes.get(name);
    if(hull == null) {
      loadCatalog();
      /* this will happen when there was a problem loading the
       * catalog */
      if(modes.size() == 0) return;
      hull = (Mode) modes.get(name);
    }
    if(hull.notLoaded()) hull.load();
  }
View Full Code Here

    int index = delegateName.indexOf("::");
    if(index == -1) {
      // Local delegate/rule set
      return mode.getRule(delegateName);
    }
    Mode loadedMode = getMode(delegateName.substring(0, index) + ".xml");
    return loadedMode.getRule(delegateName.substring(index + 2));
  }
View Full Code Here

TOP

Related Classes of cbg.editor.jedit.Mode$ModeSyntaxListener

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.