本文整理汇总了Java中org.openide.filesystems.Repository类的典型用法代码示例。如果您正苦于以下问题:Java Repository类的具体用法?Java Repository怎么用?Java Repository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Repository类属于org.openide.filesystems包,在下文中一共展示了Repository类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: 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());
MyDL1 loader1 = MyDL1.getLoader(MyDL1.class);
MyDL2 loader2 = MyDL2.getLoader(MyDL2.class);
FileSystem dfs = FileUtil.getConfigRoot().getFileSystem();
dfs.refresh (true);
FileObject fo = FileUtil.createData (dfs.getRoot (), "a.ext1");
obj1 = DataObject.find (fo);
assertEquals ("The correct loader", loader1, obj1.getLoader ());
fo = FileUtil.createData (dfs.getRoot (), "b.ext2");
obj2 = DataObject.find (fo);
assertEquals ("The correct loader", loader2, obj2.getLoader ());
sfs = new PCL ();
dfs.addFileChangeListener (sfs);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:30,代码来源:DataObjectSaveAsTest.java
示例17: prepareTest
import org.openide.filesystems.Repository; //导入依赖的package包/类
public static void prepareTest (String[] stringLayers, Lookup lkp)
throws IOException, SAXException, PropertyVetoException {
URL[] layers = new URL[stringLayers.length];
for (int cntr = 0; cntr < layers.length; cntr++) {
layers[cntr] = Utilities.class.getResource(stringLayers[cntr]);
}
XMLFileSystem system = new XMLFileSystem();
system.setXmlUrls(layers);
Repository repository = new Repository(system);
if (lkp == null) {
DEFAULT_LOOKUP.setLookup(new Object[] { repository }, UnitTestUtils.class.getClassLoader());
} else {
DEFAULT_LOOKUP.setLookup(new Object[] { repository }, lkp, UnitTestUtils.class.getClassLoader());
}
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:UnitTestUtils.java
示例18: createPropertiesDataObject
import org.openide.filesystems.Repository; //导入依赖的package包/类
/**
* Creates a new PropertiesDataObject (properties file).
* @param folder FileObject folder where to create the properties file
* @param fileName String name of the file without the extension, can include
* relative path underneath the folder
* @return created PropertiesDataObjet
*/
public static PropertiesDataObject createPropertiesDataObject(FileObject folder, String fileName)
throws IOException
{
int idx = fileName.lastIndexOf('/');
if (idx > 0) {
String folderPath = fileName.substring(0, idx);
folder = FileUtil.createFolder(folder, folderPath);
fileName = fileName.substring(idx + 1);
}
FileSystem defaultFS = Repository.getDefault().getDefaultFileSystem();
FileObject templateFO = defaultFS.findResource("Templates/Other/properties.properties"); // NOI18N
DataObject template = DataObject.find(templateFO);
return (PropertiesDataObject)
template.createFromTemplate(DataFolder.findFolder(folder), fileName);
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:23,代码来源:Util.java
示例19: setUp
import org.openide.filesystems.Repository; //导入依赖的package包/类
protected void setUp(String mime) throws Exception {
super.setUp();
MockServices.setServices(Pool.class);
String ext = getName();
clearWorkDir();
lfs = new LocalFileSystem();
lfs.setRootDirectory(getWorkDir());
FileUtil.createData(lfs.getRoot(), "AA/a." + ext);
Repository.getDefault().addFileSystem(lfs);
FileUtil.setMIMEType(ext, mime);
FileObject fo = lfs.findResource("AA/a." + ext);
assertNotNull("file not found", fo);
obj = DataObject.find(fo);
assertEquals("The right class", obj.getClass(), XMLDataObject.class);
assertFalse("Designed to run outside of AWT", SwingUtilities.isEventDispatchThread());
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:XMLDataObjectMimeTypeTest.java
示例20: testReadWrite
import org.openide.filesystems.Repository; //导入依赖的package包/类
public void testReadWrite() throws Exception {
FileObject dtdFO = Repository.getDefault().getDefaultFileSystem().
findResource("/xml/lookups/NetBeans_org_netbeans_modules_settings_xtest/DTD_XML_FooSetting_2_0.instance");
assertNotNull("Provider not found", dtdFO);
Convertor c = XMLPropertiesConvertor.create(dtdFO);
AnnoFoo foo = new AnnoFoo();
foo.setProperty1("xxx");
CharArrayWriter caw = new CharArrayWriter(1024);
c.write(caw, foo);
caw.flush();
caw.close();
CharArrayReader car = new CharArrayReader(caw.toCharArray());
Object obj = c.read(car);
assertEquals(foo, obj);
assertEquals("HooFoo is the class", HooFoo.class, obj.getClass());
}
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:XMLPropertiesConvertorAnnotationTest.java
注:本文中的org.openide.filesystems.Repository类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论