de.cau.cs.kieler.core.model.effects
Class ShowHideEffect

java.lang.Object
  extended by de.cau.cs.kieler.core.kivi.AbstractEffect
      extended by de.cau.cs.kieler.core.model.effects.ShowHideEffect
All Implemented Interfaces:
IEffect
Direct Known Subclasses:
GmfShowHideEffect

public class ShowHideEffect
extends AbstractEffect

KiviEffect that hides or reveals an element by modifying the visibility of its figure.

Rating red

Field Summary
protected  GraphicalEditPart editPart
          the edit part of the element to hide or reveal.
protected  boolean hide
          if true the target will be hidden, if false target will be visible again.
protected  boolean originalVisible
          the original visibility status.
 
Constructor Summary
ShowHideEffect(IWorkbenchPart editor, EObject target, boolean hide)
          Create a show / hide effect from an editor and a target object.
 
Method Summary
 void execute()
          Execute the effect.
 boolean isMergeable()
          Determines whether this effect can be merged with previously scheduled effects.
 IEffect merge(IEffect other)
          Merge this effect with another effect.
 void undo()
          Attempt to undo the effect.
 
Methods inherited from class de.cau.cs.kieler.core.kivi.AbstractEffect
schedule, scheduleUndo, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

editPart

protected GraphicalEditPart editPart
the edit part of the element to hide or reveal.


hide

protected boolean hide
if true the target will be hidden, if false target will be visible again.


originalVisible

protected boolean originalVisible
the original visibility status.

Constructor Detail

ShowHideEffect

public ShowHideEffect(IWorkbenchPart editor,
                      EObject target,
                      boolean hide)
Create a show / hide effect from an editor and a target object.

Parameters:
editor - the editor in which to hide in
target - the object to hide or reveal
hide - if true the target will be hidden, if false target will be visible again
Method Detail

execute

public void execute()
Execute the effect.


undo

public void undo()
Attempt to undo the effect.

Specified by:
undo in interface IEffect
Overrides:
undo in class AbstractEffect

isMergeable

public boolean isMergeable()
Determines whether this effect can be merged with previously scheduled effects.

Specified by:
isMergeable in interface IEffect
Overrides:
isMergeable in class AbstractEffect
Returns:
true if it can be merged, false if no search through the effect queue is necessary

merge

public IEffect merge(IEffect other)
Merge this effect with another effect. Will return null if the effects can not be merged.

Specified by:
merge in interface IEffect
Overrides:
merge in class AbstractEffect
Parameters:
other - the effect to merge with
Returns:
the newly merged effect, or null if no merge was possible.