站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc 4.1.0

OpenProjects (NetBeans Project UI API) - NetBeans API Javadoc 4.1.0

 

org.netbeans.api.project.ui
Class OpenProjects

java.lang.Object
  extended byorg.netbeans.api.project.ui.OpenProjects

public final class OpenProjects
extends Object

List of projects open in the GUI.

Warning: this API is intended only for a limited set of use cases where obtaining a list of all open projects is really the direct goal. For example, you may wish to display a chooser letting the user select a file from among the top-level source folders of any open project. For many cases, however, this API is not the correct approach, so use it as a last resort. Consider GlobalPathRegistry, ProjectOpenedHook, and ProjectSensitiveActions (or MainProjectSensitiveActions) first. Only certain operations should actually be aware of which projects are "open"; by default, all project functionality should be available whether it is open or not.


Field Summary
static String PROPERTY_OPEN_PROJECTS
          Property representing open projects.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener listener)
          Adds a listener to changes in the set of open projects.
 void close(Project[] projects)
          Closes given projects.
static OpenProjects getDefault()
          Get the default singleton instance of this class.
 Project[] getOpenProjects()
          Gets a list of currently open projects.
 void open(Project[] projects, boolean openSubprojects)
          Opens given projects.
 void removePropertyChangeListener(PropertyChangeListener listener)
          Removes a listener.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_OPEN_PROJECTS

public static final String PROPERTY_OPEN_PROJECTS
Property representing open projects.

See Also:
getOpenProjects(), Constant Field Values
Method Detail

getDefault

public static OpenProjects getDefault()
Get the default singleton instance of this class.

Returns:
the default instance

getOpenProjects

public Project[] getOpenProjects()
Gets a list of currently open projects.

Returns:
list of projects currently opened in the IDE's GUI; order not specified

open

public void open(Project[] projects,
                 boolean openSubprojects)
Opens given projects. Acquires ProjectManager.mutex() in the write mode.

Parameters:
projects - to be opened. In the case when some of the projects are already opened these projects are not opened again. If the projects contain duplicates, the duplicated projects are opened just once.
openSubprojects - if true also subprojects are opened.
Since:
org.netbeans.modules.projectuiapi/0 1.2

This method is designed for use by logical view's Libraries Node to open one or more of dependent projects. This method can be used also by other project GUI components which need to open certain project(s), eg. code generation wizards.
The method should not be used for opening newly created project, insted the WizardDescriptor.InstantiatingIterator.instantiate() used for creation of new project should return the project directory.
The method should not be also used to provide a GUI to open subprojects. The CommonProjectActions.openSubprojectsAction() should be used instead.


close

public void close(Project[] projects)
Closes given projects. Acquires ProjectManager.mutex() in the write mode.

Parameters:
projects - to be closed. The non opened project contained in the projects array are ignored.
Since:
org.netbeans.modules.projectuiapi/0 1.2

addPropertyChangeListener

public void addPropertyChangeListener(PropertyChangeListener listener)
Adds a listener to changes in the set of open projects. As this class is a singleton and is not subject to garbage collection, it is recommended to add only weak listeners, or remove regular listeners reliably.

Parameters:
listener - a listener to add
See Also:
PROPERTY_OPEN_PROJECTS

removePropertyChangeListener

public void removePropertyChangeListener(PropertyChangeListener listener)
Removes a listener.

Parameters:
listener - a listener to remove

 

Built on May 4 2005.  |  Portions Copyright 1997-2005 Sun Microsystems, Inc. All rights reserved.