Package org.eclipse.jdt.core

Examples of org.eclipse.jdt.core.IType


      }

      JavaPackageFragmentRootHandler rootResolver = getPackageFragmentRootHandler(
          javaProject, monitor);

      IType mainType = rootResolver.getMainType(monitor);

      final IPackageFragmentRoot[] roots = rootResolver
          .getPackageFragmentRoots(monitor);

      if (roots == null || roots.length == 0) {
View Full Code Here


  }

  public IType getMainTypesFromSource(IProgressMonitor monitor) {
    if (project != null) {
      IType firstEncounteredSourceType = null;
      IType[] types = getMainTypes(monitor);
      // Enable when dependency to
      // org.springsource.ide.eclipse.commons.core is
      // added. This should be the common way to obtain main types
      // MainTypeFinder.guessMainTypes(project, monitor);
View Full Code Here

    }
    UIJob job = new UIJob(Messages.JavaTypeUIAdapter_JOB_JAVA_ASSIST) {

      public IStatus runInUIThread(IProgressMonitor monitor) {

        IType type = helper.getMainTypesFromSource(monitor);
        String qualifiedTypeName = type != null ? type
            .getFullyQualifiedName() : null;
        Text text = javaStartCommandPart.getTypeText();
        if (qualifiedTypeName != null && text != null) {
          text.setText(qualifiedTypeName);
        }
View Full Code Here

        shell, false, null, scope, javaSearchType);
    dialog.setTitle(title);
    dialog.setInitialPattern(pattern);

    if (dialog.open() == Window.OK) {
      IType type = (IType) dialog.getFirstResult();
      if (type != null) {
        String qualifiedName = type.getFullyQualifiedName();
        if (qualifiedName != null) {
          textControl.setText(qualifiedName);
        }
      }
    }
View Full Code Here

    this.javaProject = javaProject;
  }

  public IPackageFragmentRoot[] getPackageFragmentRoots(
      IProgressMonitor monitor) throws CoreException {
    IType type = getMainType(monitor);

    ILaunchConfiguration configuration = createConfiguration(type);
    IPath[] classpathEntries = getRuntimeClasspaths(configuration);

    List<IPackageFragmentRoot> pckRoots = new ArrayList<IPackageFragmentRoot>();
View Full Code Here

                        {
                            for (IJavaElement e1 : JavaHelper.findTypes(root,
                                IJavaElement.COMPILATION_UNIT, IJavaElement.CLASS_FILE))
                            {
                                ITypeRoot typeRoot = (ITypeRoot) e1;
                                IType type = (IType) JavaHelper.findType(typeRoot,
                                    IJavaElement.TYPE);
                                if (JavaHelper.isAssignableTo(ifaceOrParentClass, type))
                                {
                                    dialog.addElement(type.getFullyQualifiedName());
                                }
                            }
                        }
                    }
View Full Code Here

            return null;
          }
        }
       
        // get the class declaration line
        IType type = unit.getType(controllerName);
        ITypeHierarchy superTypes = type.newSupertypeHierarchy(null);
//        String name = JapidController.class.getName(); // this will require play.jar
        String name = "cn.bran.play.JapidController";
        IType japidController = jProject.findType(name);
        if (superTypes.contains(japidController)) {
          useJapid = true;
        }
        else {
          useJapid = false;
View Full Code Here

              info("This action can only apply to controllers.");
              return null;
            }
          }

          IType type = unit.getTypes()[0];
          controllerName = type.getElementName();
          String superclassName = type.getSuperclassName();
          if (superclassName.toLowerCase().contains("japid")) {
            useJapid = true;
          }

          List<IJavaElement> path = getJavaElementsPath(m);
View Full Code Here

    String query = input.substring(input.lastIndexOf('.') + 1);
    return getAction("controllers." + typeName, query);
  }

  private IMethod getAction(String fullClassName, String query) {
    IType parent = null;
    try {
      parent = javaProject.findType(fullClassName);
    } catch (JavaModelException e) {}
    if (parent == null) {
      return null;
    }
    try {
      IMethod method = findMethod(parent, query);
      if (method != null) return method;
      ITypeHierarchy hierarchy = parent.newTypeHierarchy(null);
      for (IType superclass: hierarchy.getAllSuperclasses(parent)) {
        method = findMethod(superclass, query);
        if (method != null) return method;
      }
    } catch (JavaModelException e) {
View Full Code Here

  }
 
 
  private IType findType(String name) {
    try {
      IType type = javaProject.findType(name);
//      System.out.println("Type for " + name + ": " + type);
      return type;
    } catch (CoreException e) {
      PlayPlugin.showError(e.getMessage());
    }
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.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.