org.openide.filesystems.XMLFileSystem Java Examples
The following examples show how to use
org.openide.filesystems.XMLFileSystem.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LayerUtilsTest.java From netbeans with Apache License 2.0 | 6 votes |
public void testMixedMultiFS() throws Exception { clearWorkDir(); LayerCacheManager m = LayerCacheManager.manager(true); // b-layer.xml overrides a-layer.xml now and then: File lb = new File(getDataDir(), "layers/b-layer.xml"); File la = new File(getDataDir(), "layers/a-layer.xml"); FileSystem cfs = createCachedFS(m, lb); FileSystem xfs = new XMLFileSystem(Utilities.toURI(la).toURL()); FileSystem mfs = new MultiFileSystem(cfs, xfs); assertNotNull(mfs.findResource("Menu/File")); assertNotNull(mfs.findResource("Menu/A Folder")); assertNull(mfs.findResource("Menu/A Folder/org-example-a-AAction.shadow")); // hidden by b-layer FileObject mf = mfs.findResource("Actions/File"); assertEquals(2, mf.getChildren().length); FileObject ba = mfs.findResource("Actions/File/org-example-b-BAction.instance"); assertEquals("BBBBB", ba.getAttribute("displayName")); FileObject aa = mfs.findResource("Actions/File/org-example-a-AAction.instance"); assertEquals("AAAA", aa.getAttribute("displayName")); }
Example #2
Source File: RepositoryImpl.java From netbeans with Apache License 2.0 | 6 votes |
private static FileSystem createDefFs() { try { FileSystem writeFs = FileUtil.createMemoryFileSystem(); FileSystem htmlFs = new XMLFileSystem(RepositoryImpl.class.getClassLoader().getResource("org/netbeans/modules/html/mf-layer.xml")); FileSystem htmlEditotFs = new XMLFileSystem(RepositoryImpl.class.getClassLoader().getResource("org/netbeans/modules/html/editor/resources/layer.xml")); FileSystem htmlEditorLibFs = new XMLFileSystem(RepositoryImpl.class.getClassLoader().getResource("org/netbeans/modules/html/editor/resources/layer.xml")); FileSystem lexerLayerFS = new XMLFileSystem(HTMLTokenId.class.getClassLoader().getResource("org/netbeans/lib/html/lexer/layer.xml")); FileSystem cssEditorFs = new XMLFileSystem(RepositoryImpl.class.getClassLoader().getResource("org/netbeans/modules/css/resources/layer.xml")); FileSystem jsEditorFs = new XMLFileSystem(RepositoryImpl.class.getClassLoader().getResource("org/netbeans/modules/javascript/editing/layer.xml")); return new MultiFileSystem(new FileSystem[] { writeFs, lexerLayerFS, htmlFs, htmlEditotFs, htmlEditorLibFs, cssEditorFs, jsEditorFs}); } catch (SAXException e) { return null; } }
Example #3
Source File: DecoratedFileSystem.java From visualvm with GNU General Public License v2.0 | 6 votes |
public void run () { Lookup l = consumerVisualVM (); try { Class.forName ("org.netbeans.modules.consumervisualvm.api.PluginInfo"); } catch (ClassNotFoundException ex) { // XXX: why ClassNotFoundException sometime? LOG.log (Level.FINE, ex.getLocalizedMessage (), ex); return; } Lookup.Result<PluginInfo> result = l.lookupResult (PluginInfo.class); List<XMLFileSystem> delegate = new ArrayList<XMLFileSystem> (); for (PluginInfo pi : result.allInstances ()) { Internal internal = PluginInfoAccessor.DEFAULT.getInternal (pi); if (! internal.isEnabled ()) { delegate.add (internal.getXMLFileSystem ()); } } setDelegates (delegate.toArray (new FileSystem[0])); }
Example #4
Source File: ActionUtilsTest.java From netbeans with Apache License 2.0 | 6 votes |
@Override protected void setUp() throws Exception { super.setUp(); clearWorkDir(); dir = FileUtil.toFileObject(getWorkDir()); f1 = dir.createData("f1.data"); f1form = dir.createData("f1.form"); f2 = dir.createData("f2"); subdir = dir.createFolder("sub"); f3 = subdir.createData("f3.data"); f3a = subdir.createData("f3a.data"); subdir2 = dir.createFolder("subdir2"); f4 = subdir2.createData("f3.nondata"); subsubdir = subdir2.createFolder("sub"); f5 = subdir2.createData("f1.data"); f5a = subsubdir.createData("f3.data"); fx = new XMLFileSystem().getRoot(); d1 = DataObject.find(f1); d2 = DataObject.find(f2); d3 = DataObject.find(f3); dx = DataObject.find(fx); n1 = d1.getNodeDelegate(); n2 = d2.getNodeDelegate(); n3 = d3.getNodeDelegate(); nx = dx.getNodeDelegate(); }
Example #5
Source File: LayerCacheManager.java From netbeans with Apache License 2.0 | 6 votes |
@Override public FileSystem load(FileSystem previous, ByteBuffer bb) throws IOException { byte[] arr = new byte[bb.limit()]; bb.get(arr); DataInputStream is = new DataInputStream(new ByteArrayInputStream(arr)); List<URL> urls = new ArrayList<URL>(); while (is.available() > 0) { String u = is.readUTF(); urls.add(new URL(u)); } try { XMLFileSystem fs = (XMLFileSystem)previous; fs.setXmlUrls(urls.toArray(new URL[urls.size()])); return fs; } catch (PropertyVetoException pve) { throw (IOException) new IOException(pve.toString()).initCause(pve); } }
Example #6
Source File: MenuBarTest.java From netbeans with Apache License 2.0 | 6 votes |
private void doActionIsCreatedOnlyOnce_13195(String name) throws Exception { // crate XML FS from data String[] stringLayers = new String [] { "/org/openide/awt/data/testActionOnlyOnce.xml" }; 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); // build menu DataFolder dataFolder = DataFolder.findFolder(system.findResource(name)); MenuBar menuBar = new MenuBar(dataFolder); menuBar.waitFinished(); if (CreateOnlyOnceAction.instancesCount != 1) { // ensure that only one instance of action was created fail("Action created only once, but was: " + CreateOnlyOnceAction.instancesCount + "\n" + CreateOnlyOnceAction.w); } }
Example #7
Source File: IDEInitializer.java From netbeans with Apache License 2.0 | 6 votes |
/** * Add layers to system filesystem. * * @param layers xml-layer URLs to be present in the system filesystem. * */ public static void addLayers (String[] layers) { ClassLoader classLoader = IDEInitializer.class.getClassLoader (); URL[] urls = new URL [layers.length]; int i, k = urls.length; for (i = 0; i < k; i++) { urls [i] = classLoader.getResource (layers [i]); } systemFS = new XMLFileSystem (); try { systemFS.setXmlUrls (urls); } catch (Exception ex) { ex.printStackTrace (); } MainLookup.register(systemFS); }
Example #8
Source File: BaseCaretTest.java From netbeans with Apache License 2.0 | 6 votes |
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()); }
Example #9
Source File: UnitTestUtils.java From netbeans with Apache License 2.0 | 6 votes |
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) { UnitTestUtils.setLookup(new Object[] { repository }, UnitTestUtils.class.getClassLoader()); } else { UnitTestUtils.setLookup(new Object[] { repository }, lkp, UnitTestUtils.class.getClassLoader()); } }
Example #10
Source File: RepositoryImpl.java From netbeans with Apache License 2.0 | 6 votes |
private static FileSystem createDefFs() { try { FileSystem writeFs = FileUtil.createMemoryFileSystem(); FileSystem profilerLayer = new XMLFileSystem(RepositoryImpl.class.getClassLoader().getResource( "org/netbeans/modules/profiler/j2ee/mf-layer.xml")); FileSystem layerJ2eeDeployment = new XMLFileSystem(RepositoryImpl.class.getClassLoader(). getResource("org/netbeans/modules/j2ee/deployment/impl/layer.xml")); FileSystem layerTomcat = new XMLFileSystem(RepositoryImpl.class.getClassLoader(). getResource("org/netbeans/modules/tomcat5/resources/layer.xml")); FileSystem layerJBoss = new XMLFileSystem(RepositoryImpl.class.getClassLoader(). getResource("org/netbeans/modules/j2ee/jboss4/resources/layer.xml")); return new MultiFileSystem(new FileSystem[] {writeFs, profilerLayer, layerJ2eeDeployment, layerTomcat , layerJBoss }); } catch (SAXException e) { AssertionError ae = new AssertionError(e.getMessage()); ae.initCause(e); throw ae; } }
Example #11
Source File: MavenNbModuleImpl.java From netbeans with Apache License 2.0 | 6 votes |
@Override public FileSystem getEffectiveSystemFilesystem() throws IOException { FileSystem projectLayer = LayerHandle.forProject(project).layer(false); Collection<FileSystem> platformLayers = new ArrayList<FileSystem>(); PlatformJarProvider pjp = project.getLookup().lookup(PlatformJarProvider.class); if (pjp != null) { List<URL> urls = new ArrayList<URL>(); for (File jar : pjp.getPlatformJars()) { // XXX use LayerHandle.forProject on this and sister modules instead urls.addAll(LayerUtil.layersOf(jar)); } XMLFileSystem xmlfs = new XMLFileSystem(); try { xmlfs.setXmlUrls(urls.toArray(new URL[urls.size()])); } catch (PropertyVetoException x) { throw new IOException(x); } platformLayers.add(xmlfs); } // XXX would using PlatformLayersCacheManager be beneficial? (would need to modify in several ways) return LayerUtil.mergeFilesystems(projectLayer, platformLayers); }
Example #12
Source File: LayerUtilsTest.java From netbeans with Apache License 2.0 | 6 votes |
public void testXMLMultiFS() throws Exception { clearWorkDir(); // b-layer.xml overrides a-layer.xml now and then: List<File> files = new ArrayList<File>(Arrays.asList( new File(getDataDir(), "layers/b-layer.xml"), new File(getDataDir(), "layers/a-layer.xml") )); FileSystem xfs0 = new XMLFileSystem(Utilities.toURI(files.get(0)).toURL()); FileSystem xfs1 = new XMLFileSystem(Utilities.toURI(files.get(1)).toURL()); FileSystem mfs = new MultiFileSystem(xfs0, xfs1); assertNotNull(xfs1.findResource("Menu/A Folder")); assertNotNull(mfs.findResource("Menu/File")); assertNotNull(mfs.findResource("Menu/A Folder")); assertNull(mfs.findResource("Menu/A Folder/org-example-a-AAction.shadow")); // hidden by b-layer FileObject mf = mfs.findResource("Actions/File"); assertEquals(2, mf.getChildren().length); FileObject ba = mfs.findResource("Actions/File/org-example-b-BAction.instance"); assertEquals("BBBBB", ba.getAttribute("displayName")); FileObject aa = mfs.findResource("Actions/File/org-example-a-AAction.instance"); assertEquals("AAAA", aa.getAttribute("displayName")); }
Example #13
Source File: UnitTestUtils.java From netbeans with Apache License 2.0 | 6 votes |
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()); } }
Example #14
Source File: RepositoryImpl.java From netbeans with Apache License 2.0 | 5 votes |
private static FileSystem createDefFs() { try { FileSystem writeFs = FileUtil.createMemoryFileSystem(); FileSystem layerFs = new XMLFileSystem(RepositoryImpl.class.getClassLoader().getResource("org/netbeans/modules/palette/resources/layer.xml")); return new MultiFileSystem(new FileSystem[] { writeFs, layerFs }); } catch (SAXException e) { return null; } }
Example #15
Source File: RepositoryImpl.java From netbeans with Apache License 2.0 | 5 votes |
private static FileSystem createDefFs() { try { FileSystem writeFs = FileUtil.createMemoryFileSystem(); FileSystem layerFs = new XMLFileSystem(RepositoryImpl.class.getClassLoader().getResource("org/netbeans/modules/css/resources/layer.xml")); return new MultiFileSystem(new FileSystem[] { writeFs, layerFs }); } catch (SAXException e) { return null; } }
Example #16
Source File: RepositoryImpl.java From netbeans with Apache License 2.0 | 5 votes |
private static FileSystem createDefFs() { try { FileSystem writeFs = FileUtil.createMemoryFileSystem(); FileSystem layerFs = new XMLFileSystem(RepositoryImpl.class.getClassLoader().getResource("org/netbeans/modules/db/resources/mf-layer.xml")); FileSystem dbapiLayerFs = new XMLFileSystem(RepositoryImpl.class.getClassLoader().getResource("org/netbeans/modules/dbapi/resources/layer.xml")); return new MultiFileSystem(new FileSystem[] { writeFs, layerFs, dbapiLayerFs }); } catch (SAXException e) { return null; } }
Example #17
Source File: RepositoryImpl.java From netbeans with Apache License 2.0 | 5 votes |
private static FileSystem createDefFs() { try { FileSystem writeFs = FileUtil.createMemoryFileSystem(); FileSystem layerFs = new XMLFileSystem(RepositoryImpl.class.getClassLoader().getResource("org/netbeans/modules/db/resources/mf-layer.xml")); return new MultiFileSystem(new FileSystem[] { writeFs, layerFs }); } catch (SAXException e) { return null; } }
Example #18
Source File: IDEInitializer.java From netbeans with Apache License 2.0 | 5 votes |
/** * Set the global default lookup with the specified content. * * @param layers xml-layer URLs to be present in the system filesystem. * @param instances object instances to be present in the default lookup. */ public static void setup ( String[] layers, Object[] instances ) { ClassLoader classLoader = IDEInitializer.class.getClassLoader (); File workDir = new File (Manager.getWorkDirPath ()); URL[] urls = new URL [layers.length]; int i, k = urls.length; for (i = 0; i < k; i++) urls [i] = classLoader.getResource (layers [i]); // 1) create repository XMLFileSystem systemFS = new XMLFileSystem (); lfs = FileUtil.createMemoryFileSystem(); try { systemFS.setXmlUrls (urls); } catch (Exception ex) { ex.printStackTrace (); } MyFileSystem myFileSystem = new MyFileSystem ( new FileSystem [] {lfs, systemFS} ); Repository repository = new Repository (myFileSystem); Object[] lookupContent = new Object [instances.length + 1]; lookupContent [0] = repository; System.arraycopy (instances, 0, lookupContent, 1, instances.length); DEFAULT_LOOKUP.setLookups (new Lookup[] { Lookups.fixed (lookupContent), Lookups.metaInfServices (classLoader), Lookups.singleton (classLoader), }); Assert.assertTrue (myFileSystem.isDefault()); }
Example #19
Source File: RepositoryImpl.java From netbeans with Apache License 2.0 | 5 votes |
private static FileSystem createDefFs() { try { FileSystem writeFs = FileUtil.createMemoryFileSystem(); FileSystem layerFs = new XMLFileSystem(RepositoryImpl.class.getClassLoader().getResource("org/netbeans/modules/xml/text/resources/mf-layer.xml")); return new MultiFileSystem(new FileSystem[] { writeFs, layerFs }); } catch (SAXException e) { return null; } }
Example #20
Source File: IDEInitializer.java From netbeans with Apache License 2.0 | 5 votes |
/** * Set the global default lookup with the specified content. * * @param layers xml-layer URLs to be present in the system filesystem. * @param instances object instances to be present in the default lookup. */ public static void setup ( String[] layers, Object[] instances ) { ClassLoader classLoader = IDEInitializer.class.getClassLoader (); File workDir = new File (Manager.getWorkDirPath ()); URL[] urls = new URL [layers.length]; int i, k = urls.length; for (i = 0; i < k; i++) urls [i] = classLoader.getResource (layers [i]); // 1) create repository XMLFileSystem systemFS = new XMLFileSystem (); lfs = FileUtil.createMemoryFileSystem(); try { systemFS.setXmlUrls (urls); } catch (Exception ex) { ex.printStackTrace (); } MyFileSystem myFileSystem = new MyFileSystem ( new FileSystem [] {lfs, systemFS} ); Repository repository = new Repository (myFileSystem); Object[] lookupContent = new Object [instances.length + 1]; lookupContent [0] = repository; System.arraycopy (instances, 0, lookupContent, 1, instances.length); DEFAULT_LOOKUP.setLookups (new Lookup[] { Lookups.fixed (lookupContent), Lookups.metaInfServices (classLoader), Lookups.singleton (classLoader), }); Assert.assertTrue (myFileSystem.isDefault()); }
Example #21
Source File: EditorTestLookup.java From netbeans with Apache License 2.0 | 5 votes |
/** * Set the global default lookup with the specified content. * * @param layers xml-layer URLs to be present in the system filesystem. * @param instances object instances to be present in the default lookup. */ public static void setLookup(URL[] layers, Object[] instances, ClassLoader cl) throws IOException, PropertyVetoException { XMLFileSystem system = new XMLFileSystem(); system.setXmlUrls(layers); Repository repository = new Repository(system); Object[] lookupContent = new Object[instances.length + 1]; lookupContent[0] = repository; System.arraycopy(instances, 0, lookupContent, 1, instances.length); DEFAULT_LOOKUP.setLookup(lookupContent, cl); }
Example #22
Source File: RepositoryImpl.java From netbeans with Apache License 2.0 | 5 votes |
private static FileSystem createDefFs() { try { FileSystem writeFs = FileUtil.createMemoryFileSystem(); FileSystem layerFs = new XMLFileSystem(RepositoryImpl.class.getClassLoader().getResource("org/netbeans/modules/web/core/syntax/resources/layer.xml")); FileSystem lexerLayerFS = new XMLFileSystem(HTMLTokenId.class.getClassLoader().getResource("org/netbeans/lib/jsp/lexer/layer.xml")); return new MultiFileSystem(new FileSystem[] { writeFs, lexerLayerFS, layerFs }); } catch (SAXException e) { return null; } }
Example #23
Source File: RepositoryImpl.java From netbeans with Apache License 2.0 | 5 votes |
private static FileSystem createDefFs() { try { FileSystem writeFs = FileUtil.createMemoryFileSystem(); FileSystem layerFs = new XMLFileSystem(RepositoryImpl.class.getClassLoader().getResource("org/netbeans/modules/tomcat5/resources/layer.xml")); FileSystem j2eeserverFs = new XMLFileSystem(RepositoryImpl.class.getClassLoader().getResource("org/netbeans/modules/tomcat5/util/fake-j2eeserver-layer.xml")); FileSystem dbFs = new XMLFileSystem(RepositoryImpl.class.getClassLoader().getResource("org/netbeans/modules/db/resources/mf-layer.xml")); return new MultiFileSystem(new FileSystem[] { writeFs, layerFs, j2eeserverFs, dbFs}); } catch (SAXException e) { return null; } }
Example #24
Source File: RepositoryImpl.java From netbeans with Apache License 2.0 | 5 votes |
private static FileSystem createDefFs() { try { FileSystem writeFs = FileUtil.createMemoryFileSystem(); FileSystem layerFs = new XMLFileSystem(RepositoryImpl.class.getClassLoader().getResource("org/netbeans/modules/html/editor/resources/layer.xml")); FileSystem lexerLayerFS = new XMLFileSystem(HTMLTokenId.class.getClassLoader().getResource("org/netbeans/lib/html/lexer/layer.xml")); return new MultiFileSystem(new FileSystem[] { writeFs, lexerLayerFS, layerFs }); } catch (SAXException e) { return null; } }
Example #25
Source File: RepositoryImpl.java From netbeans with Apache License 2.0 | 5 votes |
private static FileSystem createDefFs() { try { FileSystem writeFs = FileUtil.createMemoryFileSystem(); FileSystem profilerLayer = new XMLFileSystem(RepositoryImpl.class.getClassLoader().getResource( "org/netbeans/modules/profiler/j2se/mf-layer.xml")); return new MultiFileSystem(new FileSystem[] {writeFs, profilerLayer}); } catch (SAXException e) { AssertionError ae = new AssertionError(e.getMessage()); ae.initCause(e); throw ae; } }
Example #26
Source File: LayerHandle.java From netbeans with Apache License 2.0 | 5 votes |
private void configure() { List<FileSystem> layers = new ArrayList<FileSystem>(2); if (explicit != null) { layers.add(explicit); } if (generated != null && generated.isFile()) { try { layers.add(new XMLFileSystem(Utilities.toURI(generated).toString())); } catch (SAXException x) { Logger.getLogger(DualLayers.class.getName()).log(Level.INFO, "could not load " + generated, x); } } setDelegates(layers.toArray(new FileSystem[layers.size()])); }
Example #27
Source File: LayerUtilsTest.java From netbeans with Apache License 2.0 | 5 votes |
public void testXMLFSJarPerformance() throws Exception { clearWorkDir(); List<File> files = generateLayers(NUM_LAYERS, NUM_ACTIONS, true); List<URL> urls = new ArrayList<URL>(NUM_LAYERS); for (File f : files) { urls.add(new URL("jar:" + Utilities.toURI(f) + "!/" + LAYER_PATH_IN_JAR)); } XMLFileSystem[] xfss = new XMLFileSystem[NUM_LAYERS]; long start = System.currentTimeMillis(); for (int i = 0; i < NUM_LAYERS; i++) { xfss[i] = new XMLFileSystem(urls.get(i)); } FileSystem mfs = new MultiFileSystem(xfss); long stop = System.currentTimeMillis(); System.out.println("XMLFS Jar scan takes " + (stop - start) + " ms"); // 2-nd action of 1-st layer assertNotNull(mfs.findResource("Actions/Test/" + String.format(ACTION_NAME_FMT, 1, 0))); // last action of last layer assertNotNull(mfs.findResource("Actions/Test/" + String.format(ACTION_NAME_FMT, NUM_ACTIONS - 1, NUM_LAYERS - 1))); // nothing beyond that assertNull(mfs.findResource("Actions/Test/" + String.format(ACTION_NAME_FMT, NUM_ACTIONS, NUM_LAYERS - 1))); // 1-st action of 1-st layer is hidden assertNull(mfs.findResource("Actions/Test/" + String.format(ACTION_NAME_FMT, 0, 0))); // last hidden action assertNull(mfs.findResource("Actions/Test/" + String.format(ACTION_NAME_FMT, 0, NUM_LAYERS - 2))); assertNotNull(mfs.findResource("Actions/Test/" + String.format(ACTION_NAME_FMT, 0, NUM_LAYERS - 1))); System.out.println("XMLFS Jar performance test finished"); }
Example #28
Source File: DecoratedFileSystem.java From visualvm with GNU General Public License v2.0 | 5 votes |
public URL getParentFileSystem (FileObject template) { Lookup.Result<PluginInfo> result = consumerVisualVM ().lookupResult (PluginInfo.class); String path = template.getPath (); for (PluginInfo pi : result.allInstances ()) { Internal internal = PluginInfoAccessor.DEFAULT.getInternal (pi); XMLFileSystem fs = internal.getXMLFileSystem (); if (fs.findResource (path) != null) { return fs.getXmlUrl (); } } return null; }
Example #29
Source File: DecoratedFileSystem.java From visualvm with GNU General Public License v2.0 | 5 votes |
public String getPluginCodeName (FileObject template) { Lookup.Result<PluginInfo> result = consumerVisualVM ().lookupResult (PluginInfo.class); String path = template.getPath (); for (PluginInfo pi : result.allInstances ()) { Internal internal = PluginInfoAccessor.DEFAULT.getInternal (pi); XMLFileSystem fs = internal.getXMLFileSystem (); if (fs.findResource (path) != null) { return PluginInfoAccessor.DEFAULT.getCodeName (pi); } } return null; }
Example #30
Source File: UnitUtilities.java From netbeans with Apache License 2.0 | 5 votes |
public static void prepareTest(String[] additionalLayers, Object[] additionalLookupContent) throws IOException, SAXException, PropertyVetoException { URL[] layers = new URL[additionalLayers.length + 1]; layers[0] = Utilities.class.getResource("/org/netbeans/modules/editor/errorstripe/resources/layer.xml"); for (int cntr = 0; cntr < additionalLayers.length; cntr++) { layers[cntr + 1] = Utilities.class.getResource(additionalLayers[cntr]); } for (int cntr = 0; cntr < layers.length; cntr++) { if (layers[cntr] == null) { throw new IllegalStateException("layers[" + cntr + "]=null"); } } XMLFileSystem system = new XMLFileSystem(); system.setXmlUrls(layers); Repository repository = new Repository(system); Object[] lookupContent = new Object[additionalLookupContent.length + 1]; System.arraycopy(additionalLookupContent, 0, lookupContent, 1, additionalLookupContent.length); lookupContent[0] = repository; DEFAULT_LOOKUP.setLookup(lookupContent, UnitUtilities.class.getClassLoader()); }