本文整理汇总了Java中org.openide.filesystems.annotations.LayerBuilder.File.position方法的典型用法代码示例。如果您正苦于以下问题:Java File.position方法的具体用法?Java File.position怎么用?Java File.position使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.filesystems.annotations.LayerBuilder.File
的用法示例。
在下文中一共展示了File.position方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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();
}
示例4: 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();
}
示例5: 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
// }
}
示例6: registerLoader
import org.openide.filesystems.annotations.LayerBuilder.File; //导入方法依赖的package包/类
private static void registerLoader(LayerBuilder b, String mimeType) throws LayerGenerationException {
// File f = b.file("Loaders/" + mimeType + "/Factories/org-netbeans-modules-csl-GsfDataLoader.instance"); //NOI18N
File f = instanceFile(b, "Loaders/" + mimeType + "/Factories", null, GsfDataLoader.class, null); //NOI18N
f.position(89998);
f.write();
}
示例7: processReferences
import org.openide.filesystems.annotations.LayerBuilder.File; //导入方法依赖的package包/类
private void processReferences(Element e, ActionReference ref, ActionID aid) throws LayerGenerationException {
if (!ref.id().category().isEmpty() && !ref.id().id().isEmpty()) {
if (!aid.id().equals(ref.id().id()) || !aid.category().equals(ref.id().category())) {
throw new LayerGenerationException("Can't specify id() attribute when @ActionID provided on the element", e, processingEnv, aid);
}
}
String name = ref.name();
if (name.isEmpty()) {
name = aid.id().replace('.', '-');
}
if (ref.path().startsWith("Shortcuts")) {
KeyStroke[] stroke = Utilities.stringToKeys(name);
if (stroke == null) {
throw new LayerGenerationException(
"Registrations in Shortcuts folder need to represent a key. "
+ "Specify value for 'name' attribute.\n"
+ "See org.openide.util.Utilities.stringToKeys for possible values. Current "
+ "name=\"" + name + "\" is not valid.\n", e, processingEnv, ref, "path"
);
}
}
File f = layer(e).file(ref.path() + "/" + name + ".shadow");
f.stringvalue("originalFile", "Actions/" + aid.category() + "/" + aid.id().replace('.', '-') + ".instance");
f.position(ref.position());
f.write();
if (ref.separatorAfter() != Integer.MAX_VALUE) {
if (ref.position() == Integer.MAX_VALUE || ref.position() >= ref.separatorAfter()) {
throw new LayerGenerationException("separatorAfter() must be greater than position()", e, processingEnv, ref);
}
File after = layer(e).file(ref.path() + "/" + name + "-separatorAfter.instance");
after.newvalue("instanceCreate", JSeparator.class.getName());
after.position(ref.separatorAfter());
after.write();
}
if (ref.separatorBefore() != Integer.MAX_VALUE) {
if (ref.position() == Integer.MAX_VALUE || ref.position() <= ref.separatorBefore()) {
throw new LayerGenerationException("separatorBefore() must be lower than position()", e, processingEnv, ref);
}
File before = layer(e).file(ref.path() + "/" + name + "-separatorBefore.instance");
before.newvalue("instanceCreate", JSeparator.class.getName());
before.position(ref.separatorBefore());
before.write();
}
}
示例8: processRegistration
import org.openide.filesystems.annotations.LayerBuilder.File; //导入方法依赖的package包/类
private void processRegistration(Element e, RibbonRegistration ref, ActionID aid) throws LayerGenerationException {
String name = aid.id().replace('.', '-');
File f = layer(e).file(ref.path() + "/" + name + ".shadow");
f.stringvalue("originalFile", "Actions/" + aid.category() + "/" + name + ".instance");
f.position(ref.position());
String str = ref.menuText();
if(str!=null && str.length()>0)
f.bundlevalue("menuText", str);
str = ref.description();
if(str!=null && str.length()>0)
f.bundlevalue("description", str);
str = ref.iconBase();
if(str!=null && str.length()>0)
f.stringvalue("iconBase", str);
str = ref.tooltipBody();
if(str!=null && str.length()>0)
f.bundlevalue("tooltipBody", str);
str = ref.tooltipTitle();
if(str!=null && str.length()>0)
f.bundlevalue("tooltipTitle", str);
str = ref.tooltipIcon();
if(str!=null && str.length()>0)
f.stringvalue("tooltipIcon", str);
str = ref.tooltipFooter();
if(str!=null && str.length()>0)
f.bundlevalue("tooltipFooter", str);
str = ref.tooltipFooterIcon();
if(str!=null && str.length()>0)
f.stringvalue("tooltipFooterIcon", str);
switch(ref.priority()) {
case TOP: f.stringvalue("priority", "top"); break;
case MEDIUM: f.stringvalue("priority", "medium"); break;
case LOW: f.stringvalue("priority", "low"); break;
}
f.write();
if (ref.separatorAfter() != Integer.MAX_VALUE) {
if (ref.position() == Integer.MAX_VALUE || ref.position() >= ref.separatorAfter()) {
throw new LayerGenerationException("separatorAfter() must be greater than position()", e, processingEnv, ref);
}
File after = layer(e).file(ref.path() + "/" + name + "-separatorAfter.instance");
after.newvalue("instanceCreate", JSeparator.class.getName());
after.position(ref.separatorAfter());
after.write();
}
if (ref.separatorBefore() != Integer.MAX_VALUE) {
if (ref.position() == Integer.MAX_VALUE || ref.position() <= ref.separatorBefore()) {
throw new LayerGenerationException("separatorBefore() must be lower than position()", e, processingEnv, ref);
}
File before = layer(e).file(ref.path() + "/" + name + "-separatorBefore.instance");
before.newvalue("instanceCreate", JSeparator.class.getName());
before.position(ref.separatorBefore());
before.write();
}
}