Package org.eclipse.jdt.core

Examples of org.eclipse.jdt.core.IType


            IPackageFragment pack = choosePackage();
            if (pack != null) {
                fPackageDialogField.setText(pack.getElementName());
            }
        } else if (field == fEnclosingTypeDialogField) {
            IType type = chooseEnclosingType();
            if (type != null) {
                fEnclosingTypeDialogField.setText(type.getFullyQualifiedName('.'));
            }
        } else if (field == fSuperClassDialogField) {
            IType type = chooseSuperClass();
            if (type != null) {
                fSuperClassDialogField.setText(SuperInterfaceSelectionDialog.getNameWithTypeParameters(type));
            }
        }
    }
View Full Code Here


     *
     * @return A resource or null if the page contains illegal values.
     * @since 3.0
     */
    public IResource getModifiedResource() {
        IType enclosing = getEnclosingType();
        if (enclosing != null) {
            return enclosing.getResource();
        }
        IPackageFragment pack = getPackageFragment();
        if (pack != null) {
            String cuName = getCompilationUnitName(getTypeNameWithoutParameters());
            return pack.getCompilationUnit(cuName).getResource();
View Full Code Here

                        IJavaProject javaProject = getJavaProject();
                        if (javaProject == null) {
                            activatorError = "Cannot validate activator class name, the bnd file is not in a Java project.";
                            activatorErrorLevel = IMessageProvider.WARNING;
                        } else {
                            IType activatorType = javaProject.findType(activatorClassName);
                            if (activatorType == null) {
                                activatorError = "The activator class name is not known in this project.";
                                activatorErrorLevel = IMessageProvider.ERROR;
                            }
                        }
                    } catch (JavaModelException e) {
                        logger.logError("Error looking up activator class name: " + activatorClassName, e);
                    }
                }

                if (activatorError != null) {
                    msgs.addMessage(UNKNOWN_ACTIVATOR_ERROR_KEY, activatorError, null, activatorErrorLevel, txtActivator);
                } else {
                    msgs.removeMessage(UNKNOWN_ACTIVATOR_ERROR_KEY, txtActivator);
                }

                checkActivatorIncluded();
            }
        });
        linkActivator.addHyperlinkListener(new HyperlinkAdapter() {
            @Override
            public void linkActivated(HyperlinkEvent ev) {
                String activatorClassName = txtActivator.getText();
                if (activatorClassName != null && activatorClassName.length() > 0) {
                    try {
                        IJavaProject javaProject = getJavaProject();
                        if (javaProject == null)
                            return;

                        IType activatorType = javaProject.findType(activatorClassName);
                        if (activatorType != null) {
                            JavaUI.openInEditor(activatorType, true, true);
                        }
                    } catch (PartInitException e) {
                        ErrorDialog.openError(getManagedForm().getForm().getShell(), "Error", null,
View Full Code Here

                final List<IContentProposal> result = new ArrayList<IContentProposal>();

                final IRunnableWithProgress runnable = new IRunnableWithProgress() {
                    public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
                        try {
                            IType activatorType = javaProject.findType(BundleActivator.class.getName());
                            if (activatorType != null) {
                                ITypeHierarchy hierarchy = activatorType.newTypeHierarchy(javaProject, monitor);
                                for (IType subType : hierarchy.getAllSubtypes(activatorType)) {
                                    if (!Flags.isAbstract(subType.getFlags()) && subType.getElementName().toLowerCase().contains(prefix.toLowerCase())) {
                                        result.add(new JavaTypeContentProposal(subType));
                                    }
                                }
View Full Code Here

        return null;
    }
    */

    CompilationUnit createAST(IJavaProject javaProject, String className) throws JavaModelException {
        IType type = javaProject.findType(className);
        if (type == null)
            return null;

        final ICompilationUnit cunit = type.getCompilationUnit();
        if (cunit == null)
            return null; // not a source type

        ASTParser parser = ASTParser.newParser(AST.JLS4);
        parser.setKind(ASTParser.K_COMPILATION_UNIT);
View Full Code Here

    String project = conf.getAttribute(JunitLaunchListener.PROJ_ATTR, "");

    IJavaModel javaModel = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot());
    IJavaProject jproj = javaModel.getJavaProject(project);

    IType mockitType = jproj.findType("mockit.Mock");
    if (mockitType == null) {
      mockitType = jproj.findType("mockit.Mockit");
    }

    if (mockitType != null)
    {
      IPackageFragmentRoot root = (IPackageFragmentRoot) mockitType
          .getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);

      if (root != null && root.isArchive()) // its a jar
      {
        String jarPath = root.getPath().toOSString();
View Full Code Here

        && !project.getProject().getName().equals(Activator.getActiveProject()) )
    {
      return false;
    }

    IType mockitType = null;
    try
    {
      mockitType = project.findType(MockUtil.MOCKIT);
    }
    catch (JavaModelException e)
View Full Code Here

        /*
         * For a type, we only have to check if it is testable.
         */
        case IJavaElement.TYPE : {
            IType type = (IType) element;
            if (isTestable(type)) {
                testNames.add((type).getFullyQualifiedName());
            }
        }
            break;
View Full Code Here

                for (Iterator< ? > iter = selection.iterator(); iter.hasNext();) {
                    Object item = iter.next();
                    if (item instanceof ImportUsedByClass) {
                        ImportUsedByClass importUsedBy = (ImportUsedByClass) item;
                        String className = importUsedBy.getClazz().getFQN();
                        IType type = null;

                        IFile file = getEditorFile();
                        if (file != null) {
                            IJavaProject javaProject = JavaCore.create(file.getProject());
                            try {
View Full Code Here

    void doOpenSource(String name) {
        IJavaProject javaProj = getJavaProject();
        if (javaProj != null) {
            try {
                IType type = javaProj.findType(name);
                if (type != null)
                    JavaUI.openInEditor(type, true, true);
            } catch (PartInitException e) {
                e.printStackTrace();
            } catch (JavaModelException e) {
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.