Package org.eclipse.dltk.ast.declarations

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


            if (currentNamespace != null) {

              PHPDocBlock docBlock = PHPModelUtils
                  .getDocBlock(method);
              ModuleDeclaration moduleDeclaration = SourceParserUtil
                  .getModuleDeclaration(currentNamespace
                      .getSourceModule());
              if (typeName
                  .indexOf(NamespaceReference.NAMESPACE_SEPARATOR) > 0) {
                // check if the first part
View Full Code Here


        if (name.indexOf(NamespaceReference.NAMESPACE_SEPARATOR) > 0
            && currentNamespace != null) {
          // check if the first part is an
          // alias,then get the full name
          ModuleDeclaration moduleDeclaration = SourceParserUtil
              .getModuleDeclaration(currentNamespace
                  .getSourceModule());
          String prefix = name.substring(0, name
              .indexOf(NamespaceReference.NAMESPACE_SEPARATOR));
          final Map<String, UsePart> result = PHPModelUtils
View Full Code Here

  /**
   * @since 0.17.0
   */
  private static IType fixInvalidSourceElement(IMethod sourceElement, int offset, int length) throws CoreException {
    ModuleDeclaration moduleDeclaration = SourceParserUtil.getModuleDeclaration(sourceElement.getSourceModule());
    if (moduleDeclaration != null) {
      SourceTypeFinder sourceTypeFinder = new PDTModelUtils().new SourceTypeFinder(sourceElement.getSourceModule(), offset, length);

      try {
        moduleDeclaration.traverse(sourceTypeFinder);
      } catch (Exception e) {
        throw new CoreException(new Status(IStatus.ERROR, PEXCorePlugin.PLUGIN_ID, e.getMessage(), e));
      }

      return sourceTypeFinder.getSourceType();
View Full Code Here

        @Override
        public void acceptSearchMatch(final SearchMatch match) throws CoreException {
          if (match instanceof TypeReferenceMatch && match.getElement() instanceof IModelElement) {
            final ISourceModule module = (ISourceModule) ((IModelElement) match.getElement()).getAncestor(IModelElement.SOURCE_MODULE);
            if (module != null && RefactoringAvailabilityTester.isRenameAvailable(module)) {
              ModuleDeclaration moduleDeclaration = SourceParserUtil.getModuleDeclaration(module);
              if (moduleDeclaration != null) {
                try {
                  moduleDeclaration.traverse(new PHPASTVisitor() {
                    @Override
                    public boolean visit(FullyQualifiedReference s) throws Exception {
                      if (s.sourceStart() == match.getOffset() && s.sourceEnd() == match.getOffset() + match.getLength()) {
                        IModelElement sourceElement = PDTModelUtils.getSourceElement(module, s.sourceStart(), s.matchLength());
                        if (sourceElement != null) {
View Full Code Here

        @Override
        public void acceptSearchMatch(SearchMatch match) throws CoreException {
          if (match instanceof FieldReferenceMatch && match.getElement() instanceof IModelElement) {
            ISourceModule module = (ISourceModule) ((IModelElement) match.getElement()).getAncestor(IModelElement.SOURCE_MODULE);
            if (module != null && RefactoringAvailabilityTester.isRenameAvailable(module)) {
              ModuleDeclaration moduleDeclaration = SourceParserUtil.getModuleDeclaration(module);
              if (moduleDeclaration != null) {
                ReferenceFinder referenceFinder = createReferenceFinder(((FieldReferenceMatch) match).getNode(), module);

                try {
                  moduleDeclaration.traverse(referenceFinder);
                } catch (Exception e) {
                  throw new CoreException(new Status(IStatus.ERROR, PEXUIPlugin.PLUGIN_ID, e.getMessage(), e));
                }

                ReplaceEdit replaceEdit = referenceFinder.getReplaceEdit();
View Full Code Here

    // dependency report
    if (context.getBuildType() == IBuildContext.RECONCILE_BUILD) {
      return;
    }

    final ModuleDeclaration moduleDeclaration = (ModuleDeclaration) context.get(IBuildContext.ATTR_MODULE_DECLARATION);

    if (moduleDeclaration != null) {
      try {
        moduleDeclaration.traverse(new UsageVisitor(context));
      } catch (Exception e) {
        PEXAnalysisPlugin.error("Exception during dependency detection", e); //$NON-NLS-1$
      }
    }
  }
View Full Code Here

        try {

          if (sourceModule.getTypes().length != 1) {
            return;
          }
          ModuleDeclaration module = SourceParserUtil.getModuleDeclaration(sourceModule);
          ImplementationValidator validator = new ImplementationValidator(sourceModule);
          String code = "";
          try {
            module.traverse(validator);
          } catch (Exception e) {
            e.getClass();
            e.printStackTrace();
          }
          char indentChar = FormatterUtils
View Full Code Here

    return IPHPRefactorings.RENAME_LOCAL_VARIABLE;
  }

  @Override
  protected RefactoringStatus updateReferences(IProgressMonitor pm) throws CoreException {
    ModuleDeclaration moduleDeclaration = SourceParserUtil.getModuleDeclaration(cu);
    if (moduleDeclaration != null) {
      IModelElement enclosingElement = modelElement.getParent();
      final ISourceRange declarationSourceRange = ((IField) modelElement).getNameRange();
      if (enclosingElement != null && declarationSourceRange != null) {
        ISourceRange enclosingElementSourceRange = null;

        if (enclosingElement.getElementType() == IModelElement.METHOD) {
          enclosingElementSourceRange = ((IMethod) enclosingElement).getSourceRange();
        } else if (enclosingElement.getElementType() == IModelElement.SOURCE_MODULE) {
          enclosingElementSourceRange = ((ISourceModule) enclosingElement).getSourceRange();
        }

        if (enclosingElementSourceRange != null) {
          final int enclosingElementSourceStart = enclosingElementSourceRange.getOffset();
          final int enclosingElementSourceEnd = enclosingElementSourceRange.getOffset() + enclosingElementSourceRange.getLength();

          try {
            moduleDeclaration.traverse(new PHPASTVisitor() {
              @Override
              public boolean visit(ArrayVariableReference s) throws Exception {
                return visit((VariableReference) s);
              }
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

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.