Package org.eclipse.core.commands
Interface IObjectWithState
- All Known Implementing Classes:
AbstractHandlerWithState
,Command
,HandlerServiceHandler
,WorkbenchHandlerServiceHandler
public interface IObjectWithState
An object that holds zero or more state objects. This state information can
be shared between different instances of IObjectWithState
.
Clients may implement, but must not extend this interface.
- Since:
- 3.2
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Adds state to this object.Gets the state with the given id.String[]
Gets the identifiers for all of the state associated with this object.void
removeState
(String stateId) Removes state from this object.
-
Method Details
-
addState
Adds state to this object. Usually, consumers will callremoveState()
with a matching id in the same lifecycle of IObjectWithState. However, this behavior is not guaranteed. Implementors should not rely onremoveState()
for resource disposal. The recommended practice is to free resources associated with non-removed states in some kind of dispose() method.- Parameters:
id
- The identifier indicating the type of state being added; must not benull
.state
- The new state to add to this object; must not benull
.- See Also:
-
getState
Gets the state with the given id.- Parameters:
stateId
- The identifier of the state to retrieve; must not benull
.- Returns:
- The state; may be
null
if there is no state with the given id.
-
getStateIds
String[] getStateIds()Gets the identifiers for all of the state associated with this object.- Returns:
- All of the state identifiers; may be empty, but never
null
.
-
removeState
Removes state from this object.- Parameters:
stateId
- The id of the state to remove from this object; must not benull
.
-