public interface ProjectConfigurationProvider<C extends ProjectConfiguration>
lookup
.
Besides the implementor, only the project UI infrastructure is expected to use this class.Modifier and Type | Field and Description |
---|---|
static String |
PROP_CONFIGURATION_ACTIVE
Property name for the active configuration.
|
static String |
PROP_CONFIGURATIONS
Property name of the set of configurations.
|
Modifier and Type | Method and Description |
---|---|
void |
addPropertyChangeListener(PropertyChangeListener lst)
Adds a listener to check for changes in
ProjectConfigurationProvider.PROP_CONFIGURATION_ACTIVE or ProjectConfigurationProvider.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.
|
static final String PROP_CONFIGURATION_ACTIVE
static final String PROP_CONFIGURATIONS
Collection<C> getConfigurations()
Should be called within read access
.
@CheckForNull C getActiveConfiguration()
Should be called within read access
.
ProjectConfigurationProvider.getConfigurations()
, or null only if that is empty)void setActiveConfiguration(C configuration) throws IllegalArgumentException, IOException
ProjectConfigurationProvider.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
.
configuration
- new active configurationIllegalArgumentException
- if the requested configuration is not a member of ProjectConfigurationProvider.getConfigurations()
IOException
- if storing the configuration change failedboolean hasCustomizer()
ProjectConfigurationProvider.customize()
may be calledvoid customize()
ProjectConfigurationProvider.hasCustomizer()
is true.
May, for example, open the project properties dialog.boolean configurationsAffectAction(String command)
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
.
command
- one of ActionProvider.getSupportedActions()
void addPropertyChangeListener(PropertyChangeListener lst)
ProjectConfigurationProvider.PROP_CONFIGURATION_ACTIVE
or ProjectConfigurationProvider.PROP_CONFIGURATIONS
.lst
- a listener to addvoid removePropertyChangeListener(PropertyChangeListener lst)
lst
- a listener to remove