Java Code Examples for org.netbeans.api.project.SourceGroup#addPropertyChangeListener()
The following examples show how to use
org.netbeans.api.project.SourceGroup#addPropertyChangeListener() .
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: TreeRootNode.java From netbeans with Apache License 2.0 | 6 votes |
private TreeRootNode(Node originalNode, SourceGroup group, GrailsProject project, Type type) { super(originalNode, new PackageFilterChildren(originalNode), new ProxyLookup( originalNode.getLookup(), Lookups.fixed( new PathFinder(group), // no need for explicit search info // Adding TemplatesImpl to Node's lookup to narrow-down // number of displayed templates with the NewFile action. // see # 122942 new TemplatesImpl(project, group) ) )); String pathName = group.getName(); setShortDescription(pathName.substring(project.getProjectDirectory().getPath().length() + 1)); this.group = group; this.visualType = type; group.addPropertyChangeListener(WeakListeners.propertyChange(this, group)); }
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: TreeRootNode.java From netbeans with Apache License 2.0 | 5 votes |
private TreeRootNode (Node originalNode, DataFolder folder, SourceGroup g, boolean reduced) { super(originalNode, reduced ? Children.create(new ReducedChildren(folder, new GroupDataFilter(g), g), true) : new PackageFilterChildren(originalNode), new ProxyLookup( originalNode.getLookup(), Lookups.singleton(new PathFinder(g, reduced)) // no need for explicit search info )); this.g = g; g.addPropertyChangeListener(WeakListeners.propertyChange(this, g)); }
Example 4
Source File: ProjectsRootNode.java From netbeans with Apache License 2.0 | 5 votes |
private void setGroups(Collection<SourceGroup> groups, FileObject projectDirectory) { if (groupsListeners != null) { for (Map.Entry<SourceGroup, PropertyChangeListener> entry : groupsListeners.entrySet()) { entry.getKey().removePropertyChangeListener(entry.getValue()); } } Map<SourceGroup,PropertyChangeListener> _groupsListeners = new HashMap<SourceGroup, PropertyChangeListener>(); Set<FileObject> roots = new HashSet<FileObject>(); for (SourceGroup group : groups) { PropertyChangeListener pcl = WeakListeners.propertyChange(this, group); _groupsListeners.put(group, pcl); group.addPropertyChangeListener(pcl); FileObject fo = group.getRootFolder(); if (fo.equals(projectDirectory)) { // #78994: do not listen to project root folder since changes in a nested project will mark it as modified. // Instead, listen to direct subdirs which are owned by this project. Not very precise but the best we can do. // (Would ideally obtain a complete but minimal list of dirs which cover this project but no subprojects. // Unfortunately the current APIs provide no efficient way of doing this in general.) for (FileObject kid : fo.getChildren()) { Project owner = FileOwnerQuery.getOwner(kid); // Not sufficient to check owner == project, because at startup owner will be a LazyProject. if (owner != null && owner.getProjectDirectory() == projectDirectory) { roots.add(kid); } } if (projectDirsListenedTo.add(fo)) { fo.addFileChangeListener(FileUtil.weakFileChangeListener(newSubDirListener, fo)); } } else { roots.add(fo); } } groupsListeners = _groupsListeners; setFiles(roots); }
Example 5
Source File: TreeRootNode.java From netbeans with Apache License 2.0 | 4 votes |
public GroupDataFilter(SourceGroup g) { this.g = g; VisibilityQuery.getDefault().addChangeListener(WeakListeners.change(this, VisibilityQuery.getDefault())); g.addPropertyChangeListener(WeakListeners.propertyChange(this, g)); }
Example 6
Source File: PackageView.java From netbeans with Apache License 2.0 | 4 votes |
private RootNode (SourceGroup group) { super(getOriginalNode(group)); this.sourceGroup = group; JavaProjectSettings.addPropertyChangeListener(WeakListeners.propertyChange(this, JavaProjectSettings.class)); group.addPropertyChangeListener(WeakListeners.propertyChange(this, group)); }
Example 7
Source File: TreeRootNode.java From netbeans with Apache License 2.0 | 4 votes |
public VisibilityQueryDataFilter(SourceGroup g) { this.g = g; VisibilityQuery.getDefault().addChangeListener(WeakListeners.change(this, VisibilityQuery.getDefault())); g.addPropertyChangeListener(WeakListeners.propertyChange(this, g)); }