Examples of IPackageFragmentRoot


Examples of org.eclipse.jdt.core.IPackageFragmentRoot

     *
     * @return the status of the validation
     */
    protected IStatus superClassChanged() {
        StatusInfo status = new StatusInfo();
        IPackageFragmentRoot root = getPackageFragmentRoot();
        fSuperClassDialogField.enableButton(root != null);

        fSuperClassStubTypeContext = null;

        String sclassName = getSuperClass();
        if (sclassName.length() == 0) {
            // accept the empty field (stands for java.lang.Object)
            return status;
        }

        if (root != null) {
            Type type = TypeContextChecker.parseSuperClass(sclassName);
            if (type == null) {
                status.setError(NewWizardMessages.NewTypeWizardPage_error_InvalidSuperClassName);
                return status;
            }
            if (type instanceof ParameterizedType && !JavaModelUtil.is50OrHigher(root.getJavaProject())) {
                status.setError(NewWizardMessages.NewTypeWizardPage_error_SuperClassNotParameterized);
                return status;
            }
        } else {
            status.setError(""); //$NON-NLS-1$
View Full Code Here

Examples of org.eclipse.jdt.core.IPackageFragmentRoot

     * @return the status of the validation
     */
    protected IStatus superInterfacesChanged() {
        StatusInfo status = new StatusInfo();

        IPackageFragmentRoot root = getPackageFragmentRoot();
        fSuperInterfacesDialogField.enableButton(0, root != null);

        if (root != null) {
            List<InterfaceWrapper> elements = fSuperInterfacesDialogField.getElements();
            int nElements = elements.size();
            for (int i = 0; i < nElements; i++) {
                String intfname = elements.get(i).interfaceName;
                Type type = TypeContextChecker.parseSuperInterface(intfname);
                if (type == null) {
                    status.setError(Messages.format(NewWizardMessages.NewTypeWizardPage_error_InvalidSuperInterfaceName, BasicElementLabels.getJavaElementName(intfname)));
                    return status;
                }
                if (type instanceof ParameterizedType && !JavaModelUtil.is50OrHigher(root.getJavaProject())) {
                    status.setError(Messages.format(NewWizardMessages.NewTypeWizardPage_error_SuperInterfaceNotParameterized, BasicElementLabels.getJavaElementName(intfname)));
                    return status;
                }
            }
        }
View Full Code Here

Examples of org.eclipse.jdt.core.IPackageFragmentRoot

     *         Clients can override this method if they want to offer a different dialog.
     *         </p>
     * @since 3.2
     */
    protected IPackageFragment choosePackage() {
        IPackageFragmentRoot froot = getPackageFragmentRoot();
        IJavaElement[] packages = null;
        try {
            if (froot != null && froot.exists()) {
                packages = froot.getChildren();
            }
        } catch (JavaModelException e) {
            JavaPlugin.log(e);
        }
        if (packages == null) {
View Full Code Here

Examples of org.eclipse.jdt.core.IPackageFragmentRoot

     *         Clients can override this method if they want to offer a different dialog.
     *         </p>
     * @since 3.2
     */
    protected IType chooseEnclosingType() {
        IPackageFragmentRoot root = getPackageFragmentRoot();
        if (root == null) {
            return null;
        }

        IJavaSearchScope scope = SearchEngine.createJavaSearchScope(new IJavaElement[] {
View Full Code Here

Examples of org.eclipse.jdt.core.IPackageFragmentRoot

            monitor = new NullProgressMonitor();
        }

        monitor.beginTask(NewWizardMessages.NewTypeWizardPage_operationdesc, 8);

        IPackageFragmentRoot root = getPackageFragmentRoot();
        IPackageFragment pack = getPackageFragment();
        if (pack == null) {
            pack = root.getPackageFragment(""); //$NON-NLS-1$
        }

        if (!pack.exists()) {
            String packName = pack.getElementName();
            pack = root.createPackageFragment(packName, true, new SubProgressMonitor(monitor, 1));
        } else {
            monitor.worked(1);
        }

        boolean needsSave;
View Full Code Here

Examples of org.eclipse.jdt.core.IPackageFragmentRoot

      if (ProjectHelper.isContentProject(project)) {
        for (Iterator it = theCurrentChildren.iterator(); it
            .hasNext();) {
          Object aChild = (Object) it.next();
          if (aChild instanceof IPackageFragmentRoot) {
            IPackageFragmentRoot ipfr = (IPackageFragmentRoot)aChild;
            IResource res = ipfr.getResource();
            IFolder syncDir = getSyncDir(project);
            if (res!=null && syncDir!=null && res.equals(syncDir)) {
              // then remove this one folder provided via j2ee content provider
              // reason: we are showing it too via the sling content provider
              it.remove();
View Full Code Here

Examples of org.eclipse.jdt.core.IPackageFragmentRoot

      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();
        if (root.getResource() != null)
        {
          jarPath = root.getResource().getRawLocation().toString();
        }

        if (new File(jarPath).exists())
        {
          String javaagentArg = "-javaagent:\"" + jarPath + "\"";
View Full Code Here

Examples of org.eclipse.jdt.core.IPackageFragmentRoot

     * @see org.eclipse.jdt.ui.wizards.NewContainerWizardPage#containerChanged()
     */
    @Override
    protected IStatus containerChanged() {
        IStatus status = super.containerChanged();
        IPackageFragmentRoot root = getPackageFragmentRoot();
        if (root == null) {
            return status;
        }

        IJavaProject project = root.getJavaProject();

        if ((fTypeKind == ANNOTATION_TYPE || fTypeKind == ENUM_TYPE) && !status.matches(IStatus.ERROR)) {
            if (!JavaModelUtil.is50OrHigher(project)) {
                // error as createType will fail otherwise (bug 96928)
                return new StatusInfo(IStatus.ERROR, Messages.format(NewWizardMessages.NewTypeWizardPage_warning_NotJDKCompliant, BasicElementLabels.getJavaElementName(project.getElementName())));
            }
            if (fTypeKind == ENUM_TYPE) {
                try {
                    // if findType(...) == null then Enum is unavailable
                    if (findType(project, "java.lang.Enum") == null) //$NON-NLS-1$
                        return new StatusInfo(IStatus.WARNING, NewWizardMessages.NewTypeWizardPage_warning_EnumClassNotFound);
                } catch (JavaModelException e) {
                    JavaPlugin.log(e);
                }
            }
        }

        fCurrPackageCompletionProcessor.setPackageFragmentRoot(root);
        fEnclosingTypeCompletionProcessor.setPackageFragment(root.getPackageFragment("")); //$NON-NLS-1$
        return status;
    }
View Full Code Here

Examples of org.eclipse.jdt.core.IPackageFragmentRoot

     *
     * @return the status of the validation
     */
    protected IStatus packageChanged() {
        StatusInfo status = new StatusInfo();
        IPackageFragmentRoot root = getPackageFragmentRoot();
        fPackageDialogField.enableButton(root != null);

        IJavaProject project = root != null ? root.getJavaProject() : null;

        String packName = getPackageText();
        if (packName.length() > 0) {
            IStatus val = validatePackageName(packName, project);
            if (val.getSeverity() == IStatus.ERROR) {
                status.setError(Messages.format(NewWizardMessages.NewTypeWizardPage_error_InvalidPackageName, val.getMessage()));
                return status;
            } else if (val.getSeverity() == IStatus.WARNING) {
                status.setWarning(Messages.format(NewWizardMessages.NewTypeWizardPage_warning_DiscouragedPackageName, val.getMessage()));
                // continue
            }
        } else {
            status.setWarning(NewWizardMessages.NewTypeWizardPage_warning_DefaultPackageDiscouraged);
        }

        if (project != null) {
            assert (root != null);
            if (project.exists() && packName.length() > 0) {
                try {
                    IPath rootPath = root.getPath();
                    IPath outputPath = project.getOutputLocation();
                    if (rootPath.isPrefixOf(outputPath) && !rootPath.equals(outputPath)) {
                        // if the bin folder is inside of our root, don't allow to name a package
                        // like the bin folder
                        IPath packagePath = rootPath.append(packName.replace('.', '/'));
                        if (outputPath.isPrefixOf(packagePath)) {
                            status.setError(NewWizardMessages.NewTypeWizardPage_error_ClashOutputLocation);
                            return status;
                        }
                    }
                } catch (JavaModelException e) {
                    JavaPlugin.log(e);
                    // let pass
                }
            }

            fCurrPackage = root.getPackageFragment(packName);
            IResource resource = fCurrPackage.getResource();
            if (resource != null) {
                if (resource.isVirtual()) {
                    status.setError(NewWizardMessages.NewTypeWizardPage_error_PackageIsVirtual);
                    return status;
View Full Code Here

Examples of org.eclipse.jdt.core.IPackageFragmentRoot

     */
    protected IStatus enclosingTypeChanged() {
        StatusInfo status = new StatusInfo();
        fCurrEnclosingType = null;

        IPackageFragmentRoot root = getPackageFragmentRoot();

        fEnclosingTypeDialogField.enableButton(root != null);
        if (root == null) {
            status.setError(""); //$NON-NLS-1$
            return status;
        }

        String enclName = getEnclosingTypeText();
        if (enclName.length() == 0) {
            status.setError(NewWizardMessages.NewTypeWizardPage_error_EnclosingTypeEnterName);
            return status;
        }
        try {
            IType type = findType(root.getJavaProject(), enclName);
            if (type == null) {
                status.setError(NewWizardMessages.NewTypeWizardPage_error_EnclosingTypeNotExists);
                return status;
            }

            if (type.getCompilationUnit() == null) {
                status.setError(NewWizardMessages.NewTypeWizardPage_error_EnclosingNotInCU);
                return status;
            }
            if (!JavaModelUtil.isEditable(type.getCompilationUnit())) {
                status.setError(NewWizardMessages.NewTypeWizardPage_error_EnclosingNotEditable);
                return status;
            }

            fCurrEnclosingType = type;
            IPackageFragmentRoot enclosingRoot = JavaModelUtil.getPackageFragmentRoot(type);
            if (!enclosingRoot.equals(root)) {
                status.setWarning(NewWizardMessages.NewTypeWizardPage_warning_EnclosingNotInSourceFolder);
            }
            return status;
        } catch (JavaModelException e) {
            status.setError(NewWizardMessages.NewTypeWizardPage_error_EnclosingTypeNotExists);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.