本文整理汇总了Java中org.openide.filesystems.annotations.LayerBuilder.File.write方法的典型用法代码示例。如果您正苦于以下问题:Java File.write方法的具体用法?Java File.write怎么用?Java File.write使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.filesystems.annotations.LayerBuilder.File
的用法示例。
在下文中一共展示了File.write方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: handleProcess
import org.openide.filesystems.annotations.LayerBuilder.File; //导入方法依赖的package包/类
@Override
protected boolean handleProcess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) throws LayerGenerationException {
if (roundEnv.processingOver()) {
return false;
}
for (Element e : roundEnv.getElementsAnnotatedWith(ServicesTabNodeRegistration.class)) {
ServicesTabNodeRegistration reg = e.getAnnotation(ServicesTabNodeRegistration.class);
File f = layer(e).
instanceFile("UI/Runtime", null, Node.class).
stringvalue("iconResource", reg.iconResource()).
stringvalue("name", reg.name()).
methodvalue("instanceCreate", "org.openide.nodes.NodeOp", "factory").
bundlevalue("displayName", reg.displayName()).
instanceAttribute("original", Node.class);
if (!"".equals(reg.shortDescription())) {
f.bundlevalue("shortDescription", reg.shortDescription());
}
f.position(reg.position());
f.write();
}
return true;
}
示例2: handle
import org.openide.filesystems.annotations.LayerBuilder.File; //导入方法依赖的package包/类
private void handle(Element e, Registration r) throws LayerGenerationException {
String path = "Projects/" + r.projectType() + "/Customizer";
if (r.category().length() > 0) {
path += "/" + r.category();
}
boolean addsFolder = r.categoryLabel().length() > 0;
if (addsFolder) {
handleFolder(path, e, r);
}
if (e.getKind() == ElementKind.PACKAGE) {
if (!addsFolder) {
throw new LayerGenerationException("Must specify categoryLabel", e, processingEnv, r);
}
} else {
File f = layer(e).instanceFile(path, addsFolder ? "Self" : null, CompositeCategoryProvider.class, r, null);
f.position(addsFolder ? 0 : r.position());
f.write();
}
}
示例3: handleProcess
import org.openide.filesystems.annotations.LayerBuilder.File; //导入方法依赖的package包/类
@Override
protected boolean handleProcess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) throws LayerGenerationException {
for (Element e : roundEnv.getElementsAnnotatedWith(VersioningSystem.Registration.class)) {
Registration a = e.getAnnotation(VersioningSystem.Registration.class);
if (a == null) {
continue;
}
File f = layer(e).instanceFile("Services/VersioningSystem", null, a, null); // NOI18N
f.methodvalue("instanceCreate", DelegatingVCS.class.getName(), "create"); // NOI18N
f.stringvalue("instanceOf", org.netbeans.modules.versioning.core.spi.VersioningSystem.class.getName()); // NOI18N
String[] folderNames = a.metadataFolderNames();
for (int i = 0; i < folderNames.length; i++) {
f.stringvalue("metadataFolderName" + i, folderNames[i]); // NOI18N
}
f.instanceAttribute("delegate", VersioningSystem.class); // NOI18N
f.bundlevalue("displayName", a.displayName()); // NOI18N
f.bundlevalue("menuLabel", a.menuLabel()); // NOI18N
f.stringvalue("actionsCategory", a.actionsCategory()); // NOI18N
f.write();
}
return true;
}
示例4: handleProcess
import org.openide.filesystems.annotations.LayerBuilder.File; //导入方法依赖的package包/类
@Override
protected boolean handleProcess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) throws LayerGenerationException {
for (Element e : roundEnv.getElementsAnnotatedWith(VersioningSystem.Registration.class)) {
Registration r = e.getAnnotation(VersioningSystem.Registration.class);
if(r == null) {
continue;
}
String s = processingEnv.getElementUtils().getBinaryName((TypeElement)e).toString();
File f = layer(e).instanceFile("Services/VersioningSystem", null, r, null); // NOI18N
f.methodvalue("instanceCreate", DelegatingVCS.class.getName(), "create"); // NOI18N
f.stringvalue("instanceOf", VersioningSystem.class.getName());
String[] folderNames = r.metadataFolderNames();
for (int i = 0; i < folderNames.length; i++) {
f.stringvalue("metadataFolderName" + i, folderNames[i]); // NOI18N
}
f.instanceAttribute("delegate", VersioningSystem.class); // NOI18N
f.bundlevalue("displayName", r.displayName()); // NOI18N
f.bundlevalue("menuLabel", r.menuLabel()); // NOI18N
f.stringvalue("actionsCategory", r.actionsCategory()); // NOI18N
f.boolvalue("isLocalHistory", s.equals("org.netbeans.modules.localhistory.LocalHistoryVCS")); // NOI18N
f.write();
}
return true;
}
示例5: registerExt
import org.openide.filesystems.annotations.LayerBuilder.File; //导入方法依赖的package包/类
private void registerExt(Element e, ExtensionRegistration r) throws LayerGenerationException {
final LayerBuilder b = layer(e);
File f = b.file("Services/MIMEResolver/" + getName(e).replace('.', '-') + "-Extension" + SUFFIX); // NOI18N
f.methodvalue("instanceCreate", MIMEResolver.class.getName(), "create"); // NOI18N
f.stringvalue("instanceClass", MIMEResolver.class.getName()); // NOI18N
f.stringvalue("mimeType", r.mimeType()); // NOI18N
int cnt = 0;
for (String ext : r.extension()) {
f.stringvalue("ext." + (cnt++), ext); // NOI18N
}
f.position(r.position());
int ccnt = 0;
for (String chooser : r.showInFileChooser()) {
f.bundlevalue("fileChooser." + (ccnt++), chooser);
}
f.bundlevalue("displayName", r.displayName()); // NOI18N
f.write();
}
示例6: registerDefinition
import org.openide.filesystems.annotations.LayerBuilder.File; //导入方法依赖的package包/类
private void registerDefinition(Element e, String relRes, Registration r) throws LayerGenerationException {
String absRes = LayerBuilder.absolutizeResource(e, relRes);
final LayerBuilder b = layer(e);
FileObject fo = b.validateResource(absRes, e, r, null, false);
File f = b.file("Services/MIMEResolver/" + getName(e).replace('.', '-') + "-Registration" + SUFFIX); // NOI18N
f.methodvalue("instanceCreate", MIMEResolver.class.getName(), "create"); // NOI18N
f.stringvalue("instanceClass", MIMEResolver.class.getName()); // NOI18N
f.serialvalue("bytes", generateInstanceResolver(fo, e, f, r)); // NOI18N
f.position(r.position());
int ccnt = 0;
for (String chooser : r.showInFileChooser()) {
f.bundlevalue("fileChooser." + (ccnt++), chooser);
}
f.bundlevalue("displayName", r.displayName()); // NOI18N
f.write();
}
示例7: handleElement
import org.openide.filesystems.annotations.LayerBuilder.File; //导入方法依赖的package包/类
private void handleElement(Element e, Keywords annotation, String name) throws LayerGenerationException {
originatingElement = e;
if (!annotation.location().equals(OptionsDisplayer.GENERAL) && !annotation.location().equals(OptionsDisplayer.KEYMAPS)) {
if (annotation.tabTitle().trim().isEmpty()) {
throw new LayerGenerationException("Must specify tabTitle", e, processingEnv, annotation, "tabTitle");
}
}
File file = layer(e).
file("OptionsDialog/Keywords/".concat(e.asType().toString()).concat(name)).
stringvalue("location", annotation.location()).
bundlevalue("tabTitle", annotation.tabTitle(), annotation, "tabTitle");
String[] keywords = annotation.keywords();
for (int j = 0; j < keywords.length; j++) {
file = file.bundlevalue("keywords-".concat(Integer.toString(j+1)), keywords[j], annotation, "keywords");
}
file.write();
}
示例8: handleProcess
import org.openide.filesystems.annotations.LayerBuilder.File; //导入方法依赖的package包/类
@Override
protected boolean handleProcess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) throws LayerGenerationException {
for (Element e : roundEnv.getElementsAnnotatedWith(Registration.class)) {
Registration registration = e.getAnnotation(Registration.class);
if(registration == null) {
continue;
}
File f = layer(e).instanceFile("Services", null);
f.stringvalue("instanceOf", TestCreatorProvider.class.getName());
f.bundlevalue("displayName", registration.displayName());
f.bundlevalue("identifier", registration.identifier());
f.write();
}
return true;
}
示例9: handleProcess
import org.openide.filesystems.annotations.LayerBuilder.File; //导入方法依赖的package包/类
@Override
protected boolean handleProcess(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) throws LayerGenerationException {
for (Element e : roundEnv.getElementsAnnotatedWith(BugtrackingConnector.Registration.class)) {
Registration r = e.getAnnotation(BugtrackingConnector.Registration.class);
if (r == null) {
continue;
}
File f = layer(e).instanceFile("Services/Bugtracking", null, r, null); // NOI18N
f.methodvalue("instanceCreate", DelegatingConnector.class.getName(), "create"); // NOI18N
f.stringvalue("instanceOf", BugtrackingConnector.class.getName()); // NOI18N
f.instanceAttribute("delegate", BugtrackingConnector.class); // NOI18N
f.bundlevalue("displayName", r.displayName()); // NOI18N
f.bundlevalue("tooltip", r.tooltip()); // NOI18N
f.stringvalue("id", r.id()); // NOI18N
f.boolvalue("providesRepositoryManagement", r.providesRepositoryManagement()); // NOI18N
if (!r.iconPath().isEmpty()) {
f.bundlevalue("iconPath", r.iconPath()); // NOI18N
}
f.write();
}
return true;
}
示例10: handleProcess
import org.openide.filesystems.annotations.LayerBuilder.File; //导入方法依赖的package包/类
@Override
protected boolean handleProcess(Set<? extends TypeElement> set, RoundEnvironment env) throws LayerGenerationException {
Elements elements = processingEnv.getElementUtils();
for (Element element : env.getElementsAnnotatedWith(AboutBox.class)) {
TypeElement clazz = (TypeElement) element;
AboutBox aboutBox = clazz.getAnnotation(AboutBox.class);
String teName = elements.getBinaryName(clazz).toString();
File file = layer(element)
.file("AboutBox/" + teName.replace('.', '-') + ".instance")
.intvalue("position", aboutBox.position())
.bundlevalue("displayName", aboutBox.displayName());
if (!aboutBox.iconPath().isEmpty()) {
file.bundlevalue("iconPath", aboutBox.iconPath());
}
file.write();
}
return true;
}
示例11: registerCslPlugin
import org.openide.filesystems.annotations.LayerBuilder.File; //导入方法依赖的package包/类
private static void registerCslPlugin(LayerBuilder b, String mimeType, TypeElement language, boolean useMultiview) throws LayerGenerationException {
File f = b.folder("CslPlugins/" + mimeType); //NOI18N
f.intvalue("genver", 2); //NOI18N
f.write();
f.boolvalue("useMultiview", useMultiview); //NOI18N
f.write();
f = instanceFile(b, "CslPlugins/" + mimeType, "language", (String) null, null); //NOI18N
f.stringvalue("instanceClass", language.getQualifiedName().toString()); //NOI18N
f.write();
}
示例12: registerPathRecognizer
import org.openide.filesystems.annotations.LayerBuilder.File; //导入方法依赖的package包/类
private static void registerPathRecognizer(LayerBuilder b, String mimeType) throws LayerGenerationException {
File f = instanceFile(b,
"Services/Hidden/PathRecognizers", //NOI18N
"org-netbeans-modules-csl-core-PathRecognizerImpl-" + makeFilesystemName(mimeType), //NOI18N
PathRecognizerImpl.class,
"createInstance", //NOI18N
PathRecognizer.class);
// f.methodvalue("instanceCreate", "org.netbeans.modules.csl.core.PathRecognizerImpl", "createInstance"); //NOI18N
f.stringvalue("mimeType", mimeType); //NOI18N
f.write();
}
示例13: registerCommentUncommentToolbarButtons
import org.openide.filesystems.annotations.LayerBuilder.File; //导入方法依赖的package包/类
private static void registerCommentUncommentToolbarButtons(LayerBuilder b, String mimeType) {
File f = instanceFile(b, "Editors/" + mimeType + "/Toolbars/Default", "Separator-before-comment", JSeparator.class, null); //NOI18N
f.position(30000);
f.write();
f = b.file("Editors/" + mimeType + "/Toolbars/Default/comment"); //NOI18N
f.position(30100);
f.write();
f = b.file("Editors/" + mimeType + "/Toolbars/Default/uncomment"); //NOI18N
f.position(30200);
f.write();
//
// // Toolbar
// if (linePrefix != null && linePrefix.length() > 0) {
// // Yes, found line comment prefix - register comment/uncomment toolbar buttons!
// Element toolbarFolder = mkdirs(mimeFolder, "Toolbars/Default"); // NOI18N
//
// item = createFile(doc, toolbarFolder, "Separator-before-comment.instance"); // NOI18N
// setFileAttribute(doc, item, "instanceClass", STRINGVALUE, "javax.swing.JSeparator"); // NOI18N
// setFileAttribute(doc, item, "position", INTVALUE, "30000"); // NOI18N
//
// item = createFile(doc, toolbarFolder, "comment"); // NOI18N
// setFileAttribute(doc, item, "position", INTVALUE, "30100"); // NOI18N
//
// item = createFile(doc, toolbarFolder, "uncomment"); // NOI18N
// setFileAttribute(doc, item, "position", INTVALUE, "30200"); // NOI18N
// }
}
示例14: dumpAnnotation
import org.openide.filesystems.annotations.LayerBuilder.File; //导入方法依赖的package包/类
private void dumpAnnotation(LayerBuilder builder, File folder, Element errElement, AnnotationMirror annotation, boolean topLevel) {
String fqn = getFQN(((TypeElement) annotation.getAnnotationType().asElement())).replace('.', '-');
if (topLevel && !fqn.startsWith("org-netbeans-spi-java-hints")) return ;
final File annotationFolder = builder.folder(folder.getPath() + "/" + fqn + ".annotation");
for (Entry<? extends ExecutableElement, ? extends AnnotationValue> e : annotation.getElementValues().entrySet()) {
final String attrName = e.getKey().getSimpleName().toString();
e.getValue().accept(new DumpAnnotationValue(builder, annotationFolder, attrName, errElement, annotation, e.getValue()), null);
}
annotationFolder.write();
}
示例15: visitAnnotation
import org.openide.filesystems.annotations.LayerBuilder.File; //导入方法依赖的package包/类
public Void visitAnnotation(AnnotationMirror a, Void p) {
File f = builder.folder(annotationFolder.getPath() + "/" + attrName);
dumpAnnotation(builder, f, errElement, a, false);
f.write();
return null;
}