use of javax.tools.FileObject in project ballerina by ballerina-lang.
the class ClassIndexProcessor method writeSimpleNameIndexFile.
private void writeSimpleNameIndexFile(Set<String> elementList, String resourceName) throws IOException {
FileObject file = readOldIndexFile(elementList, resourceName);
if (file != null) {
/**
* Ugly hack for Eclipse JDT incremental compilation.
* Eclipse JDT can't createResource() after successful getResource().
* But we can file.openWriter().
*/
try {
writeIndexFile(elementList, resourceName, file);
return;
} catch (IllegalStateException e) {
// Thrown by HotSpot Java Compiler
}
}
writeIndexFile(elementList, resourceName, null);
}
use of javax.tools.FileObject in project ballerina by ballerina-lang.
the class ClassIndexProcessor method writeIndexFile.
private void writeIndexFile(Set<String> entries, String resourceName, FileObject overrideFile) throws IOException {
FileObject file = overrideFile;
if (file == null) {
file = filer.createResource(StandardLocation.CLASS_OUTPUT, "", resourceName);
}
try (Writer writer = file.openWriter()) {
for (String entry : entries) {
writer.write(entry);
writer.write("\n");
}
}
}
use of javax.tools.FileObject in project mvp4g2 by mvp4g.
the class ApplicationAnnotationScanner method restore.
private ApplicationMetaModel restore() {
Properties props = new Properties();
try {
FileObject resource = this.processingEnvironment.getFiler().getResource(StandardLocation.CLASS_OUTPUT, "", this.createRelativeFileName());
props.load(resource.openInputStream());
return new ApplicationMetaModel(props);
} catch (IOException e) {
// every thing is ok -> no operation
// this.processorUtils.createNoteMessage("no resource found for : >>" + this.createRelativeFileName() + "<<");
}
return null;
}
use of javax.tools.FileObject in project mvp4g2 by mvp4g.
the class HistoryAnnotationScanner method restore.
private HistoryMetaModel restore() {
Properties props = new Properties();
try {
FileObject resource = this.processingEnvironment.getFiler().getResource(StandardLocation.CLASS_OUTPUT, "", this.createRelativeFileName());
props.load(resource.openInputStream());
return new HistoryMetaModel(props);
} catch (IOException e) {
// every thing is ok -> no operation
// this.processorUtils.createNoteMessage("no resource found for : >>" + this.createRelativeFileName() + "<<");
}
return new HistoryMetaModel();
}
use of javax.tools.FileObject in project mvp4g2 by mvp4g.
the class PresenterAnnotationScanner method restore.
private PresenterMetaModel restore() {
Properties props = new Properties();
try {
FileObject resource = this.processingEnvironment.getFiler().getResource(StandardLocation.CLASS_OUTPUT, "", this.createRelativeFileName());
props.load(resource.openInputStream());
return new PresenterMetaModel(props);
} catch (IOException e) {
// every thing is ok -> no operation
// this.processorUtils.createNoteMessage("no resource found for : >>" + this.createRelativeFileName() + "<<");
}
return new PresenterMetaModel();
}
Aggregations