Interface ProjectConfigurationProvider<C extends ProjectConfiguration>
- Type Parameters:
C
- the type of configuration created by this provider
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:
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds a listener to check for changes inPROP_CONFIGURATION_ACTIVE
orPROP_CONFIGURATIONS
.boolean
configurationsAffectAction
(String command) Indicates if a project action is affected by the choice of configuration.void
Customize this project's configurations.Gets the currently active configuration.Gets a list of configurations.boolean
Checks if this project can provide a GUI customizer for its configurations.void
Removes a listener.void
setActiveConfiguration
(C configuration) Sets the active configuration.
-
Field Details
-
PROP_CONFIGURATION_ACTIVE
Property name for the active configuration. Use it when firing a change in the active configuration.- See Also:
-
PROP_CONFIGURATIONS
Property name of the set of configurations. Use it when firing a change in the set of configurations.- See Also:
-
-
Method Details
-
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
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
Sets the active configuration. Should fire a change inPROP_CONFIGURATION_ACTIVE
. It should be true afterwards thatconfiguration.equals(getActiveConfiguration())
though it might not be true thatconfiguration == 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 ofgetConfigurations()
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 ifhasCustomizer()
is true. May, for example, open the project properties dialog. -
configurationsAffectAction
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 aProjectConfiguration
in the context passed toActionProvider.invokeAction(java.lang.String, org.openide.util.Lookup)
. A project is free to returnfalse
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
, andActionProvider.COMMAND_DEBUG
.- Parameters:
command
- one ofActionProvider.getSupportedActions()
- Returns:
- true if the named command refers to an action affected by configurations
-
addPropertyChangeListener
Adds a listener to check for changes inPROP_CONFIGURATION_ACTIVE
orPROP_CONFIGURATIONS
.- Parameters:
lst
- a listener to add
-
removePropertyChangeListener
Removes a listener.- Parameters:
lst
- a listener to remove
-