Java Code Examples for org.openide.loaders.DataFolder#getNodeDelegate()
The following examples show how to use
org.openide.loaders.DataFolder#getNodeDelegate() .
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: PackageRootNode.java From netbeans with Apache License 2.0 | 6 votes |
private Node getDataFolderNodeDelegate() { DataFolder df = getLookup().lookup(DataFolder.class); try { if (df.isValid()) { return df.getNodeDelegate(); } } catch (IllegalStateException e) { //The data systems API is not thread save, //the DataObject may become invalid after isValid call and before //getNodeDelegate call, we have to catch the ISE. When the DataObject //is valid - other cause rethrow it otherwise return leaf node. //todo: The DataObject.getNodedelegate should throw specialized exception type. if (df.isValid()) { throw e; } } return new AbstractNode(Children.LEAF); }
Example 2
Source File: PhysicalView.java From netbeans with Apache License 2.0 | 6 votes |
public GroupNode(Project project, SourceGroup group, boolean isProjectDir, DataFolder dataFolder ) { super( dataFolder.getNodeDelegate(), dataFolder.createNodeChildren( VISIBILITY_QUERY_FILTER ), createLookup(project, group, dataFolder, isProjectDir)); this.pi = ProjectUtils.getInformation( project ); this.group = group; this.isProjectDir = isProjectDir; if(isProjectDir) { LogicalViewProvider lvp = project.getLookup().lookup(LogicalViewProvider.class); // used to retrieve e.g. actions in case of a folder representing a project, // so that a projects context menu is the same is in a logical view this.projectDelegateNode = lvp != null ? lvp.createLogicalView() : null; } else { this.projectDelegateNode = null; } pi.addPropertyChangeListener(WeakListeners.propertyChange(this, pi)); group.addPropertyChangeListener( WeakListeners.propertyChange( this, group ) ); }
Example 3
Source File: NbAndroidRootProjectImpl.java From NBANDROID-V2 with Apache License 2.0 | 5 votes |
@Override public Node createLogicalView() { FileObject projectDirectory = NbAndroidRootProjectImpl.this.getProjectDirectory(); DataFolder projectFolder = DataFolder.findFolder(projectDirectory); Node nodeOfProjectFolder = projectFolder.getNodeDelegate(); try { return new ProjectNode(nodeOfProjectFolder); } catch (DataObjectNotFoundException ex) { Exceptions.printStackTrace(ex); return new AbstractNode(Children.LEAF); } }
Example 4
Source File: PackageViewChildren.java From netbeans with Apache License 2.0 | 5 votes |
public PackageNode( FileObject root, DataFolder dataFolder, boolean empty ) { super( dataFolder.getNodeDelegate(), empty ? Children.LEAF : dataFolder.createNodeChildren( NO_FOLDERS_FILTER ), new ProxyLookup( Lookups.singleton(new NoFoldersContainer (dataFolder)), dataFolder.getNodeDelegate().getLookup(), Lookups.singleton(SearchInfoDefinitionFactory.createFlatSearchInfo( dataFolder.getPrimaryFile())))); this.root = root; this.dataFolder = dataFolder; this.isDefaultPackage = root.equals( dataFolder.getPrimaryFile() ); this.accRes = new AtomicReference<>(); }
Example 5
Source File: MultiModuleNodeFactory.java From netbeans with Apache License 2.0 | 5 votes |
@NonNull private Node getDataFolderNodeDelegate() { final DataFolder df = getLookup().lookup(DataFolder.class); try { if (df.isValid()) { return df.getNodeDelegate(); } } catch (IllegalStateException e) { if (df.isValid()) { throw e; } } return new AbstractNode(Children.LEAF); }
Example 6
Source File: ExpandFolderTest.java From netbeans with Apache License 2.0 | 5 votes |
public void testGetNodesForAFolderExtjava() throws Exception { CountingSecurityManager.initialize(getWorkDirPath()); long now = System.currentTimeMillis(); DataFolder f = DataFolder.findFolder(root); Node n = f.getNodeDelegate(); Node[] arr = n.getChildren().getNodes(true); assertEquals("1000 nodes", 1000, arr.length); CountingSecurityManager.assertCounts("About 1000 * 4?", 4000, len); }
Example 7
Source File: ExpandFolderTest.java From netbeans with Apache License 2.0 | 5 votes |
public void testGetNodesForAFolderExtxml() throws Exception { CountingSecurityManager.initialize(getWorkDirPath()); long now = System.currentTimeMillis(); DataFolder f = DataFolder.findFolder(root); Node n = f.getNodeDelegate(); Node[] arr = n.getChildren().getNodes(true); assertEquals("1000 nodes", 1000, arr.length); CountingSecurityManager.assertCounts("About 1000 * 11?", 11000, len); }
Example 8
Source File: NbAndroidProjectImpl.java From NBANDROID-V2 with Apache License 2.0 | 5 votes |
@Override public Node createLogicalView() { FileObject projectDirectory = NbAndroidProjectImpl.this.getProjectDirectory(); DataFolder projectFolder = DataFolder.findFolder(projectDirectory); Node nodeOfProjectFolder = projectFolder.getNodeDelegate(); try { return new ProjectNode(nodeOfProjectFolder); } catch (DataObjectNotFoundException ex) { Exceptions.printStackTrace(ex); return new AbstractNode(Children.LEAF); } }
Example 9
Source File: TemplatesPanel.java From netbeans with Apache License 2.0 | 5 votes |
static Node getTemplateRootNode () { if (templatesRootNode == null) { DataFolder df = DataFolder.findFolder (getTemplatesRoot ()); templatesRootNode = new TemplateNode (new FilterNode (df.getNodeDelegate (), df.createNodeChildren (new TemplateFilter ()))); } return templatesRootNode; }
Example 10
Source File: LookupNode.java From netbeans with Apache License 2.0 | 4 votes |
/** @param or original node to take children from */ public Ch (DataFolder folder) { super(folder.getNodeDelegate ()); }
Example 11
Source File: TreeRootNode.java From netbeans with Apache License 2.0 | 4 votes |
TreeRootNode(DataFolder folder, SourceGroup g, GrailsProject project, Type type) { this(new FilterNode(folder.getNodeDelegate(), folder.createNodeChildren(new VisibilityQueryDataFilter(g))), g, project, type); }
Example 12
Source File: SourceNode.java From netbeans-mmd-plugin with Apache License 2.0 | 4 votes |
SourceNode(@Nonnull final Project project, @Nonnull final DataFolder folder, @Nonnull final DataFilter filter, final String name) { this(project, folder, new FilterNode(folder.getNodeDelegate(), folder.createNodeChildren(filter)), name); }
Example 13
Source File: ServerResourceNode.java From netbeans with Apache License 2.0 | 4 votes |
private static Node getDataFolderNode(DataFolder folderDo, Project project) { // The project in the placeholder node lookup is needed for the New File action. return (folderDo != null) ? folderDo.getNodeDelegate() : new PlaceHolderNode(Lookups.singleton(project)); }
Example 14
Source File: DocBaseNodeFactory.java From netbeans with Apache License 2.0 | 4 votes |
BaseNode(final DataFolder folder, WebProject project, VisibilityQueryDataFilter filter) { super(folder.getNodeDelegate(), folder.createNodeChildren(filter)); this.project = project; }
Example 15
Source File: ArchiveViews.java From netbeans with Apache License 2.0 | 4 votes |
public DocBaseNode(DataFolder folder) { super(folder.getNodeDelegate(), folder.createNodeChildren(VISIBILITY_QUERY_FILTER)); }
Example 16
Source File: TreeRootNode.java From netbeans with Apache License 2.0 | 4 votes |
private TreeRootNode(DataFolder folder, SourceGroup g, boolean reduced) { this(new FilterNode(folder.getNodeDelegate(), reduced ? Children.LEAF : folder.createNodeChildren(new GroupDataFilter(g))), folder, g, reduced); }
Example 17
Source File: JavaSrc.java From netbeans with Apache License 2.0 | 4 votes |
/** @param or original node to take children from */ public ActionsPoolChildren (DataFolder folder) { super(folder.getNodeDelegate ()); }
Example 18
Source File: FolderNodeFactory.java From netbeans with Apache License 2.0 | 4 votes |
public ViewItemNode(DataFolder folder, String includes, String excludes, String name, String displayName) { super(folder.getNodeDelegate(), folder.createNodeChildren(new GroupDataFilter(folder.getPrimaryFile(), includes, excludes))); this.name = name; this.displayName = displayName; }
Example 19
Source File: SrcNode.java From netbeans with Apache License 2.0 | 2 votes |
/** * creates source root node based on specified DataFolder. * Uses specified name. */ SrcNode(PhpProject project, DataFolder folder, DataFilter filter, String name, boolean isTest) { this(project, folder, new FilterNode(folder.getNodeDelegate(), folder.createNodeChildren(filter)), name, isTest); }
Example 20
Source File: MVCNode.java From cakephp3-netbeans with Apache License 2.0 | 2 votes |
/** * creates source root node based on specified DataFolder. Uses specified * name. */ MVCNode(DataFolder folder, DataFilter filter, String name) { this(folder, new FilterNode(folder.getNodeDelegate(), folder.createNodeChildren(filter)), name); }