本文整理汇总了Java中org.openide.filesystems.annotations.LayerBuilder.File.stringvalue方法的典型用法代码示例。如果您正苦于以下问题:Java File.stringvalue方法的具体用法?Java File.stringvalue怎么用?Java File.stringvalue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.openide.filesystems.annotations.LayerBuilder.File
的用法示例。
在下文中一共展示了File.stringvalue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
示例2: 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;
}
示例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: setFileChooserRelatedAttributes
import org.openide.filesystems.annotations.LayerBuilder.File; //导入方法依赖的package包/类
private void setFileChooserRelatedAttributes(Registration r,
MIMEResolver resolver, File f) {
if (r.showInFileChooser().length > 0) {
String[] types = MIMEResolverImpl.getMIMETypes(resolver);
List<String> exts = ((FilterInfo) resolver).getExtensions();
int cnt = 0;
for (String ext : unq(exts)) {
f.stringvalue("ext." + (cnt++), ext); // NOI18N
}
int tcnt = 0;
for (String type : unq(types)) {
f.stringvalue("mimeType." + (tcnt++), type); // NOI18N
}
int ncnt = 0;
for (String name : ((FilterInfo) resolver).getFileNames()) {
f.stringvalue("fileName." + (ncnt++), name); //NOI18N
}
}
}
示例6: writeBundle
import org.openide.filesystems.annotations.LayerBuilder.File; //导入方法依赖的package包/类
private void writeBundle(File f, String key, String value, Element e) throws LayerGenerationException {
if (value.isEmpty()) {
return;
}
// test first; note that cannot call bundlevalue on f since its originatingElement is wrong
layer(e).file("dummy/file").bundlevalue(key, value);
if (value.startsWith("#")) {
Element referenceElement = e;
while (referenceElement != null && referenceElement.getKind() != ElementKind.PACKAGE) {
referenceElement = referenceElement.getEnclosingElement();
}
if (referenceElement == null) {
throw new LayerGenerationException("No reference element to determine package in '" + value + "'", e);
}
value = ((PackageElement) referenceElement).getQualifiedName() + ".Bundle" + value;
}
f.stringvalue(key, value);
}
示例7: instanceFile
import org.openide.filesystems.annotations.LayerBuilder.File; //导入方法依赖的package包/类
private static File instanceFile(LayerBuilder b, String folder, String name, Class implClass, String factoryMethod, Class... instanceOf) {
String basename;
if (name == null) {
basename = implClass.getName().replace('.', '-'); //NOI18N
if (factoryMethod != null) {
basename += "-" + factoryMethod; //NOI18N
}
} else {
basename = name;
}
File f = b.file(folder + "/" + basename + ".instance"); //NOI18N
if (implClass != null) {
if (factoryMethod != null) {
f.methodvalue("instanceCreate", implClass.getName(), factoryMethod); //NOI18N
} else {
f.stringvalue("instanceClass", implClass.getName()); //NOI18N
}
}
for(Class c : instanceOf) {
f.stringvalue("instanceOf", c.getName()); //NOI18N
}
return f;
}
示例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: instanceFile
import org.openide.filesystems.annotations.LayerBuilder.File; //导入方法依赖的package包/类
private static File instanceFile(LayerBuilder b, String folder, String name, String implClass, String factoryMethod, Integer position, Class... instanceOf) {
String basename;
if (name == null) {
basename = implClass.replace('.', '-'); //NOI18N
if (factoryMethod != null) {
basename += "-" + factoryMethod; //NOI18N
}
} else {
basename = name;
}
File f = b.file(folder + "/" + basename + ".instance"); //NOI18N
if (implClass != null) {
if (factoryMethod != null) {
f.methodvalue("instanceCreate", implClass, factoryMethod); //NOI18N
} else {
f.stringvalue("instanceClass", implClass); //NOI18N
}
}
for(Class c : instanceOf) {
f.stringvalue("instanceOf", c.getName()); //NOI18N
}
if (position != null) {
f.intvalue("position", position); //NOI18N
}
return f;
}
示例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: commaSeparated
import org.openide.filesystems.annotations.LayerBuilder.File; //导入方法依赖的package包/类
private static File commaSeparated(File f, String[] arr) {
if (arr.length == 0) {
return f;
}
StringBuilder sb = new StringBuilder();
String sep = "";
for (String s : arr) {
sb.append(sep);
sb.append(s);
sep = ",";
}
return f.stringvalue("xmlproperties.ignoreChanges", sb.toString());
}
示例14: 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(PathRecognizerRegistration.class)) {
TypeElement cls = (TypeElement) e;
PathRecognizerRegistration prr = cls.getAnnotation(PathRecognizerRegistration.class);
String sourcePathIds = processIds(prr.sourcePathIds());
String libraryPathIds = processIds(prr.libraryPathIds());
String binaryLibraryPathIds = processIds(prr.binaryLibraryPathIds());
String mimeTypes = processMts(prr.mimeTypes());
if (mimeTypes != null && (sourcePathIds != null || libraryPathIds != null || binaryLibraryPathIds != null)) {
final LayerBuilder lb = layer(cls);
File f = instanceFile(lb,
"Services/Hidden/PathRecognizers", //NOI18N
makeFilesystemName(cls.getQualifiedName().toString()),
DefaultPathRecognizer.class,
"createInstance", //NOI18N
PathRecognizer.class);
if (sourcePathIds != null) {
f.stringvalue("sourcePathIds", sourcePathIds); //NOI18N
}
if (libraryPathIds != null) {
f.stringvalue("libraryPathIds", libraryPathIds); //NOI18N
}
if (binaryLibraryPathIds != null) {
f.stringvalue("binaryLibraryPathIds", binaryLibraryPathIds); //NOI18N
}
if (mimeTypes != null) {
f.stringvalue("mimeTypes", mimeTypes); //NOI18N
}
f.write();
}
}
return true;
}
示例15: generateContext
import org.openide.filesystems.annotations.LayerBuilder.File; //导入方法依赖的package包/类
private void generateContext(Element e, File f, ActionRegistration ar) throws LayerGenerationException {
ExecutableElement ee = null;
ExecutableElement candidate = null;
for (ExecutableElement element : ElementFilter.constructorsIn(e.getEnclosedElements())) {
if (element.getKind() == ElementKind.CONSTRUCTOR) {
candidate = element;
if (!element.getModifiers().contains(Modifier.PUBLIC)) {
continue;
}
if (ee != null) {
throw new LayerGenerationException("Only one public constructor allowed", e, processingEnv, ar); // NOI18N
}
ee = element;
}
}
if (ee == null || ee.getParameters().size() != 1) {
if (candidate != null) {
throw new LayerGenerationException("Constructor has to be public with one argument", candidate);
}
throw new LayerGenerationException("Constructor must have one argument", ee);
}
VariableElement ve = (VariableElement)ee.getParameters().get(0);
TypeMirror ctorType = ve.asType();
switch (ctorType.getKind()) {
case ARRAY:
String elemType = ((ArrayType) ctorType).getComponentType().toString();
throw new LayerGenerationException("Use List<" + elemType + "> rather than " + elemType + "[] in constructor", e, processingEnv, ar);
case DECLARED:
break; // good
default:
throw new LayerGenerationException("Must use SomeType (or List<SomeType>) in constructor, not " + ctorType.getKind());
}
DeclaredType dt = (DeclaredType) ctorType;
String dtName = processingEnv.getElementUtils().getBinaryName((TypeElement)dt.asElement()).toString();
if ("java.util.List".equals(dtName)) {
if (dt.getTypeArguments().isEmpty()) {
throw new LayerGenerationException("Use List<SomeType>", ee);
}
f.stringvalue("type", binaryName(dt.getTypeArguments().get(0)));
f.methodvalue("delegate", "org.openide.awt.Actions", "inject");
f.stringvalue("injectable", processingEnv.getElementUtils().getBinaryName((TypeElement) e).toString());
f.stringvalue("selectionType", "ANY");
f.methodvalue("instanceCreate", "org.openide.awt.Actions", "context");
return;
}
if (!dt.getTypeArguments().isEmpty()) {
throw new LayerGenerationException("No type parameters allowed in ", ee);
}
f.stringvalue("type", binaryName(ctorType));
f.methodvalue("delegate", "org.openide.awt.Actions", "inject");
f.stringvalue("injectable", processingEnv.getElementUtils().getBinaryName((TypeElement)e).toString());
f.stringvalue("selectionType", "EXACTLY_ONE");
f.methodvalue("instanceCreate", "org.openide.awt.Actions", "context");
}