de.cau.cs.kieler.core.kivi
Class KiVi

java.lang.Object
  extended by de.cau.cs.kieler.core.kivi.KiVi

public class KiVi
extends Object

Core controller for the view management.

Rating red

Field Summary
static String PROPERTY_ACTIVE
          The property key holding the active value.
 
Constructor Summary
KiVi()
          Instantiate the singleton class.
 
Method Summary
 void addEffectsListener(IEffectsListener listener)
          Add an effects listener to the effects worker.
 void distributeTriggerState(ITriggerState triggerState)
          Distribute the event from the given trigger state to all combinations waiting for such a trigger state class.
static void error(ICombination responsibleCombination, ITriggerState trigger, Throwable cause)
          Log an error in a Combination that was triggered by a specific Trigger.
static void error(String m)
          Log an error.
static void error(Throwable t)
          Log an error.
 void executeEffect(IEffect effect)
          Tell the view management to execute an effect.
 List<CombinationDescriptor> getAvailableCombinations()
          Get a list of all available combinations registered to the combinations extension point.
 int getEffectsQueueSize()
          Get the current size of the effects queue.
static KiVi getInstance()
          Get the singleton view management instance.
 ITriggerState getTriggerState(Class<?> clazz)
          Get the current trigger state of the given class.
 void initialize()
          Called on eclipse startup to do a short initialization.
 boolean isActive()
          Checks whether view management is active or not.
 boolean isCombinationClassActive(Class<?> clazz)
          Check whether any combination of the given class is active.
 boolean isDebug()
          Whether the View Management is currently in debug mode.
 void loadActiveStates()
          Update activity state for each combination after preference page submit.
 void registerCombination(ICombination combination, boolean register)
          Register or unregister a combination when it is activated or deactivated to enable or disable reception of trigger events.
 void removeEffectsListener(IEffectsListener listener)
          Remove an effects listener from the effects worker.
 void setActive(boolean a)
          Activate or deactivate the entire view management.
 void setDebug(boolean debug)
          Set the View Management debug mode status.
 void trigger(ITriggerState triggerState)
          Inform the view management about an event contained in the given trigger state.
 void undoEffect(IEffect effect)
          Undo an effect.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PROPERTY_ACTIVE

public static final String PROPERTY_ACTIVE
The property key holding the active value.

Constructor Detail

KiVi

public KiVi()
Instantiate the singleton class.

Method Detail

isDebug

public boolean isDebug()
Whether the View Management is currently in debug mode.

Returns:
the debug mode status

setDebug

public void setDebug(boolean debug)
Set the View Management debug mode status.

Parameters:
debug - the debug mode status

getInstance

public static KiVi getInstance()
Get the singleton view management instance.

Returns:
the instance

initialize

public void initialize()
Called on eclipse startup to do a short initialization. This is called either by an Eclipse early startup registered call or by the KiViMenuContributionItem, when it gets first asked for its menu items, depending on what happens first.


setActive

public void setActive(boolean a)
Activate or deactivate the entire view management.

Parameters:
a - true if activating

isActive

public boolean isActive()
Checks whether view management is active or not.

Returns:
true if active

getTriggerState

public ITriggerState getTriggerState(Class<?> clazz)
Get the current trigger state of the given class.

Parameters:
clazz - the class of trigger state to look for
Returns:
the trigger state

loadActiveStates

public void loadActiveStates()
Update activity state for each combination after preference page submit.


getAvailableCombinations

public List<CombinationDescriptor> getAvailableCombinations()
Get a list of all available combinations registered to the combinations extension point.

Returns:
a copied list of combinations

getEffectsQueueSize

public int getEffectsQueueSize()
Get the current size of the effects queue.

Returns:
size of the effects queue

registerCombination

public void registerCombination(ICombination combination,
                                boolean register)
Register or unregister a combination when it is activated or deactivated to enable or disable reception of trigger events.

Parameters:
combination - the newly activated or deactivated combination
register - true if registering, false if unregistering

trigger

public void trigger(ITriggerState triggerState)
Inform the view management about an event contained in the given trigger state.

Parameters:
triggerState - the triggerState created by the event

executeEffect

public void executeEffect(IEffect effect)
Tell the view management to execute an effect.

Parameters:
effect - the effect to execute

undoEffect

public void undoEffect(IEffect effect)
Undo an effect.

Parameters:
effect - the effect to be undone

distributeTriggerState

public void distributeTriggerState(ITriggerState triggerState)
Distribute the event from the given trigger state to all combinations waiting for such a trigger state class. Called from the combinations worker thread.

Parameters:
triggerState - the triggerState that contains the event

isCombinationClassActive

public boolean isCombinationClassActive(Class<?> clazz)
Check whether any combination of the given class is active.

Parameters:
clazz - the combination class to look for
Returns:
true if an active combination was found

error

public static void error(Throwable t)
Log an error.

Parameters:
t - the causing throwable

error

public static void error(ICombination responsibleCombination,
                         ITriggerState trigger,
                         Throwable cause)
Log an error in a Combination that was triggered by a specific Trigger.

Parameters:
responsibleCombination - the Combination involved
trigger - the Trigger that caused the execution of the combination
cause - the original exception

error

public static void error(String m)
Log an error.

Parameters:
m - the error message

addEffectsListener

public void addEffectsListener(IEffectsListener listener)
Add an effects listener to the effects worker.

Parameters:
listener - the listener to add

removeEffectsListener

public void removeEffectsListener(IEffectsListener listener)
Remove an effects listener from the effects worker.

Parameters:
listener - the listener to remove