de.cau.cs.kieler.core.model.gmf.effects
Class CompartmentCollapseExpandEffect

java.lang.Object
  extended by de.cau.cs.kieler.core.kivi.AbstractEffect
      extended by de.cau.cs.kieler.core.model.gmf.effects.CompartmentCollapseExpandEffect
All Implemented Interfaces:
IEffect

public class CompartmentCollapseExpandEffect
extends AbstractEffect

This Effect collapses or expands compartments. The execute() method expands while the undo method collapses.

Rating red

Constructor Summary
CompartmentCollapseExpandEffect(IWorkbenchPart editor, EObject node, EStructuralFeature thefeatureToCollapse, int theCompartmentLevel, boolean collapse)
          The compartment level gives the hierarchy to which to search for compartments to doCollapse.
CompartmentCollapseExpandEffect(IWorkbenchPart editor, EObject node, EStructuralFeature thefeatureToCollapse, int theCompartmentLevel, boolean collapse, boolean persistent)
          The compartment level gives the hierarchy to which to search for compartments to doCollapse.
 
Method Summary
 void execute()
          Execute the effect.
 IWorkbenchPart getTargetEditor()
          Get the editor the effect is performed on.
 EObject getTargetNode()
          Get the node the effect is performed on.
 boolean hasJustExecuted()
          Determines whether the last call to execute() or undo() actually performed any changes.
 boolean isMergeable()
          Determines whether this effect can be merged with previously scheduled effects.
 IEffect merge(IEffect otherEffect)
          Merge this effect with another effect.
 void setCollapsed(boolean collapsed)
          Set whether this effect should collapse or expand on the next execute().
 String toString()
          
 void undo()
          Undo the effect, i.e.
 
Methods inherited from class de.cau.cs.kieler.core.kivi.AbstractEffect
schedule, scheduleUndo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

CompartmentCollapseExpandEffect

public CompartmentCollapseExpandEffect(IWorkbenchPart editor,
                                       EObject node,
                                       EStructuralFeature thefeatureToCollapse,
                                       int theCompartmentLevel,
                                       boolean collapse)
The compartment level gives the hierarchy to which to search for compartments to doCollapse.

Parameters:
editor - the DiagramEditor containing the EObject
node - the EObject to doCollapse/expand
thefeatureToCollapse - the feature of the EObject to doCollapse/expand
theCompartmentLevel - hierarchy level. 0 means only exactly the given EditPart. Not implemented.
collapse - true if collapsing, false if expanding

CompartmentCollapseExpandEffect

public CompartmentCollapseExpandEffect(IWorkbenchPart editor,
                                       EObject node,
                                       EStructuralFeature thefeatureToCollapse,
                                       int theCompartmentLevel,
                                       boolean collapse,
                                       boolean persistent)
The compartment level gives the hierarchy to which to search for compartments to doCollapse.

Parameters:
editor - the DiagramEditor containing the EObject
node - the EObject to doCollapse/expand
thefeatureToCollapse - the feature of the EObject to doCollapse/expand
theCompartmentLevel - hierarchy level. 0 means only exactly the given EditPart. Not implemented.
collapse - true if collapsing, false if expanding
persistent - true if the collapsing should be persistent
Method Detail

execute

public void execute()
Execute the effect.


undo

public void undo()
Undo the effect, i.e. expand a collapsed compartment.

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

hasJustExecuted

public boolean hasJustExecuted()
Determines whether the last call to execute() or undo() actually performed any changes.

Returns:
true if changes were performed

setCollapsed

public void setCollapsed(boolean collapsed)
Set whether this effect should collapse or expand on the next execute().

Parameters:
collapsed - true if collapsing

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 otherEffect)
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:
otherEffect - the effect to merge with
Returns:
the newly merged effect, or null if no merge was possible.

getTargetEditor

public IWorkbenchPart getTargetEditor()
Get the editor the effect is performed on.

Returns:
the target editor

getTargetNode

public EObject getTargetNode()
Get the node the effect is performed on.

Returns:
the target node

toString

public String toString()

Overrides:
toString in class AbstractEffect