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");
}
}
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();
}
}
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;
}
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);
}
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();
}
}
Aggregations