Package org.eclipse.dltk.core

Examples of org.eclipse.dltk.core.IType


   * @param offset
   */
  public FileContext(ISourceModule sourceModule, ModuleDeclaration rootNode,
      int offset) {
    super(sourceModule, rootNode);
    IType currentNamespace = PHPModelUtils.getCurrentNamespace(
        sourceModule, offset);
    if (currentNamespace != null) {
      this.namespaceName = currentNamespace.getElementName();
    }
  }
View Full Code Here


    PHPDocTag[] tags = docBlock.getTags(PHPDocTagKinds.RETURN);
    PHPDocTag[] inherit = docBlock.getTags(PHPDocTagKinds.INHERITDOC);

    if (inherit != null && inherit.length == 1) {
      IType type = method.getDeclaringType();

      if (type != null) {
        try {
          IContext context = goal.getContext();
          IModelAccessCache cache = null;
View Full Code Here

  }

  public IGoal[] init() {

    for (IMethod method : getMethods()) {
      IType currentNamespace = PHPModelUtils.getCurrentNamespace(method);
      String[] typeNames = null;
      if (method instanceof IPHPDocAwareElement) {
        typeNames = ((IPHPDocAwareElement) method).getReturnTypes();
      } else {
        List<String> returnTypeList = new LinkedList<String>();
        PHPDocBlock docBlock = PHPModelUtils.getDocBlock(method);
        if (docBlock == null) {
          return IGoal.NO_GOALS;
        }

        evaluateReturnType(returnTypeList, docBlock, method);
        typeNames = returnTypeList.toArray(new String[returnTypeList
            .size()]);
      }
      if (typeNames != null) {
        MultiTypeType evalMultiType = null;
        for (String typeName : typeNames) {
          Matcher m = ARRAY_TYPE_PATTERN.matcher(typeName);
          Matcher multi = MULTITYPE_PATTERN.matcher(typeName);
          if (m.find()) {
            int offset = 0;
            try {
              offset = method.getSourceRange().getOffset();
            } catch (ModelException e) {
            }
            evaluated.add(getArrayType(m.group(), currentNamespace,
                offset));

          } else if (typeName.endsWith(BRACKETS)
              && typeName.length() > 2) {
            int offset = 0;
            try {
              offset = method.getSourceRange().getOffset();
            } catch (ModelException e) {
            }
            evaluated.add(getArrayType(
                typeName.substring(0, typeName.length() - 2),
                currentNamespace, offset));
          } else {
            boolean isMulti = false;

            if (multi.find()) {
              if (evalMultiType == null) {
                evalMultiType = new MultiTypeType();
              }
              isMulti = true;
              typeName = multi.group(1);
            }
            AbstractMethodReturnTypeGoal goal = (AbstractMethodReturnTypeGoal) getGoal();
            IType[] types = goal.getTypes();
            if (typeName.equals(SELF_RETURN_TYPE) && types != null) {
              for (IType t : types) {
                IEvaluatedType type = getEvaluatedType(
                    PHPModelUtils.getFullName(t), null);
                if (type != null) {
                  if (isMulti) {
                    evalMultiType.addType(type);
                  } else {
                    evaluated.add(type);
                  }
                }
              }
            } else {
              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
                  // is an
View Full Code Here

  public void setCurrentType(IType type) {
    this.type = type;
    if (type != null) {
      if (type.getParent() instanceof IType) {
        IType ns = (IType) type.getParent();
        instanceType = new PHPThisClassType(ns.getElementName(),
            type.getElementName(), type);
      } else {
        instanceType = new PHPThisClassType(type.getElementName(), type);
      }
View Full Code Here

      if (context instanceof MethodContext) {
        final MethodContext methodContext = (MethodContext) context;
        ModuleDeclaration rootNode = methodContext.getRootNode();
        ISourceModule sourceModule = ((ISourceModuleContext) context)
            .getSourceModule();
        final IType currentNamespace = PHPModelUtils
            .getCurrentNamespace(sourceModule,
                rootNode.sourceStart());
        final ModuleDeclaration moduleDeclaration = SourceParserUtil
            .getModuleDeclaration(sourceModule);
        final MethodDeclaration methodDecl = methodContext
            .getMethodNode();

        // Look for parent class types:
        final List<IEvaluatedType> types = new LinkedList<IEvaluatedType>();
        try {
          rootNode.traverse(new ASTVisitor() {
            private TypeDeclaration currentType;
            private boolean found;

            public boolean visit(MethodDeclaration s)
                throws Exception {
              if (s == methodDecl
                  && currentType instanceof ClassDeclaration) {
                ClassDeclaration classDecl = (ClassDeclaration) currentType;

                ASTListNode superClasses = classDecl
                    .getSuperClasses();
                List childs = superClasses.getChilds();
                for (Iterator iterator = childs.iterator(); iterator
                    .hasNext();) {
                  ASTNode node = (ASTNode) iterator.next();
                  NamespaceReference namespace = null;
                  SimpleReference reference = null;
                  if (node instanceof SimpleReference) {
                    reference = (SimpleReference) node;
                    String typeName = reference.getName();
                    if (reference instanceof FullyQualifiedReference) {
                      FullyQualifiedReference ref = (FullyQualifiedReference) node;
                      namespace = ref.getNamespace();
                    }
                    if (namespace != null
                        && !namespace.getName().equals(
                            "")) { //$NON-NLS-1$
                      String nsName = namespace.getName();
                      if (nsName.equals("\\")) { //$NON-NLS-1$
                        typeName = nsName + typeName;
                      } else {
                        if (nsName
                            .startsWith("namespace\\")) { //$NON-NLS-1$
                          nsName = nsName.replace(
                              "namespace\\", ""); //$NON-NLS-1$ //$NON-NLS-2$
                        }
                        typeName = nsName
                            + NamespaceReference.NAMESPACE_SEPARATOR
                            + typeName;
                      }
                    }
                    if (typeName
                        .indexOf(NamespaceReference.NAMESPACE_SEPARATOR) > 0) {
                      // check if the first part
                      // is an
                      // alias,then get the full
                      // name
                      String prefix = typeName.substring(
                          0,
                          typeName.indexOf(NamespaceReference.NAMESPACE_SEPARATOR));
                      final Map<String, UsePart> result = PHPModelUtils
                          .getAliasToNSMap(
                              prefix,
                              moduleDeclaration,
                              reference
                                  .sourceStart(),
                              currentNamespace,
                              true);
                      if (result.containsKey(prefix)) {
                        String fullName = result
                            .get(prefix)
                            .getNamespace()
                            .getFullyQualifiedName();
                        typeName = typeName.replace(
                            prefix, fullName);
                      }
                    } else if (typeName
                        .indexOf(NamespaceReference.NAMESPACE_SEPARATOR) < 0) {

                      String prefix = typeName;
                      final Map<String, UsePart> result = PHPModelUtils
                          .getAliasToNSMap(
                              prefix,
                              moduleDeclaration,
                              reference
                                  .sourceStart(),
                              currentNamespace,
                              true);
                      if (result.containsKey(prefix)) {
                        String fullName = result
                            .get(prefix)
                            .getNamespace()
                            .getFullyQualifiedName();
                        typeName = fullName;
                      }
                    }
                    IEvaluatedType type = PHPSimpleTypes
                        .fromString(typeName);
                    if (type == null) {
                      if (typeName
                          .indexOf(NamespaceReference.NAMESPACE_SEPARATOR) != -1
                          || currentNamespace == null) {
                        type = new PHPClassType(
                            typeName);
                      } else {
                        type = new PHPClassType(
                            currentNamespace
                                .getElementName(),
                            typeName);
                      }
                    }
View Full Code Here

   * org.eclipse.php.internal.core.ast.nodes.IMethodBinding#getDeclaringClass
   * ()
   */
  public ITypeBinding getDeclaringClass() {
    if (declaringClassTypeBinding == null) {
      IType parent = modelElement.getDeclaringType();
      if (parent != null) {
        declaringClassTypeBinding = resolver.getTypeBinding(parent);
      }
    }
    return declaringClassTypeBinding;
View Full Code Here

      EntityAlias alias = new EntityAlias(entity);
     
      if (!alias.hasBundle())
        return null;
     
      IType type = SymfonyModelAccess.getDefault().findEntity(alias, input.getScriptProject());
     
      if (type == null)
        return null;
     
      IHyperlink link = new ModelElementHyperlink(wordRegion, type, new OpenAction(editor));
View Full Code Here

            String name = controller.getElementName();

            try {

                if (module.getTypes().length > 0) {
                    IType type = module.getTypes()[0];
                    if (type.getTypes().length > 0) {
                        IType sType = type.getTypes()[0];
                        name = sType.getFullyQualifiedName().replace("$", "\\");

                        body = PHPDocumentationContentAccess.getHTMLContent(sType);

                        methods.append("<h2> Methods: </h2>");
                        HTMLPrinter.startBulletList(methods);

                        for (IMethod method : sType.getMethods()) {

                            HTMLPrinter.addBullet(methods, method.getElementName());

                        }
View Full Code Here

      IType[] types =  PhpModelAccess.getDefault().findTypes(var.getQualifier(), var.getClassName(), MatchRule.EXACT, 0, 0, scope, null);
     
     
      if (types.length == 1) {
        IType type = types[0];

       
        IDLTKSearchScope methodScope = SearchEngine.createSuperHierarchyScope(type);
       
        IMethod[] methods = PhpModelAccess.getDefault().findMethods(prefix, MatchRule.PREFIX, 0, 0, methodScope, null);
View Full Code Here

            String name = service.getElementName();

            try {

                if (module.getTypes().length > 0) {
                    IType type = module.getTypes()[0];
                    if (type.getTypes().length > 0) {
                        IType sType = type.getTypes()[0];
                        name = sType.getFullyQualifiedName().replace("$", "\\");

                        body = PHPDocumentationContentAccess.getHTMLContent(sType);

                    }
                }
View Full Code Here

TOP

Related Classes of org.eclipse.dltk.core.IType

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.