Package org.eclipse.dltk.ast.declarations

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


      }
    }

    public boolean visit(TraitUseStatement node) {
      ISourceModule sourceModule = getSourceModule();
      ModuleDeclaration moduleDeclaration = SourceParserUtil
          .getModuleDeclaration(sourceModule, null);
      FileContext context = new FileContext(sourceModule,
          moduleDeclaration, node.getStart());
      List<TraitStatement> tsList = node.getTsList();
      for (TraitStatement traitStatement : tsList) {
View Full Code Here


    return doc;
  }

  static public IType[] getTypes(String typeName, ISourceModule sm,
      int offset, IType currentNamespace) {
    ModuleDeclaration moduleDeclaration = SourceParserUtil
        .getModuleDeclaration(sm, null);
    IContext context = ASTUtils.findContext(sm, moduleDeclaration, offset);
    if (currentNamespace != null) {
      if (typeName.indexOf(NamespaceReference.NAMESPACE_SEPARATOR) > 0) {
        // check if the first part is an alias,then get the full name
View Full Code Here

    if (!isFinal(field)) {
      return null;
    }
    ISourceModule sourceModule = field.getSourceModule();

    ModuleDeclaration module = SourceParserUtil
        .getModuleDeclaration(sourceModule);
    ASTNode node = PHPModelUtils.getNodeByField(module, field);

    if (node == null) {// define constant
      PHPCallExpression callExpression = DefineMethodUtils
View Full Code Here

              protected void runTest() throws Throwable {

                ByteArrayInputStream inputStream = new ByteArrayInputStream(
                    pdttFile.getFile().trim().getBytes());
                ModuleDeclaration moduleDeclaration = (ModuleDeclaration) parser
                    .parse(new InputStreamReader(
                        inputStream),
                        null,
                        ProjectOptions
                            .useShortTags((IProject) null));

                final StringBuilder builder = new StringBuilder();

                moduleDeclaration
                    .traverse(new TypeDeclarationVisitor() {
                      @Override
                      public void visitType(
                          TypeDeclaration s) {
                        builder.append(s.getName());
View Full Code Here

    // sourceModule,so when we rename the php file back to its original
    // name will get the wrong ModuleDeclaration
    if (null == fSourceModule || !fSourceModule.exists()) {
      return new IModelElement[0];
    }
    ModuleDeclaration moduleDeclaration = SourceParserUtil
        .getModuleDeclaration(fSourceModule);
    if (moduleDeclaration == null)
      return new IModelElement[0];
    UseStatement[] useStatements = ASTUtils.getUseStatements(
        moduleDeclaration, moduleDeclaration.sourceEnd());
    List<UseStatementElement> elements = new LinkedList<UseStatementElement>();
    for (UseStatement useStatement : useStatements) {
      for (UsePart usePart : useStatement.getParts()) {
        elements.add(new UseStatementElement(
            (ModelElement) fSourceModule, usePart));
View Full Code Here

              if (activeEditor instanceof PHPStructuredEditor) {
                IModelElement base = ((PHPStructuredEditor) activeEditor)
                    .getModelElement();

                if (isNamespaceSupported(base)) {
                  ModuleDeclaration moduleDeclaration = SourceParserUtil
                      .getModuleDeclaration((ISourceModule) base);
                  UseStatement[] useStatements = ASTUtils
                      .getUseStatements(
                          moduleDeclaration,
                          moduleDeclaration
                              .sourceEnd());
                  useStatementsCountNew = useStatements.length;
                }
              }
            }
View Full Code Here

              protected void runTest() throws Throwable {

                ByteArrayInputStream inputStream = new ByteArrayInputStream(
                    pdttFile.getFile().trim().getBytes());
                ModuleDeclaration moduleDeclaration = (ModuleDeclaration) parser
                    .parse(new InputStreamReader(
                        inputStream),
                        null,
                        ProjectOptions
                            .useShortTags((IProject) null));
View Full Code Here

              protected void runTest() throws Throwable {

                ByteArrayInputStream inputStream = new ByteArrayInputStream(
                    pdttFile.getFile().trim().getBytes());
                ModuleDeclaration moduleDeclaration = (ModuleDeclaration) parser
                    .parse(new InputStreamReader(
                        inputStream),
                        null,
                        ProjectOptions
                            .useShortTags((IProject) null));

                final StringBuilder builder = new StringBuilder();

                moduleDeclaration
                    .traverse(new TraitUseStatementVisitor() {
                      @Override
                      public boolean visit(
                          TraitUseStatement s)
                          throws Exception {
View Full Code Here

              protected void runTest() throws Throwable {

                ByteArrayInputStream inputStream = new ByteArrayInputStream(
                    pdttFile.getFile().trim().getBytes());
                ModuleDeclaration moduleDeclaration = (ModuleDeclaration) parser
                    .parse(new InputStreamReader(
                        inputStream),
                        null,
                        ProjectOptions
                            .useShortTags((IProject) null));
View Full Code Here

      project.build(IncrementalProjectBuilder.FULL_BUILD, null);
      PHPCoreTests.waitForIndexer();
      PHPCoreTests.waitForAutoBuild();

      ISourceModule sourceModule = DLTKCore.createSourceModuleFrom(file);
      ModuleDeclaration moduleDecl = SourceParserUtil
          .getModuleDeclaration(sourceModule);

      ASTNodeSearcher searcher = new ASTNodeSearcher(sourceModule,
          criteriaFunction);
      moduleDecl.traverse(searcher);

      Assert.assertNotNull("Method call " + criteriaFunction
          + "() in code: " + code, searcher.getResult());
      Assert.assertNotNull("Can't find context for " + criteriaFunction
          + "() in code: " + code, searcher.getContext());
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.