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


Java Repository类代码示例

本文整理汇总了Java中org.openide.filesystems.Repository的典型用法代码示例。如果您正苦于以下问题:Java Repository类的具体用法?Java Repository怎么用?Java Repository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: prepareTest

import org.openide.filesystems.Repository; //导入依赖的package包/类
public static void prepareTest(String[] additionalLayers, Object[] additionalLookupContent) throws IOException, SAXException, PropertyVetoException {
    Collection<URL> allUrls = new ArrayList<URL>();
    for (String u : additionalLayers) {
        if (u.charAt(0) == '/') {
            u = u.substring(1);
        }
        for (Enumeration<URL> en = Thread.currentThread().getContextClassLoader().getResources(u); en.hasMoreElements(); ) {
            allUrls.add(en.nextElement());
        }
    }
    XMLFileSystem system = new XMLFileSystem();
    system.setXmlUrls(allUrls.toArray(new URL[allUrls.size()]));
    
    Repository repository = new Repository(system);
    Object[] lookupContent = new Object[additionalLookupContent.length + 1];
    
    System.arraycopy(additionalLookupContent, 0, lookupContent, 1, additionalLookupContent.length);
    
    lookupContent[0] = repository;
    
    setLookup(lookupContent, BaseCaretTest.class.getClassLoader());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:BaseCaretTest.java

示例2: getSupportedMimeTypes

import org.openide.filesystems.Repository; //导入依赖的package包/类
private static List<String> getSupportedMimeTypes () {
    List<String> result = new ArrayList<String> ();
    FileSystem fs = Repository.getDefault ().getDefaultFileSystem ();
    FileObject root = fs.findResource ("Editors");
    Enumeration e1 = root.getChildren (false);
    while (e1.hasMoreElements ()) {
        FileObject f1 = (FileObject) e1.nextElement ();
        if (f1.isData ()) continue;
        Enumeration e2 = f1.getChildren (false);
        while (e2.hasMoreElements ()) {
            FileObject f2 = (FileObject) e2.nextElement ();
            if (f2.isData ()) continue;
            FileObject fo = f2.getFileObject ("language.nbs");
            if (fo == null) continue;
            result.add (f1.getName () + '/' + f2.getName ());
        }
    }
    return result;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:GLFFilesCustomEditor.java

示例3: tearDown

import org.openide.filesystems.Repository; //导入依赖的package包/类
@Override
@SuppressWarnings("deprecation")
protected void tearDown() throws Exception {
for (FileSystem fs : Repository.getDefault().toArray()) {
        Repository.getDefault().removeFileSystem(fs);
    }

    
    List<Reference> gc = new ArrayList<Reference>();
    
    for (Object key : TimesCollectorPeer.getDefault().getFiles()) {
        gc.add(new WeakReference<Object>(key));
    }
    
    for (Reference<?> reference : gc) {
        assertGC("GC it", reference);
    }

}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:HandlerTest.java

示例4: testFileUtilFromFile

import org.openide.filesystems.Repository; //导入依赖的package包/类
@SuppressWarnings("deprecation")
public void testFileUtilFromFile () throws Exception {        
    assertNotNull(root);
    
    File f = FileUtil.normalizeFile(getWorkDir());
    IgnoreDirFileSystem ifs = new IgnoreDirFileSystem();
    ifs.setRootDirectory(f);
    
    Repository.getDefault().addFileSystem(ifs);
    Repository.getDefault().addFileSystem(testedFS);
    
    FileObject[] fos = FileUtil.fromFile(f);
    assertTrue(fos.length > 0);
    assertEquals(fos[0].getFileSystem(), testedFS );
    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:BaseFileObjectTestHid.java

示例5: setUp

import org.openide.filesystems.Repository; //导入依赖的package包/类
/** setUp method  */
public void setUp() {
    System.out.println("########  "+getName()+"  #######");
    if (!getName().equals("testChangeSourceCode") && !getName().equals("testDeleteAnyPropertiesAndEvents")) {
        
        FileObject testFile = Repository.getDefault().findResource("gui/data/" + NAME_TEST_FILE + ".java");
        FileObject destination = Repository.getDefault().findFileSystem(sampleDir.replace('\\', '/')).getRoot();
        
        try {
            DataObject.find(testFile).copy(DataFolder.findFolder(destination));
        } catch (IOException e) {
            fail(e);
        }
    }
    new PropertiesAction().perform();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:ChangingOfBeanPropertyProperties.java

示例6: setUp

import org.openide.filesystems.Repository; //导入依赖的package包/类
/** setUp method  */
public void setUp() {
    // redirect jemmy trace and error output to a log
    System.out.println("########  "+getName()+"  #######");

    OptionsOperator optionsOperator = OptionsOperator.invoke();
    optionsOperator.selectOption(Bundle.getString("org.netbeans.core.Bundle", "UI/Services/Editing")+"|"+Bundle.getString("org.netbeans.modules.beans.Bundle", "PROP_Option_Menu"));
    PropertySheetOperator propertySheetTabOperator = new PropertySheetOperator(optionsOperator);
    new Property(propertySheetTabOperator, Bundle.getString("org.netbeans.modules.beans.Bundle", "PROP_Option_Prop_Style")).setValue(Bundle.getString("org.netbeans.modules.beans.Bundle", "MSG_Option_Gen_This"));
    
    FileObject testFile = Repository.getDefault().findResource("gui/data/" + NAME_TEST_FILE + ".java");
    FileObject destination = Repository.getDefault().findFileSystem(sampleDir.replace('\\', '/')).getRoot();
    optionsOperator.close();
    try {
        DataObject.find(testFile).copy(DataFolder.findFolder(destination));
    } catch (IOException e) {
        fail(e);
    }
    new PropertiesAction().perform();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:CreateNewIndexedProperty.java

示例7: setUp

import org.openide.filesystems.Repository; //导入依赖的package包/类
/** setUp method  */
public void setUp() {
    System.out.println("########  "+getName()+"  #######");

    new EventTool().waitNoEvent(DELAY);
    new PropertiesAction().perform();
    
    FileObject testFile = Repository.getDefault().findResource("gui/data/" + NAME_TEST_FILE + ".java");
    FileObject destination = Repository.getDefault().findFileSystem(sampleDir.replace('\\', '/')).getRoot();
    
    try {
        DataObject.find(testFile).copy(DataFolder.findFolder(destination));
    } catch (IOException e) {
        fail(e);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:BeanInfoGeneration.java

示例8: testCheckBeanInfoCompilability

import org.openide.filesystems.Repository; //导入依赖的package包/类
public void testCheckBeanInfoCompilability() {
    createContent();
    RepositoryTabOperator explorerOperator = new RepositoryTabOperator();
    Node repositoryRootNode = explorerOperator.getRootNode();
    Node patternsNode = new Node(repositoryRootNode, sampleDir+"|"+NAME_TEST_FILE+"|"+"class "+NAME_TEST_FILE+"|"+Bundle.getString("org.netbeans.modules.beans.Bundle", "Patterns"));
    patternsNode.select();
    patternsNode.performPopupActionNoBlock(Bundle.getString("org.netbeans.modules.beans.Bundle", "CTL_TITLE_GenerateBeanInfo"));
    new EventTool().waitNoEvent(DELAY);
    String dialogTitle = Bundle.getString("org.netbeans.modules.beans.beaninfo.Bundle", "CTL_TITLE_GenerateBeanInfo");
    NbDialogOperator nbDialogOperator = new NbDialogOperator(dialogTitle);
    nbDialogOperator.ok();
    //new EventTool().waitNoEvent(1000);
    explorerOperator = new RepositoryTabOperator();
    repositoryRootNode = explorerOperator.getRootNode();
    JavaNode javaNode = new JavaNode(repositoryRootNode, sampleDir+"|"+NAME_TEST_FILE+"BeanInfo");
    javaNode.select();
    javaNode.compile();
    
    MainWindowOperator.getDefault().waitStatusText("Finished TestFileBeanInfo");
    assertNotNull("Generated BeanInfo is not compilable", Repository.getDefault().findResource("TestFileBeanInfo.class"));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:22,代码来源:BeanInfoGeneration.java

示例9: setUp

import org.openide.filesystems.Repository; //导入依赖的package包/类
/** setUp method  */
public void setUp() {
    System.out.println("########  "+getName()+"  #######");
    
    OptionsOperator optionsOperator = OptionsOperator.invoke();
    optionsOperator.selectOption(Bundle.getString("org.netbeans.core.Bundle", "UI/Services/Editing")+"|"+Bundle.getString("org.netbeans.modules.beans.Bundle", "PROP_Option_Menu"));
    PropertySheetOperator propertySheetTabOperator = new PropertySheetOperator(optionsOperator);
    new Property(propertySheetTabOperator, Bundle.getString("org.netbeans.modules.beans.Bundle", "PROP_Option_Prop_Style")).setValue(Bundle.getString("org.netbeans.modules.beans.Bundle", "MSG_Option_Gen_This"));

    FileObject testFile = Repository.getDefault().findResource("gui/data/" + NAME_TEST_FILE + ".java");
    FileObject destination = Repository.getDefault().findFileSystem(sampleDir.replace('\\', '/')).getRoot();
    optionsOperator.close();
    try {
        DataObject.find(testFile).copy(DataFolder.findFolder(destination));
    } catch (IOException e) {
        fail(e);
    }
    new PropertiesAction().perform();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:CreateNewNonIndexedProperty.java

示例10: mountSampledir

import org.openide.filesystems.Repository; //导入依赖的package包/类
/** Mounts <userdir>/sampledir through API
 * @return absolute path of mounted dir
 */
public static boolean mountSampledir() {
    String userdir = System.getProperty("netbeans.user"); // NOI18N
    String mountPoint = userdir+File.separator+"sampledir"; // NOI18N
    mountPoint = mountPoint.replace('\\', '/');
    FileSystem fs = Repository.getDefault().findFileSystem(mountPoint);
    if (fs == null) {
        try {
            LocalFileSystem lfs= new LocalFileSystem();
            lfs.setRootDirectory(new File(mountPoint));
            Repository.getDefault().addFileSystem(lfs);
            return true;
        } catch (IOException ioe) {
            throw new JemmyException("Mounting FS: "+mountPoint+" failed.", ioe);
        } catch (PropertyVetoException pve) {
            throw new JemmyException("Mounting FS: "+mountPoint+" failed.", pve);
        }
    }
    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:Utilities.java

示例11: setUp

import org.openide.filesystems.Repository; //导入依赖的package包/类
/**
 * Sets up the testing environment by creating testing folders
 * on the system file system.
 */
@Override
protected void setUp() throws Exception {
    clearWorkDir();
    MockLookup.setInstances(
            new Repository(TestUtilHid.createLocalFileSystem(getWorkDir(), new String[0])),
            new Pool());
    
    MyDL loader = MyDL.getLoader(MyDL.class);

    FileSystem dfs = FileUtil.getConfigRoot().getFileSystem();
    dfs.refresh (true);        
    root = FileUtil.createFolder (dfs.getRoot (), loader.actionsContext ());
    
    
    FileObject fo = FileUtil.createData (dfs.getRoot (), "a.txt");
    obj = DataObject.find (fo);
    
    assertEquals ("The correct loader", loader, obj.getLoader ());
    
    node = obj.getNodeDelegate ();    
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:DataLoaderGetActionsTest.java

示例12: tearDown

import org.openide.filesystems.Repository; //导入依赖的package包/类
protected void tearDown() throws Exception {
    waitForAWT();
    DD.disableTest = true;

    super.tearDown();
    if (obj != null) {
        CloseCookie cc;
        cc = obj.getCookie(CloseCookie.class);
        if (cc != null) {
            DD.toReturn = NotifyDescriptor.NO_OPTION;
            cc.close();
        }
    }
    Repository.getDefault().removeFileSystem(lfs);

    waitForAWT();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:XMLDataObjectMimeTypeTest.java

示例13: setUp

import org.openide.filesystems.Repository; //导入依赖的package包/类
/**
 * Sets up the testing environment by creating testing folders
 * on the system file system.
 */
@Override
protected void setUp() throws Exception {
    clearWorkDir();
    MockLookup.setInstances(
            new Repository(TestUtilHid.createLocalFileSystem(getWorkDir(), new String[0])),
            new Pool());
    
    MyDL loader = MyDL.getLoader(MyDL.class);

    FileSystem dfs = FileUtil.getConfigRoot().getFileSystem();
    dfs.refresh (true);        
    
    FileObject fo = FileUtil.createData (dfs.getRoot (), "a.txt");
    obj = DataObject.find (fo);
    
    assertEquals ("The correct loader", loader, obj.getLoader ());
    
    node = obj.getNodeDelegate ();    
    
    sfs = new PCL ();
    dfs.addFileChangeListener (sfs);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:DataLoaderGetActionsCompatibilityTest.java

示例14: setUp

import org.openide.filesystems.Repository; //导入依赖的package包/类
protected void setUp() throws Exception {
    super.setUp();

    registerIntoLookup(new DD());

    DD x = (DD)Lookup.getDefault().lookup(DD.class);
    assertNotNull("DD is there", x);

    String fsstruct [] = new String [] {
        "AA/a.test"
    };

    TestUtilHid.destroyLocalFileSystem(getName());
    lfs = TestUtilHid.createLocalFileSystem(getWorkDir(), fsstruct);
    Repository.getDefault().addFileSystem(lfs);

    FileObject fo = lfs.findResource("AA/a.test");
    assertNotNull("file not found", fo);
    obj = DataObject.find(fo);

    assertEquals("The right class", obj.getClass(), DefaultDataObject.class);

    assertTrue("Designed to run inside of AWT", SwingUtilities.isEventDispatchThread());
    DD.options = null;
    DD.disableTest = false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:27,代码来源:DefaultDataObjectLookupTest.java

示例15: setUp

import org.openide.filesystems.Repository; //导入依赖的package包/类
protected void setUp() throws Exception {
    
    lfs = FileUtil.getConfigRoot().getFileSystem();
    
    FileObject[] delete = lfs.getRoot().getChildren();
    for (int i = 0; i < delete.length; i++) {
        delete[i].delete();
    }
    
    FileObject fo = FileUtil.createData (lfs.getRoot (), getName () + "/folder/original.txt");
    assertNotNull(fo);
    original = DataObject.find (fo);
    assertFalse ("Just to be sure that this is not shadow", original instanceof DataShadow);
    assertFalse ("And is some kind of subclass of DO", original.getClass () == DataObject.class);
    fo = FileUtil.createFolder (lfs.getRoot (), getName () + "/modify");
    assertNotNull(fo);
    assertTrue (fo.isFolder ());
    folder = DataFolder.findFolder (fo);
    
    Repository.getDefault ().addFileSystem (lfs);
    
    err = Logger.getLogger(getName());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:DataShadowTest.java


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