Java Code Examples for org.netbeans.api.java.platform.JavaPlatform#getJavadocFolders()

The following examples show how to use org.netbeans.api.java.platform.JavaPlatform#getJavadocFolders() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: CompletionHandler.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public CompletionHandler() {
    JavaPlatformManager platformMan = JavaPlatformManager.getDefault();
    JavaPlatform platform = platformMan.getDefaultPlatform();
    List<URL> docfolder = platform.getJavadocFolders();

    for (URL url : docfolder) {
        LOG.log(Level.FINEST, "JDK Doc path: {0}", url.toString()); // NOI18N
        jdkJavaDocBase = url.toString();
    }

    GroovySettings groovySettings = GroovySettings.getInstance();
    docListener = new PropertyChangeListener() {

        @Override
        public void propertyChange(PropertyChangeEvent evt) {
            synchronized (CompletionHandler.this) {
                groovyJavaDocBase = null;
                groovyApiDocBase = null;
            }
        }
    };
    groovySettings.addPropertyChangeListener(WeakListeners.propertyChange(docListener, this));
}
 
Example 2
Source File: PlatformJavadocForBinaryQuery.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
@NonNull
public synchronized URL[] getRoots() {
    if (this.cachedRoots == null) {
        final List<URL> l = new ArrayList<URL>();
        for (JavaPlatform platform : platforms) {
            final List<? extends URL> javadoc = platform.getJavadocFolders();
            if (!javadoc.isEmpty()) {
                for (URL u : javadoc) {
                    if (u != null) {
                        FileObject root = URLMapper.findFileObject(u);
                        if (root == null) {
                            //Non existing
                            l.add (u);
                        }
                        else if (root.isFolder()) {
                            //Has to be folder
                            try {
                                l.add(getIndexFolder(root));
                            } catch (FileStateInvalidException e) {
                                Exceptions.printStackTrace(e);
                            }
                        } else {
                            LOG.log(
                                Level.WARNING,
                                "Ignoring non folder root: {0}",    //NOI18N
                                FileUtil.getFileDisplayName(root));
                        }
                    }
                }
                break;
            }
        }
        this.cachedRoots = l.toArray(new URL[l.size()]);
    }
    return this.cachedRoots;
}