Search in sources :

Example 1 with ALinkNode

use of org.freeplane.plugin.workspace.nodes.ALinkNode in project freeplane by freeplane.

the class ProjectModel method getAllNodesFiltered.

public List<URI> getAllNodesFiltered(String filter) {
    HashSet<URI> set = new HashSet<URI>();
    Collection<AWorkspaceTreeNode> values = hashStringKeyIndex.values();
    for (AWorkspaceTreeNode node : values) {
        if (node instanceof AFolderNode || node instanceof FolderFileNode) {
            continue;
        }
        if (node instanceof DefaultFileNode) {
            File file = ((DefaultFileNode) node).getFile();
            if (file.getName().endsWith(filter)) {
                set.add(file.toURI());
            }
        } else if (node instanceof ALinkNode) {
            URI uri = ((ALinkNode) node).getLinkURI();
            if (uri.getPath().endsWith(filter)) {
                URI absUri = URIUtils.getAbsoluteURI(uri);
                if (absUri == null) {
                    continue;
                }
                set.add(absUri);
            }
        }
    }
    return Arrays.asList(set.toArray(new URI[] {}));
}
Also used : AWorkspaceTreeNode(org.freeplane.plugin.workspace.model.AWorkspaceTreeNode) FolderFileNode(org.freeplane.plugin.workspace.nodes.FolderFileNode) AFolderNode(org.freeplane.plugin.workspace.nodes.AFolderNode) ALinkNode(org.freeplane.plugin.workspace.nodes.ALinkNode) URI(java.net.URI) File(java.io.File) DefaultFileNode(org.freeplane.plugin.workspace.nodes.DefaultFileNode) HashSet(java.util.HashSet)

Aggregations

File (java.io.File)1 URI (java.net.URI)1 HashSet (java.util.HashSet)1 AWorkspaceTreeNode (org.freeplane.plugin.workspace.model.AWorkspaceTreeNode)1 AFolderNode (org.freeplane.plugin.workspace.nodes.AFolderNode)1 ALinkNode (org.freeplane.plugin.workspace.nodes.ALinkNode)1 DefaultFileNode (org.freeplane.plugin.workspace.nodes.DefaultFileNode)1 FolderFileNode (org.freeplane.plugin.workspace.nodes.FolderFileNode)1