de.cau.cs.kieler.core.model.triggers
Class PartTrigger.PartState

java.lang.Object
  extended by de.cau.cs.kieler.core.kivi.AbstractTriggerState
      extended by de.cau.cs.kieler.core.model.triggers.PartTrigger.PartState
All Implemented Interfaces:
ITriggerState, IPropertyHolder
Direct Known Subclasses:
PartTrigger.EditorState
Enclosing class:
PartTrigger

public static class PartTrigger.PartState
extends AbstractTriggerState
implements IPropertyHolder

Trigger states containing information of the current active work bench part.

Rating red

Constructor Summary
PartTrigger.PartState()
          Default constructor.
PartTrigger.PartState(IWorkbenchPart theCurrentActivePart, IEditorPart theCurrentActiveEditorPart, PartTrigger.EventType theEventType)
          Constructor taking the part to be delivered to combination.
 
Method Summary
 void copyProperties(IPropertyHolder holder)
          Copy all properties from another property holder to this one.
 boolean editorIsActivePart()
          Convenience tester, whether current active editor is current actual active workbench part.
 Map<IProperty<?>,Object> getAllProperties()
          Returns a map of all assigned properties with associated values.
 IEditorPart getEditorPart()
           
 PartTrigger.EventType getEventType()
           
 IWorkbenchPart getPart()
           
<T> T
getProperty(IProperty<T> property)
          Retrieves a property value.
 Class<? extends ITrigger> getTriggerClass()
          Get the trigger class associated with this trigger state.
 void setProperty(IProperty<?> property, Object value)
          Sets a property value.
 
Methods inherited from class de.cau.cs.kieler.core.kivi.AbstractTriggerState
finish, getKeyClass, getSequenceNumber, merge, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

PartTrigger.PartState

public PartTrigger.PartState()
Default constructor.


PartTrigger.PartState

public PartTrigger.PartState(IWorkbenchPart theCurrentActivePart,
                             IEditorPart theCurrentActiveEditorPart,
                             PartTrigger.EventType theEventType)
Constructor taking the part to be delivered to combination.

Parameters:
theCurrentActivePart - the currently active workbench part.
theCurrentActiveEditorPart - the currently active editor part.
theEventType - indicates the kind of the occurred event.
Method Detail

getPart

public IWorkbenchPart getPart()
Returns:
the current active workbench part or null if no one exists. If a close event is indicated this method returns the part being closed.

getEditorPart

public IEditorPart getEditorPart()
Returns:
the current active workbench part or null if no one exists.

getEventType

public PartTrigger.EventType getEventType()
Returns:
the the event type the state was triggered for.

editorIsActivePart

public boolean editorIsActivePart()
Convenience tester, whether current active editor is current actual active workbench part.

Returns:
true if the known editor is the actual active part, false otherwise.

getTriggerClass

public Class<? extends ITrigger> getTriggerClass()
Get the trigger class associated with this trigger state.

Specified by:
getTriggerClass in interface ITriggerState
Returns:
the trigger class

getProperty

public <T> T getProperty(IProperty<T> property)
Retrieves a property value. If the property is not set, its default value shall be taken, which is taken from the given property instance.

Specified by:
getProperty in interface IPropertyHolder
Type Parameters:
T - type of property
Parameters:
property - the property to get
Returns:
the current value, or the default value if the property is not set

setProperty

public void setProperty(IProperty<?> property,
                        Object value)
Sets a property value. No type checking is performed while setting, so users of this method must take care that the right object types are generated.

Specified by:
setProperty in interface IPropertyHolder
Parameters:
property - the property to set
value - the new value

copyProperties

public void copyProperties(IPropertyHolder holder)
Copy all properties from another property holder to this one.

Specified by:
copyProperties in interface IPropertyHolder
Parameters:
holder - another property holder

getAllProperties

public Map<IProperty<?>,Object> getAllProperties()
Returns a map of all assigned properties with associated values.

Specified by:
getAllProperties in interface IPropertyHolder
Returns:
a map of all properties