Java Code Examples for org.openide.util.Enumerations#empty()

The following examples show how to use org.openide.util.Enumerations#empty() . 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: NetigsoLoader.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public Enumeration<URL> findResources(String name) {
    //Netigso.start();
    Bundle b = bundle;
    if (b == null) {
        LOG.log(Level.WARNING, "Trying to load resource before initialization finished {0}", name);
        return Enumerations.empty();
    }
    Enumeration<URL> ret = null;
    try {
        if (b.getState() != Bundle.UNINSTALLED) {
            ret = b.getResources(name);
        }
    } catch (IOException ex) {
        Exceptions.printStackTrace(ex);
    }
    return ret == null ? Enumerations.<URL>empty() : NbCollections.checkedEnumerationByFilter(ret, URL.class, true);
}
 
Example 2
Source File: Module.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Locates resource in this module. May search only the main JAR
 * of the module (which is what it does in case of OSGi bundles). 
 * Should be as lightweight as possible - e.g. if it is OK to not
 * initialize something in the module while performing this method,
 * the something should not be initialized (e.g. OSGi bundles are
 * not resolved).
 * 
 * @param resources path to the resources we are looking for
 * @since 2.49
 */
public Enumeration<URL> findResources(String resources) {
    try { // #149136
        // Cannot use getResources because we do not wish to delegate to parents.
        // In fact both URLClassLoader and ProxyClassLoader override this method to be public.
        if (findResources == null) {
            findResources = ClassLoader.class.getDeclaredMethod("findResources", String.class); // NOI18N
            findResources.setAccessible(true);
        }
        ClassLoader cl = getClassLoader();
        @SuppressWarnings("unchecked")
        Enumeration<URL> en = (Enumeration<URL>) findResources.invoke(cl, resources); // NOI18N
        return en;
    } catch (Exception x) {
        Exceptions.printStackTrace(x);
        return Enumerations.empty();
    }
}
 
Example 3
Source File: XMLFileSystem.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public Enumeration<String> attributes(String name) {
    FileObjRef<? extends FileObject> ref = (FileObjRef<? extends FileObject>) fs.findReference(name);

    if ((ref == null) && (name.length() == 0) && (fs.rootRef != null)) {
        ref = fs.rootRef;
    }

    if (ref == null) {
        return Enumerations.empty();
    }

    return ref.attributes();
}
 
Example 4
Source File: ExtensionList.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** Enumeration from set
 * @param set set or null
 */
private static Enumeration<String> en(Collection<String> c) {
    if (c == null) {
        return Enumerations.empty();
    } else {
        return Collections.enumeration(createExtensionSet(c));
    }
}
 
Example 5
Source File: NbURLStreamHandlerFactoryTest.java    From netbeans with Apache License 2.0 5 votes vote down vote up
protected Enumeration<URL> findResources(String name) throws IOException {
    URL u = findResource(name);
    if (u != null) {
        return Enumerations.singleton(u);
    } else {
        return Enumerations.empty();
    }
}
 
Example 6
Source File: AbstractFolder.java    From netbeans with Apache License 2.0 5 votes vote down vote up
/** @return enumeration of all listeners.
*/
private final Enumeration<FileChangeListener> listeners() {
    if (listeners == null) {
        return Enumerations.empty();
    } else {
        return Collections.enumeration(listeners.getAllListeners());
    }
}
 
Example 7
Source File: RootObjWindows.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public final Enumeration<String> getAttributes() {
    return Enumerations.empty();
}
 
Example 8
Source File: FileObj.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public final Enumeration<FileObject> getData(final boolean rec) {
    return Enumerations.empty();
}
 
Example 9
Source File: MultiFileObject.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public Enumeration<? extends FileObject> getFolders(boolean rec) {
    return Enumerations.empty();
}
 
Example 10
Source File: HudsonRemoteFileSystem.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public Enumeration<String> attributes(String name) {
    return Enumerations.empty();
}
 
Example 11
Source File: SelfSampleVFS.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public Enumeration<String> attributes(String name) {
    return Enumerations.empty();
}
 
Example 12
Source File: ConnectionSupportTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public Enumeration<? extends DataLoader> loaders() {
    if (loaders == null) {
        return Enumerations.empty ();
    }
    return Collections.enumeration (loaders);
}
 
Example 13
Source File: MultiFileObject.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public Enumeration<? extends FileObject> getChildren(boolean rec) {
    return Enumerations.empty();
}
 
Example 14
Source File: MultiFileSystemGetAttrTest.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public Enumeration<String> attributes(String name) {
    return Enumerations.empty();
}
 
Example 15
Source File: MultiFileObject.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public Enumeration<? extends FileObject> getData(boolean rec) {
    return Enumerations.empty();
}
 
Example 16
Source File: SampleGrammarQueryManager.java    From netbeans with Apache License 2.0 2 votes vote down vote up
/** @stereotype query
 * @output list of results that can be queried on name, and attributes
 * @time Performs fast up to 300 ms.
 * @param ctx represents virtual attribute <code>Node</code> to be replaced. Its parent is a element node.
 * @return enumeration of <code>GrammarResult</code>s (ATTRIBUTE_NODEs) that can be queried on name, and attributes.
 *         Every list member represents one possibility.
 *
 */
public Enumeration queryAttributes(HintContext ctx) {
    return Enumerations.empty();
}
 
Example 17
Source File: AntGrammar.java    From netbeans with Apache License 2.0 2 votes vote down vote up
/**
 * Allow to get names of <b>declared notations</b>.
 * @return list of <code>CompletionResult</code>s (NOTATION_NODEs)
 */
public @Override Enumeration<GrammarResult> queryNotations(String prefix) {
    return Enumerations.empty();
}
 
Example 18
Source File: SampleGrammarQueryManager.java    From netbeans with Apache License 2.0 2 votes vote down vote up
/** Can this manager provide a grammar for given context?
 * @param ctx Enumeration of DOM Nodes at Document level
 *        (never <code>null</code>). Method must not
 *        invoke <code>remove</remove> at the iterator.
 * @return <code>null</code> if a grammar cannot be provided for
 *         the context else return context items (subenum of
 *         passed one) that defines grammar enableness context.
 *
 */
public Enumeration enabled(GrammarEnvironment ctx) {
    return Enumerations.empty();
}
 
Example 19
Source File: AbstractSchemaBasedGrammar.java    From netbeans with Apache License 2.0 2 votes vote down vote up
/**
 * Allow to get names of <b>parsed general entities</b>.
 * @param prefix prefix filter
 * @return enumeration of <code>GrammarResult</code>s (ENTITY_REFERENCE_NODEs)
 */
@Override
public Enumeration<GrammarResult> queryEntities(String prefix) {
    return Enumerations.<GrammarResult>empty();
}
 
Example 20
Source File: AbstractSchemaBasedGrammar.java    From netbeans with Apache License 2.0 2 votes vote down vote up
/**
 * Query attribute options for given context. All implementations must handle
 * queries based on owner element context.
 * @stereotype query
 * @output list of results that can be queried on name, and attributes
 * @time Performs fast up to 300 ms.
 * @param ownerElementCtx represents owner <code>Element</code> that will host result.
 * @return enumeration of <code>GrammarResult</code>s (ATTRIBUTE_NODEs) that can be queried on name, and attributes.
 *         Every list member represents one possibility.
 */
@Override
public Enumeration<GrammarResult> queryAttributes(HintContext ownerElementCtx) {
    return Enumerations.<GrammarResult>empty();
}