org.jupe.editors.classdiagram.model
Class ClassDiagram

java.lang.Object
  extended by org.eclipse.emf.common.notify.impl.AdapterImpl
      extended by org.jupe.editors.classdiagram.model.ModelElement
          extended by org.jupe.editors.classdiagram.model.nodes.NodeModelElement
              extended by org.jupe.editors.classdiagram.model.ClassDiagram
All Implemented Interfaces:
org.eclipse.emf.common.notify.Adapter, org.eclipse.emf.common.notify.Adapter.Internal, org.eclipse.ui.views.properties.IPropertySource, IContainerElement

public class ClassDiagram
extends NodeModelElement
implements IContainerElement

A ClassDiagram represents the subset of elements of the complete UML2 model which are shown in a class diagram.

Author:
Michael Pradel, Emanuel Thomas

Nested Class Summary
 
Nested classes/interfaces inherited from interface org.eclipse.emf.common.notify.Adapter
org.eclipse.emf.common.notify.Adapter.Internal
 
Field Summary
static java.lang.String DETAIL_PROP
          PropertyId for detail degree of the ClassDiagram: HIGH (show all), LOW (only element names) Value: Integer
static java.lang.String NAME_PROP
          PropertyId for the class name.
 
Fields inherited from class org.jupe.editors.classdiagram.model.nodes.NodeModelElement
CHILD_ADDED_PROP, CHILD_REMOVED_PROP, CONNECTIONS_PROP, LOCATION_PROP, SIZE_PROP, SOURCE_CONNECTIONS_PROP, TARGET_CONNECTIONS_PROP
 
Fields inherited from class org.jupe.editors.classdiagram.model.ModelElement
GENERAL_CHANGE_PROP
 
Constructor Summary
ClassDiagram(UML2ModelRoot modelRoot)
          Constructor
 
Method Summary
 boolean addToDiagram(org.eclipse.uml2.uml.Element parentUML2Element, org.eclipse.uml2.uml.Element uml2Element)
          Display an already existing UML2 element in this diagram.
 boolean assimilate(NodeModelElement modelElement)
          Creates a UML2 element to a given NodeModelElement.
 ClassDiagram getClassDiagram()
          Get the class diagram that contains this element.
 ClassDiagramEditor getEditor()
          Method returns class diagram editor which holds that diagram or null if diagram is not open in such an editor.
 JupeProject getJupeProject()
          Determines the corresponding JupeProject either via an open diagram or UML element.
 java.lang.Object getPropertyValue(java.lang.Object propertyId)
          Children should override this.
 org.eclipse.uml2.uml.Element getUML2Element()
          Sets the corresponding uml2element of this model element.
 boolean isPropertySet(java.lang.Object propertyId)
          Children should override this.
 void resetPropertyValue(java.lang.Object propertyId)
          Children should override this.
 void setEditor(ClassDiagramEditor editor)
          Method sets class diagram editor in which this diagram is open.
 void setJupeProject(JupeProject project)
          Set the Jupe project this diagram belongs to.
 void setPropertyValue(java.lang.Object propertyId, java.lang.Object value)
          Children should override this.
 void setUML2Element(org.eclipse.uml2.uml.Element uml2Element)
          As this is the modelRoot element of the model, calling this method has no effect.
 
Methods inherited from class org.jupe.editors.classdiagram.model.nodes.NodeModelElement
addChild, addConnection, addToHash, getAllChildren, getChildren, getLocation, getParent, getSize, getSourceConnections, getTargetConnections, notifyChanged, removeChild, removeConnection, removeFromHash, removeFromModel, setLocation, setSize, setSourceConnections, setTargetConnections
 
Methods inherited from class org.jupe.editors.classdiagram.model.ModelElement
addPropertyChangeListener, getEditableValue, getPropertyDescriptors, removePropertyChangeListener
 
Methods inherited from class org.eclipse.emf.common.notify.impl.AdapterImpl
getTarget, isAdapterForType, setTarget, unsetTarget
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME_PROP

public static final java.lang.String NAME_PROP
PropertyId for the class name. Should be displayed.

Value: String

See Also:
Constant Field Values

DETAIL_PROP

public static final java.lang.String DETAIL_PROP
PropertyId for detail degree of the ClassDiagram: HIGH (show all), LOW (only element names)

Value: Integer

See Also:
Constant Field Values
Constructor Detail

ClassDiagram

public ClassDiagram(UML2ModelRoot modelRoot)
Constructor

Parameters:
modelRoot - model root of this diagram
Method Detail

addToDiagram

public boolean addToDiagram(org.eclipse.uml2.uml.Element parentUML2Element,
                            org.eclipse.uml2.uml.Element uml2Element)
Display an already existing UML2 element in this diagram.

Parameters:
parentUML2Element - The UML2 parent of the element. It has to be in this diagram.
uml2Element - The UML2 element to display in the diagram.
Returns:
True if it has been added, false if it's already in the diagram.

assimilate

public boolean assimilate(NodeModelElement modelElement)
Creates a UML2 element to a given NodeModelElement.

Specified by:
assimilate in interface IContainerElement
Parameters:
modelElement - the given NodeModelElement
Returns:
true if the UML2 element has been created successfully.
See Also:
IContainerElement.assimilate(NodeModelElement)

getClassDiagram

public ClassDiagram getClassDiagram()
Get the class diagram that contains this element.

Overrides:
getClassDiagram in class NodeModelElement
Returns:
The containing class diagram, or null if there is none.

getEditor

public ClassDiagramEditor getEditor()
Method returns class diagram editor which holds that diagram or null if diagram is not open in such an editor.

Returns:
editor or null if it is not open in such an editor

getJupeProject

public JupeProject getJupeProject()
Determines the corresponding JupeProject either via an open diagram or UML element.

Returns:
returns the corresponding JupeProject

getPropertyValue

public java.lang.Object getPropertyValue(java.lang.Object propertyId)
Children should override this.

Specified by:
getPropertyValue in interface org.eclipse.ui.views.properties.IPropertySource
Overrides:
getPropertyValue in class NodeModelElement
See Also:
eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)

getUML2Element

public org.eclipse.uml2.uml.Element getUML2Element()
Sets the corresponding uml2element of this model element. This method should only be called by IContainerElements in their create.. methods. This method has to be implemented by each subclass which have themselves to set as an adapter of the element.

Specified by:
getUML2Element in class ModelElement

isPropertySet

public boolean isPropertySet(java.lang.Object propertyId)
Description copied from class: ModelElement
Children should override this.

Specified by:
isPropertySet in interface org.eclipse.ui.views.properties.IPropertySource
Overrides:
isPropertySet in class NodeModelElement
See Also:
eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)

resetPropertyValue

public void resetPropertyValue(java.lang.Object propertyId)
Description copied from class: ModelElement
Children should override this.

Specified by:
resetPropertyValue in interface org.eclipse.ui.views.properties.IPropertySource
Overrides:
resetPropertyValue in class NodeModelElement
See Also:
IPropertySource.resetPropertyValue(java.lang.Object)

setEditor

public void setEditor(ClassDiagramEditor editor)
Method sets class diagram editor in which this diagram is open.

Parameters:
editor - class diagram editor

setJupeProject

public void setJupeProject(JupeProject project)
Set the Jupe project this diagram belongs to.

Parameters:
project - The Jupe project of this diagram.

setPropertyValue

public void setPropertyValue(java.lang.Object propertyId,
                             java.lang.Object value)
Children should override this.

Specified by:
setPropertyValue in interface org.eclipse.ui.views.properties.IPropertySource
Overrides:
setPropertyValue in class NodeModelElement
See Also:
eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)

setUML2Element

public void setUML2Element(org.eclipse.uml2.uml.Element uml2Element)
As this is the modelRoot element of the model, calling this method has no effect. However, for compatibility issues while saving/loading, it must be kept here.

Overrides:
setUML2Element in class ModelElement
Parameters:
uml2Element - the new uml2 reference for the model element