當前位置: 首頁>>代碼示例>>Java>>正文


Java File類代碼示例

本文整理匯總了Java中org.openide.filesystems.annotations.LayerBuilder.File的典型用法代碼示例。如果您正苦於以下問題:Java File類的具體用法?Java File怎麽用?Java File使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


File類屬於org.openide.filesystems.annotations.LayerBuilder包,在下文中一共展示了File類的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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:23,代碼來源:ServiceTabProcessor.java

示例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();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:20,代碼來源:CompositeCategoryProviderAnnotationProcessor.java

示例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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:23,代碼來源:VCSRegistrationProcessor.java

示例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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:26,代碼來源:VCSRegistrationProcessor.java

示例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();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,代碼來源:MIMEResolverProcessor.java

示例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();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:17,代碼來源:MIMEResolverProcessor.java

示例7: 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
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:21,代碼來源:MIMEResolverProcessor.java

示例8: 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();
   }
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:OptionsPanelControllerProcessor.java

示例9: 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);
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:21,代碼來源:OptionAnnotationProcessorImpl.java

示例10: 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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:27,代碼來源:PathRecognizerRegistrationProcessor.java

示例11: 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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:18,代碼來源:TestCreatorProviderProcessor.java

示例12: 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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:23,代碼來源:BugtrackingRegistrationProcessor.java

示例13: 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;
}
 
開發者ID:senbox-org,項目名稱:snap-desktop,代碼行數:19,代碼來源:AboutBoxProcessor.java

示例14: 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;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:31,代碼來源:LanguageRegistrationProcessor.java

示例15: 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();
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:13,代碼來源:LanguageRegistrationProcessor.java


注:本文中的org.openide.filesystems.annotations.LayerBuilder.File類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。