org.openide.loaders.DataObject Java Examples
The following examples show how to use
org.openide.loaders.DataObject.
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: StrutsConfigHyperlinkProvider.java From netbeans with Apache License 2.0 | 6 votes |
public boolean isHyperlinkPoint(javax.swing.text.Document doc, int offset) { if (debug) debug(":: isHyperlinkSpan - offset: " + offset); //NOI18N // PENDING - this check should be removed, when // the issue #61704 is solved. DataObject dObject = NbEditorUtilities.getDataObject(doc); if (! (dObject instanceof StrutsConfigDataObject)) return false; eav = getElementAttrValue(doc, offset); if (eav != null){ if (hyperlinkTable.get(eav[0]+"#"+eav[1])!= null) return true; } return false; }
Example #2
Source File: CreateFromTemplateDecoratorTest.java From netbeans with Apache License 2.0 | 6 votes |
public void testPreCreateDecorator() throws Exception { MockLookup.setLayersAndInstances(new Deco() { @Override public boolean isBeforeCreation() { return true; } @Override public List<FileObject> decorate(CreateDescriptor desc, List<FileObject> createdFiles) throws IOException { assertSize("No files should have been created", createdFiles, 0); decorated = true; assertEquals(0, target.getChildren().length); return null; } }); Map<String,String> parameters = Collections.singletonMap("type", "empty"); DataObject n = obj.createFromTemplate(folder, "complex", parameters); assertTrue(decorated); assertNotNull(n); }
Example #3
Source File: JspHyperlinkProvider.java From netbeans with Apache License 2.0 | 6 votes |
private void openInEditor(FileObject fObj) { if (fObj != null) { DataObject dobj; try { dobj = DataObject.find(fObj); } catch (DataObjectNotFoundException e) { Exceptions.printStackTrace(e); return; } if (dobj != null) { Node.Cookie cookie = dobj.getLookup().lookup(EditCookie.class); if (cookie != null) { ((EditCookie) cookie).edit(); } } } }
Example #4
Source File: SCFTHandlerTest.java From netbeans with Apache License 2.0 | 6 votes |
public void testCreateFromTemplateUsingFreemarker() throws Exception { FileObject root = FileUtil.createMemoryFileSystem().getRoot(); FileObject fo = FileUtil.createData(root, "simpleObject.txt"); OutputStream os = fo.getOutputStream(); String txt = "print('<html><h1>', title, '</h1></html>');"; os.write(txt.getBytes()); os.close(); fo.setAttribute(ScriptingCreateFromTemplateHandler.SCRIPT_ENGINE_ATTR, "js"); DataObject obj = DataObject.find(fo); DataFolder folder = DataFolder.findFolder(FileUtil.createFolder(root, "target")); Map<String,String> parameters = Collections.singletonMap("title", "Nazdar"); DataObject n = obj.createFromTemplate(folder, "complex", parameters); assertEquals("Created in right place", folder, n.getFolder()); assertEquals("Created with right name", "complex.txt", n.getName()); String exp = "<html><h1> Nazdar </h1></html>\n"; assertEquals(exp, readFile(n.getPrimaryFile())); }
Example #5
Source File: Util.java From netbeans with Apache License 2.0 | 6 votes |
/** * 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); }
Example #6
Source File: TemplateOperation.java From netbeans with Apache License 2.0 | 6 votes |
@Override public Set<FileObject> execute() { FileObject template = FileUtil.getConfigFile(templateName); if (template != null) { String targetName = target.getName(); try { FileObject targetParent = FileUtil.createFolder(target.getParentFile()); DataFolder targetFolder = DataFolder.findFolder(targetParent); DataObject o = DataObject.find(template); DataObject newData = o.createFromTemplate(targetFolder,targetName, tokens); return important ? Collections.singleton(newData.getPrimaryFile()) : null; } catch (IOException ex) { } } return null; }
Example #7
Source File: ImageNavigatorPanel.java From netbeans with Apache License 2.0 | 6 votes |
@Override public void fileChanged(final FileEvent fe) { if (fe.getTime() > lastSaveTime) { lastSaveTime = System.currentTimeMillis(); // Refresh image viewer SwingUtilities.invokeLater(new Runnable() { public void run() { try { currentDataObject = DataObject.find(fe.getFile()); setNewContent(currentDataObject); } catch (DataObjectNotFoundException ex) { Logger.getLogger(ImageNavigatorPanel.class.getName()).info(NbBundle.getMessage(ImageNavigatorPanel.class, "ERR_DataObject")); } } }); } }
Example #8
Source File: CopyStyleAction.java From netbeans with Apache License 2.0 | 6 votes |
@Override public void actionPerformed(ActionEvent evt, JTextComponent target) { BaseDocument bdoc = Utilities.getDocument(target); if(bdoc == null) { return ; //no document?!?! } DataObject csso = NbEditorUtilities.getDataObject(bdoc); if(csso == null) { return ; //document not backuped by DataObject } String pi = createText(csso); StringSelection ss = new StringSelection(pi); ExClipboard clipboard = Lookup.getDefault().lookup(ExClipboard.class); clipboard.setContents(ss, null); StatusDisplayer.getDefault().setStatusText( NbBundle.getMessage(CopyStyleAction.class, "MSG_Style_tag_in_clipboard")); // NOI18N }
Example #9
Source File: ConvertAsBeanTest.java From netbeans with Apache License 2.0 | 6 votes |
public void testReadWriteOnSubclass() throws Exception { HooFoo foo = new HooFoo(); foo.setName("xxx"); DataFolder test = DataFolder.findFolder(FileUtil.getConfigRoot()); DataObject obj = InstanceDataObject.create(test, null, foo, null); final FileObject pf = obj.getPrimaryFile(); final String content = pf.asText(); if (content.indexOf("<string>xxx</string>") == -1) { fail(content); } obj.setValid(false); DataObject newObj = DataObject.find(pf); if (newObj == obj) { fail("Strange, objects shall differ"); } InstanceCookie ic = newObj.getLookup().lookup(InstanceCookie.class); assertNotNull("Instance cookie found", ic); Object read = ic.instanceCreate(); assertNotNull("Instance created", read); assertEquals("Correct class", HooFoo.class, read.getClass()); HooFoo readFoo = (HooFoo)read; assertEquals("property changed", "xxx", readFoo.getName()); }
Example #10
Source File: JerseyClientWizardIterator.java From netbeans with Apache License 2.0 | 6 votes |
@Override public Set<DataObject> instantiate() throws IOException { FileObject template = Templates.getTemplate(wizard); template.setAttribute("REST_RESOURCE_NAME", bottomPanel.getResourceName()); DataObject dTemplate = DataObject.find( template ); org.openide.filesystems.FileObject dir = Templates.getTargetFolder(wizard); DataFolder df = DataFolder.findFolder( dir ); final DataObject dobj = dTemplate.createFromTemplate(df, Templates.getTargetName(wizard )); // generating client RequestProcessor.getDefault().post(new Runnable() { @Override public void run() { ClientJavaSourceHelper.generateJerseyClient( bottomPanel.getResourceNode(), dobj.getPrimaryFile(), null, bottomPanel.getSecurity()); } }); return Collections.<DataObject>singleton(dobj); }
Example #11
Source File: TestSuiteWizardIterator.java From netbeans with Apache License 2.0 | 6 votes |
@Override public Set<DataObject> instantiate() throws IOException { saveSettings(wizard); /* collect and build necessary data: */ String name = Templates.getTargetName(wizard); FileObject targetFolder = Templates.getTargetFolder(wizard); FileObject testRootFolder = findTestRootFolder(targetFolder); assert testRootFolder != null; /* create test class(es) for the selected source class: */ DataObject suite = JUnitUtils.createSuiteTest(testRootFolder, targetFolder, name, JUnitTestUtil.getSettingsMap(true)); if (suite != null) { return Collections.singleton(suite); } else { throw new IOException(); } }
Example #12
Source File: FileActionTest.java From netbeans with Apache License 2.0 | 6 votes |
public boolean isActionEnabled( String command, Lookup context) throws IllegalArgumentException { if ( COMMAND.equals( command ) ) { Collection dobjs = context.lookupAll(DataObject.class); for ( Iterator it = dobjs.iterator(); it.hasNext(); ) { DataObject dobj = (DataObject)it.next(); if ( !dobj.getPrimaryFile().getNameExt().endsWith( ".java" ) ) { return false; } } return true; } else { throw new IllegalArgumentException(); } }
Example #13
Source File: LineSeparatorDataEditorSupportTest.java From netbeans with Apache License 2.0 | 6 votes |
public void testLineSeparator() throws Exception { File file = File.createTempFile("lineSeparator", ".txt", getWorkDir()); file.deleteOnExit(); FileObject fileObject = FileUtil.toFileObject(file); fileObject.setAttribute(FileObject.DEFAULT_LINE_SEPARATOR_ATTR, "\r"); DataObject dataObject = DataObject.find(fileObject); EditorCookie editor = dataObject.getLookup().lookup(org.openide.cookies.EditorCookie.class); final StyledDocument doc = editor.openDocument(); SwingUtilities.invokeAndWait(new Runnable() { @Override public void run() { try { doc.insertString(doc.getLength(), ".\n", null); } catch (BadLocationException ex) { Exceptions.printStackTrace(ex); } } }); editor.saveDocument(); InputStream inputStream = fileObject.getInputStream(); assertEquals('.',inputStream.read()); assertEquals('\r',inputStream.read()); inputStream.close(); }
Example #14
Source File: ProjectFileExplorer.java From netbeans with Apache License 2.0 | 6 votes |
@Override public void addNotify() { super.addNotify(); manager.addPropertyChangeListener(this); for (int i = 0; i < projects.length; i++) { try { Project project = projects[i]; FileObject projectDir = project.getProjectDirectory(); DataObject projectDirDObj = DataObject.find(projectDir); Node rootNode = projectDirDObj.getNodeDelegate(); FilterNode node = new FilterNode(rootNode); projectNodeList.add(node); } catch (DataObjectNotFoundException ex) { ErrorManager.getDefault().notify(ex); } } Node[] projectNodes = new Node[projectNodeList.size()]; projectNodeList.<Node>toArray(projectNodes); rootChildren.add(projectNodes); manager.setRootContext(explorerClientRoot); descriptor.setValid(false); }
Example #15
Source File: Actions.java From netbeans with Apache License 2.0 | 6 votes |
static DataObject createShadows(final DataFolder favourities, final List<DataObject> dos, final List<DataObject> listAdd) { DataObject createdDO = null; for (DataObject obj : dos) { try { DataShadow added = findShadow(favourities, obj); if (added != null) { if (createdDO == null) { createdDO = added; } } else { if (createdDO == null) { // Select only first node in array added to favorites createdDO = obj.createShadow(favourities); listAdd.add(createdDO); } else { listAdd.add(obj.createShadow(favourities)); } } } catch (IOException ex) { LOG.log(Level.WARNING, null, ex); } } return createdDO; }
Example #16
Source File: DefaultPlugin.java From netbeans with Apache License 2.0 | 6 votes |
/** * Loads a test template. * If the template loading fails, displays an error message. * * @param templateID bundle key identifying the template type * @return loaded template, or <code>null</code> if the template * could not be loaded */ private static DataObject loadTestTemplate(String templateID) { // get the Test class template String path = NbBundle.getMessage(DefaultPlugin.class, templateID); try { FileObject fo = FileUtil.getConfigFile(path); if (fo == null) { noTemplateMessage(path); return null; } return DataObject.find(fo); } catch (DataObjectNotFoundException e) { noTemplateMessage(path); return null; } }
Example #17
Source File: ProjectTemplateAttributesLegacy.java From netbeans with Apache License 2.0 | 6 votes |
@Override public Map<String, ?> attributesFor(DataObject template, DataFolder target, String name) { FileObject targetF = target.getPrimaryFile(); Project prj = FileOwnerQuery.getOwner(targetF); Map<String, Object> all = new HashMap<>(); if (prj != null) { // call old providers Collection<? extends CreateFromTemplateAttributesProvider> oldProvs = prj.getLookup().lookupAll(CreateFromTemplateAttributesProvider.class); if (!oldProvs.isEmpty()) { for (CreateFromTemplateAttributesProvider attrs : oldProvs) { Map<String, ? extends Object> m = attrs.attributesFor(template, target, name); if (m != null) { all.putAll(m); } } } } all.put(ProjectTemplateAttributesLegacy.class.getName(), Boolean.TRUE); return checkProjectAttrs(all, targetF); }
Example #18
Source File: ModuleLogicalViewTest.java From netbeans with Apache License 2.0 | 6 votes |
private Node find(LogicalViewProvider lvp, String path) throws Exception { FileObject f = FileUtil.toFileObject(file(path)); assertNotNull("found " + path, f); Node root = new FilterNode(lvp.createLogicalView()); lvp.findPath(root, f); // ping waitForNodesUpdate(); DataObject d = DataObject.find(f); Node n = lvp.findPath(root, f); assertEquals("same result for DataObject as for FileObject", n, lvp.findPath(root, d)); if (n != null) { assertEquals("right DataObject", d, n.getLookup().lookup(DataObject.class)); } return n; }
Example #19
Source File: DerivedKeyPasswordValidatorCreator.java From netbeans with Apache License 2.0 | 6 votes |
public DataObject generate(FileObject targetFolder, String targetName) { try { DataFolder folder = (DataFolder) DataObject.find(targetFolder); FileObject fo = null; fo = FileUtil.getConfigFile("Templates/WebServices/DerivedKeyPasswordValidator.java"); // NOI18N if (fo != null) { DataObject template = DataObject.find(fo); DataObject obj = template.createFromTemplate(folder, targetName); return obj; } } catch (IOException ex) { Logger.getLogger("global").log(Level.INFO, null, ex); } return null; }
Example #20
Source File: MultiBundleStructureTest.java From netbeans with Apache License 2.0 | 6 votes |
/** * Test of getOpenSupport method, of class MultiBundleStructure. */ @Test public void testGetOpenSupport() throws Exception{ System.out.println("getOpenSupport"); String fileName1 = "foo.properties"; String fileName2 = "foo_ru.properties"; File propFile = new File(getWorkDir(), fileName1); propFile.createNewFile(); File propFile2 = new File(getWorkDir(), fileName2); propFile2.createNewFile(); DataObject propDO1 = DataObject.find(FileUtil.toFileObject(propFile)); DataObject propDO2 = DataObject.find(FileUtil.toFileObject(propFile)); DataObject.find(FileUtil.toFileObject(propFile2)); assertTrue(propDO1 instanceof PropertiesDataObject); PropertiesDataObject dataObject = (PropertiesDataObject) propDO1; MultiBundleStructure instance = (MultiBundleStructure) dataObject.getBundleStructure(); MultiBundleStructure instance2 = (MultiBundleStructure) ((PropertiesDataObject)propDO2).getBundleStructure(); //instances should be the same assertEquals(instance, instance2); instance.updateEntries(); PropertiesOpen result = instance.getOpenSupport(); assertNotNull(result); }
Example #21
Source File: EditQueryStringAction.java From netbeans with Apache License 2.0 | 6 votes |
@Override protected boolean enable (Node[] activatedNodes){ if (activatedNodes.length == 0) { return false; } for (int i = 0; i < activatedNodes.length; i++){ DataObject dObj = (DataObject)(activatedNodes[i]).getCookie(DataObject.class); QueryStringCookie qsc = (QueryStringCookie)activatedNodes[i].getCookie(QueryStringCookie.class); if (qsc == null || dObj == null) return false; if (dObj instanceof JspDataObject){ String ext = dObj.getPrimaryFile().getExt(); if (ext.equals(JspLoader.TAGF_FILE_EXTENSION) || ext.equals(JspLoader.TAGX_FILE_EXTENSION) || ext.equals(JspLoader.TAG_FILE_EXTENSION)) return false; } } return true; }
Example #22
Source File: NbKeymapTest.java From netbeans with Apache License 2.0 | 6 votes |
public void testAcceleratorMapping() throws Exception { FileObject def1 = make("Actions/DummyAction1.instance"); def1.setAttribute("instanceCreate", new DummyAction("one")); FileObject def2 = make("Actions/DummyAction2.instance"); def2.setAttribute("instanceCreate", new DummyAction("two")); FileObject def3 = make("Actions/DummySystemAction1.instance"); def3.setAttribute("instanceClass", DummySystemAction1.class.getName()); FileObject def4 = make("Actions/" + DummySystemAction2.class.getName().replace('.', '-') + ".instance"); DataFolder shortcuts = DataFolder.findFolder(makeFolder("Shortcuts")); DataShadow.create(shortcuts, "1", DataObject.find(def1)).getPrimaryFile(); DataShadow.create(shortcuts, "2", DataObject.find(def2)).getPrimaryFile(); DataShadow.create(shortcuts, "3", DataObject.find(def3)).getPrimaryFile(); DataShadow.create(shortcuts, "C-4", DataObject.find(def4)).getPrimaryFile(); DataFolder menu = DataFolder.findFolder(makeFolder("Menu/Tools")); FileObject menuitem1 = DataShadow.create(menu, "whatever1", DataObject.find(def1)).getPrimaryFile(); FileObject menuitem2 = DataShadow.create(menu, "whatever2", DataObject.find(def2)).getPrimaryFile(); FileObject menuitem3 = DataShadow.create(menu, "whatever3", DataObject.find(def3)).getPrimaryFile(); FileObject menuitem4 = DataShadow.create(menu, "whatever4", DataObject.find(def4)).getPrimaryFile(); NbKeymap km = new NbKeymap(); assertMapping(km, KeyStroke.getKeyStroke(KeyEvent.VK_1, 0), menuitem1, "one"); assertMapping(km, KeyStroke.getKeyStroke(KeyEvent.VK_2, 0), menuitem2, "two"); assertMapping(km, KeyStroke.getKeyStroke(KeyEvent.VK_3, 0), menuitem3, "DummySystemAction1"); assertMapping(km, KeyStroke.getKeyStroke(KeyEvent.VK_4, KeyEvent.CTRL_MASK), menuitem4, "DummySystemAction2"); }
Example #23
Source File: DnDSupport.java From netbeans with Apache License 2.0 | 6 votes |
private boolean handleDropImpl(Transferable t) { try { Object o; if( t.isDataFlavorSupported( actionDataFlavor ) ) { o = t.getTransferData( actionDataFlavor ); if( o instanceof Node ) { DataObject dobj = ((Node)o).getLookup().lookup( DataObject.class ); return addButton( dobj, dropTargetButtonIndex, insertBefore ); } } else { o = t.getTransferData( buttonDataFlavor ); if( o instanceof DataObject ) { return moveButton( (DataObject)o, dropTargetButtonIndex, insertBefore ); } } } catch( UnsupportedFlavorException e ) { log.log( Level.INFO, null, e ); } catch( IOException ioE ) { log.log( Level.INFO, null, ioE ); } return false; }
Example #24
Source File: WebFreeFormActionProvider.java From netbeans with Apache License 2.0 | 6 votes |
private void openFile(String path) { FileObject file = helper.getProjectDirectory().getFileObject(path); if (file == null) return; DataObject fileDO; try { fileDO = DataObject.find(file); } catch (DataObjectNotFoundException e) { throw new AssertionError(e); } EditCookie edit = (EditCookie)fileDO.getCookie(EditCookie.class); if (edit != null) { edit.edit(); } }
Example #25
Source File: DocumentTitlePropertyTest.java From netbeans with Apache License 2.0 | 6 votes |
public void testDocumentId () throws IOException { FileUtil.createData(FileUtil.getConfigRoot(), "someFolder/someFile.obj"); FileUtil.createData(FileUtil.getConfigRoot(), "someFolder/someFile.txt"); DataObject obj = DataObject.find(FileUtil.getConfigFile("someFolder/someFile.obj")); DataObject txt = DataObject.find(FileUtil.getConfigFile("someFolder/someFile.txt")); assertEquals( MyDataObject.class, obj.getClass()); assertTrue( "we need UniFileLoader", obj.getLoader() instanceof UniFileLoader ); CloneableEditorSupport ecobj = (CloneableEditorSupport) obj.getCookie(EditorCookie.class); CloneableEditorSupport ectxt = (CloneableEditorSupport) txt.getCookie(EditorCookie.class); if (ecobj.documentID().equals(ectxt.documentID())) { fail("The same ID: " + ectxt.documentID()); } assertEquals("Should be full name of the fileObj", obj.getPrimaryFile().getNameExt(), ecobj.documentID()); assertEquals("Should be full name of the txtObj", txt.getPrimaryFile().getNameExt(), ectxt.documentID()); }
Example #26
Source File: JavaActions.java From netbeans with Apache License 2.0 | 5 votes |
private boolean isSingleJavaFileSelected(Lookup context) { Collection<? extends DataObject> selectedDO = context.lookupAll(DataObject.class); if (selectedDO.size() == 1 && selectedDO.iterator().next().getPrimaryFile().hasExt("java")) { return true; } return false; }
Example #27
Source File: MissingHashCode.java From netbeans with Apache License 2.0 | 5 votes |
public void run() { try { EditorCookie cook = DataObject.find(file).getLookup().lookup(EditorCookie.class); JEditorPane[] arr = cook.getOpenedPanes(); if (arr == null) { return; } EqualsHashCodeGenerator.invokeEqualsHashCode(handle, arr[0]); } catch (DataObjectNotFoundException ex) { Exceptions.printStackTrace(ex); } }
Example #28
Source File: GitUtils.java From netbeans with Apache License 2.0 | 5 votes |
private static void openInRevision (final File fileToOpen, final File originalFile, final int lineNumber, final String revision, boolean showAnnotations, ProgressMonitor pm) throws IOException { final FileObject fo = FileUtil.toFileObject(FileUtil.normalizeFile(fileToOpen)); EditorCookie ec = null; org.openide.cookies.OpenCookie oc = null; try { DataObject dobj = DataObject.find(fo); ec = dobj.getCookie(EditorCookie.class); oc = dobj.getCookie(org.openide.cookies.OpenCookie.class); } catch (DataObjectNotFoundException ex) { Logger.getLogger(GitUtils.class.getName()).log(Level.FINE, null, ex); } if (ec == null && oc != null) { oc.open(); } else { CloneableEditorSupport ces = org.netbeans.modules.versioning.util.Utils.openFile(fo, revision.substring(0, 7)); if (showAnnotations && ces != null && !pm.isCanceled()) { final org.openide.text.CloneableEditorSupport support = ces; EventQueue.invokeLater(new Runnable() { @Override public void run() { javax.swing.JEditorPane[] panes = support.getOpenedPanes(); if (panes != null) { if (lineNumber >= 0 && lineNumber < support.getLineSet().getLines().size()) { support.getLineSet().getCurrent(lineNumber).show(Line.ShowOpenType.NONE, Line.ShowVisibilityType.FRONT); } SystemAction.get(AnnotateAction.class).showAnnotations(panes[0], originalFile, revision); } } }); } } }
Example #29
Source File: PeterZMoveTest.java From netbeans with Apache License 2.0 | 5 votes |
private void doWhenMovingAFileNoLockshallBetaken (boolean save) throws Exception { DES sup = support (); assertFalse ("It is closed now", support ().isDocumentLoaded ()); Lookup lkp = sup.getLookup (); obj = lkp.lookup(DataObject.class); assertNotNull ("DataObject found", obj); Document d = sup.openDocument (); assertTrue ("It is open now", support ().isDocumentLoaded ()); d.insertString(0, "Ahoj", null); assertTrue("Really modified", sup.isModified()); if (save) { sup.saveDocument(); } FileObject fo = FileUtil.createFolder(obj.getFolder().getPrimaryFile(), "newfold"); DataFolder nf = DataFolder.findFolder(fo); obj.move(nf); FileLock lock = obj.getPrimaryFile().lock(); assertNotNull("It is possible to take another lock", lock); }
Example #30
Source File: BeanInstaller.java From netbeans with Apache License 2.0 | 5 votes |
/** Recursive method scanning folders for classes (class files) that could * be JavaBeans. */ private static void scanFolderForBeans(FileObject folder, final Map<String,ItemInfo> beans, final ClassSource.Entry root) { JavaClassHandler handler = new JavaClassHandler() { @Override public void handle(String className, String problem) { if (problem == null) { ItemInfo ii = new ItemInfo(); ii.classname = className; ii.entry = root; beans.put(ii.classname, ii); } } }; FileObject[] files = folder.getChildren(); for (int i=0; i < files.length; i++) { FileObject fo = files[i]; if (fo.isFolder()) { scanFolderForBeans(fo, beans, root); } else try { if ("class".equals(fo.getExt()) // NOI18N && (DataObject.find(fo) != null)) { scanFileObject(folder, fo, handler); } } catch (org.openide.loaders.DataObjectNotFoundException ex) {} // should not happen } }