Package org.eclipse.dltk.ast.declarations

Examples of org.eclipse.dltk.ast.declarations.ModuleDeclaration


      removeAnnotations(myAnnotations.keySet());
    }

    RutaSelectionParser parser = new RutaSelectionParser();
    ISourceModule unit = (ISourceModule) getInputModelElement();
    ModuleDeclaration parsed = parser.parse(unit);
    RutaRuleIdVisitor visitor = new RutaRuleIdVisitor(id);
    try {
      parsed.traverse(visitor);
    } catch (Exception e) {
    }
    RutaRule rule = visitor.getResult();
    myAnnotations = new HashMap<Annotation, Position>();
    if (rule != null) {
View Full Code Here


    return highlightings;
  }

  public void doOtherHighlighting(ISourceModule code,
          final ISemanticHighlightingRequestor semanticHighlightingRequestor) {
    ModuleDeclaration moduleDeclaration = SourceParserUtil
            .getModuleDeclaration((org.eclipse.dltk.core.ISourceModule) (code.getModelElement()));
    if (moduleDeclaration instanceof RutaModuleDeclaration) {
      RutaModuleDeclaration md = (RutaModuleDeclaration) moduleDeclaration;
      if (md != null) {
View Full Code Here

     * if an ASTVisitor implementation is created for this, just override getFoldingVisitor() and
     * remove this method
     */
    ISourceParser pp = null;
    pp = DLTKLanguageManager.getSourceParser(RutaNature.NATURE_ID);
    ModuleDeclaration md = (ModuleDeclaration) pp.parse(new ModuleSource(code), null);
    List statements = md.getStatements();
    if (statements == null) {
      return new CodeBlock[0];
    }

    List result = new ArrayList();
View Full Code Here

  }

  private PairBlock[] computePairRanges(final int offset, String contents) {
    ISourceParser pp = null;
    pp = DLTKLanguageManager.getSourceParser(RutaNature.NATURE_ID);
    ModuleDeclaration md = null;// pp.parse(null, contents.toCharArray(),
    // null);
    IModelElement el = this.editor.getInputModelElement();
    if (el != null && el instanceof ISourceModule) {
      md = SourceParserUtil.getModuleDeclaration((ISourceModule) el, null);
    }
    if (md == null) {
      md = (ModuleDeclaration) pp.parse(new ModuleSource(contents), null);
    }
    if (md == null) {
      return new PairBlock[0];
    }
    final List result = new ArrayList();
    try {
      md.traverse(new ASTVisitor() {
        @Override
        public boolean visitGeneral(ASTNode node) throws Exception {
          if (node instanceof StringLiteral) {
            StringLiteral be = (StringLiteral) node;
            result.add(new PairBlock(offset + be.sourceStart(), offset + be.sourceEnd() - 1, '\"'));
View Full Code Here

    // unit comes from ModuleDeclaration parsedUnit = this.parser.parse(possibleMatch);
    this.parser.parse(possibleMatch);
   
    this.currentPossibleMatch = possibleMatch;
   
    ModuleDeclaration unit = possibleMatch.parsedUnit;
    try {
      if (unit == null || getDeeModuleDeclaration(unit) == null /*Modified code*/) {
        return;
      }
      reportMatchingDo();
View Full Code Here

            return;
        }
       
        try {
            ISourceModule sourceModule = context.getSourceModule();    
            ModuleDeclaration moduleDeclaration = SourceParserUtil.getModuleDeclaration(sourceModule);
            moduleDeclaration.traverse(new AutoloadVisitor(context.getSourceModule()));
        } catch (Exception e) {
            Logger.logException(e);
        }       
    }
View Full Code Here

     * if an ASTVisitor implementation is created for this, just override getFoldingVisitor() and
     * remove this method
     */
    ISourceParser pp = null;
    pp = DLTKLanguageManager.getSourceParser(RutaNature.NATURE_ID);
    ModuleDeclaration md = (ModuleDeclaration) pp.parse(new ModuleSource(code), null);
    List statements = md.getStatements();
    if (statements == null) {
      return new CodeBlock[0];
    }

    List result = new ArrayList();
View Full Code Here

      }
    }
  }

  public void buildExternalModule(IBuildContext context) throws CoreException {
    final ModuleDeclaration ast = (ModuleDeclaration) context
            .get(IBuildContext.ATTR_MODULE_DECLARATION);
    if (ast != null) {
      packageCollector.getRequireDirectives().clear();
      packageCollector.process(ast);
    }
View Full Code Here

      packageCollector.process(ast);
    }
  }

  public void build(IBuildContext context) throws CoreException {
    ModuleDeclaration ast = (ModuleDeclaration) context.get(ModuleDeclaration.class.getName());
    if (ast == null) {
      return;
    }
    packageCollector.getRequireDirectives().clear();
    packageCollector.process(ast);
View Full Code Here

      removeAnnotations(myAnnotations.keySet());
    }

    RutaSelectionParser parser = new RutaSelectionParser();
    ISourceModule unit = (ISourceModule) getInputModelElement();
    ModuleDeclaration parsed = parser.parse(unit);
    ISourceViewer sourceViewer = getSourceViewer();
    StyledText styledText = sourceViewer.getTextWidget();
    int caret = 0;
    if (sourceViewer instanceof ITextViewerExtension5) {
      ITextViewerExtension5 extension = (ITextViewerExtension5) sourceViewer;
      caret = extension.widgetOffset2ModelOffset(styledText.getCaretOffset());
    } else {
      int offset = sourceViewer.getVisibleRegion().getOffset();
      caret = offset + styledText.getCaretOffset();
    }
    RutaReferenceVisitor visitor1 = new RutaReferenceVisitor(caret);
    ASTNode node = null;
    try {
      parsed.traverse(visitor1);
    } catch (Exception e) {
    }
    node = visitor1.getResult();
    if (node == null) {
      RutaReferenceDeclarationVisitor visitor2 = new RutaReferenceDeclarationVisitor(
              caret);
      try {
        parsed.traverse(visitor2);
      } catch (Exception e) {
      }
      node = visitor2.getResult();
    }
    if (node != null) {
      ReferenceFinder refFinder = new ReferenceFinder(node);
      try {
        parsed.traverse(refFinder);
      } catch (Exception e) {
      }
      List<ASTNode> result = refFinder.getResult();
      myAnnotations = new HashMap<Annotation, Position>(result.size());
      for (ASTNode each : result) {
View Full Code Here

TOP

Related Classes of org.eclipse.dltk.ast.declarations.ModuleDeclaration

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.