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

ProjectConfigurationProvider (Project API) - NetBeans API Javadoc (Current Development Version)

org.netbeans.modules.projectapi/1 1.13

org.netbeans.spi.project
Interface ProjectConfigurationProvider<C extends ProjectConfiguration>


public interface ProjectConfigurationProvider<C extends ProjectConfiguration>

Provider of configurations for a project. Should be registered in a project's lookup. Besides the implementor, only the project UI infrastructure is expected to use this class.

Since:
org.netbeans.modules.projectapi/1 1.11
See Also:
Project Configurations design document

Field Summary
static String PROP_CONFIGURATION_ACTIVE
          Property name for the active configuration.
static String PROP_CONFIGURATIONS
          Property name of the set of configurations.
 
Method Summary
 void addPropertyChangeListener(PropertyChangeListener lst)
          Adds a listener to check for changes in PROP_CONFIGURATION_ACTIVE or PROP_CONFIGURATIONS.
 boolean configurationsAffectAction(String command)
          Indicates if a project action is affected by the choice of configuration.
 void customize()
          Customize this project's configurations.
 C getActiveConfiguration()
          Gets the currently active configuration.
 Collection<C> getConfigurations()
          Gets a list of configurations.
 boolean hasCustomizer()
          Checks if this project can provide a GUI customizer for its configurations.
 void removePropertyChangeListener(PropertyChangeListener lst)
          Removes a listener.
 void setActiveConfiguration(C configuration)
          Sets the active configuration.
 

Field Detail

PROP_CONFIGURATION_ACTIVE

static final String PROP_CONFIGURATION_ACTIVE
Property name for the active configuration. Use it when firing a change in the active configuration.

See Also:
Constant Field Values

PROP_CONFIGURATIONS

static final String PROP_CONFIGURATIONS
Property name of the set of configurations. Use it when firing a change in the set of configurations.

See Also:
Constant Field Values
Method Detail

getConfigurations

Collection<C> getConfigurations()
Gets a list of configurations. Permitted to return different instances from one invocation to the next but it is advisable for the "same" instances to compare as equal.

Should be called within read access.

Returns:
all available configurations for this project

getActiveConfiguration

C getActiveConfiguration()
Gets the currently active configuration.

Should be called within read access.

Returns:
the active configuration for this project (should be a member of getConfigurations(), or null only if that is empty)

setActiveConfiguration

void setActiveConfiguration(C configuration)
                            throws IllegalArgumentException,
                                   IOException
Sets the active configuration. Should fire a change in PROP_CONFIGURATION_ACTIVE. It should be true afterwards that configuration.equals(getActiveConfiguration()) though it might not be true that configuration == getActiveConfiguration().

If possible, the choice of configuration should be persisted for the next IDE session. If applicable, the persisted choice should be kept in per-user settings, not shared or versioned.

Should be called within write access.

Parameters:
configuration - new active configuration
Throws:
IllegalArgumentException - if the requested configuration is not a member of getConfigurations()
IOException - if storing the configuration change failed

hasCustomizer

boolean hasCustomizer()
Checks if this project can provide a GUI customizer for its configurations.

Returns:
true if customize() may be called

customize

void customize()
Customize this project's configurations. Only permitted if hasCustomizer() is true. May, for example, open the project properties dialog.


configurationsAffectAction

boolean configurationsAffectAction(String command)
Indicates if a project action is affected by the choice of configuration. If so, a GUI for this action is permitted to show a list of configurations and let the user select a configuration to apply to one action invocation only. Such a GUI can avoid the need to first select an active configuration and then run the action as two steps. This is done by including a ProjectConfiguration in the context passed to ActionProvider.invokeAction(java.lang.String, org.openide.util.Lookup). A project is free to return false even if the configuration might affect the behavior of the action, if it simply does not wish for such a GUI to be shown.

The likely values of command are those actions normally shown in the IDE's tool bar with main project bindings: ActionProvider.COMMAND_BUILD, ActionProvider.COMMAND_REBUILD, ActionProvider.COMMAND_RUN, and ActionProvider.COMMAND_DEBUG.

Parameters:
command - one of ActionProvider.getSupportedActions()
Returns:
true if the named command refers to an action affected by configurations

addPropertyChangeListener

void addPropertyChangeListener(PropertyChangeListener lst)
Adds a listener to check for changes in PROP_CONFIGURATION_ACTIVE or PROP_CONFIGURATIONS.

Parameters:
lst - a listener to add

removePropertyChangeListener

void removePropertyChangeListener(PropertyChangeListener lst)
Removes a listener.

Parameters:
lst - a listener to remove

org.netbeans.modules.projectapi/1 1.13

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