当前位置: 首页>>代码示例>>Java>>正文


Java FileUtil.getConfigFile方法代码示例

本文整理汇总了Java中org.openide.filesystems.FileUtil.getConfigFile方法的典型用法代码示例。如果您正苦于以下问题:Java FileUtil.getConfigFile方法的具体用法?Java FileUtil.getConfigFile怎么用?Java FileUtil.getConfigFile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.openide.filesystems.FileUtil的用法示例。


在下文中一共展示了FileUtil.getConfigFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testFactoryActionIsOKInEQ

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
public void testFactoryActionIsOKInEQ() throws Exception {
    assertTrue("This one needs to run in EQT", EventQueue.isDispatchThread());
    FileObject fo = FileUtil.getConfigFile("Actions/Windows/open-factory-tc.instance");
    assertNotNull("Action generated", fo);
    Action a = (Action)fo.getAttribute("instanceCreate");
    assertNotNull("Action found", a);
    assertEquals("Not created yet", 0, TC.cnt);
    a.actionPerformed(new ActionEvent(this, 0, ""));
    assertEquals("Created", 1, TC.cnt);
    assertEquals("Hello TC!", a.getValue(Action.NAME));
    assertEquals("any/iconbase.png", a.getValue("iconBase"));
    assertEquals("preferredID found", "factory-tc", fo.getAttribute("preferredID"));
    
    FileObject dir = FileUtil.getConfigFile("Kuk/Huk");
    assertNotNull("Kuk/Huk found", dir);
    FileObject ref = dir.getFileObject("open-factory-tc.shadow");
    assertNotNull("Reference found: " + Arrays.toString(dir.getChildren()), ref);
    assertEquals(fo.getPath(), ref.getAttribute("originalFile"));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:TopComponentProcessorTest.java

示例2: testContextAction

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
public void testContextAction() throws Exception {
    Context.cnt = 0;
    
    FileObject fo = FileUtil.getConfigFile(
        "actions/support/test/testInjectContext.instance"
    );
    assertNotNull("File found", fo);
    Object obj = fo.getAttribute("instanceCreate");
    assertNotNull("Attribute present", obj);
    assertTrue("It is context aware action", obj instanceof ContextAwareAction);
    ContextAwareAction a = (ContextAwareAction)obj;

    InstanceContent ic = new InstanceContent();
    AbstractLookup lkp = new AbstractLookup(ic);
    Action clone = a.createContextAwareInstance(lkp);
    ic.add(10);

    assertEquals("Number lover!", clone.getValue(Action.NAME));
    clone.actionPerformed(new ActionEvent(this, 300, ""));
    assertEquals("Global Action not called", 10, Context.cnt);

    ic.remove(10);
    clone.actionPerformed(new ActionEvent(this, 200, ""));
    assertEquals("Global Action stays same", 10, Context.cnt);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:ContextActionInjectTest.java

示例3: testOSGiCanProvideLayer

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
public void testOSGiCanProvideLayer() throws Exception {
    mgr.mutexPrivileged().enterWriteAccess();
    FileObject fo;
    try {
        String mfBar = "Bundle-SymbolicName: org.bar\n" +
            "Bundle-Version: 1.1.0\n" +
            "Bundle-ManifestVersion: 2\n" +
            "Import-Package: org.foo\n" +
            "OpenIDE-Module-Layer: org/bar/layer.xml\n" +
            "\n\n";

        File j2 = changeManifest(new File(jars, "depends-on-simple-module.jar"), mfBar);
        Module m2 = mgr.create(j2, null, false, false, false);
        mgr.enable(m2);
    } finally {
        mgr.mutexPrivileged().exitWriteAccess();
    }
    fo = FileUtil.getConfigFile("TestFolder");
    assertNotNull("Folder found", fo);

    URL u = mgr.getClassLoader().getResource("org/bar/layer.xml");
    assertNotNull("System ClassLoader can load resources", u);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:NetigsoLayerTest.java

示例4: setStartOffset

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
@Override
public void setStartOffset(int offset) {
    super.setStartOffset (offset);
    FileObject fileObject = FileUtil.getConfigFile ("Spellcheckers/Properties");
    Boolean b = (Boolean) fileObject.getAttribute ("Hidden");
    hidden = Boolean.TRUE.equals (b);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:PropertiesTokenList.java

示例5: getTemplate

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
/**
 * Returns template data object for properties file.
 */
public static DataObject getTemplate() throws IOException {
    FileObject fileObject = FileUtil.getConfigFile("Templates/Other/properties.properties"); // NOI18N

    if(fileObject == null)
        throw new IOException(Util.getString("EXC_TemplateNotFound"));

    try {
        return DataObject.find(fileObject);
    } catch(DataObjectNotFoundException e) {
        throw new IOException(Util.getString("EXC_TemplateNotFound"));
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:JavaResourceHolder.java

示例6: testDataObject

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
public void testDataObject() throws Exception {
    FileObject template = FileUtil.getConfigFile("Templates/Other/SQLTemplate.sql");
    assertNotNull("Template file shall be found", template);

    DataObject obj = DataObject.find(template);
    assertEquals("It is our data object", SQLDataObject.class, obj.getClass());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:SQLDataObjectTest.java

示例7: setUp

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
protected @Override void setUp() throws Exception {
    super.setUp();
    clearWorkDir();

    EditorTestLookup.setLookup(
        new URL[] {
            getClass().getClassLoader().getResource(
                "org/netbeans/modules/editor/settings/storage/layer.xml"),
            getClass().getClassLoader().getResource(
                "org/netbeans/core/resources/mf-layer.xml"), // for MIMEResolverImpl to work
            getClass().getClassLoader().getResource(
                "org/netbeans/modules/editor/settings/storage/compatibility/p1/SFS-Editors-Folder.zip"), 
        },
        getWorkDir(),
        new Object[] {},
        getClass().getClassLoader()
    );

    // This is here to initialize Nb URL factory (org.netbeans.core.startup),
    // which is needed by Nb EntityCatalog (org.netbeans.core).
    // Also see the test dependencies in project.xml
    Main.initializeURLFactory();

    // Sanity check
    FileObject f = FileUtil.getConfigFile("Editors/text/x-java/NetBeans/Defaults/coloring.xml");
    assertNotNull("Corrupted SystemFileSystem!", f);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:Pre90403Phase1CompatibilityTest.java

示例8: testFullFontsColorsMixedLayout

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
public void testFullFontsColorsMixedLayout() throws Exception {
    String writableUserFile = "Editors/" + getWritableFileName(ColoringStorage.ID, "text/x-whatever", "NetBeans", "xyz", false);
    String [] files = new String [] {
        "Editors/text/x-whatever/NetBeans/Defaults/defaultColoring.xml",
        "Editors/text/x-whatever/NetBeans/Defaults/coloring.xml",
        "Editors/text/x-whatever/NetBeans/Defaults/editorColoring.xml",
        "Editors/text/x-whatever/FontsColors/NetBeans/Defaults/file1.xml",
        "Editors/text/x-whatever/FontsColors/NetBeans/Defaults/file2.xml",
        "Editors/text/x-whatever/FontsColors/NetBeans/Defaults/file3.xml",
        "Editors/text/x-whatever/FontsColors/NetBeans/Defaults/file4.xml",
        "Editors/text/x-whatever/NetBeans/coloring.xml",
        "Editors/text/x-whatever/NetBeans/editorColoring.xml",
        "Editors/text/x-whatever/FontsColors/NetBeans/file1.xml",
        "Editors/text/x-whatever/FontsColors/NetBeans/file2.xml",
        "Editors/text/x-whatever/FontsColors/NetBeans/file3.xml",
        writableUserFile,
    };
    
    createOrderedFiles(files, FC_CONTENTS);
    
    FileObject baseFolder = FileUtil.getConfigFile("Editors");
    Map<String, List<Object []>> results = new HashMap<>();
    scan(ColoringStorage.ID, baseFolder, "text/x-whatever", null, true, true, true, results);
    
    assertNotNull("Scan results should not null", results);
    assertEquals("Wrong number of profiles", 1, results.size());
    
    List<Object []> profileFiles = results.get("NetBeans");
    checkProfileFiles(files, writableUserFile, profileFiles, "NetBeans");
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:LocatorTest.java

示例9: testDefineAFileAndCheckType

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
public void testDefineAFileAndCheckType() throws Exception {
    FileObject type = FileUtil.createData(FileUtil.getConfigRoot(), "Templates/type.inc");
    assertEquals("At first unknown", "content/unknown", type.getMIMEType());
    
    FileObject mimeRoot = FileUtil.getConfigFile("Services/MIMEResolver/");
    assertNotNull("Mime root found", mimeRoot);
    
    
    String txt = "<?xml version='1.0' encoding='UTF-8'?>\n"
        + "<!DOCTYPE MIME-resolver PUBLIC '-//NetBeans//DTD MIME Resolver 1.1//EN' 'http://www.netbeans.org/dtds/mime-resolver-1_1.dtd'>\n"
        + "<MIME-resolver>\n"
        + "  <file>\n"
        + "    <ext name='XXX'/>\n"
        + "    <ext name='inc'/>\n"
        + "    <resolver mime='text/x-h'/>\n"
        + "</file>\n"
        + "</MIME-resolver>\n";
    
    FileObject udmr = FileUtil.createData(mimeRoot, "user-defined-mime-resolver.xml");
    
    assertEquals("Still unknown", "content/unknown", type.getMIMEType());
    
    
    OutputStream os = udmr.getOutputStream();
    os.write(txt.getBytes("UTF-8"));
    os.close();
    udmr.setAttribute("position", 555);
    udmr.setAttribute("user-defined-mime-resolver", Boolean.TRUE);
    
    assertEquals("Recognized well at the end", "text/x-h", type.getMIMEType());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:32,代码来源:UserDefinedMIMETest.java

示例10: deleteFileImpl

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
private static void deleteFileImpl(File workDir, String path) throws IOException{
    FileObject fo = FileUtil.toFileObject(new File(workDir, path));
    if (fo == null) {
        fo = FileUtil.getConfigFile(path); // NOI18N
        if (fo == null){
            return;
        }
    }
    fo.delete();        
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:TestUtilities.java

示例11: validate

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
/**
 * Validate according to all *.xsd found in catalog.
 * @param dom DOM fragment to validate
 * @throws SAXException if schemas were malformed or the document was invalid
 */
public static void validate(Element dom) throws SAXException {
    if (FileUtil.getConfigFile(CATALOG) == null) {
        // Probably running from inside a unit test which overrides the system filesystem.
        // Safest and simplest to just skip validation in this case.
        return;
    }
    XMLUtil.validate(dom, projectXmlCombinedSchema());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:ProjectXMLCatalogReader.java

示例12: isValid

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
public boolean isValid () {
    if (shortcutsFolder == null)
        shortcutsFolder = FileUtil.getConfigFile ("Shortcuts"); // NOI18N
    return (getPanel().stroke != null) &&
           (shortcutsFolder.getFileObject(Utilities.keyToString(getPanel().stroke), "instance") == null) && // NOI18N
           (shortcutsFolder.getFileObject(Utilities.keyToString(getPanel().stroke), "xml") == null); // NOI18N
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:SelectKeyboardShortcutPanel.java

示例13: setUp

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
@Override
protected void setUp() throws Exception {
    NbBundle.setBranding("big");
    folder = FileUtil.getConfigFile("actions/support/test");
    assertNotNull("testing layer is loaded: ", folder);

    myIconResourceCounter = 0;
    myListenerCalled = 0;
    myListenerCounter = 0;
    MyAction.last = null;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:12,代码来源:AlwaysEnabledActionTest.java

示例14: setUp

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
@Override
protected void setUp() throws IOException {
    FileObject fo = FileUtil.getConfigFile("Services");
    if (fo != null) {
        fo.delete();
    }
    clearWorkDir();
    MockLookup.setInstances(TestProject.createProjectType());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:GeneratedSourceRootTest.java

示例15: getRepositoryRoot

import org.openide.filesystems.FileUtil; //导入方法依赖的package包/类
@NonNull
private FileObject getRepositoryRoot() {
    FileObject root = FileUtil.getConfigFile("NBProfiler/Config/OQL"); // NOI18N
    if (root == null) {
        throw new IllegalStateException("can not find OQL queries repository"); // NOI18N
    }
    return root;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:OQLQueryRepository.java


注:本文中的org.openide.filesystems.FileUtil.getConfigFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。