Search in sources :

Example 66 with FileObject

use of org.openide.filesystems.FileObject in project netbeans-mmd-plugin by raydac.

the class MMKnowledgeSources method node.

@Override
public Node node(final SourceGroup key) {
    SourceNode node = null;
    if (key != null) {
        final FileObject rootFolder = key.getRootFolder();
        final DataFolder folder = getFolder(rootFolder);
        if (folder != null) {
            node = new SourceNode(project, folder, this, key.getDisplayName());
            if (KNOWLEDGE_FOLDER_NAME.equals(folder.getName())) {
                node.setIcons(BadgeIcons.BADGED_FOLDER, BadgeIcons.BADGED_FOLDER_OPEN);
                node.setShortDescription(BUNDLE.getString("KnowledgeSourceGroup.tooltip"));
            }
        }
    }
    return node;
}
Also used : FileObject(org.openide.filesystems.FileObject) DataFolder(org.openide.loaders.DataFolder)

Example 67 with FileObject

use of org.openide.filesystems.FileObject in project netbeans-mmd-plugin by raydac.

the class MMKnowledgeSources method keys.

@Override
public List<SourceGroup> keys() {
    final SourceGroup[] sourceGroups = getSourceGroups(this.project);
    final List<SourceGroup> keysList = new ArrayList<SourceGroup>();
    FileObject fileObject;
    for (final SourceGroup g : sourceGroups) {
        fileObject = g.getRootFolder();
        DataFolder srcDir = getFolder(fileObject);
        if (srcDir != null) {
            keysList.add(g);
        }
    }
    return keysList;
}
Also used : ArrayList(java.util.ArrayList) FileObject(org.openide.filesystems.FileObject) DataFolder(org.openide.loaders.DataFolder) SourceGroup(org.netbeans.api.project.SourceGroup)

Example 68 with FileObject

use of org.openide.filesystems.FileObject in project netbeans-mmd-plugin by raydac.

the class MMDEditorSupport method getProjectDirectory.

public File getProjectDirectory() {
    File result = null;
    final Project project = getProject();
    if (project != null) {
        final FileObject projDir = project.getProjectDirectory();
        if (projDir != null) {
            return FileUtil.toFile(projDir);
        }
    }
    return result;
}
Also used : Project(org.netbeans.api.project.Project) FileObject(org.openide.filesystems.FileObject) File(java.io.File)

Example 69 with FileObject

use of org.openide.filesystems.FileObject in project netbeans-mmd-plugin by raydac.

the class MMDGraphEditor method getProjectFolderAsFileObject.

@Nullable
public FileObject getProjectFolderAsFileObject() {
    final Project proj = this.editorSupport.getProject();
    FileObject result = null;
    if (proj != null) {
        result = proj.getProjectDirectory();
    }
    return result;
}
Also used : Project(org.netbeans.api.project.Project) FileObject(org.openide.filesystems.FileObject) Nullable(javax.annotation.Nullable)

Example 70 with FileObject

use of org.openide.filesystems.FileObject in project netbeans-mmd-plugin by raydac.

the class RefactoringUtils method hasOnlyMMDNodes.

public static boolean hasOnlyMMDNodes(final Lookup lookup) {
    final Collection<? extends Node> nodes = lookup.lookupAll(Node.class);
    boolean result = false;
    for (final Node n : nodes) {
        final FileObject fo = n.getLookup().lookup(FileObject.class);
        if (fo != null) {
            if (!isMMD(fo)) {
                result = false;
                break;
            } else {
                result = true;
            }
        }
    }
    return result;
}
Also used : Node(org.openide.nodes.Node) FileObject(org.openide.filesystems.FileObject)

Aggregations

FileObject (org.openide.filesystems.FileObject)79 File (java.io.File)27 IOException (java.io.IOException)16 ArrayList (java.util.ArrayList)9 NotifyDescriptor (org.openide.NotifyDescriptor)7 Project (org.netbeans.api.project.Project)6 DataObject (org.openide.loaders.DataObject)6 ActionEvent (java.awt.event.ActionEvent)5 PropertyChangeEvent (java.beans.PropertyChangeEvent)5 PropertyChangeListener (java.beans.PropertyChangeListener)5 InputStream (java.io.InputStream)5 JFileChooser (javax.swing.JFileChooser)5 JPanel (javax.swing.JPanel)5 ImportControllerUI (org.gephi.desktop.importer.api.ImportControllerUI)5 DialogFileFilter (org.gephi.ui.utils.DialogFileFilter)5 DialogDescriptor (org.openide.DialogDescriptor)5 ActionListener (java.awt.event.ActionListener)4 DocumentBuilder (javax.xml.parsers.DocumentBuilder)4 DocumentBuilderFactory (javax.xml.parsers.DocumentBuilderFactory)4 BorderLayout (java.awt.BorderLayout)3