Package org.netbeans.api.scala.platform

Examples of org.netbeans.api.scala.platform.ScalaPlatform


        } catch (FileStateInvalidException fsi) {
            return null;
        }
        if (SCALA_EXT.equalsIgnoreCase(file.getExt()) || file.isFolder()) {  //Workaround: Editor asks for package root
            if (ClassPath.BOOT.equals (type)) {
                ScalaPlatform defaultPlatform = ScalaPlatformManager.getDefault().getDefaultPlatform();
                if (defaultPlatform != null) {
                    return defaultPlatform.getBootstrapLibraries();
                }
            }
            else if (ClassPath.COMPILE.equals(type)) {
                synchronized (this) {
                    ClassPath cp = null;
                    if (this.compiledClassPath == null || (cp = this.compiledClassPath.get()) == null) {
                        cp = ClassPathFactory.createClassPath(new CompileClassPathImpl ());
                        this.compiledClassPath = new WeakReference<ClassPath> (cp);
                    }
                    return cp;
                }
            }
            else if (ClassPath.SOURCE.equals(type)) {
//                synchronized (this) {
//                    ClassPath cp = null;
//                    if (file.isFolder()) {
//                        Reference ref = (Reference) this.sourceClasPathsCache.get (file);
//                        if (ref == null || (cp = (ClassPath)ref.get()) == null ) {
//                            cp = ClassPathSupport.createClassPath(new FileObject[] {file});
//                            this.sourceClasPathsCache.put (file, new WeakReference(cp));
//                        }
//                    }
//                    else {
//                        Reference ref = (Reference) this.sourceRootsCache.get (file);
//                        FileObject sourceRoot = null;
//                        if (ref == null || (sourceRoot = (FileObject)ref.get()) == null ) {
//                            sourceRoot = getRootForFile (file, TYPE_JAVA);
//                            if (sourceRoot == null) {
//                                return null;
//                            }
//                            this.sourceRootsCache.put (file, new WeakReference(sourceRoot));
//                        }
//                        if (!sourceRoot.isValid()) {
//                            this.sourceClasPathsCache.remove(sourceRoot);
//                        }
//                        else {
//                            ref = (Reference) this.sourceClasPathsCache.get(sourceRoot);
//                            if (ref == null || (cp = (ClassPath)ref.get()) == null ) {
//                                cp = ClassPathSupport.createClassPath(new FileObject[] {sourceRoot});
//                                this.sourceClasPathsCache.put (sourceRoot, new WeakReference(cp));
//                            }
//                        }
//                    }
//                    return cp;                                       
//                }        
                //XXX: Needed by refactoring of the javaws generated files,
                //anyway it's better to return no source path for files with no project.
                //It has to be ignored by java model anyway otherwise a single java
                //file inside home folder may cause a scan of the whole home folder.
                //see issue #75410
                return null;
            }
        }
        else if (CLASS_EXT.equals(file.getExt())) {
            if (ClassPath.BOOT.equals (type)) {
                ScalaPlatform defaultPlatform = ScalaPlatformManager.getDefault().getDefaultPlatform();
                if (defaultPlatform != null) {
                    return defaultPlatform.getBootstrapLibraries();
                }
            }
            else if (ClassPath.EXECUTE.equals(type)) {
                ClassPath cp = null;
                Reference<FileObject> foRef = this.sourceRootsCache.get (file);
View Full Code Here


                }
            }
           
        }
        ScalaPlatformManager jpm = ScalaPlatformManager.getDefault();
        ScalaPlatform platforms[] = jpm.getInstalledPlatforms();
        for (int i=0; i<platforms.length; i++) {
            ScalaPlatform jp = platforms[i];
//Not valid assumption: May change in the future result should be returned, since the result is live.           
//            if (jp.getJavadocFolders().size() == 0) {
//                continue;
//            }
            Iterator it = jp.getBootstrapLibraries().entries().iterator();
            while (it.hasNext()) {
                ClassPath.Entry entry = (ClassPath.Entry)it.next();
                if (b.equals(entry.getURL())) {
                    return new R (jp);
                }
View Full Code Here

    public String getSourceLevel(final FileObject javaFile) {
        assert javaFile != null : "javaFile has to be non null";   //NOI18N
        String ext = javaFile.getExt();
        if (JAVA_EXT.equalsIgnoreCase (ext)) {
            ScalaPlatform jp = ScalaPlatformManager.getDefault().getDefaultPlatform();
            assert jp != null : "JavaPlatformManager.getDefaultPlatform returned null";     //NOI18N
            String s = jp.getSpecification().getVersion().toString();
            if (s.equals("1.6") || s.equals("1.7")) {
                // #89131: these levels are not actually distinct from 1.5.
                return "1.5";
            } else {
                return s;
View Full Code Here

            return valid;
        }

        public void readSettings(WizardDescriptor settings) {          
            this.wiz = settings;
            ScalaPlatform platform = this.iterator.getPlatform();
            String srcPath = null;
            String jdocPath = null;
            ClassPath src = platform.getSourceFolders();
            if (src.entries().size()>0) {
                URL folderRoot = src.entries().get(0).getURL();
                if ("jar".equals(folderRoot.getProtocol())) {   //NOI18N
                    folderRoot = FileUtil.getArchiveFile (folderRoot);
                }
                srcPath = new File(URI.create(folderRoot.toExternalForm())).getAbsolutePath();
            }
            else if (firstPass) {
                for (FileObject folder : platform.getInstallFolders()) {
                    File base = FileUtil.toFile(folder);
                    if (base!=null) {
                        File f = new File (base,"src.zip"); //NOI18N
                        if (f.canRead()) {
                            srcPath = f.getAbsolutePath();
                        }
                        else {
                            f = new File (base,"src.jar")//NOI18N
                            if (f.canRead()) {
                                srcPath = f.getAbsolutePath();
                            }
                        }
                    }
                }               
            }
            List<URL> jdoc = platform.getJavadocFolders();
            if (jdoc.size()>0) {
                URL folderRoot = jdoc.get(0);
                if ("jar".equals(folderRoot.getProtocol())) {
                    folderRoot = FileUtil.getArchiveFile (folderRoot);
                }
                jdocPath = new File (URI.create(folderRoot.toExternalForm())).getAbsolutePath();
            }
            else if (firstPass) {
                for (FileObject folder : platform.getInstallFolders()) {
                    File base = FileUtil.toFile(folder);
                    if (base!=null) {
                        File f = new File (base,"docs"); //NOI18N
                        if (f.isDirectory() && f.canRead()) {
                            jdocPath = f.getAbsolutePath();
View Full Code Here

                }
            });
    }
   
    private static boolean updateSourceLevel(EditableProperties ep) {
        ScalaPlatform platform = ScalaPlatformManager.getDefault().getDefaultPlatform();
        String ver = platform.getSpecification().getVersion().toString();
        if (!ver.equals(ep.getProperty("default.javac.source"))) { //NOI18N
            ep.setProperty("default.javac.source", ver); //NOI18N
            ep.setProperty("default.javac.target", ver); //NOI18N
            return true;
        } else {
View Full Code Here

   
    public ClassPath findClassPath(FileObject fo, String type) {
        if (fo == null || type == null) {
            throw new IllegalArgumentException();
        }
        ScalaPlatform lp = this.getLastUsedPlatform(fo);
        ScalaPlatform[] platforms;
        if (lp != null) {
            platforms = new ScalaPlatform[] {lp};
        }
        else {
View Full Code Here

TOP

Related Classes of org.netbeans.api.scala.platform.ScalaPlatform

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.