Search in sources :

Example 61 with FileObject

use of org.openide.filesystems.FileObject in project Aspose.BarCode-for-Java by aspose-barcode.

the class AsposeMavenProjectManager method writeToPOM.

/**
 * @param pomDocument
 * @throws IOException
 */
public void writeToPOM(Document pomDocument) throws IOException {
    FileObject projectRoot = FileUtil.toFileObject(projectDir);
    FileObject fo = FileUtil.createData(projectRoot, AsposeConstants.MAVEN_POM_XML);
    try (OutputStream out = fo.getOutputStream()) {
        XMLUtil.write(pomDocument, out, "UTF-8");
    }
}
Also used : FileObject(org.openide.filesystems.FileObject)

Example 62 with FileObject

use of org.openide.filesystems.FileObject in project Aspose.BarCode-for-Java by aspose-barcode.

the class AsposeMavenProjectWizardIterator method createAsposeMavenProject.

private void createAsposeMavenProject(InputStream source, FileObject projectRoot) throws IOException {
    try {
        ZipInputStream str = new ZipInputStream(source);
        ZipEntry entry;
        while ((entry = str.getNextEntry()) != null) {
            if (entry.isDirectory()) {
                FileUtil.createFolder(projectRoot, entry.getName());
            } else {
                FileObject fo = FileUtil.createData(projectRoot, entry.getName());
                if (AsposeConstants.MAVEN_POM_XML.equals(entry.getName())) {
                    /*
                         Special handling for maven pom.xml:
                         1. Defining / creating project artifacts
                         2. Adding latest Aspose.BarCode Maven Dependency reference into pom.xml
                         */
                    configureProjectMavenPOM(fo, str);
                } else {
                    writeFile(str, fo);
                }
            }
        }
    } finally {
        source.close();
    }
}
Also used : ZipInputStream(java.util.zip.ZipInputStream) ZipEntry(java.util.zip.ZipEntry) FileObject(org.openide.filesystems.FileObject)

Example 63 with FileObject

use of org.openide.filesystems.FileObject in project blue by kunstmusik.

the class LazyPluginFactory method loadPlugins.

public static <T> List<LazyPlugin<T>> loadPlugins(String folder, Class<T> pluginClass, MetaDataProcessor processor, Filter f) {
    List<LazyPlugin<T>> plugins = new ArrayList<>();
    FileObject[] files = FileUtil.getConfigFile(folder).getChildren();
    List<FileObject> orderedFiles = FileUtil.getOrder(Arrays.asList(files), true);
    for (FileObject fObj : orderedFiles) {
        if (fObj.isFolder()) {
            continue;
        }
        if (f != null && !f.accept(fObj)) {
            continue;
        }
        LazyPlugin<T> plugin = new LazyPlugin<>(fObj, pluginClass);
        if (processor != null) {
            processor.process(fObj, plugin);
        }
        plugins.add(plugin);
    }
    return plugins;
}
Also used : ArrayList(java.util.ArrayList) FileObject(org.openide.filesystems.FileObject)

Example 64 with FileObject

use of org.openide.filesystems.FileObject in project cakephp-netbeans by cakephp.

the class CakeScript method forPhpModule.

/**
 * Get the project specific, <b>valid only</b> Cake script. If not found, the {@link InvalidPhpProgramException} is thrown.
 * @param phpModule PHP module for which Cake script is taken
 * @return the project specific, <b>valid only</b> Cake script
 * @throws InvalidPhpProgramException if Zend script is not valid or missing completely
 */
public static CakeScript forPhpModule(PhpModule phpModule) throws InvalidPhpProgramException {
    FileObject sourceDirectory = phpModule.getSourceDirectory();
    // locate
    FileObject cake = sourceDirectory.getFileObject(SCRIPT_DIRECTORY + SCRIPT_NAME);
    if (cake == null) {
        cake = sourceDirectory.getFileObject(SCRIPT_DIRECTORY + SCRIPT_NAME_LONG);
    }
    if (cake == null) {
        throw new InvalidPhpProgramException(NbBundle.getMessage(CakeScript.class, "MSG_CakeNotFound"));
    }
    // validate
    String cakePath = FileUtil.toFile(cake).getAbsolutePath();
    String error = validate(cakePath);
    if (error != null) {
        throw new InvalidPhpProgramException(error);
    }
    return new CakeScript(cakePath, phpModule);
}
Also used : FileObject(org.openide.filesystems.FileObject)

Example 65 with FileObject

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

the class MindMapLink method readUTF8Text.

public String readUTF8Text() throws IOException {
    final FileObject foj = getFile();
    final FileLock flock = lock(foj);
    try {
        return foj.asText("UTF-8");
    } finally {
        flock.releaseLock();
    }
}
Also used : FileLock(org.openide.filesystems.FileLock) 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