Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrescobar2010-03-12 18:27:25 +0000
committerrescobar2010-03-12 18:27:25 +0000
commit205aa057fa925d37a3a5375aa8418b9567e99c6d (patch)
treed33f80b9f727c479b8031aeb352494c38ad9878d /plugins/org.eclipse.osee.framework.ui.data.model.editor
parent0e6d2b595cfb4d54eccdf3479e7c5d74d9c736a5 (diff)
downloadorg.eclipse.osee-205aa057fa925d37a3a5375aa8418b9567e99c6d.tar.gz
org.eclipse.osee-205aa057fa925d37a3a5375aa8418b9567e99c6d.tar.xz
org.eclipse.osee-205aa057fa925d37a3a5375aa8418b9567e99c6d.zip
Diffstat (limited to 'plugins/org.eclipse.osee.framework.ui.data.model.editor')
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/.classpath7
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/.project28
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/.settings/org.eclipse.gmf.bridge.ui.dashboard.prefs7
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/META-INF/MANIFEST.MF40
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/build.properties7
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/help/contexts.xml8
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/help/images/ngrelc.pngbin0 -> 671 bytes
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/help/images/ngrelr.pngbin0 -> 619 bytes
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/help/oseeDataModelEditor.html36
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/help/toc.xml9
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/images/access_restriction_attrib.gifbin0 -> 365 bytes
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/images/access_restriction_relat.gifbin0 -> 369 bytes
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/images/arrows.gifbin0 -> 194 bytes
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/images/datastore.gifbin0 -> 545 bytes
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/images/extractsupertype_wiz.pngbin0 -> 4262 bytes
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/images/file.gifbin0 -> 354 bytes
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/images/geometry.gifbin0 -> 387 bytes
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/images/geometry_disabled.gifbin0 -> 355 bytes
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/images/hierarchy_co.gifbin0 -> 199 bytes
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/images/importsupertype_wiz.pngbin0 -> 4380 bytes
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/images/link.gifbin0 -> 882 bytes
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/images/local_attribute.gifbin0 -> 124 bytes
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/images/one_way_reference.gifbin0 -> 183 bytes
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/images/operation.gifbin0 -> 150 bytes
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/images/package_mode.gifbin0 -> 249 bytes
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/images/two_way_reference.gifbin0 -> 874 bytes
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/images/workflowConfig.gifbin0 -> 470 bytes
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/plugin.xml56
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/ODMEditorActivator.java27
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/ODMEditorLauncher.java37
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/OpenODMEditor.java47
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/action/ODMExportAction.java45
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/action/ODMImportAction.java45
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/ChangeBoundsCommand.java61
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/ChangeNameCommand.java47
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/CreateAttributeCommand.java47
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/CreateBendpointCommand.java38
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/CreateConnectionCommand.java85
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/CreateNodeCommand.java63
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/CreateRelationCommand.java47
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/DeleteBendpointCommand.java49
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/DeleteCommand.java225
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/MoveBendpointCommand.java48
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/ReconnectConnectionCommand.java177
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/core/ODMEditor.java264
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/core/ODMEditorActionBarContributor.java77
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/core/ODMEditorContextMenuProvider.java48
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/core/ODMEditorInput.java75
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/core/ODMOutlinePage.java170
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/core/ODMPaletteDropListener.java29
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/core/ODMPaletteFactory.java202
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/figure/ArtifactTypeFigure.java67
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/figure/CompartmentFigure.java58
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/figure/DataTypeFigure.java56
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/figure/SelectableLabel.java91
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/input/IOseeDataTypeHandler.java24
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/input/OseeDataTypeConverter.java89
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/input/OseeDataTypeDatastore.java135
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/input/OseeDataTypeFactory.java111
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/ArtifactDataType.java245
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/AttributeDataType.java179
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/ConnectionModel.java131
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/DataType.java95
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/DataTypeCache.java51
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/DataTypeSource.java74
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/IModelListener.java19
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/InheritanceLinkModel.java25
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/Model.java54
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/NodeModel.java122
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/ODMDiagram.java71
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/RelationDataType.java127
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/RelationLinkModel.java53
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/TypeManager.java95
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/helper/ArtifactTypeContentProvider.java93
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/helper/ArtifactTypeLabelProvider.java70
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/helper/ContainerModel.java62
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/helper/PackageModel.java44
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/ArtifactDataTypeXml.java79
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/AttributeDataTypeXml.java90
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/BaseXmlDataType.java125
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/IDataTypeCollector.java21
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/ImportDataTypeXml.java36
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/ODMXmlFactory.java42
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/ODMXmlReader.java64
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/ODMXmlWriter.java118
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/RelationDataTypeXml.java64
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/operation/ODMLoadGraphRunnable.java78
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/operation/ODMToXmlOperation.java114
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/operation/XmlToODMOperation.java36
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/outline/OutlineTreePartFactory.java44
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/ArtifactEditPart.java191
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/AttributeEditPart.java50
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/BaseEditPart.java183
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/ComponentEditPart.java70
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/ConnectionEditPart.java135
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/ContainerEditPart.java57
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/DataTypeEditPart.java92
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/DiagramEditPart.java101
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/InheritanceEditPart.java38
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/LabelDirectEditManager.java149
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/NodeModelEditPart.java118
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/ODMEditPartFactory.java66
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/RelationEditPart.java50
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/RelationLinkEditPart.java218
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/StringEditPart.java35
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/policy/ConnectionModelEndpointEditPolicy.java61
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/policy/DiagramLayoutEditPolicy.java179
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/policy/LabelSelectionEditPolicy.java68
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/ArtifactPropertySource.java74
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/AttributeBaseClassPropertyDescriptor.java61
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/AttributePropertySource.java215
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/AttributeProviderPropertyDescriptor.java58
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/ConnectionPropertySource.java88
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/DataTypeElementPropertySource.java78
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/EnumPropertySource.java89
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/EnumeratedAttributeValuesPropertyDescriptor.java61
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/NodePropertySource.java91
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/PropertySourceFactory.java62
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/RelationPropertySource.java106
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/utility/Base64Converter.java193
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/utility/ImageUtility.java95
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/utility/ODMConstants.java32
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/utility/ODMImage.java59
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/FileOrFolderSelectPanel.java198
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/FileOrFolderTreeSelecPanel.java304
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/ODMExportOutputPage.java230
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/ODMExportWizard.java113
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/ODMImportPage.java164
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/ODMImportWizard.java61
-rw-r--r--plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/ODMSelectPage.java300
130 files changed, 9896 insertions, 0 deletions
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/.classpath b/plugins/org.eclipse.osee.framework.ui.data.model.editor/.classpath
new file mode 100644
index 00000000000..8a8f1668cdc
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/.classpath
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
+ <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/.project b/plugins/org.eclipse.osee.framework.ui.data.model.editor/.project
new file mode 100644
index 00000000000..89888bebdac
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/.project
@@ -0,0 +1,28 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>org.eclipse.osee.framework.ui.data.model.editor</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.jdt.core.javabuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ManifestBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.SchemaBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.eclipse.pde.PluginNature</nature>
+ <nature>org.eclipse.jdt.core.javanature</nature>
+ </natures>
+</projectDescription>
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/.settings/org.eclipse.gmf.bridge.ui.dashboard.prefs b/plugins/org.eclipse.osee.framework.ui.data.model.editor/.settings/org.eclipse.gmf.bridge.ui.dashboard.prefs
new file mode 100644
index 00000000000..80c0f9a6103
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/.settings/org.eclipse.gmf.bridge.ui.dashboard.prefs
@@ -0,0 +1,7 @@
+#Wed Aug 26 21:36:29 MST 2009
+eclipse.preferences.version=1
+gmf_dashboard/domainGenerationModel=platform\:/resource/org.eclipse.osee.framework.types/src-gen/org/eclipse/osee/framework/OseeTypes.genmodel
+gmf_dashboard/generationModel=platform\:/resource/org.eclipse.osee.framework.types/src-gen/org/eclipse/osee/framework/OseeTypes.gmfgen
+gmf_dashboard/graphicalDefinitionModel=platform\:/resource/org.eclipse.osee.framework.types/src-gen/org/eclipse/osee/framework/OseeTypes.gmfgraph
+gmf_dashboard/mappingModel=platform\:/resource/org.eclipse.osee.framework.types/src-gen/org/eclipse/osee/framework/OseeTypes.gmfmap
+gmf_dashboard/toolingDefinitionModel=platform\:/resource/org.eclipse.osee.framework.types/src-gen/org/eclipse/osee/framework/OseeTypes.gmftool
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/META-INF/MANIFEST.MF b/plugins/org.eclipse.osee.framework.ui.data.model.editor/META-INF/MANIFEST.MF
new file mode 100644
index 00000000000..09a2dbb149a
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/META-INF/MANIFEST.MF
@@ -0,0 +1,40 @@
+Manifest-Version: 1.0
+Bundle-ManifestVersion: 2
+Bundle-Name: Osee Data Model Editor Plug-in
+Bundle-SymbolicName: org.eclipse.osee.framework.ui.data.model.editor;singleton:=true
+Bundle-Version: 0.9.2.qualifier
+Bundle-Activator: org.eclipse.osee.framework.ui.data.model.editor.ODMEditorActivator
+Bundle-Vendor: Eclipse.org
+Require-Bundle: org.eclipse.ui,
+ org.eclipse.core.runtime,
+ org.eclipse.core.resources,
+ org.eclipse.gef,
+ org.eclipse.ui.views,
+ org.eclipse.ui.ide,
+ org.eclipse.ui.forms,
+ org.eclipse.osee.framework.ui.skynet,
+ org.eclipse.help,
+ org.eclipse.core.filesystem
+Bundle-RequiredExecutionEnvironment: JavaSE-1.6
+Bundle-ActivationPolicy: lazy
+Import-Package: org.eclipse.osee.framework.core.client,
+ org.eclipse.osee.framework.core.data,
+ org.eclipse.osee.framework.core.exception,
+ org.eclipse.osee.framework.core.model,
+ org.eclipse.osee.framework.database.core,
+ org.eclipse.osee.framework.jdk.core.type,
+ org.eclipse.osee.framework.jdk.core.util,
+ org.eclipse.osee.framework.jdk.core.util.io.xml,
+ org.eclipse.osee.framework.logging,
+ org.eclipse.osee.framework.plugin.core,
+ org.eclipse.osee.framework.plugin.core.util,
+ org.eclipse.osee.framework.skynet.core,
+ org.eclipse.osee.framework.skynet.core.artifact,
+ org.eclipse.osee.framework.skynet.core.attribute,
+ org.eclipse.osee.framework.skynet.core.importing,
+ org.eclipse.osee.framework.skynet.core.relation,
+ org.eclipse.osee.framework.skynet.core.types,
+ org.eclipse.osee.framework.ui.plugin,
+ org.eclipse.osee.framework.ui.plugin.util,
+ org.eclipse.osee.framework.ui.plugin.views.property,
+ org.eclipse.osee.framework.ui.swt
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/build.properties b/plugins/org.eclipse.osee.framework.ui.data.model.editor/build.properties
new file mode 100644
index 00000000000..d24f89bcf2b
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/build.properties
@@ -0,0 +1,7 @@
+source.. = src/
+output.. = bin/
+bin.includes = META-INF/,\
+ .,\
+ plugin.xml,\
+ help/,\
+ images/
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/help/contexts.xml b/plugins/org.eclipse.osee.framework.ui.data.model.editor/help/contexts.xml
new file mode 100644
index 00000000000..a8cbb21efc9
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/help/contexts.xml
@@ -0,0 +1,8 @@
+<contexts>
+<!--
+ <context id="oseeDataModelEditor" title="OSEE Data Model Editor">
+ <description>Create and modify OSEE Data Types</description>
+ <topic href="help/oseeDataModelEditor.html" label="OSEE Data Model Editor"/>
+ </context>
+-->
+</contexts>
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/help/images/ngrelc.png b/plugins/org.eclipse.osee.framework.ui.data.model.editor/help/images/ngrelc.png
new file mode 100644
index 00000000000..161e3aa313b
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/help/images/ngrelc.png
Binary files differ
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/help/images/ngrelr.png b/plugins/org.eclipse.osee.framework.ui.data.model.editor/help/images/ngrelr.png
new file mode 100644
index 00000000000..4726f8c43aa
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/help/images/ngrelr.png
Binary files differ
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/help/oseeDataModelEditor.html b/plugins/org.eclipse.osee.framework.ui.data.model.editor/help/oseeDataModelEditor.html
new file mode 100644
index 00000000000..4420b0802d1
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/help/oseeDataModelEditor.html
@@ -0,0 +1,36 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<meta http-equiv="Content-Style-Type" content="text/css">
+<link rel="STYLESHEET" href="../book.css" charset="ISO-8859-1" type="text/css">
+<title>Quick Search View</title>
+<script language="JavaScript" src="PLUGINS_ROOT/org.eclipse.help/livehelp.js"> </script>
+
+<link rel="stylesheet" href="../content/PLUGINS_ROOT/org.eclipse.help.webapp/advanced/breadcrumbs.css" charset="ISO-8859-1" type="text/css"></link>
+<script type="text/javascript" src="../content/PLUGINS_ROOT/org.eclipse.help/livehelp.js"> </script>
+
+<link rel="stylesheet" href="../content/PLUGINS_ROOT/PRODUCT_PLUGIN/narrow_book.css" type="text/css"></link>
+<link rel="stylesheet" href="../content/PLUGINS_ROOT/PRODUCT_PLUGIN/win32_narrow_book.css" type="text/css"></link>
+<script type="text/javascript">
+<!--
+if (parent.ContentToolbarFrame && parent.ContentToolbarFrame.setButtonState) parent.ContentToolbarFrame.setButtonState("toggle_highlight","hidden");
+-->
+</script>
+</head>
+<body>
+
+ <h1>OSEE Data Model Editor</h1>
+ <p>The test run view is used for viewing test run results. It can view a summary of output files that exist on a file system and it will upload those output files to the OSEE data store. It can also be used to view previous test runs that have been uploaded to the OSEE data store.
+ </p>
+
+ <li>Select <a class="command-link" href='javascript:executeCommand("org.eclipse.ui.views.showView(org.eclipse.ui.views.showView.viewId=org.eclipse.osee.framework.ui.skynet.QuickSearchView)")'>
+ <img src="artifact_search.gif" alt="search icon" border="0" />
+ <b>Window &gt; Show View &gt; Other... &gt; OSEE &gt; Quick Search</b></a>, to open the view.
+ </li>
+
+ <p><img border="0" src="images/ngrelr.png" alt="Related reference" /><br>
+ &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<a href="link.html">Link1</a><br/>
+ </p>
+</body>
+</html> \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/help/toc.xml b/plugins/org.eclipse.osee.framework.ui.data.model.editor/help/toc.xml
new file mode 100644
index 00000000000..3d52291df87
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/help/toc.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?NLS TYPE="org.eclipse.help.toc"?>
+
+<toc link_to="../org.eclipse.osee.ote.core/help/toc.xml#tools" label="OSEE Data Model Editor">
+ <topic href="help/oseeDataModelEditor.html" label="OSEE Data Model Editor">
+ </topic>
+
+
+</toc>
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/access_restriction_attrib.gif b/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/access_restriction_attrib.gif
new file mode 100644
index 00000000000..c1f9af87e32
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/access_restriction_attrib.gif
Binary files differ
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/access_restriction_relat.gif b/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/access_restriction_relat.gif
new file mode 100644
index 00000000000..c6545d547c4
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/access_restriction_relat.gif
Binary files differ
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/arrows.gif b/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/arrows.gif
new file mode 100644
index 00000000000..e1fd67f06ee
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/arrows.gif
Binary files differ
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/datastore.gif b/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/datastore.gif
new file mode 100644
index 00000000000..0470e1588d9
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/datastore.gif
Binary files differ
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/extractsupertype_wiz.png b/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/extractsupertype_wiz.png
new file mode 100644
index 00000000000..931797368c1
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/extractsupertype_wiz.png
Binary files differ
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/file.gif b/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/file.gif
new file mode 100644
index 00000000000..7ccc6a70317
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/file.gif
Binary files differ
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/geometry.gif b/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/geometry.gif
new file mode 100644
index 00000000000..4cc4d32ba40
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/geometry.gif
Binary files differ
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/geometry_disabled.gif b/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/geometry_disabled.gif
new file mode 100644
index 00000000000..509af72b7ec
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/geometry_disabled.gif
Binary files differ
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/hierarchy_co.gif b/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/hierarchy_co.gif
new file mode 100644
index 00000000000..45b6b132268
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/hierarchy_co.gif
Binary files differ
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/importsupertype_wiz.png b/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/importsupertype_wiz.png
new file mode 100644
index 00000000000..4aa509f2fe9
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/importsupertype_wiz.png
Binary files differ
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/link.gif b/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/link.gif
new file mode 100644
index 00000000000..186a12726a5
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/link.gif
Binary files differ
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/local_attribute.gif b/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/local_attribute.gif
new file mode 100644
index 00000000000..d4cb4254d92
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/local_attribute.gif
Binary files differ
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/one_way_reference.gif b/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/one_way_reference.gif
new file mode 100644
index 00000000000..88cdf2ad850
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/one_way_reference.gif
Binary files differ
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/operation.gif b/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/operation.gif
new file mode 100644
index 00000000000..5818a308849
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/operation.gif
Binary files differ
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/package_mode.gif b/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/package_mode.gif
new file mode 100644
index 00000000000..24fce6cb4bb
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/package_mode.gif
Binary files differ
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/two_way_reference.gif b/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/two_way_reference.gif
new file mode 100644
index 00000000000..fad54826195
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/two_way_reference.gif
Binary files differ
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/workflowConfig.gif b/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/workflowConfig.gif
new file mode 100644
index 00000000000..8a945332071
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/images/workflowConfig.gif
Binary files differ
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/plugin.xml b/plugins/org.eclipse.osee.framework.ui.data.model.editor/plugin.xml
new file mode 100644
index 00000000000..e4203257d78
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/plugin.xml
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.2"?>
+<plugin>
+ <extension
+ point="org.eclipse.ui.editors">
+ <editor
+ class="org.eclipse.osee.framework.ui.data.model.editor.core.ODMEditor"
+ contributorClass="org.eclipse.osee.framework.ui.data.model.editor.core.ODMEditorActionBarContributor"
+ extensions="xml"
+ icon="images/workflowConfig.gif"
+ id="org.eclipse.osee.framework.ui.data.model.editor.ODMEditor"
+ name="OSEE Data Model Editor">
+ </editor>
+ </extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ defaultHandler="org.eclipse.osee.framework.ui.data.model.editor.OpenODMEditor"
+ description="Opens the Osee Data Model Editor"
+ id="org.eclipse.osee.framework.ui.data.model.editor.command.ODMOpen"
+ name="Open OSEE Data Model Editor">
+ </command>
+ </extension>
+ <extension
+ point="org.eclipse.ui.menus">
+ <menuContribution
+ locationURI="menu:org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchView">
+ <command
+ commandId="org.eclipse.osee.framework.ui.data.model.editor.command.ODMOpen"
+ icon="images/workflowConfig.gif"
+ style="push"
+ tooltip="Opens the Osee Data Model Editor">
+ </command>
+ </menuContribution>
+ <menuContribution
+ locationURI="popup:org.eclipse.osee.framework.ui.skynet.widgets.xBranch.BranchView">
+ <command
+ commandId="org.eclipse.osee.framework.ui.data.model.editor.command.ODMOpen"
+ style="push">
+ </command>
+ </menuContribution>
+ </extension>
+ <extension
+ point="org.eclipse.help.toc">
+ <toc
+ file="help/toc.xml"
+ primary="false">
+ </toc>
+ </extension>
+ <extension
+ point="org.eclipse.help.contexts">
+ <contexts
+ file="help/contexts.xml">
+ </contexts>
+ </extension>
+</plugin>
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/ODMEditorActivator.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/ODMEditorActivator.java
new file mode 100644
index 00000000000..f411fb0734a
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/ODMEditorActivator.java
@@ -0,0 +1,27 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor;
+
+import org.osgi.framework.BundleActivator;
+import org.osgi.framework.BundleContext;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ODMEditorActivator implements BundleActivator {
+ public static final String PLUGIN_ID = "org.eclipse.osee.framework.ui.data.model.editor";
+
+ public void start(BundleContext context) throws Exception {
+ }
+
+ public void stop(BundleContext context) throws Exception {
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/ODMEditorLauncher.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/ODMEditorLauncher.java
new file mode 100644
index 00000000000..c1b13b1f3bd
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/ODMEditorLauncher.java
@@ -0,0 +1,37 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor;
+
+import java.util.logging.Level;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.data.model.editor.core.ODMEditor;
+import org.eclipse.osee.framework.ui.data.model.editor.core.ODMEditorInput;
+import org.eclipse.ui.IEditorLauncher;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ODMEditorLauncher implements IEditorLauncher {
+
+ @Override
+ public void open(IPath file) {
+ try {
+ IWorkbenchPage workbenchPage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
+
+ workbenchPage.openEditor(new ODMEditorInput(), ODMEditor.EDITOR_ID);
+ } catch (Exception ex) {
+ OseeLog.log(ODMEditorActivator.class, Level.WARNING, ex);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/OpenODMEditor.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/OpenODMEditor.java
new file mode 100644
index 00000000000..4e1c0efdad2
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/OpenODMEditor.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.osee.framework.ui.data.model.editor.core.ODMEditor;
+import org.eclipse.osee.framework.ui.data.model.editor.core.ODMEditorInput;
+import org.eclipse.osee.framework.ui.skynet.commandHandlers.AbstractSelectionChangedHandler;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class OpenODMEditor extends AbstractSelectionChangedHandler {
+
+ public OpenODMEditor() {
+ super();
+ }
+
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IEditorPart editorPart = null;
+ try {
+ editorPart =
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().openEditor(new ODMEditorInput(),
+ ODMEditor.EDITOR_ID);
+ } catch (Exception ex) {
+ throw new ExecutionException("Error opening Branch Editor", ex);
+ }
+ return editorPart;
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return true;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/action/ODMExportAction.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/action/ODMExportAction.java
new file mode 100644
index 00000000000..0228969df0d
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/action/ODMExportAction.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.action;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.osee.framework.ui.data.model.editor.core.ODMEditor;
+import org.eclipse.osee.framework.ui.data.model.editor.wizard.ODMExportWizard;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.ActionFactory;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ODMExportAction extends Action {
+
+ private final ODMEditor editor;
+
+ public ODMExportAction(ODMEditor editor) {
+ super("Export");
+ this.editor = editor;
+ }
+
+ @Override
+ public String getId() {
+ return ActionFactory.EXPORT.getId();
+ }
+
+ @Override
+ public void run() {
+ super.run();
+ ODMExportWizard wizard = new ODMExportWizard(editor.getEditorInput().getDataTypeCache());
+ WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard);
+ dialog.create();
+ dialog.open();
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/action/ODMImportAction.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/action/ODMImportAction.java
new file mode 100644
index 00000000000..43215ff1d43
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/action/ODMImportAction.java
@@ -0,0 +1,45 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.action;
+
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.osee.framework.ui.data.model.editor.core.ODMEditor;
+import org.eclipse.osee.framework.ui.data.model.editor.wizard.ODMImportWizard;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.ActionFactory;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ODMImportAction extends Action {
+
+ private final ODMEditor editor;
+
+ public ODMImportAction(ODMEditor editor) {
+ super("Import");
+ this.editor = editor;
+ }
+
+ @Override
+ public String getId() {
+ return ActionFactory.IMPORT.getId();
+ }
+
+ @Override
+ public void run() {
+ super.run();
+ ODMImportWizard wizard = new ODMImportWizard(editor);
+ WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard);
+ dialog.create();
+ dialog.open();
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/ChangeBoundsCommand.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/ChangeBoundsCommand.java
new file mode 100644
index 00000000000..be697e9f5f0
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/ChangeBoundsCommand.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.command;
+
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.osee.framework.ui.data.model.editor.model.NodeModel;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ChangeBoundsCommand extends Command {
+
+ private NodeModel node;
+ private Point newLocation, oldLocation;
+ private int newWidth, oldWidth;
+
+ public ChangeBoundsCommand(NodeModel node, Point newLocation, int newWidth) {
+ super("Change Bounds");
+ setNode(node);
+ setNewLocation(newLocation);
+ this.newWidth = newWidth;
+ }
+
+ public boolean canExecute() {
+ return node != null && newLocation != null && (newWidth == -1 || newWidth > 0);
+ }
+
+ public void execute() {
+ oldLocation = node.getLocation();
+ oldWidth = node.getWidth();
+ redo();
+ }
+
+ public void redo() {
+ node.setLocation(newLocation);
+ node.setWidth(newWidth);
+ }
+
+ public void setNode(NodeModel node) {
+ this.node = node;
+ }
+
+ public void setNewLocation(Point loc) {
+ newLocation = loc;
+ }
+
+ public void undo() {
+ node.setWidth(oldWidth);
+ node.setLocation(oldLocation);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/ChangeNameCommand.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/ChangeNameCommand.java
new file mode 100644
index 00000000000..706d94ae1af
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/ChangeNameCommand.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.command;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.osee.framework.ui.data.model.editor.model.DataType;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ChangeNameCommand extends Command {
+
+ private DataType element;
+ private String newName, oldName;
+
+ public ChangeNameCommand(DataType dataType, String newName) {
+ super("Change Name");
+ element = dataType;
+ oldName = dataType.getName();
+ this.newName = newName.trim();
+ }
+
+ public boolean canExecute() {
+ return element != null;
+ }
+
+ public void execute() {
+ redo();
+ }
+
+ public void redo() {
+ element.setName(newName);
+ }
+
+ public void undo() {
+ element.setName(oldName);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/CreateAttributeCommand.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/CreateAttributeCommand.java
new file mode 100644
index 00000000000..be0a2ceda0a
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/CreateAttributeCommand.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.command;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ArtifactDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.AttributeDataType;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class CreateAttributeCommand extends Command {
+
+ private AttributeDataType attribute;
+ private ArtifactDataType parent;
+
+ public CreateAttributeCommand(AttributeDataType attribute, ArtifactDataType parent) {
+ super("Create Attribute");
+ this.attribute = attribute;
+ this.parent = parent;
+ }
+
+ public boolean canExecute() {
+ return attribute != null && parent != null;
+ }
+
+ public void execute() {
+ redo();
+ }
+
+ public void redo() {
+ parent.add(attribute);
+ }
+
+ public void undo() {
+ parent.remove(attribute);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/CreateBendpointCommand.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/CreateBendpointCommand.java
new file mode 100644
index 00000000000..2f3f776ec05
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/CreateBendpointCommand.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.command;
+
+import org.eclipse.draw2d.AbsoluteBendpoint;
+import org.eclipse.draw2d.Bendpoint;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ConnectionModel;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class CreateBendpointCommand extends Command {
+
+ private ConnectionModel link;
+ private Bendpoint point;
+ private int index = -1;
+
+ public CreateBendpointCommand(ConnectionModel link, Point location, int index) {
+ super("Create Bendpoint");
+ this.link = link;
+ point = new AbsoluteBendpoint(location);
+ }
+
+ public void undo() {
+ link.getBendpoints().remove(index);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/CreateConnectionCommand.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/CreateConnectionCommand.java
new file mode 100644
index 00000000000..1bb93d944f5
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/CreateConnectionCommand.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.command;
+
+import java.util.logging.Level;
+import org.eclipse.draw2d.AbsoluteBendpoint;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.data.model.editor.core.ODMEditor;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ArtifactDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ConnectionModel;
+import org.eclipse.osee.framework.ui.data.model.editor.model.InheritanceLinkModel;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class CreateConnectionCommand extends Command {
+
+ private ConnectionModel<ArtifactDataType> connectionModel;
+ private ArtifactDataType source;
+ private ArtifactDataType target;
+ private ArtifactDataType oldAncestor;
+
+ public CreateConnectionCommand(ConnectionModel<ArtifactDataType> connectionModel, ArtifactDataType source) {
+ super("Create connection");
+ this.connectionModel = connectionModel;
+ this.source = source;
+ this.oldAncestor = null;
+ }
+
+ public boolean canExecute() {
+ boolean result = source != null && target != null && connectionModel != null;
+ result = result && !source.getSuperTypes().contains(target);
+ return result;
+ }
+
+ public void execute() {
+ redo();
+ }
+
+ public void setTarget(ArtifactDataType target) {
+ this.target = target;
+ }
+
+ public void redo() {
+ try {
+ if (connectionModel instanceof InheritanceLinkModel) {
+
+ }
+ oldAncestor = source.getSuperType();
+ source.setSuperType(target);
+ if (source == target) {
+ connectionModel.getBendpoints().add(new AbsoluteBendpoint(source.getLocation().getTranslated(-10, 10)));
+ connectionModel.getBendpoints().add(new AbsoluteBendpoint(source.getLocation().getTranslated(-10, -10)));
+ connectionModel.getBendpoints().add(new AbsoluteBendpoint(source.getLocation().getTranslated(10, -10)));
+ }
+ connectionModel.setSource(source);
+ connectionModel.setTarget(target);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(ODMEditor.class, Level.SEVERE, ex);
+ }
+ }
+
+ public void undo() {
+ try {
+ connectionModel.setSource(null);
+ connectionModel.setTarget(null);
+ if (source == target) {
+ connectionModel.getBendpoints().clear();
+ }
+ source.setSuperType(oldAncestor);
+ } catch (OseeCoreException ex) {
+ OseeLog.log(ODMEditor.class, Level.SEVERE, ex);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/CreateNodeCommand.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/CreateNodeCommand.java
new file mode 100644
index 00000000000..1397e2a1cf5
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/CreateNodeCommand.java
@@ -0,0 +1,63 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.command;
+
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ArtifactDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.DataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ODMDiagram;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class CreateNodeCommand extends Command {
+
+ private int width = -1;
+ private Point location;
+ private DataType node;
+ private ODMDiagram diagram;
+
+ public CreateNodeCommand(DataType newObject, ODMDiagram diagram, Point location) {
+ super("Create Node");
+ this.node = newObject;
+ this.diagram = diagram;
+ this.location = location;
+ }
+
+ public CreateNodeCommand(DataType newObject, ODMDiagram parent, Point location, int width) {
+ this(newObject, parent, location);
+ this.width = width;
+ }
+
+ public boolean canExecute() {
+ return node != null && diagram != null && location != null && (width == -1 || width > 0);
+ }
+
+ public void execute() {
+ redo();
+ }
+
+ public void redo() {
+ if (node instanceof ArtifactDataType) {
+ node.setLocation(location);
+ node.setWidth(width);
+ diagram.add(node);
+ }
+ // if (node instanceof StickyNote) ((StickyNote) node).setText("Comment");
+ }
+
+ public void undo() {
+ if (node instanceof ArtifactDataType) {
+ diagram.remove(node);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/CreateRelationCommand.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/CreateRelationCommand.java
new file mode 100644
index 00000000000..f9122f3be25
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/CreateRelationCommand.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.command;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ArtifactDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.RelationDataType;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class CreateRelationCommand extends Command {
+
+ protected RelationDataType relation;
+ protected ArtifactDataType parent;
+
+ public CreateRelationCommand(RelationDataType relation, ArtifactDataType parent) {
+ super("Create Relation");
+ this.relation = relation;
+ this.parent = parent;
+ }
+
+ public boolean canExecute() {
+ return relation != null && parent != null;
+ }
+
+ public void execute() {
+ redo();
+ }
+
+ public void redo() {
+ parent.add(relation);
+ }
+
+ public void undo() {
+ parent.remove(relation);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/DeleteBendpointCommand.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/DeleteBendpointCommand.java
new file mode 100644
index 00000000000..f897295a0d4
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/DeleteBendpointCommand.java
@@ -0,0 +1,49 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.command;
+
+import org.eclipse.draw2d.Bendpoint;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ConnectionModel;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class DeleteBendpointCommand extends Command {
+
+ private ConnectionModel link;
+ private Bendpoint bendpoint;
+ private int index;
+
+ public DeleteBendpointCommand(ConnectionModel link, int index) {
+ super("Delete Bendpoint");
+ this.link = link;
+ this.index = index;
+ bendpoint = (Bendpoint) link.getBendpoints().get(index);
+ }
+
+ public boolean canExecute() {
+ return index >= 0 && bendpoint != null && link != null;
+ }
+
+ public void execute() {
+ redo();
+ }
+
+ public void redo() {
+ link.getBendpoints().remove(index);
+ }
+
+ public void undo() {
+ link.getBendpoints().add(index, bendpoint);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/DeleteCommand.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/DeleteCommand.java
new file mode 100644
index 00000000000..5191a5cbb34
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/DeleteCommand.java
@@ -0,0 +1,225 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.command;
+
+import java.util.logging.Level;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.data.model.editor.ODMEditorActivator;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ArtifactDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.AttributeDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ConnectionModel;
+import org.eclipse.osee.framework.ui.data.model.editor.model.InheritanceLinkModel;
+import org.eclipse.osee.framework.ui.data.model.editor.model.NodeModel;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ODMDiagram;
+import org.eclipse.osee.framework.ui.data.model.editor.model.RelationDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.RelationLinkModel;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class DeleteCommand extends Command {
+
+ public static final Object DELETE_FROM_ODM_DIAGRAM = new Object();
+ private Command commandDelegate;
+
+ public DeleteCommand() {
+ super("Delete");
+ }
+
+ public boolean canExecute() {
+ return commandDelegate != null && commandDelegate.canExecute();
+ }
+
+ public void execute() {
+ redo();
+ }
+
+ public Command setPartToBeDeleted(Object toDelete, Object parent, boolean isDeleteFromDiagram) {
+ if (toDelete instanceof AttributeDataType) {
+ commandDelegate = new DeleteAttributeCommand(toDelete, parent);
+ } else if (toDelete instanceof RelationDataType) {
+ commandDelegate = new DeleteRelationCommand(toDelete, parent);
+ } else if (isDeleteFromDiagram && toDelete instanceof ArtifactDataType) {
+ commandDelegate = new DeleteArtifactCommand(toDelete, parent);
+ } else if (isDeleteFromDiagram && toDelete instanceof ConnectionModel) {
+ commandDelegate = new DeleteConnectionCommand(toDelete, parent);
+ } else {
+ commandDelegate = null;
+ }
+ return this;
+ }
+
+ public void redo() {
+ commandDelegate.execute();
+ }
+
+ public void undo() {
+ commandDelegate.undo();
+ }
+
+ private static class DeleteArtifactCommand extends Command {
+ private ArtifactDataType artifact;
+ private ODMDiagram container;
+
+ public DeleteArtifactCommand(Object model, Object parent) {
+ artifact = (ArtifactDataType) model;
+ container = (ODMDiagram) parent;
+ }
+
+ public void execute() {
+ redo();
+ }
+
+ public void redo() {
+ if (container != null) {
+ container.remove(artifact);
+ }
+ }
+
+ public void undo() {
+ if (container != null) {
+ container.add(artifact);
+ }
+ }
+ }
+
+ private static class DeleteAttributeCommand extends Command {
+ private AttributeDataType attribute;
+ private ArtifactDataType container;
+
+ public DeleteAttributeCommand(Object model, Object parent) {
+ attribute = (AttributeDataType) model;
+ container = (ArtifactDataType) parent;
+ }
+
+ public void execute() {
+ redo();
+ }
+
+ public void redo() {
+ if (container != null) {
+ container.remove(attribute);
+ }
+ }
+
+ public void undo() {
+ if (container != null) {
+ container.add(attribute);
+ }
+ }
+ }
+
+ private static class DeleteRelationCommand extends Command {
+ private RelationDataType relation;
+ private ArtifactDataType container;
+
+ public DeleteRelationCommand(Object model, Object parent) {
+ relation = (RelationDataType) model;
+ container = (ArtifactDataType) parent;
+ }
+
+ public void execute() {
+ redo();
+ }
+
+ public void redo() {
+ if (container != null) {
+ container.remove(relation);
+ }
+ }
+
+ public void undo() {
+ if (container != null) {
+ container.add(relation);
+ }
+ }
+ }
+
+ private static class DeleteConnectionCommand extends Command {
+
+ private ConnectionModel link;
+ private NodeModel src, target;
+ private int srcIndex, targetIndex, superIndex, parentIndex;
+ private ArtifactDataType superClass, subClass;
+
+ public DeleteConnectionCommand(Object link, Object parent) {
+ super("Delete Connection");
+ this.link = (ConnectionModel) link;
+ src = this.link.getSource();
+ target = this.link.getTarget();
+ }
+
+ public boolean canExecute() {
+ return link != null && src != null && target != null;
+ }
+
+ public void execute() {
+ redo();
+ }
+
+ public void redo() {
+ boolean removeConnection = true;
+
+ if (link instanceof InheritanceLinkModel) {
+ superClass = (ArtifactDataType) src;
+ subClass = (ArtifactDataType) target;
+
+ try {
+ subClass.setSuperType(null);
+ } catch (OseeStateException ex) {
+ OseeLog.log(ODMEditorActivator.class, Level.SEVERE, String.format(
+ "Unable to remove inheritance link between [%s] - [%s]", superClass, subClass), ex);
+ removeConnection = false;
+ }
+ }
+
+ if (removeConnection) {
+ srcIndex = src.getSourceConnections().indexOf(link);
+ targetIndex = target.getTargetConnections().indexOf(link);
+ if (srcIndex != -1 && targetIndex != -1) {
+ src.getSourceConnections().remove(srcIndex);
+ target.getTargetConnections().remove(targetIndex);
+ }
+ }
+ // if (isHardDelete && link instanceof RelationLinkModel) {
+ // reference = ((ReferenceView) link).getEReference();
+ // parent = reference.getEContainingClass();
+ // parentIndex = parent.getEStructuralFeatures().indexOf(reference);
+ // if (parentIndex != -1) parent.getEStructuralFeatures().remove(parentIndex);
+ // }
+ }
+
+ public void undo() {
+ boolean addConnection = true;
+ if (link instanceof InheritanceLinkModel) {
+ try {
+ subClass.setSuperType(superClass);
+ } catch (OseeStateException ex) {
+ OseeLog.log(ODMEditorActivator.class, Level.SEVERE, String.format(
+ "Unable to add inheritance link between [%s] - [%s]", superClass, subClass), ex);
+ addConnection = false;
+ }
+ }
+
+ if (addConnection && srcIndex != -1 && targetIndex != -1) {
+ src.getSourceConnections().add(srcIndex, link);
+ target.getTargetConnections().add(targetIndex, link);
+ }
+
+ if (link instanceof RelationLinkModel) {
+ // if (parentIndex != -1) parent.getEStructuralFeatures().add(parentIndex, reference);
+ }
+ }
+
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/MoveBendpointCommand.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/MoveBendpointCommand.java
new file mode 100644
index 00000000000..a7360925695
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/MoveBendpointCommand.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.command;
+
+import org.eclipse.draw2d.AbsoluteBendpoint;
+import org.eclipse.draw2d.Bendpoint;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ConnectionModel;
+
+/**
+ * @author Roberto E. Escobars
+ */
+public class MoveBendpointCommand extends Command {
+
+ private ConnectionModel connectionModel;
+ private int index;
+ private Bendpoint oldBendpoint, newBendpoint;
+
+ public MoveBendpointCommand(ConnectionModel connectionModel, Point location, int index) {
+ super("Move Bendpoint");
+ this.connectionModel = connectionModel;
+ this.index = index;
+ newBendpoint = new AbsoluteBendpoint(location);
+ oldBendpoint = (Bendpoint) connectionModel.getBendpoints().get(index);
+ }
+
+ public boolean canExecute() {
+ return connectionModel != null && index >= 0 && newBendpoint != null && oldBendpoint != null;
+ }
+
+ public void execute() {
+ connectionModel.getBendpoints().set(index, newBendpoint);
+ }
+
+ public void undo() {
+ connectionModel.getBendpoints().set(index, oldBendpoint);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/ReconnectConnectionCommand.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/ReconnectConnectionCommand.java
new file mode 100644
index 00000000000..1a7a723599c
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/command/ReconnectConnectionCommand.java
@@ -0,0 +1,177 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.command;
+
+import org.eclipse.gef.commands.Command;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ArtifactDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ConnectionModel;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ReconnectConnectionCommand extends Command {
+
+ private ConnectionModel<ArtifactDataType> connectionModel;
+ // private NodeModel newNode, oldNode;
+ // private int oldIndex, viewIndex;
+
+ private ArtifactDataType oldSource;
+ private ArtifactDataType oldTarget;
+ private ArtifactDataType newSource;
+ private ArtifactDataType newTarget;
+
+ public ReconnectConnectionCommand(ConnectionModel<ArtifactDataType> connectionModel) {
+ super("Reconnect connection");
+ this.connectionModel = connectionModel;
+ this.oldSource = connectionModel.getSource();
+ this.oldTarget = connectionModel.getTarget();
+ }
+
+ public void setNewSource(ArtifactDataType source) {
+ if (source == null) {
+ throw new IllegalArgumentException();
+ }
+ setLabel("move connection startpoint");
+ newSource = source;
+ newTarget = null;
+ }
+
+ public void setNewTarget(ArtifactDataType target) {
+ if (target == null) {
+ throw new IllegalArgumentException();
+ }
+ setLabel("move connection endpoint");
+ newSource = null;
+ newTarget = target;
+ }
+
+ public boolean canExecute() {
+ if (newSource != null) {
+ return checkSourceReconnection();
+ } else if (newTarget != null) {
+ return checkTargetReconnection();
+ }
+ return false;
+ }
+
+ private boolean checkSourceReconnection() {
+ if (newSource.equals(oldTarget)) {
+ return false;
+ }
+ // if (newSource != null) {
+ for (ConnectionModel<ArtifactDataType> connection : newSource.getTargetConnections()) {
+ // return false if a newSource -> oldTarget connection exists already
+ // and it is a different instance than the connection-field
+ if (connection.getTarget().equals(oldTarget) && !this.connectionModel.equals(connection)) {
+ return false;
+ }
+ }
+ // } else {
+ // return false;
+ // }
+ return true;
+ }
+
+ private boolean checkTargetReconnection() {
+ if (newTarget.equals(oldSource)) {
+ return false;
+ }
+ // return false, if the connection exists already
+ // if (newTarget != null) {
+ for (ConnectionModel<ArtifactDataType> connection : newTarget.getSourceConnections()) {
+ // return false if a oldSource -> newTarget connection exists already
+ // and it is a different instance that the connection-field
+ if (connection.getSource().equals(oldSource) && !this.connectionModel.equals(connection)) {
+ return false;
+ }
+ }
+ // } else {
+ // return false;
+ // }
+ return true;
+ }
+
+ public void execute() {
+ if (newSource != null) {
+ this.connectionModel.reconnect(newSource, oldTarget);
+ } else if (newTarget != null) {
+ this.connectionModel.reconnect(oldSource, newTarget);
+ } else {
+ throw new IllegalStateException("Should not happen");
+ }
+ }
+
+ public void undo() {
+ this.connectionModel.reconnect(oldSource, oldTarget);
+ }
+ // public void execute() {
+ // superClass = (ArtifactDataType) connectionModel.getTarget();
+ // oldClass = (ArtifactDataType) connectionModel.getSource();
+ //
+ // newClass = (ArtifactDataType) newNode;
+ //
+ // if (isSource) {
+ // ancestor = newClass.getAncestorType();
+ // newClass.setParent(superClass);
+ // } else {
+ // ancestor = oldClass.getAncestorType();
+ // oldClass.setParent(newClass);
+ // }
+ //
+ // if (isSource) {
+ // oldNode = connectionModel.getSource();
+ // viewIndex = oldNode.getOutgoingConnections().indexOf(connectionModel);
+ // connectionModel.setSource((ArtifactDataType) newNode);
+ // } else {
+ // oldNode = connectionModel.getTarget();
+ // viewIndex = oldNode.getIncomingConnections().indexOf(connectionModel);
+ // connectionModel.setTarget((ArtifactDataType) newNode);
+ // }
+ //
+ // // Reference
+ // // if (link instanceof ReferenceView) {
+ // // ref = ((ReferenceView) link).getEReference();
+ // // oldClass = (ArtifactDataType) ((NamedElementView) oldNode).getDataTypeElement();
+ // // newClass = (ArtifactDataType) ((NamedElementView) newNode).getDataTypeElement();
+ // // if (isSource) {
+ // // oldIndex = oldClass.getEStructuralFeatures().indexOf(ref);
+ // // oldClass.getEStructuralFeatures().remove(oldIndex);
+ // // newClass.getEStructuralFeatures().add(ref);
+ // // } else {
+ // // ref.setEType(newClass);
+ // // }
+ // // }
+ // }
+
+ // public void undo() {
+ // // if (link instanceof ReferenceView) {
+ // // if (isSource) {
+ // // newClass.getEStructuralFeatures().remove(ref);
+ // // oldClass.getEStructuralFeatures().add(oldIndex, ref);
+ // // } else
+ // // ref.setEType(oldClass);
+ // // }
+ // if (isSource) {
+ // newNode.getOutgoingConnections().remove(connectionModel);
+ // oldNode.getOutgoingConnections().add(viewIndex, connectionModel);
+ // } else {
+ // newNode.getIncomingConnections().remove(connectionModel);
+ // oldNode.getIncomingConnections().add(viewIndex, connectionModel);
+ // }
+ // oldNode = null;
+ //
+ // if (isSource) {
+ // newClass.setParent(ancestor);
+ // } else {
+ // oldClass.setParent(ancestor);
+ // }
+ // }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/core/ODMEditor.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/core/ODMEditor.java
new file mode 100644
index 00000000000..9127aed333f
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/core/ODMEditor.java
@@ -0,0 +1,264 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.core;
+
+import java.util.Arrays;
+import java.util.EventObject;
+import java.util.List;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.gef.ContextMenuProvider;
+import org.eclipse.gef.DefaultEditDomain;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gef.GraphicalViewer;
+import org.eclipse.gef.KeyHandler;
+import org.eclipse.gef.KeyStroke;
+import org.eclipse.gef.MouseWheelHandler;
+import org.eclipse.gef.MouseWheelZoomHandler;
+import org.eclipse.gef.RequestConstants;
+import org.eclipse.gef.RootEditPart;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.CompoundCommand;
+import org.eclipse.gef.dnd.TemplateTransferDragSourceListener;
+import org.eclipse.gef.editparts.ScalableFreeformRootEditPart;
+import org.eclipse.gef.editparts.ZoomManager;
+import org.eclipse.gef.palette.PaletteRoot;
+import org.eclipse.gef.requests.GroupRequest;
+import org.eclipse.gef.ui.actions.ActionRegistry;
+import org.eclipse.gef.ui.actions.GEFActionConstants;
+import org.eclipse.gef.ui.actions.ToggleSnapToGeometryAction;
+import org.eclipse.gef.ui.actions.ZoomInAction;
+import org.eclipse.gef.ui.actions.ZoomOutAction;
+import org.eclipse.gef.ui.palette.PaletteCustomizer;
+import org.eclipse.gef.ui.palette.PaletteViewer;
+import org.eclipse.gef.ui.palette.PaletteViewerProvider;
+import org.eclipse.gef.ui.parts.GraphicalEditorWithFlyoutPalette;
+import org.eclipse.gef.ui.parts.GraphicalViewerKeyHandler;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.util.TransferDropTargetListener;
+import org.eclipse.osee.framework.plugin.core.IActionable;
+import org.eclipse.osee.framework.plugin.core.util.Jobs;
+import org.eclipse.osee.framework.ui.data.model.editor.ODMEditorActivator;
+import org.eclipse.osee.framework.ui.data.model.editor.action.ODMExportAction;
+import org.eclipse.osee.framework.ui.data.model.editor.action.ODMImportAction;
+import org.eclipse.osee.framework.ui.data.model.editor.command.DeleteCommand;
+import org.eclipse.osee.framework.ui.data.model.editor.operation.ODMLoadGraphRunnable;
+import org.eclipse.osee.framework.ui.data.model.editor.part.ODMEditPartFactory;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IEditorPart;
+import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ODMEditor extends GraphicalEditorWithFlyoutPalette {
+
+ public static String EDITOR_ID = "org.eclipse.osee.framework.ui.data.model.editor.ODMEditor";
+
+ private ODMPaletteFactory editorPalette;
+ private ActionRegistry actionRegistry;
+ private ODMOutlinePage overviewOutlinePage;
+ private KeyHandler shareKeyHandler;
+
+ public ODMEditor() {
+ super();
+ setEditDomain(new DefaultEditDomain(this));
+ }
+
+ @Override
+ protected PaletteRoot getPaletteRoot() {
+ if (editorPalette == null) {
+ editorPalette = new ODMPaletteFactory(this);
+ }
+ return editorPalette.getPaletteRoot();
+ }
+
+ public void updatePalette() {
+ editorPalette.updatePaletteRoot();
+ }
+
+ @Override
+ public boolean isSaveAsAllowed() {
+ return false;
+ }
+
+ @Override
+ public boolean isDirty() {
+ return false;
+ }
+
+ @Override
+ public void doSave(IProgressMonitor monitor) {
+ }
+
+ @SuppressWarnings("unchecked")
+ @Override
+ public Object getAdapter(Class adapter) {
+ if (adapter == GraphicalViewer.class || adapter == EditPartViewer.class) {
+ return getGraphicalViewer();
+ } else if (adapter == ZoomManager.class) {
+ return ((ScalableFreeformRootEditPart) getGraphicalViewer().getRootEditPart()).getZoomManager();
+ } else if (adapter == IContentOutlinePage.class) {
+ return getOverviewOutlinePage();
+ } else if (adapter == IActionable.class) {
+ return new IActionable() {
+ @Override
+ public String getActionDescription() {
+ return "ODM Editor description here";
+ }
+ };
+ }
+ return super.getAdapter(adapter);
+ }
+
+ @Override
+ protected void configureGraphicalViewer() {
+ super.configureGraphicalViewer();
+
+ GraphicalViewer viewer = getGraphicalViewer();
+ viewer.setRootEditPart(new ScalableFreeformRootEditPart());
+ viewer.setEditPartFactory(new ODMEditPartFactory());
+
+ getSite().setSelectionProvider(viewer);
+
+ viewer.setContents("Loading graph... This can take several minutes");
+
+ ContextMenuProvider cmProvider = new ODMEditorContextMenuProvider(viewer, this);
+ viewer.setContextMenu(cmProvider);
+
+ IEditorInput input = getEditorInput();
+ if (input instanceof ODMEditorInput) {
+ ODMEditorInput editorInput = (ODMEditorInput) input;
+ showGraphFor(editorInput);
+ }
+
+ ZoomManager zoomManager = ((ScalableFreeformRootEditPart) viewer.getRootEditPart()).getZoomManager();
+ IAction zoomIn = new ZoomInAction(zoomManager);
+ IAction zoomOut = new ZoomOutAction(zoomManager);
+ getActionRegistry().registerAction(zoomIn);
+ getActionRegistry().registerAction(zoomOut);
+ getActionRegistry().registerAction(new ToggleSnapToGeometryAction(viewer));
+
+ viewer.setKeyHandler(getCommonKeyHandler());
+
+ // Scroll-wheel Zoom
+ viewer.setProperty(MouseWheelHandler.KeyGenerator.getKey(SWT.MOD1), MouseWheelZoomHandler.SINGLETON);
+
+ // keyboard
+ // IHandlerService service = (IHandlerService) getSite().getService(IHandlerService.class);
+ // service.activateHandler(zoomIn.getActionDefinitionId(), new ActionHandler(zoomIn));
+ // service.activateHandler(zoomOut.getActionDefinitionId(), new ActionHandler(zoomOut));
+ getSite().getKeyBindingService().registerAction(zoomIn);
+ getSite().getKeyBindingService().registerAction(zoomOut);
+ List<String> zoomContributions =
+ Arrays.asList(new String[] {ZoomManager.FIT_ALL, ZoomManager.FIT_HEIGHT, ZoomManager.FIT_WIDTH});
+ zoomManager.setZoomLevelContributions(zoomContributions);
+
+ // viewer.addDropTargetListener((TransferDropTargetListener) new DiagramDropTargetListener(viewer));
+ viewer.addDropTargetListener((TransferDropTargetListener) new ODMPaletteDropListener(viewer));
+ }
+
+ private KeyHandler getCommonKeyHandler() {
+ if (shareKeyHandler == null) {
+ shareKeyHandler = new GraphicalViewerKeyHandler(getViewer()) {
+ @SuppressWarnings("unchecked")
+ public boolean keyPressed(KeyEvent event) {
+ if (event.keyCode == SWT.DEL) {
+ List objects = getGraphicalViewer().getSelectedEditParts();
+ if (objects == null || objects.isEmpty()) {
+ return true;
+ }
+ GroupRequest deleteReq = new GroupRequest(RequestConstants.REQ_DELETE);
+ deleteReq.getExtendedData().put(DeleteCommand.DELETE_FROM_ODM_DIAGRAM, Boolean.TRUE);
+ CompoundCommand compoundCmd = new CompoundCommand("Delete");
+ for (int i = 0; i < objects.size(); i++) {
+ EditPart object = (EditPart) objects.get(i);
+ Command cmd = object.getCommand(deleteReq);
+ if (cmd != null) {
+ compoundCmd.add(cmd);
+ }
+ }
+ getCommandStack().execute(compoundCmd);
+ return true;
+ }
+ return super.keyPressed(event);
+ }
+ };
+ shareKeyHandler.put(KeyStroke.getPressed(SWT.F2, 0), getActionRegistry().getAction(
+ GEFActionConstants.DIRECT_EDIT));
+ }
+ return shareKeyHandler;
+ }
+
+ @Override
+ protected void initializeGraphicalViewer() {
+ }
+
+ @Override
+ public void commandStackChanged(EventObject event) {
+ firePropertyChange(IEditorPart.PROP_DIRTY);
+ super.commandStackChanged(event);
+ }
+
+ private ODMOutlinePage getOverviewOutlinePage() {
+ if (null == overviewOutlinePage && null != getGraphicalViewer()) {
+ RootEditPart rootEditPart = getGraphicalViewer().getRootEditPart();
+ if (rootEditPart instanceof ScalableFreeformRootEditPart) {
+ overviewOutlinePage = new ODMOutlinePage((ScalableFreeformRootEditPart) rootEditPart, getActionRegistry());
+ }
+ }
+ return overviewOutlinePage;
+ }
+
+ public ActionRegistry getActionRegistry() {
+ if (actionRegistry == null) {
+ actionRegistry = new ActionRegistry();
+ actionRegistry.registerAction(new ODMImportAction(this));
+ actionRegistry.registerAction(new ODMExportAction(this));
+ }
+ return actionRegistry;
+ }
+
+ public GraphicalViewer getViewer() {
+ return getGraphicalViewer();
+ }
+
+ public void showGraphFor(ODMEditorInput editorInput) {
+ setPartName(editorInput.getName() + " graph");
+ ODMLoadGraphRunnable runnable = new ODMLoadGraphRunnable(getGraphicalViewer(), this, editorInput);
+ Jobs.runInJob(runnable.getName(), runnable, ODMEditorActivator.class, ODMEditorActivator.PLUGIN_ID, true);
+ }
+
+ @Override
+ protected PaletteViewerProvider createPaletteViewerProvider() {
+ return new PaletteViewerProvider(getEditDomain()) {
+ protected void configurePaletteViewer(PaletteViewer viewer) {
+ super.configurePaletteViewer(viewer);
+ viewer.setCustomizer(new PaletteCustomizer() {
+ public void revertToSaved() {
+ }
+
+ public void save() {
+ }
+ });
+ viewer.addDragSourceListener(new TemplateTransferDragSourceListener(viewer));
+ }
+ };
+ }
+
+ @Override
+ public ODMEditorInput getEditorInput() {
+ return (ODMEditorInput) super.getEditorInput();
+ }
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/core/ODMEditorActionBarContributor.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/core/ODMEditorActionBarContributor.java
new file mode 100644
index 00000000000..afdda67435b
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/core/ODMEditorActionBarContributor.java
@@ -0,0 +1,77 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.core;
+
+import org.eclipse.gef.ui.actions.ActionBarContributor;
+import org.eclipse.gef.ui.actions.DeleteRetargetAction;
+import org.eclipse.gef.ui.actions.GEFActionConstants;
+import org.eclipse.gef.ui.actions.RedoRetargetAction;
+import org.eclipse.gef.ui.actions.UndoRetargetAction;
+import org.eclipse.gef.ui.actions.ZoomComboContributionItem;
+import org.eclipse.gef.ui.actions.ZoomInRetargetAction;
+import org.eclipse.gef.ui.actions.ZoomOutRetargetAction;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.Separator;
+import org.eclipse.osee.framework.ui.data.model.editor.utility.ODMImage;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.actions.RetargetAction;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ODMEditorActionBarContributor extends ActionBarContributor {
+
+ /**
+ * Create actions managed by this contributor.
+ *
+ * @see org.eclipse.gef.ui.actions.ActionBarContributor#buildActions()
+ */
+ @Override
+ protected void buildActions() {
+ addRetargetAction(new UndoRetargetAction());
+ addRetargetAction(new RedoRetargetAction());
+ addRetargetAction(new DeleteRetargetAction());
+ addRetargetAction(new ZoomInRetargetAction());
+ addRetargetAction(new ZoomOutRetargetAction());
+ RetargetAction action =
+ new RetargetAction(GEFActionConstants.TOGGLE_SNAP_TO_GEOMETRY, null, IAction.AS_CHECK_BOX);
+ action.setImageDescriptor(ImageManager.getImageDescriptor(ODMImage.SNAP_TO_GRID));
+ action.setDisabledImageDescriptor(ImageManager.getImageDescriptor(ODMImage.SNAP_TO_GRID_DISABLED));
+ action.setToolTipText("Enable Snap To Geometry");
+ addRetargetAction(action);
+ }
+
+ /**
+ * Add actions to the given toolbar.
+ *
+ * @see org.eclipse.ui.part.EditorActionBarContributor#contributeToToolBar(org.eclipse.jface.action.IToolBarManager)
+ */
+ @Override
+ public void contributeToToolBar(IToolBarManager toolBarManager) {
+ super.contributeToToolBar(toolBarManager);
+ toolBarManager.add(new Separator());
+ toolBarManager.add(new ZoomComboContributionItem(getPage()));
+ toolBarManager.add(getAction(ActionFactory.UNDO.getId()));
+ toolBarManager.add(getAction(ActionFactory.REDO.getId()));
+ toolBarManager.add(getAction(GEFActionConstants.TOGGLE_SNAP_TO_GEOMETRY));
+ // toolBarManager.add(getAction(ActionFactory.REFRESH.getId()));
+ toolBarManager.add(new Separator());
+ }
+
+ @Override
+ protected void declareGlobalActionKeys() {
+ addGlobalActionKey(ActionFactory.PRINT.getId());
+ addGlobalActionKey(ActionFactory.SELECT_ALL.getId());
+ addGlobalActionKey(ActionFactory.DELETE.getId());
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/core/ODMEditorContextMenuProvider.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/core/ODMEditorContextMenuProvider.java
new file mode 100644
index 00000000000..e9287e48413
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/core/ODMEditorContextMenuProvider.java
@@ -0,0 +1,48 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.core;
+
+import org.eclipse.gef.ContextMenuProvider;
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gef.ui.actions.GEFActionConstants;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.ui.actions.ActionFactory;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ODMEditorContextMenuProvider extends ContextMenuProvider {
+
+ private final ODMEditor editor;
+
+ public ODMEditorContextMenuProvider(EditPartViewer viewer, ODMEditor editor) {
+ super(viewer);
+ this.editor = editor;
+ }
+
+ @Override
+ public void buildContextMenu(IMenuManager menu) {
+ GEFActionConstants.addStandardActionGroups(menu);
+
+ // menu.appendToGroup(GEFActionConstants.GROUP_EDIT, getAction(EditAction.ID));
+ menu.appendToGroup(GEFActionConstants.GROUP_UNDO, getAction(ActionFactory.UNDO.getId()));
+ menu.appendToGroup(GEFActionConstants.GROUP_UNDO, getAction(ActionFactory.REDO.getId()));
+ menu.appendToGroup(GEFActionConstants.GROUP_EDIT, getAction(ActionFactory.DELETE.getId()));
+ menu.appendToGroup(GEFActionConstants.GROUP_PRINT, getAction(ActionFactory.PRINT.getId()));
+ menu.appendToGroup(GEFActionConstants.GROUP_EDIT, getAction(ActionFactory.IMPORT.getId()));
+ menu.appendToGroup(GEFActionConstants.GROUP_EDIT, getAction(ActionFactory.EXPORT.getId()));
+ }
+
+ private IAction getAction(String actionId) {
+ return editor.getActionRegistry().getAction(actionId);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/core/ODMEditorInput.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/core/ODMEditorInput.java
new file mode 100644
index 00000000000..60765faac67
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/core/ODMEditorInput.java
@@ -0,0 +1,75 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.core;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.osee.framework.ui.data.model.editor.model.DataTypeCache;
+import org.eclipse.ui.IEditorInput;
+import org.eclipse.ui.IPersistableElement;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ODMEditorInput implements IEditorInput {
+
+ private DataTypeCache dataTypeCache;
+ private IResource resource;
+
+ public ODMEditorInput() {
+ dataTypeCache = new DataTypeCache();
+ }
+
+ public ODMEditorInput(IResource resource) {
+ this.resource = resource;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof ODMEditorInput) {
+ ODMEditorInput otherEdInput = (ODMEditorInput) obj;
+ }
+ return false;
+ }
+
+ public boolean exists() {
+ return true;
+ }
+
+ public ImageDescriptor getImageDescriptor() {
+ return null;
+ }
+
+ public String getName() {
+ return "No Data Types Provided";
+ }
+
+ public IPersistableElement getPersistable() {
+ return null;
+ }
+
+ public String getToolTipText() {
+ return getName();
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object getAdapter(Class adapter) {
+ return null;
+ }
+
+ public DataTypeCache getDataTypeCache() {
+ return dataTypeCache;
+ }
+
+ public IResource getResource() {
+ return resource;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/core/ODMOutlinePage.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/core/ODMOutlinePage.java
new file mode 100644
index 00000000000..6f093813202
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/core/ODMOutlinePage.java
@@ -0,0 +1,170 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.core;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.LightweightSystem;
+import org.eclipse.draw2d.MarginBorder;
+import org.eclipse.draw2d.Viewport;
+import org.eclipse.draw2d.parts.ScrollableThumbnail;
+import org.eclipse.draw2d.parts.Thumbnail;
+import org.eclipse.gef.EditDomain;
+import org.eclipse.gef.LayerConstants;
+import org.eclipse.gef.editparts.ScalableFreeformRootEditPart;
+import org.eclipse.gef.ui.actions.ActionRegistry;
+import org.eclipse.gef.ui.parts.TreeViewer;
+import org.eclipse.jface.action.Action;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.osee.framework.ui.data.model.editor.outline.OutlineTreePartFactory;
+import org.eclipse.osee.framework.ui.data.model.editor.utility.ODMImage;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.layout.FillLayout;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.part.IPageSite;
+import org.eclipse.ui.part.Page;
+import org.eclipse.ui.views.contentoutline.IContentOutlinePage;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ODMOutlinePage extends Page implements IContentOutlinePage {
+
+ private Composite composite;
+ private Canvas overview;
+ private final ScalableFreeformRootEditPart rootEditPart;
+ private Thumbnail thumbnail;
+ private TreeViewer viewer;
+ private final ActionRegistry registry;
+
+ public ODMOutlinePage(ScalableFreeformRootEditPart rootEditPart, ActionRegistry registry) {
+ super();
+ this.rootEditPart = rootEditPart;
+ this.registry = registry;
+ }
+
+ public void addSelectionChangedListener(ISelectionChangedListener listener) {
+
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ composite = new SashForm(parent, SWT.BORDER);
+ composite.setLayout(new FillLayout(SWT.VERTICAL));
+
+ SashForm sash = (SashForm) composite;
+ sash.setOrientation(SWT.VERTICAL);
+
+ overview = new Canvas(composite, SWT.BORDER);
+ overview.setBackground(ColorConstants.white);
+ overview.setLayout(new FillLayout(SWT.VERTICAL));
+
+ thumbnail = new ScrollableThumbnail((Viewport) rootEditPart.getFigure());
+ thumbnail.setBorder(new MarginBorder(3));
+ thumbnail.setSource(rootEditPart.getLayer(LayerConstants.PRINTABLE_LAYERS));
+
+ LightweightSystem lws = new LightweightSystem(overview);
+ lws.setContents(thumbnail);
+
+ Group panel = new Group(composite, SWT.NONE);
+ panel.setLayout(new GridLayout());
+ panel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ panel.setText("Hierarchy");
+
+ viewer = new TreeViewer();
+ viewer.createControl(panel);
+ viewer.setEditDomain(new EditDomain());
+ viewer.setEditPartFactory(new OutlineTreePartFactory());
+ // viewer.setContents);
+ // viewer.addDragSourceListener(new OutlineDragSourceListener(viewer));
+ sash.setWeights(new int[] {2, 8});
+ }
+
+ public void setContents(Object contents) {
+ viewer.setContents(contents);
+ }
+
+ @Override
+ public void dispose() {
+ if (null != thumbnail) {
+ thumbnail.deactivate();
+ }
+ super.dispose();
+ }
+
+ @Override
+ public Control getControl() {
+ return overview;
+ }
+
+ public ISelection getSelection() {
+ return StructuredSelection.EMPTY;
+ }
+
+ public void removeSelectionChangedListener(ISelectionChangedListener listener) {
+
+ }
+
+ @Override
+ public void setFocus() {
+ if (getControl() != null) {
+ getControl().setFocus();
+ }
+ }
+
+ public void setSelection(ISelection selection) {
+ }
+
+ @Override
+ public void init(IPageSite pageSite) {
+ super.init(pageSite);
+
+ IActionBars bars = pageSite.getActionBars();
+ String id = ActionFactory.UNDO.getId();
+ bars.setGlobalActionHandler(id, registry.getAction(id));
+ id = ActionFactory.REDO.getId();
+ bars.setGlobalActionHandler(id, registry.getAction(id));
+ bars.updateActionBars();
+
+ IToolBarManager manager = bars.getToolBarManager();
+ ImageDescriptor img = ImageManager.getImageDescriptor(ODMImage.EXPAND_ALL);
+ IAction action = new Action("Expand All", img) {
+ @Override
+ public void run() {
+ expand(((Tree) viewer.getControl()).getItems());
+ }
+
+ private void expand(TreeItem[] items) {
+ for (int i = 0; i < items.length; i++) {
+ expand(items[i].getItems());
+ items[i].setExpanded(true);
+ }
+ }
+ };
+ action.setToolTipText("Expand All");
+ manager.add(action);
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/core/ODMPaletteDropListener.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/core/ODMPaletteDropListener.java
new file mode 100644
index 00000000000..c6977c9ba1b
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/core/ODMPaletteDropListener.java
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.core;
+
+import org.eclipse.gef.EditPartViewer;
+import org.eclipse.gef.dnd.TemplateTransferDropTargetListener;
+import org.eclipse.gef.requests.CreationFactory;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ODMPaletteDropListener extends TemplateTransferDropTargetListener {
+
+ public ODMPaletteDropListener(EditPartViewer viewer) {
+ super(viewer);
+ }
+
+ protected CreationFactory getFactory(Object template) {
+ return (CreationFactory) template;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/core/ODMPaletteFactory.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/core/ODMPaletteFactory.java
new file mode 100644
index 00000000000..3d7b40e8134
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/core/ODMPaletteFactory.java
@@ -0,0 +1,202 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.core;
+
+import java.util.ArrayList;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+import org.eclipse.gef.palette.CombinedTemplateCreationEntry;
+import org.eclipse.gef.palette.ConnectionCreationToolEntry;
+import org.eclipse.gef.palette.MarqueeToolEntry;
+import org.eclipse.gef.palette.PaletteContainer;
+import org.eclipse.gef.palette.PaletteDrawer;
+import org.eclipse.gef.palette.PaletteEntry;
+import org.eclipse.gef.palette.PaletteRoot;
+import org.eclipse.gef.palette.PaletteSeparator;
+import org.eclipse.gef.palette.PaletteToolbar;
+import org.eclipse.gef.palette.PanningSelectionToolEntry;
+import org.eclipse.gef.palette.ToolEntry;
+import org.eclipse.gef.requests.CreationFactory;
+import org.eclipse.gef.requests.SimpleFactory;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ArtifactDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.AttributeDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.DataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.DataTypeCache;
+import org.eclipse.osee.framework.ui.data.model.editor.model.DataTypeSource;
+import org.eclipse.osee.framework.ui.data.model.editor.model.InheritanceLinkModel;
+import org.eclipse.osee.framework.ui.data.model.editor.model.RelationDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.utility.ODMImage;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ODMPaletteFactory {
+
+ private final static String DATA_TYPE_TIP_FORMAT = "Add [%s] %s type to %s";
+ private final ODMEditor editor;
+ private PaletteRoot paletteRoot;
+
+ private enum DrawerEnum {
+ Artifact_Types,
+ Attribute_Types,
+ Relation_Types;
+
+ public String asLabel() {
+ return this.name().replaceAll("_", " ");
+ }
+ }
+
+ private final Map<DrawerEnum, PaletteContainer> containers;
+
+ public ODMPaletteFactory(ODMEditor editor) {
+ this.containers = new LinkedHashMap<DrawerEnum, PaletteContainer>();
+ this.editor = editor;
+ }
+
+ private void updateDrawers() {
+ if (editor.getEditorInput() == null) {
+ return;
+ }
+ DataTypeCache dataTypeCache = editor.getEditorInput().getDataTypeCache();
+
+ for (DrawerEnum drawerType : DrawerEnum.values()) {
+ PaletteContainer container = containers.get(drawerType);
+ if (container == null) {
+ container = new PaletteDrawer(drawerType.asLabel());
+ containers.put(drawerType, container);
+ getPaletteRoot().add(container);
+ } else {
+ for (Object child : container.getChildren()) {
+ container.remove((PaletteEntry) child);
+ }
+ }
+ container.addAll(getToolEntries(drawerType, dataTypeCache));
+ }
+ }
+
+ private List<CombinedTemplateCreationEntry> getToolEntries(DrawerEnum drawerType, DataTypeCache dataTypeCache) {
+ List<CombinedTemplateCreationEntry> toReturn = new ArrayList<CombinedTemplateCreationEntry>();
+ ImageDescriptor image = null;
+ String message = null;
+ for (String sourceId : dataTypeCache.getDataTypeSourceIds()) {
+ DataTypeSource dataTypeSource = dataTypeCache.getDataTypeSourceById(sourceId);
+ switch (drawerType) {
+ case Artifact_Types:
+ for (ArtifactDataType dataType : dataTypeSource.getArtifactTypeManager().getAllSorted()) {
+ image = ImageDescriptor.createFromImage(dataType.getImage());
+ message = String.format(DATA_TYPE_TIP_FORMAT, dataType.getName(), "artifact", "the diagram");
+ toReturn.add(createDataTypeToolEntry(dataType, image, message));
+ }
+ break;
+ case Attribute_Types:
+ image = ImageManager.getImageDescriptor(ODMImage.LOCAL_ATTRIBUTE);
+ for (AttributeDataType dataType : dataTypeSource.getAttributeTypeManager().getAllSorted()) {
+ message = String.format(DATA_TYPE_TIP_FORMAT, dataType.getName(), "attribute", "an artifact type");
+ toReturn.add(createDataTypeToolEntry(dataType, image, message));
+ }
+ break;
+ case Relation_Types:
+ image = ImageManager.getImageDescriptor(ODMImage.LOCAL_RELATION);
+ for (RelationDataType dataType : dataTypeSource.getRelationTypeManager().getAllSorted()) {
+ message = String.format(DATA_TYPE_TIP_FORMAT, dataType.getName(), "relation", "an artifact type");
+ toReturn.add(createDataTypeToolEntry(dataType, image, message));
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ return toReturn;
+ }
+
+ private CombinedTemplateCreationEntry createDataTypeToolEntry(final DataType dataType, ImageDescriptor imageDescriptor, String message) {
+ CreationFactory factory = new CreationFactory() {
+
+ @Override
+ public Object getNewObject() {
+ return dataType;
+ }
+
+ @Override
+ public Object getObjectType() {
+ return null;
+ }
+
+ };
+ return new CombinedTemplateCreationEntry(dataType.getName(), message, factory, factory, imageDescriptor,
+ imageDescriptor);
+ }
+
+ private PaletteContainer createToolsGroup(PaletteRoot palette) {
+ PaletteToolbar toolbar = new PaletteToolbar("Tools");
+
+ ToolEntry tool = new PanningSelectionToolEntry();
+ toolbar.add(tool);
+ palette.setDefaultEntry(tool);
+
+ toolbar.add(new MarqueeToolEntry());
+ toolbar.add(new PaletteSeparator());
+
+ ImageDescriptor img = ImageManager.getImageDescriptor(ODMImage.INHERITANCE);
+ toolbar.add(new ConnectionCreationToolEntry("Inheritance", "Inherit from an artifact", new SimpleFactory(
+ InheritanceLinkModel.class), img, img));
+
+ // final Action action =
+ // OseeAts.createBugAction(ODMEditorActivator.getInstance(), editor, "OSEE Data Model Editor",
+ // ODMEditor.EDITOR_ID);
+ // img = action.getImageDescriptor();
+ //
+ // toolbar.add(new ToolEntry("", action.getText(), img, img, null) {
+ //
+ // @Override
+ // public Tool createTool() {
+ // return new AbstractTool() {
+ //
+ // @Override
+ // protected String getCommandName() {
+ // return action.getText();
+ // }
+ //
+ // @Override
+ // public void activate() {
+ // super.activate();
+ // Display.getDefault().asyncExec(new Runnable() {
+ // public void run() {
+ // deactivate();
+ // action.run();
+ // }
+ // });
+ //
+ // }
+ // };
+ // }
+ //
+ // });
+ return toolbar;
+ }
+
+ public void updatePaletteRoot() {
+ updateDrawers();
+ }
+
+ public PaletteRoot getPaletteRoot() {
+ if (paletteRoot == null) {
+ paletteRoot = new PaletteRoot();
+ paletteRoot.add(createToolsGroup(paletteRoot));
+ updateDrawers();
+ }
+ return paletteRoot;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/figure/ArtifactTypeFigure.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/figure/ArtifactTypeFigure.java
new file mode 100644
index 00000000000..6c9c2f5c9e0
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/figure/ArtifactTypeFigure.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.figure;
+
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.MarginBorder;
+import org.eclipse.draw2d.RoundedRectangle;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ArtifactTypeFigure extends RoundedRectangle {
+
+ private DataTypeFigure header;
+ private IFigure body;
+
+ public ArtifactTypeFigure(IFigure namespaceFigure, IFigure nameFigure) {
+ setOpaque(true);
+ ToolbarLayout layout = new ToolbarLayout();
+ layout.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
+ setLayoutManager(layout);
+
+ // setBorder(SimpleEtchedBorder.singleton);
+ // setBorder(new CompoundBorder(SimpleEtchedBorder.singleton, new LineBorder(ColorConstants.black, 1)));
+ // setBackgroundColor(ColorConstants.white);
+
+ header = new DataTypeFigure(namespaceFigure, nameFigure);
+ header.setBorder(new MarginBorder(4));
+ ToolbarLayout layout2 = new ToolbarLayout(true);
+ layout2.setStretchMinorAxis(true);
+ layout2.setMinorAlignment(ToolbarLayout.ALIGN_CENTER);
+ layout2.setSpacing(5);
+ header.setLayoutManager(layout2);
+ add(header);
+
+ body = new Figure();
+ body.setLayoutManager(new ToolbarLayout());
+ add(body);
+ }
+
+ public IFigure getContentPane() {
+ return body;
+ }
+
+ public IFigure getNamespaceFigure() {
+ return header.getNamespaceFigure();
+ }
+
+ public IFigure getNameFigure() {
+ return header.getNameFigure();
+ }
+
+ public void setHeaderIcon(Image image) {
+ header.setImage(image);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/figure/CompartmentFigure.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/figure/CompartmentFigure.java
new file mode 100644
index 00000000000..bec2ecb8879
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/figure/CompartmentFigure.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.figure;
+
+import org.eclipse.draw2d.AbstractBorder;
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.CompoundBorder;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.MarginBorder;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Insets;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class CompartmentFigure extends Figure {
+
+ public CompartmentFigure() {
+ ToolbarLayout layout = new ToolbarLayout();
+ layout.setMinorAlignment(ToolbarLayout.ALIGN_TOPLEFT);
+ layout.setStretchMinorAxis(false);
+ layout.setSpacing(2);
+ setLayoutManager(layout);
+ setBorder(new CompoundBorder(new CompartmentFigureBorder(), new MarginBorder(1)));
+ }
+
+ public Dimension getPreferredSize(int wHint, int hHint) {
+ Dimension size = super.getPreferredSize(wHint, hHint);
+ size.height = Math.max(size.height, 10);
+ return size;
+ }
+
+ private final static class CompartmentFigureBorder extends AbstractBorder {
+ private static final Insets INSETS = new Insets(2, 0, 0, 1);
+
+ public Insets getInsets(IFigure figure) {
+ return INSETS;
+ }
+
+ public void paint(IFigure figure, Graphics graphics, Insets insets) {
+ graphics.setForegroundColor(ColorConstants.black);
+ Rectangle rect = getPaintRectangle(figure, insets);
+ graphics.drawLine(rect.x, rect.y, rect.x + rect.width - 1, rect.y);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/figure/DataTypeFigure.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/figure/DataTypeFigure.java
new file mode 100644
index 00000000000..1f67986dfba
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/figure/DataTypeFigure.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.figure;
+
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.ImageFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.ToolbarLayout;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class DataTypeFigure extends Figure {
+
+ private ImageFigure iconFigure;
+ private IFigure namespaceFigure;
+ private IFigure nameFigure;
+
+ public DataTypeFigure(IFigure namespaceFigure, IFigure nameFigure) {
+ this.namespaceFigure = namespaceFigure;
+ this.nameFigure = nameFigure;
+ this.iconFigure = new ImageFigure();
+
+ setLayoutManager(new ToolbarLayout(true));
+
+ add(iconFigure);
+ add(namespaceFigure);
+ Label separator = new Label(":");
+ separator.setTextAlignment(PositionConstants.CENTER);
+ add(separator);
+ add(nameFigure);
+ }
+
+ public IFigure getNamespaceFigure() {
+ return namespaceFigure;
+ }
+
+ public IFigure getNameFigure() {
+ return nameFigure;
+ }
+
+ public void setImage(Image image) {
+ iconFigure.setImage(image);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/figure/SelectableLabel.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/figure/SelectableLabel.java
new file mode 100644
index 00000000000..444b48d27d1
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/figure/SelectableLabel.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.figure;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.geometry.Insets;
+import org.eclipse.draw2d.geometry.Rectangle;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class SelectableLabel extends Label {
+
+ private boolean selected;
+ private boolean hasFocus;
+ private boolean isSelectable;
+
+ public SelectableLabel() {
+ this.isSelectable = true;
+ }
+
+ private Rectangle getSelectionRectangle() {
+ Rectangle bounds = getTextBounds();
+ bounds.expand(new Insets(2, 2, 0, 0));
+ translateToParent(bounds);
+ bounds.intersect(getBounds());
+ return bounds;
+ }
+
+ /**
+ * @see org.eclipse.draw2d.Label#paintFigure(org.eclipse.draw2d.Graphics)
+ */
+ protected void paintFigure(Graphics graphics) {
+ if (isSelectable) {
+ if (selected) {
+ graphics.pushState();
+ graphics.setBackgroundColor(ColorConstants.menuBackgroundSelected);
+ graphics.fillRectangle(getSelectionRectangle());
+ graphics.popState();
+ graphics.setForegroundColor(ColorConstants.white);
+ }
+ if (hasFocus) {
+ graphics.pushState();
+ graphics.setXORMode(true);
+ graphics.setForegroundColor(ColorConstants.menuBackgroundSelected);
+ graphics.setBackgroundColor(ColorConstants.white);
+ graphics.drawFocus(getSelectionRectangle().resize(-1, -1));
+ graphics.popState();
+ }
+ }
+ super.paintFigure(graphics);
+ }
+
+ /**
+ * Sets the selection state of this SimpleActivityLabel
+ *
+ * @param b true will cause the label to appear selected
+ */
+ public void setSelected(boolean b) {
+ if (selected != b) {
+ selected = b;
+ repaint();
+ }
+ }
+
+ /**
+ * Sets the focus state of this SimpleActivityLabel
+ *
+ * @param b true will cause a focus rectangle to be drawn around the text of the Label
+ */
+ public void setFocus(boolean b) {
+ if (hasFocus != b) {
+ hasFocus = b;
+ repaint();
+ }
+ }
+
+ public void setSelectable(boolean selectable) {
+ isSelectable = selectable;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/input/IOseeDataTypeHandler.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/input/IOseeDataTypeHandler.java
new file mode 100644
index 00000000000..6710e884b52
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/input/IOseeDataTypeHandler.java
@@ -0,0 +1,24 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.input;
+
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.ui.data.model.editor.model.DataTypeSource;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface IOseeDataTypeHandler {
+ public boolean isValid(IPath file);
+
+ public DataTypeSource toODMDataTypeSource(IPath file) throws OseeCoreException;
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/input/OseeDataTypeConverter.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/input/OseeDataTypeConverter.java
new file mode 100644
index 00000000000..c3f479dc2c7
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/input/OseeDataTypeConverter.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.input;
+
+import java.util.Collection;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.OseeEnumType;
+import org.eclipse.osee.framework.skynet.core.attribute.OseeEnumTypeManager;
+import org.eclipse.osee.framework.skynet.core.importing.IOseeDataTypeProcessor;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ArtifactDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.AttributeDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.DataTypeSource;
+import org.eclipse.osee.framework.ui.data.model.editor.model.RelationDataType;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class OseeDataTypeConverter implements IOseeDataTypeProcessor {
+
+ private final DataTypeSource dataTypeSource;
+
+ public OseeDataTypeConverter(DataTypeSource dataTypeSource) {
+ this.dataTypeSource = dataTypeSource;
+ }
+
+ @Override
+ public boolean doesArtifactSuperTypeExist(String artifactSuperTypeName) throws OseeCoreException {
+ return false;
+ }
+
+ @Override
+ public void onArtifactType(boolean isAbstract, String artifactTypeName) throws OseeCoreException {
+ ArtifactDataType artifactDataType = new ArtifactDataType(artifactTypeName, null);
+
+ this.dataTypeSource.add(artifactDataType);
+ }
+
+ @Override
+ public void onArtifactTypeInheritance(String ancestor, Collection<String> descendants) throws OseeCoreException {
+
+ }
+
+ @Override
+ public void onAttributeType(String baseAttributeClass, String providerAttributeClass, String fileTypeExtension, String name, String defaultValue, String validityXml, int minOccurrence, int maxOccurrence, String toolTipText, String taggerId) throws OseeCoreException {
+ OseeEnumType enumType = OseeEnumTypeManager.getType(name);
+ int enumTypeId = enumType.getId();
+ AttributeDataType attributeDataType =
+ new AttributeDataType(name, baseAttributeClass, defaultValue, fileTypeExtension, maxOccurrence,
+ minOccurrence, providerAttributeClass, taggerId, toolTipText, enumTypeId);
+
+ // Create attribute provider and base attribute classes here ??
+
+ this.dataTypeSource.add(attributeDataType);
+ }
+
+ @Override
+ public void onAttributeValidity(String attributeName, String artifactSuperTypeName, Collection<String> concreteTypes) throws OseeCoreException {
+ }
+
+ @Override
+ public void onRelationType(String name, String sideAName, String sideBName, String artifactTypeSideA, String artifactTypeSideB, String multiplicity, String ordered, String defaultOrderTypeGuid) throws OseeCoreException {
+ RelationDataType relationDataType =
+ new RelationDataType("", name, "", "", Boolean.valueOf(ordered), "", sideAName, sideBName);
+
+ this.dataTypeSource.add(relationDataType);
+ }
+
+ @Override
+ public void onRelationValidity(String artifactTypeName, String relationTypeName, int sideAMax, int sideBMax) throws OseeCoreException {
+ }
+
+ public DataTypeSource getODMModel() {
+ return dataTypeSource;
+ }
+
+ @Override
+ public void onFinish() throws OseeCoreException {
+
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/input/OseeDataTypeDatastore.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/input/OseeDataTypeDatastore.java
new file mode 100644
index 00000000000..146bfa42a7b
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/input/OseeDataTypeDatastore.java
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.input;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.ArtifactType;
+import org.eclipse.osee.framework.core.model.AttributeType;
+import org.eclipse.osee.framework.core.model.RelationType;
+import org.eclipse.osee.framework.database.core.ConnectionHandler;
+import org.eclipse.osee.framework.database.core.IOseeStatement;
+import org.eclipse.osee.framework.jdk.core.type.CompositeKeyHashMap;
+import org.eclipse.osee.framework.jdk.core.type.HashCollection;
+import org.eclipse.osee.framework.jdk.core.type.Pair;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.artifact.ArtifactTypeManager;
+import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
+import org.eclipse.osee.framework.skynet.core.relation.RelationTypeManager;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ArtifactDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.AttributeDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.RelationDataType;
+import org.eclipse.osee.framework.ui.skynet.ArtifactImageManager;
+import org.eclipse.osee.framework.ui.skynet.SkynetGuiPlugin;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class OseeDataTypeDatastore {
+ private static final String SELECT_ATTRIBUTE_VALIDITY = "SELECT * FROM osee_artifact_type_attributes";
+
+ private OseeDataTypeDatastore() {
+ }
+
+ public static List<AttributeDataType> getAttributeTypes() throws OseeCoreException {
+ List<AttributeDataType> attributeDataTypes = new ArrayList<AttributeDataType>();
+ for (AttributeType attributeType : AttributeTypeManager.getAllTypes()) {
+ String baseClass = AttributeTypeManager.getAttributeBaseClass(attributeType).getCanonicalName();
+ String providerClass = AttributeTypeManager.getAttributeProviderClass(attributeType).getCanonicalName();
+ AttributeDataType attributeDataType =
+ new AttributeDataType(String.valueOf(attributeType.getId()), attributeType.getName(), baseClass,
+ attributeType.getDefaultValue(), attributeType.getFileTypeExtension(),
+ attributeType.getMaxOccurrences(), attributeType.getMinOccurrences(), providerClass,
+ attributeType.getTaggerId(), attributeType.getDescription(), attributeType.getOseeEnumTypeId());
+ attributeDataTypes.add(attributeDataType);
+ }
+ return attributeDataTypes;
+ }
+
+ public static List<RelationDataType> getRelationDataTypes() throws OseeCoreException {
+ List<RelationDataType> relationDataTypes = new ArrayList<RelationDataType>();
+ for (RelationType relationType : RelationTypeManager.getAllTypes()) {
+ RelationDataType relationDataType =
+ new RelationDataType(String.valueOf(relationType.getId()), relationType.getName(), "", "",
+ relationType.isOrdered(), "", relationType.getSideAName(), relationType.getSideBName());
+ relationDataTypes.add(relationDataType);
+ }
+ return relationDataTypes;
+ }
+
+ public static List<ArtifactDataType> getArtifactDataTypes() throws OseeCoreException {
+ List<ArtifactDataType> artifactDataTypes = new ArrayList<ArtifactDataType>();
+ for (ArtifactType artifactType : ArtifactTypeManager.getAllTypes()) {
+ ArtifactDataType artifactDataType =
+ new ArtifactDataType(String.valueOf(artifactType.getId()), artifactType.getName(),
+ ArtifactImageManager.getImage(artifactType));
+ artifactDataTypes.add(artifactDataType);
+ }
+ return artifactDataTypes;
+ }
+
+ public static HashCollection<String, String> getArtifactToAttributeEntries() throws OseeCoreException {
+ HashCollection<String, String> toReturn = new HashCollection<String, String>();
+ IOseeStatement chStmt = ConnectionHandler.getStatement();
+ try {
+ chStmt.runPreparedQuery(2000, SELECT_ATTRIBUTE_VALIDITY);
+ while (chStmt.next()) {
+ try {
+ toReturn.put(chStmt.getString("art_type_id"), chStmt.getString("attr_type_id"));
+ } catch (OseeCoreException ex) {
+ OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ }
+ }
+ } finally {
+ chStmt.close();
+ }
+ return toReturn;
+ }
+
+ public static CompositeKeyHashMap<String, String, Pair<Integer, Integer>> getArtifactToRelationEntries() throws OseeCoreException {
+ CompositeKeyHashMap<String, String, Pair<Integer, Integer>> toReturn =
+ new CompositeKeyHashMap<String, String, Pair<Integer, Integer>>();
+ // ConnectionHandlerStatement chStmt = ConnectionHandler.getStatement();
+ // try {
+ // chStmt.runPreparedQuery(2000, SELECT_RELATION_VALIDITY);
+ // while (chStmt.next()) {
+ // try {
+ // Pair<String, String> key =
+ // new Pair<String, String>(chStmt.getString("art_type_id"), chStmt.getString("rel_link_type_id"));
+ //
+ // Pair<Integer, Integer> multiplicity =
+ // new Pair<Integer, Integer>(chStmt.getInt("side_a_max"), chStmt.getInt("side_b_max"));
+ //
+ // toReturn.put(key, multiplicity);
+ // } catch (OseeCoreException ex) {
+ // OseeLog.log(SkynetGuiPlugin.class, Level.SEVERE, ex);
+ // }
+ // }
+ // } finally {
+ // chStmt.close();
+ // }
+ return toReturn;
+ }
+
+ public static HashCollection<String, String> getArtifactInheritance() throws OseeCoreException {
+ HashCollection<String, String> toReturn = new HashCollection<String, String>();
+ for (ArtifactType artifactType : ArtifactTypeManager.getAllTypes()) {
+ if (artifactType.hasSuperArtifactTypes()) {
+ for (ArtifactType superType : artifactType.getSuperArtifactTypes()) {
+ toReturn.put(String.valueOf(superType.getId()), String.valueOf(artifactType.getId()));
+ }
+ }
+ }
+ return toReturn;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/input/OseeDataTypeFactory.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/input/OseeDataTypeFactory.java
new file mode 100644
index 00000000000..f2082a0e69b
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/input/OseeDataTypeFactory.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.input;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.database.core.OseeInfo;
+import org.eclipse.osee.framework.jdk.core.type.HashCollection;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ArtifactDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.AttributeDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.DataTypeCache;
+import org.eclipse.osee.framework.ui.data.model.editor.model.DataTypeSource;
+import org.eclipse.osee.framework.ui.data.model.editor.model.TypeManager;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class OseeDataTypeFactory {
+ private static OseeDataTypeFactory instance = new OseeDataTypeFactory();
+
+ private List<IOseeDataTypeHandler> fileHandlers;
+
+ private OseeDataTypeFactory() {
+ if (fileHandlers == null) {
+ fileHandlers = new ArrayList<IOseeDataTypeHandler>();
+ }
+ }
+
+ public static DataTypeSource loadFromFile(IPath file) throws OseeCoreException {
+ DataTypeSource dataTypeSource = null;
+ for (IOseeDataTypeHandler handler : instance.fileHandlers) {
+ if (handler.isValid(file)) {
+ dataTypeSource = handler.toODMDataTypeSource(file);
+ if (dataTypeSource != null) {
+ break;
+ }
+ }
+ }
+ return dataTypeSource;
+ }
+
+ public static void addTypesFromDataStore(DataTypeCache cache) throws OseeCoreException {
+ String sourceId = OseeInfo.getDatabaseGuid();
+ DataTypeSource dataTypeSource = new DataTypeSource(sourceId, true);
+ dataTypeSource.addAll(OseeDataTypeDatastore.getArtifactDataTypes());
+ dataTypeSource.addAll(OseeDataTypeDatastore.getAttributeTypes());
+ dataTypeSource.addAll(OseeDataTypeDatastore.getRelationDataTypes());
+ HashCollection<String, String> entries = OseeDataTypeDatastore.getArtifactToAttributeEntries();
+
+ TypeManager<ArtifactDataType> artifactDataType = dataTypeSource.getArtifactTypeManager();
+ TypeManager<AttributeDataType> attributeDataType = dataTypeSource.getAttributeTypeManager();
+
+ for (String artifactKey : entries.keySet()) {
+ ArtifactDataType artifact = artifactDataType.getById(artifactKey);
+ if (artifact != null) {
+ Collection<String> attrKeys = entries.getValues(artifactKey);
+ if (attrKeys != null) {
+ for (String attrKey : attrKeys) {
+ AttributeDataType attribute = attributeDataType.getById(attrKey);
+ if (attribute != null) {
+ artifact.add(attribute);
+ }
+ }
+ }
+ }
+ }
+ // CompositeKeyHashMap<String, String, Pair<Integer, Integer>> relationsMap =
+ // OseeDataTypeDatastore.getArtifactToRelationEntries();
+ // TypeManager<RelationDataType> relationDataType = dataTypeSource.getRelationTypeManager();
+ // for (CompositeKey<String, String> key : relationsMap.keySet()) {
+ // ArtifactDataType artifact = artifactDataType.getById(key.getKey1());
+ // if (artifact != null) {
+ // Collection<String> relKeys = entries.getValues(key.getKey2());
+ // if (relKeys != null) {
+ // for (String relKey : relKeys) {
+ // RelationDataType relation = relationDataType.getById(relKey);
+ // if (relation != null) {
+ // artifact.add(relation);
+ // }
+ // }
+ // }
+ // }
+ // }
+
+ HashCollection<String, String> parentChildTable = OseeDataTypeDatastore.getArtifactInheritance();
+ for (String parentKey : parentChildTable.keySet()) {
+ ArtifactDataType parent = artifactDataType.getById(parentKey);
+ if (parent != null) {
+ Collection<String> children = parentChildTable.getValues(parentKey);
+ for (String childKey : children) {
+ ArtifactDataType child = artifactDataType.getById(childKey);
+ if (child != null) {
+ child.setSuperType(parent);
+ }
+ }
+ }
+ }
+ cache.addDataTypeSource(dataTypeSource);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/ArtifactDataType.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/ArtifactDataType.java
new file mode 100644
index 00000000000..601134bd007
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/ArtifactDataType.java
@@ -0,0 +1,245 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.model;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Level;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.data.model.editor.ODMEditorActivator;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ArtifactDataType extends DataType {
+
+ private Image image;
+ private final TypeManager<AttributeDataType> attributes;
+ private final TypeManager<RelationDataType> relations;
+ private ArtifactDataType superType;
+ private final Set<ArtifactDataType> subTypes;
+
+ public ArtifactDataType() {
+ this(EMPTY_STRING, EMPTY_STRING, null);
+ }
+
+ public ArtifactDataType(String name, Image imageName) {
+ this(EMPTY_STRING, name, imageName);
+ }
+
+ public ArtifactDataType(String uniqueId, String name, Image image) {
+ super(uniqueId, name);
+ this.image = image;
+ this.attributes = new TypeManager<AttributeDataType>();
+ this.relations = new TypeManager<RelationDataType>();
+ this.subTypes = new HashSet<ArtifactDataType>();
+ }
+
+ public void add(AttributeDataType attribute) {
+ getAttributeManager().add(attribute);
+ fireModelEvent();
+ }
+
+ public void add(RelationDataType relation) {
+ getRelationManager().add(relation);
+ fireModelEvent();
+ }
+
+ public void remove(AttributeDataType attribute) {
+ getAttributeManager().remove(attribute);
+ fireModelEvent();
+ }
+
+ public void remove(RelationDataType relation) {
+ getRelationManager().remove(relation);
+ fireModelEvent();
+ }
+
+ private TypeManager<AttributeDataType> getAttributeManager() {
+ return attributes;
+ }
+
+ private TypeManager<RelationDataType> getRelationManager() {
+ return relations;
+ }
+
+ public Image getImage() {
+ return image == null ? ImageManager.getImage(ImageManager.MISSING) : image;
+ }
+
+ public void setImage(Image image) {
+ if (this.image != image) {
+ this.image = image;
+ fireModelEvent();
+ }
+ }
+
+ @Override
+ public void addConnection(ConnectionModel connection) {
+ if (connection != null) {
+ try {
+ if (connection.getTarget() == this) {
+ setSuperType((ArtifactDataType) connection.getSource());
+ } else if (connection.getSource() == this) {
+ addSubType((ArtifactDataType) connection.getTarget());
+ }
+ super.addConnection(connection);
+ } catch (OseeStateException ex) {
+ OseeLog.log(ODMEditorActivator.class, Level.SEVERE, ex);
+ }
+ }
+ }
+
+ @Override
+ public void removeConnection(ConnectionModel connection) {
+ if (connection != null) {
+ try {
+ if (connection.getTarget() == this) {
+ setSuperType(null);
+ } else if (connection.getSource() == this) {
+ removeSubType((ArtifactDataType) connection.getTarget());
+ }
+ super.removeConnection(connection);
+ } catch (OseeStateException ex) {
+ OseeLog.log(ODMEditorActivator.class, Level.SEVERE, ex);
+ }
+ }
+ }
+
+ public void setSuperType(ArtifactDataType superType) throws OseeStateException {
+ getSourceConnections(); // I am the source;
+
+ if (this.superType != superType && !this.equals(superType)) {
+ if (superType == null) {
+ if (this.superType != null) {
+ this.superType.removeSubType(this);
+ }
+ this.superType = superType;
+ fireModelEvent();
+ } else {
+ checkInheritance(superType);
+ if (this.superType != null) {
+ this.superType.removeSubType(this);
+ }
+ this.superType = superType;
+ this.superType.addSubType(this);
+ fireModelEvent();
+ }
+ }
+ }
+
+ private void checkInheritance(ArtifactDataType item) throws OseeStateException {
+ boolean thisIsAItem = instanceOf(this, item);
+ boolean itemIsAThis = instanceOf(item, this);
+ String message = "Inheritance constraint violation - [%s] is a [%s]";
+ if (thisIsAItem) {
+ throw new OseeStateException(String.format(message, this, item));
+ } else if (itemIsAThis) {
+ throw new OseeStateException(String.format(message, item, this));
+ }
+ }
+
+ public static boolean instanceOf(ArtifactDataType art1, ArtifactDataType art2) {
+ boolean toReturn = false;
+ if (art1 == art2) {
+ toReturn = true;
+ } else if (art1 != null && art2 != null) {
+ toReturn = art1.equals(art2) || art2.getSubTypes().contains(art1);
+ }
+ return toReturn;
+ }
+
+ private void addSubType(ArtifactDataType childType) throws OseeStateException {
+ if (childType != this) {
+ checkInheritance(childType);
+ subTypes.add(childType);
+ }
+ }
+
+ private void removeSubType(ArtifactDataType childType) {
+ subTypes.remove(childType);
+ }
+
+ public List<ArtifactDataType> getSubTypes() {
+ List<ArtifactDataType> descendants = new ArrayList<ArtifactDataType>();
+ for (ArtifactDataType descendant : subTypes) {
+ if (descendant != this) {
+ descendants.add(descendant);
+ descendants.addAll(descendant.getSubTypes());
+ }
+ }
+ return descendants;
+ }
+
+ public ArtifactDataType getSuperType() {
+ return this.superType;
+ }
+
+ public List<ArtifactDataType> getSuperTypes() {
+ List<ArtifactDataType> toReturn = new ArrayList<ArtifactDataType>();
+ if (this.superType != null) {
+ toReturn.add(this.superType);
+ toReturn.addAll(this.superType.getSuperTypes());
+ }
+ return toReturn;
+ }
+
+ public List<AttributeDataType> getInheritedAttributes() {
+ List<AttributeDataType> inherited = new ArrayList<AttributeDataType>();
+ if (this.superType != null) {
+ inherited.addAll(this.superType.getLocalAndInheritedAttributes());
+ }
+ return inherited;
+ }
+
+ public List<RelationDataType> getInheritedRelations() {
+ List<RelationDataType> inherited = new ArrayList<RelationDataType>();
+ if (this.superType != null) {
+ inherited.addAll(this.superType.getLocalAndInheritedRelations());
+ }
+ return inherited;
+ }
+
+ public List<AttributeDataType> getLocalAndInheritedAttributes() {
+ List<AttributeDataType> allList = new ArrayList<AttributeDataType>();
+ allList.addAll(getInheritedAttributes());
+ allList.addAll(getLocalAttributes());
+ return allList;
+ }
+
+ public List<RelationDataType> getLocalAndInheritedRelations() {
+ List<RelationDataType> allList = new ArrayList<RelationDataType>();
+ allList.addAll(getInheritedRelations());
+ allList.addAll(getLocalRelations());
+ return allList;
+ }
+
+ public List<AttributeDataType> getLocalAttributes() {
+ return getAttributeManager().getAll();
+ }
+
+ public List<RelationDataType> getLocalRelations() {
+ return getRelationManager().getAll();
+ }
+
+ @Override
+ protected void fireModelEvent() {
+ super.fireModelEvent();
+ for (ArtifactDataType descendant : getSubTypes()) {
+ descendant.fireModelEvent();
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/AttributeDataType.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/AttributeDataType.java
new file mode 100644
index 00000000000..348678d8a9e
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/AttributeDataType.java
@@ -0,0 +1,179 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.model;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class AttributeDataType extends DataType {
+
+ private String defaultValue;
+ private int enumTypeId;
+ private String toolTipText;
+ private String fileTypeExtension;
+ private String taggerId;
+
+ private int minOccurrence;
+ private int maxOccurrence;
+
+ private String baseAttributeClass;
+ private String providerAttributeClass;
+
+ public AttributeDataType() {
+ this(EMPTY_STRING, EMPTY_STRING, EMPTY_STRING, EMPTY_STRING, EMPTY_STRING, 0, 0, EMPTY_STRING, EMPTY_STRING,
+ EMPTY_STRING, -1);
+ }
+
+ public AttributeDataType(String typeId, String name, String baseAttributeClass, String defaultValue, String fileTypeExtension, int maxOccurrence, int minOccurrence, String providerAttributeClass, String taggerId, String toolTipText, int enumTypeId) {
+ super(typeId, name);
+ this.baseAttributeClass = baseAttributeClass;
+ this.defaultValue = defaultValue;
+ this.fileTypeExtension = fileTypeExtension;
+ this.maxOccurrence = maxOccurrence;
+ this.minOccurrence = minOccurrence;
+ this.providerAttributeClass = providerAttributeClass;
+ this.taggerId = taggerId;
+ this.toolTipText = toolTipText;
+ this.enumTypeId = enumTypeId;
+ }
+
+ public AttributeDataType(String name, String baseAttributeClass, String defaultValue, String fileTypeExtension, int maxOccurrence, int minOccurrence, String providerAttributeClass, String taggerId, String toolTipText, int enumTypeId) {
+ this(EMPTY_STRING, name, baseAttributeClass, defaultValue, fileTypeExtension, maxOccurrence, minOccurrence,
+ providerAttributeClass, taggerId, toolTipText, enumTypeId);
+ }
+
+ /**
+ * @return the defaultValue
+ */
+ public String getDefaultValue() {
+ return defaultValue;
+ }
+
+ /**
+ * @param defaultValue the defaultValue to set
+ */
+ public void setDefaultValue(String defaultValue) {
+ this.defaultValue = defaultValue;
+ }
+
+ /**
+ * @return the enumTypeId
+ */
+ public int getEnumTypeId() {
+ return enumTypeId;
+ }
+
+ /**
+ * @param enumTypeId the enumTypeId to set
+ */
+ public void setEnumTypeId(int enumTypeId) {
+ this.enumTypeId = enumTypeId;
+ }
+
+ /**
+ * @return the toolTipText
+ */
+ public String getToolTipText() {
+ return toolTipText;
+ }
+
+ /**
+ * @param toolTipText the toolTipText to set
+ */
+ public void setToolTipText(String toolTipText) {
+ this.toolTipText = toolTipText;
+ }
+
+ /**
+ * @return the fileTypeExtension
+ */
+ public String getFileTypeExtension() {
+ return fileTypeExtension;
+ }
+
+ /**
+ * @param fileTypeExtension the fileTypeExtension to set
+ */
+ public void setFileTypeExtension(String fileTypeExtension) {
+ this.fileTypeExtension = fileTypeExtension;
+ }
+
+ /**
+ * @return the taggerId
+ */
+ public String getTaggerId() {
+ return taggerId;
+ }
+
+ /**
+ * @param taggerId the taggerId to set
+ */
+ public void setTaggerId(String taggerId) {
+ this.taggerId = taggerId;
+ }
+
+ /**
+ * @return the minOccurrence
+ */
+ public int getMinOccurrence() {
+ return minOccurrence;
+ }
+
+ /**
+ * @param minOccurrence the minOccurrence to set
+ */
+ public void setMinOccurrence(int minOccurrence) {
+ this.minOccurrence = minOccurrence;
+ }
+
+ /**
+ * @return the maxOccurrence
+ */
+ public int getMaxOccurrence() {
+ return maxOccurrence;
+ }
+
+ /**
+ * @param maxOccurrence the maxOccurrence to set
+ */
+ public void setMaxOccurrence(int maxOccurrence) {
+ this.maxOccurrence = maxOccurrence;
+ }
+
+ /**
+ * @return the baseAttributeClass
+ */
+ public String getBaseAttributeClass() {
+ return baseAttributeClass;
+ }
+
+ /**
+ * @param baseAttributeClass the baseAttributeClass to set
+ */
+ public void setBaseAttributeClass(String baseAttributeClass) {
+ this.baseAttributeClass = baseAttributeClass;
+ }
+
+ /**
+ * @return the providerAttributeClass
+ */
+ public String getProviderAttributeClass() {
+ return providerAttributeClass;
+ }
+
+ /**
+ * @param providerAttributeClass the providerAttributeClass to set
+ */
+ public void setProviderAttributeClass(String providerAttributeClass) {
+ this.providerAttributeClass = providerAttributeClass;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/ConnectionModel.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/ConnectionModel.java
new file mode 100644
index 00000000000..9e1c152f877
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/ConnectionModel.java
@@ -0,0 +1,131 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.model;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.draw2d.Bendpoint;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ConnectionModel<T extends NodeModel> extends Model {
+
+ private boolean isConnected;
+ private T source;
+ private T target;
+ private List<Bendpoint> bendPoints;
+
+ public ConnectionModel() {
+ this.bendPoints = new ArrayList<Bendpoint>();
+ }
+
+ public ConnectionModel(T source, T target) {
+ this();
+ reconnect(source, target);
+ }
+
+ public void disconnect() {
+ if (isConnected) {
+ source.removeConnection(this);
+ target.removeConnection(this);
+ if (this.source != null) {
+ for (IModelListener listener : getListeners()) {
+ this.source.removeListener(listener);
+ }
+ }
+ if (this.target != null) {
+ for (IModelListener listener : getListeners()) {
+ this.target.removeListener(listener);
+ }
+ }
+ isConnected = false;
+ // fireModelEvent();
+ }
+ }
+
+ public T getSource() {
+ return source;
+ }
+
+ public T getTarget() {
+ return target;
+ }
+
+ public void setSource(T source) {
+ if (this.source != source) {
+ if (this.source != null) {
+ for (IModelListener listener : getListeners()) {
+ this.source.removeListener(listener);
+ }
+ }
+ this.source = source;
+ // fireModelEvent();
+ }
+ }
+
+ public void setTarget(T target) {
+ if (this.target != target) {
+ if (this.target != null) {
+ for (IModelListener listener : getListeners()) {
+ this.target.removeListener(listener);
+ }
+ }
+ this.target = target;
+ // fireModelEvent();
+ }
+ }
+
+ public void reconnect() {
+ if (!isConnected) {
+ source.addConnection(this);
+ target.addConnection(this);
+ isConnected = true;
+ // fireModelEvent();
+ }
+ }
+
+ public void reconnect(T newSource, T newTarget) {
+ if (newSource != null && newTarget != null && newSource != newTarget) {
+ disconnect();
+ this.source = newSource;
+ this.target = newTarget;
+ reconnect();
+ }
+ }
+
+ public List<Bendpoint> getBendpoints() {
+ return bendPoints;
+ }
+
+ @Override
+ public void addListener(IModelListener listener) {
+ if (getSource() != null) {
+ getSource().addListener(listener);
+ }
+ if (getTarget() != null) {
+ getTarget().addListener(listener);
+ }
+ super.addListener(listener);
+ }
+
+ @Override
+ public void removeListener(IModelListener listener) {
+ if (getSource() != null) {
+ getSource().removeListener(listener);
+ }
+ if (getTarget() != null) {
+ getTarget().removeListener(listener);
+ }
+ super.removeListener(listener);
+ }
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/DataType.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/DataType.java
new file mode 100644
index 00000000000..1feabf64ef9
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/DataType.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.model;
+
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class DataType extends NodeModel {
+ private static final String DEFAULT_NAMESPACE = "default";
+ protected static final String EMPTY_STRING = "";
+ private String name;
+ private String uniqueId;
+
+ public DataType() {
+ this(EMPTY_STRING, EMPTY_STRING);
+ }
+
+ public DataType(String name) {
+ this(EMPTY_STRING, name);
+ }
+
+ public DataType(String typeId, String name) {
+ super();
+ this.uniqueId = typeId;
+ this.name = name;
+ }
+
+ /**
+ * @return the name
+ */
+ public String getName() {
+ return name;
+ }
+
+ /**
+ * @param name the name to set
+ */
+ public void setName(String name) {
+ if (this.name != name) {
+ this.name = Strings.isValid(name) ? name.trim() : name;
+ fireModelEvent();
+ }
+ }
+
+ /**
+ * @return the typeId
+ */
+ public String getUniqueId() {
+ return uniqueId;
+ }
+
+ /**
+ * @param typeId the typeId to set
+ */
+ public void setUniqueId(String typeId) {
+ this.uniqueId = typeId;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj instanceof DataType) {
+ DataType other = (DataType) obj;
+ return objectEquals(getName(), other.getName());
+ }
+ return false;
+ }
+
+ private boolean objectEquals(Object object1, Object object2) {
+ if (object1 == object2) {
+ return true;
+ } else if (object1 != null && object2 != null) {
+ return object1.equals(object2);
+ }
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ return super.hashCode();
+ }
+
+ public String toString() {
+ return getName();
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/DataTypeCache.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/DataTypeCache.java
new file mode 100644
index 00000000000..19d54a3783c
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/DataTypeCache.java
@@ -0,0 +1,51 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.model;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class DataTypeCache {
+
+ private final Map<String, DataTypeSource> dataTypeSources;
+
+ public DataTypeCache() {
+ dataTypeSources = new HashMap<String, DataTypeSource>();
+ }
+
+ public void addDataTypeSource(DataTypeSource dataTypeSource) {
+ dataTypeSources.put(dataTypeSource.getSourceId(), dataTypeSource);
+ }
+
+ public void removeDataTypeSource(String dataTypeSourceId) {
+ dataTypeSources.remove(dataTypeSourceId);
+ }
+
+ public Set<String> getDataTypeSourceIds() {
+ return dataTypeSources.keySet();
+ }
+
+ public DataTypeSource getDataTypeSourceById(String id) {
+ return dataTypeSources.get(id);
+ }
+
+ public int getNumberOfSources() {
+ return dataTypeSources.size();
+ }
+
+ public void clear() {
+ dataTypeSources.clear();
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/DataTypeSource.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/DataTypeSource.java
new file mode 100644
index 00000000000..d889c27ab64
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/DataTypeSource.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.model;
+
+import java.util.Collection;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class DataTypeSource {
+
+ private final TypeManager<ArtifactDataType> artifactTypeManager;
+ private final TypeManager<AttributeDataType> attributeTypeManager;
+ private final TypeManager<RelationDataType> relationTypeManager;
+
+ private final String sourceId;
+ private final boolean isFromDataStore;
+
+ public DataTypeSource(String sourceId) {
+ this(sourceId, false);
+ }
+
+ public DataTypeSource(String sourceId, boolean isFromDataStore) {
+ this.sourceId = sourceId;
+ this.isFromDataStore = isFromDataStore;
+ artifactTypeManager = new TypeManager<ArtifactDataType>();
+ attributeTypeManager = new TypeManager<AttributeDataType>();
+ relationTypeManager = new TypeManager<RelationDataType>();
+ }
+
+ public String getSourceId() {
+ return sourceId;
+ }
+
+ public boolean isFromDataStore() {
+ return isFromDataStore;
+ }
+
+ public void add(DataType dataType) {
+ if (dataType instanceof ArtifactDataType) {
+ artifactTypeManager.add((ArtifactDataType) dataType);
+ } else if (dataType instanceof AttributeDataType) {
+ attributeTypeManager.add((AttributeDataType) dataType);
+ } else if (dataType instanceof RelationDataType) {
+ relationTypeManager.add((RelationDataType) dataType);
+ }
+ }
+
+ public void addAll(Collection<? extends DataType> dataTypes) {
+ for (DataType dataType : dataTypes) {
+ add(dataType);
+ }
+ }
+
+ public TypeManager<ArtifactDataType> getArtifactTypeManager() {
+ return artifactTypeManager;
+ }
+
+ public TypeManager<AttributeDataType> getAttributeTypeManager() {
+ return attributeTypeManager;
+ }
+
+ public TypeManager<RelationDataType> getRelationTypeManager() {
+ return relationTypeManager;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/IModelListener.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/IModelListener.java
new file mode 100644
index 00000000000..7a91b8d50e5
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/IModelListener.java
@@ -0,0 +1,19 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.model;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface IModelListener {
+
+ public void onModelEvent(Object object);
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/InheritanceLinkModel.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/InheritanceLinkModel.java
new file mode 100644
index 00000000000..f6550df1f64
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/InheritanceLinkModel.java
@@ -0,0 +1,25 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.model;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class InheritanceLinkModel extends ConnectionModel<ArtifactDataType> {
+
+ public InheritanceLinkModel() {
+ super();
+ }
+
+ public InheritanceLinkModel(ArtifactDataType source, ArtifactDataType target) {
+ super(source, target);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/Model.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/Model.java
new file mode 100644
index 00000000000..7dcefffbb26
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/Model.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.model;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class Model {
+ private final Set<IModelListener> listeners;
+
+ public Model() {
+ this.listeners = Collections.synchronizedSet(new HashSet<IModelListener>());
+ }
+
+ public void addListener(IModelListener listener) {
+ if (listener != null) {
+ listeners.add(listener);
+ }
+ }
+
+ public void removeListener(IModelListener listener) {
+ if (listener != null) {
+ listeners.remove(listener);
+ }
+ }
+
+ protected List<IModelListener> getListeners() {
+ return new ArrayList<IModelListener>(listeners);
+ }
+
+ protected void fireModelEvent() {
+ fireModelEvent(null);
+ }
+
+ protected void fireModelEvent(Object object) {
+ for (IModelListener listener : listeners) {
+ listener.onModelEvent(object);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/NodeModel.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/NodeModel.java
new file mode 100644
index 00000000000..47fcbe77162
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/NodeModel.java
@@ -0,0 +1,122 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.model;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.draw2d.geometry.Dimension;
+import org.eclipse.draw2d.geometry.Point;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public abstract class NodeModel extends Model {
+
+ private final Point location;
+ private final Dimension size;
+ @SuppressWarnings("unchecked")
+ private final List<ConnectionModel> sourceConnections;
+ @SuppressWarnings("unchecked")
+ private final List<ConnectionModel> targetConnections;
+
+ @SuppressWarnings("unchecked")
+ public NodeModel() {
+ this.location = new Point(50, 50);
+ this.size = new Dimension(100, 100);
+ this.sourceConnections = new ArrayList<ConnectionModel>();
+ this.targetConnections = new ArrayList<ConnectionModel>();
+
+ }
+
+ @SuppressWarnings("unchecked")
+ void addConnection(ConnectionModel conn) {
+ if (conn != null && conn.getSource() != conn.getTarget()) {
+ if (conn.getSource() == this) {
+ sourceConnections.add(conn);
+ fireModelEvent();
+ } else if (conn.getTarget() == this) {
+ targetConnections.add(conn);
+ fireModelEvent();
+ }
+ }
+ }
+
+ public Point getLocation() {
+ return location.getCopy();
+ }
+
+ public Dimension getSize() {
+ return size.getCopy();
+ }
+
+ public int getWidth() {
+ return getSize().width;
+ }
+
+ public int getHeight() {
+ return getSize().height;
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<ConnectionModel> getSourceConnections() {
+ return new ArrayList<ConnectionModel>(sourceConnections);
+ }
+
+ @SuppressWarnings("unchecked")
+ public List<ConnectionModel> getTargetConnections() {
+ return new ArrayList<ConnectionModel>(targetConnections);
+ }
+
+ @SuppressWarnings("unchecked")
+ void removeConnection(ConnectionModel conn) {
+ if (conn != null) {
+ if (conn.getSource() == this) {
+ sourceConnections.remove(conn);
+ fireModelEvent();
+ } else if (conn.getTarget() == this) {
+ targetConnections.remove(conn);
+ fireModelEvent();
+ }
+ }
+ }
+
+ public void setLocation(Point newLocation) {
+ if (newLocation != null && !newLocation.equals(getLocation())) {
+ location.setLocation(newLocation);
+ fireModelEvent(null);
+ }
+ }
+
+ public void setSize(Dimension newSize) {
+ if (newSize != null && !newSize.equals(getSize())) {
+ size.setSize(newSize);
+ fireModelEvent(null);
+ }
+ }
+
+ public void setWidth(int newWidth) {
+ Dimension dimension = getSize();
+ dimension.width = newWidth;
+ setSize(dimension);
+ }
+
+ @Override
+ protected void fireModelEvent() {
+ super.fireModelEvent();
+ for (ConnectionModel conn : getTargetConnections()) {
+ conn.fireModelEvent();
+ }
+ for (ConnectionModel conn : getSourceConnections()) {
+ conn.fireModelEvent();
+ }
+ }
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/ODMDiagram.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/ODMDiagram.java
new file mode 100644
index 00000000000..fca7bae0926
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/ODMDiagram.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.model;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ODMDiagram extends NodeModel {
+
+ private final Set<DataType> types;
+ private final DataTypeCache cache;
+
+ public ODMDiagram(DataTypeCache cache) {
+ this.types = new HashSet<DataType>();
+ this.cache = cache;
+ }
+
+ public List<DataType> getContent() {
+ return new ArrayList<DataType>(types);
+ }
+
+ public boolean add(DataType dataType) {
+ boolean result = types.add(dataType);
+ if (result) {
+ fireModelEvent(null);
+ }
+ return result;
+ }
+
+ public boolean addAll(Collection<? extends DataType> dataTypes) {
+ boolean result = types.addAll(dataTypes);
+ if (result) {
+ fireModelEvent(null);
+ }
+ return result;
+ }
+
+ public boolean remove(DataType dataType) {
+ boolean result = this.types.remove(dataType);
+ if (result) {
+ fireModelEvent(null);
+ }
+ return result;
+ }
+
+ public boolean removeAll(Collection<? extends DataType> dataTypes) {
+ boolean result = types.removeAll(dataTypes);
+ if (result) {
+ fireModelEvent(null);
+ }
+ return result;
+ }
+
+ public DataTypeCache getCache() {
+ return cache;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/RelationDataType.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/RelationDataType.java
new file mode 100644
index 00000000000..c05bfc2a190
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/RelationDataType.java
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.model;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class RelationDataType extends DataType {
+
+ private String sideAName;
+ private String sideBName;
+ private String aToBPhrase;
+ private String bToAPhrase;
+ private String shortName;
+ private boolean ordered;
+
+ public RelationDataType() {
+ this(EMPTY_STRING, EMPTY_STRING, EMPTY_STRING, EMPTY_STRING, false, EMPTY_STRING, EMPTY_STRING, EMPTY_STRING);
+ }
+
+ public RelationDataType(String name, String aToBPhrase, String bToAPhrase, boolean ordered, String shortName, String sideAName, String sideBName) {
+ this(EMPTY_STRING, name, aToBPhrase, bToAPhrase, ordered, shortName, sideAName, sideBName);
+ }
+
+ public RelationDataType(String typeId, String name, String aToBPhrase, String bToAPhrase, boolean ordered, String shortName, String sideAName, String sideBName) {
+ super(typeId, name);
+ this.aToBPhrase = aToBPhrase;
+ this.bToAPhrase = bToAPhrase;
+ this.ordered = ordered;
+ this.shortName = shortName;
+ this.sideAName = sideAName;
+ this.sideBName = sideBName;
+ }
+
+ /**
+ * @return the sideAName
+ */
+ public String getSideAName() {
+ return sideAName;
+ }
+
+ /**
+ * @param sideAName the sideAName to set
+ */
+ public void setSideAName(String sideAName) {
+ this.sideAName = sideAName;
+ }
+
+ /**
+ * @return the sideBName
+ */
+ public String getSideBName() {
+ return sideBName;
+ }
+
+ /**
+ * @param sideBName the sideBName to set
+ */
+ public void setSideBName(String sideBName) {
+ this.sideBName = sideBName;
+ }
+
+ /**
+ * @return the aToBPhrase
+ */
+ public String getAToBPhrase() {
+ return aToBPhrase;
+ }
+
+ /**
+ * @param toBPhrase the aToBPhrase to set
+ */
+ public void setAToBPhrase(String toBPhrase) {
+ aToBPhrase = toBPhrase;
+ }
+
+ /**
+ * @return the bToAPhrase
+ */
+ public String getBToAPhrase() {
+ return bToAPhrase;
+ }
+
+ /**
+ * @param toAPhrase the bToAPhrase to set
+ */
+ public void setBToAPhrase(String toAPhrase) {
+ bToAPhrase = toAPhrase;
+ }
+
+ /**
+ * @return the shortName
+ */
+ public String getShortName() {
+ return shortName;
+ }
+
+ /**
+ * @param shortName the shortName to set
+ */
+ public void setShortName(String shortName) {
+ this.shortName = shortName;
+ }
+
+ /**
+ * @return the ordered
+ */
+ public boolean getOrdered() {
+ return ordered;
+ }
+
+ /**
+ * @param ordered the ordered to set
+ */
+ public void setOrdered(boolean ordered) {
+ this.ordered = ordered;
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/RelationLinkModel.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/RelationLinkModel.java
new file mode 100644
index 00000000000..8d46b454ab4
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/RelationLinkModel.java
@@ -0,0 +1,53 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.model;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class RelationLinkModel extends ConnectionModel<ArtifactDataType> {
+
+ private RelationDataType relation;
+
+ public RelationLinkModel() {
+ super();
+ relation = null;
+ }
+
+ public RelationLinkModel(RelationDataType relation, ArtifactDataType aSide, ArtifactDataType bSide) {
+ super(aSide, bSide);
+ this.relation = relation;
+ }
+
+ public void setASide(ArtifactDataType aSide) {
+ setSource(aSide);
+ }
+
+ public void setBSide(ArtifactDataType bSide) {
+ setTarget(bSide);
+ }
+
+ public ArtifactDataType getASide() {
+ return getSource();
+ }
+
+ public ArtifactDataType getBSide() {
+ return getTarget();
+ }
+
+ public void setRelation(RelationDataType relation) {
+ this.relation = relation;
+ }
+
+ public RelationDataType getRelation() {
+ return relation;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/TypeManager.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/TypeManager.java
new file mode 100644
index 00000000000..215113deffc
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/TypeManager.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.model;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import org.eclipse.osee.framework.ui.data.model.editor.utility.ODMConstants;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class TypeManager<T extends DataType> {
+
+ private final static DataTypeComparator DATA_TYPE_COMPARATOR = new DataTypeComparator();
+ private final Map<String, T> types;
+
+ public TypeManager() {
+ this.types = new HashMap<String, T>();
+ }
+
+ public Set<String> getIds() {
+ return types.keySet();
+ }
+
+ public List<T> getAll() {
+ return new ArrayList<T>(types.values());
+ }
+
+ public T getById(String uniqueId) {
+ return types.get(uniqueId);
+ }
+
+ public void add(T type) {
+ types.put(type.getUniqueId(), type);
+ }
+
+ public void addAll(Collection<T> types) {
+ for (T type : types) {
+ add(type);
+ }
+ }
+
+ public int size() {
+ return types.size();
+ }
+
+ public T getFirst() {
+ return types.isEmpty() ? null : types.values().iterator().next();
+ }
+
+ public boolean removeById(String uniqueId) {
+ return types.remove(uniqueId) != null;
+ }
+
+ public boolean remove(T object) {
+ String toRemove = null;
+ for (String key : types.keySet()) {
+ if (object.equals(types.get(key))) {
+ toRemove = key;
+ break;
+ }
+ }
+ return toRemove != null ? types.remove(toRemove) != null : false;
+ }
+
+ public List<T> getAllSorted() {
+ List<T> list = getAll();
+ Collections.sort(list, DATA_TYPE_COMPARATOR);
+ return list;
+ }
+
+ private final static class DataTypeComparator implements Comparator<DataType> {
+
+ @Override
+ public int compare(DataType o1, DataType o2) {
+ String text1 = ODMConstants.getDataTypeText(o1);
+ String text2 = ODMConstants.getDataTypeText(o2);
+ return text1.compareTo(text2);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/helper/ArtifactTypeContentProvider.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/helper/ArtifactTypeContentProvider.java
new file mode 100644
index 00000000000..ac4e3c82d6e
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/helper/ArtifactTypeContentProvider.java
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.model.helper;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ArtifactDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.DataTypeCache;
+import org.eclipse.osee.framework.ui.data.model.editor.model.DataTypeSource;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ArtifactTypeContentProvider implements ITreeContentProvider {
+
+ @Override
+ public Object[] getChildren(Object element) {
+ if (element instanceof DataTypeCache) {
+ List<DataTypeSource> sources = new ArrayList<DataTypeSource>();
+ DataTypeCache cache = (DataTypeCache) element;
+ for (String key : cache.getDataTypeSourceIds()) {
+ sources.add(cache.getDataTypeSourceById(key));
+ }
+ return sources.toArray();
+ }
+ if (element instanceof DataTypeSource) {
+ List<PackageModel> data = new ArrayList<PackageModel>();
+
+ List<ArtifactDataType> artifacts = ((DataTypeSource) element).getArtifactTypeManager().getAll();
+ List<ArtifactDataType> topLevel = new ArrayList<ArtifactDataType>();
+ for (ArtifactDataType artifact : artifacts) {
+ if (artifact.getSuperType() == null) {
+ topLevel.add(artifact);
+ }
+ }
+ data.add(new PackageModel(topLevel));
+ return data.toArray();
+ }
+ if (element instanceof PackageModel) {
+ return ((PackageModel) element).getArtifacts().toArray();
+ }
+ if (element instanceof ArtifactDataType) {
+ return ((ArtifactDataType) element).getSubTypes().toArray();
+ }
+ return null;
+ }
+
+ @Override
+ public Object getParent(Object element) {
+ return null;
+ }
+
+ @Override
+ public boolean hasChildren(Object element) {
+ if (element instanceof DataTypeCache) {
+ return !((DataTypeCache) element).getDataTypeSourceIds().isEmpty();
+ }
+ if (element instanceof DataTypeSource) {
+ return ((DataTypeSource) element).getArtifactTypeManager().size() > 0;
+ }
+ if (element instanceof PackageModel) {
+ return !((PackageModel) element).hasArtifactTypes();
+ }
+ if (element instanceof ArtifactDataType) {
+ return !((ArtifactDataType) element).getSubTypes().isEmpty();
+ }
+ return false;
+ }
+
+ @Override
+ public Object[] getElements(Object inputElement) {
+ return getChildren(inputElement);
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/helper/ArtifactTypeLabelProvider.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/helper/ArtifactTypeLabelProvider.java
new file mode 100644
index 00000000000..a7d17dee810
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/helper/ArtifactTypeLabelProvider.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.model.helper;
+
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ArtifactDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.DataTypeSource;
+import org.eclipse.osee.framework.ui.data.model.editor.utility.ODMImage;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ArtifactTypeLabelProvider implements ILabelProvider {
+
+ @Override
+ public void addListener(ILabelProviderListener listener) {
+ }
+
+ @Override
+ public void dispose() {
+ }
+
+ @Override
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ @Override
+ public void removeListener(ILabelProviderListener listener) {
+ }
+
+ @Override
+ public Image getImage(Object element) {
+ if (element instanceof ArtifactDataType) {
+ return ((ArtifactDataType) element).getImage();
+ }
+ if (element instanceof DataTypeSource) {
+ return ((DataTypeSource) element).isFromDataStore() ? ImageManager.getImage(ODMImage.DATASTORE_IMAGE) : ImageManager.getImage(ODMImage.FILE_SOURCE_IMAGE);
+ }
+ if (element instanceof PackageModel) {
+ return ImageManager.getImage(ODMImage.NAMESPACE_IMAGE);
+ }
+ return null;
+ }
+
+ @Override
+ public String getText(Object element) {
+ if (element instanceof DataTypeSource) {
+ return ((DataTypeSource) element).getSourceId();
+ }
+ if (element instanceof ArtifactDataType) {
+ return ((ArtifactDataType) element).getName();
+ }
+ if (element instanceof String) {
+ return (String) element;
+ }
+ return null;
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/helper/ContainerModel.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/helper/ContainerModel.java
new file mode 100644
index 00000000000..646a77fc159
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/helper/ContainerModel.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.model.helper;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ArtifactDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.DataType;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ContainerModel {
+ private final ArtifactDataType artifactDataType;
+ private final ContainerType internals;
+
+ public static enum ContainerType {
+ INHERITED_ATTRIBUTES, INHERITED_RELATIONS, LOCAL_RELATIONS, LOCAL_ATTRIBUTES;
+ }
+
+ public ContainerModel(ArtifactDataType theClass, ContainerType internals) {
+ this.artifactDataType = theClass;
+ this.internals = internals;
+ }
+
+ public List<? extends DataType> getChildren() {
+ List<? extends DataType> children = new ArrayList<DataType>();
+ switch (internals) {
+ case INHERITED_ATTRIBUTES:
+ children = artifactDataType.getInheritedAttributes();
+ break;
+ case LOCAL_ATTRIBUTES:
+ children = artifactDataType.getLocalAttributes();
+ break;
+ case INHERITED_RELATIONS:
+ children = artifactDataType.getInheritedRelations();
+ break;
+ case LOCAL_RELATIONS:
+ children = artifactDataType.getLocalRelations();
+ break;
+ default:
+ break;
+ }
+ return children;
+ }
+
+ public ArtifactDataType getArtifact() {
+ return artifactDataType;
+ }
+
+ public ContainerType getContainerType() {
+ return internals;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/helper/PackageModel.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/helper/PackageModel.java
new file mode 100644
index 00000000000..8a027d30ab0
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/helper/PackageModel.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.model.helper;
+
+import java.util.List;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ArtifactDataType;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class PackageModel {
+ private List<ArtifactDataType> artifacts;
+
+ public PackageModel(List<ArtifactDataType> artifacts) {
+ this.artifacts = artifacts;
+ }
+
+ /**
+ * @return the artifacts
+ */
+ public List<ArtifactDataType> getArtifacts() {
+ return artifacts;
+ }
+
+ /**
+ * @param artifacts the artifacts to set
+ */
+ public void setArtifacts(List<ArtifactDataType> artifacts) {
+ this.artifacts = artifacts;
+ }
+
+ public boolean hasArtifactTypes() {
+ return getArtifacts().isEmpty();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/ArtifactDataTypeXml.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/ArtifactDataTypeXml.java
new file mode 100644
index 00000000000..5e714b46f29
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/ArtifactDataTypeXml.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.model.xml;
+
+import java.io.UnsupportedEncodingException;
+import java.util.logging.Level;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.data.model.editor.ODMEditorActivator;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ArtifactDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.AttributeDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.utility.ImageUtility;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ArtifactDataTypeXml extends BaseXmlDataType<ArtifactDataType> {
+ private final String ARTIFACT_TAG = "artifact";
+
+ private final String IMAGE_DATA = "imageData";
+
+ @Override
+ public String getElementName() {
+ return ARTIFACT_TAG;
+ }
+
+ @Override
+ protected void writeBody(XMLStreamWriter writer, ArtifactDataType dataType) throws XMLStreamException {
+ if (dataType.getSuperType() != null) {
+ writer.writeStartElement("superType");
+ writeIdAttributes(writer, dataType.getSuperType());
+ writer.writeEndElement();
+ }
+
+ for (AttributeDataType attribute : dataType.getLocalAttributes()) {
+ writer.writeStartElement("attribute");
+ writeIdAttributes(writer, attribute);
+ writer.writeEndElement();
+ }
+
+ if (dataType.getImage() != null) {
+ try {
+ writeCDataElement(writer, IMAGE_DATA, new String(ImageUtility.imageToBase64(dataType.getImage()), "UTF-8"));
+ } catch (UnsupportedEncodingException ex) {
+ throw new XMLStreamException(ex);
+ }
+ }
+ }
+
+ private Image stringToImage(String data) {
+ try {
+ return ImageUtility.base64ToImage(data.getBytes("UTF-8"));
+ } catch (Exception ex) {
+ OseeLog.log(ODMEditorActivator.class, Level.SEVERE, ex);
+ }
+ return null;
+ }
+
+ @Override
+ protected void populateFromCDataElement(ArtifactDataType dataType, String tag, String text) throws XMLStreamException {
+ super.populateFromCDataElement(dataType, tag, text);
+ if (IMAGE_DATA.equals(tag)) dataType.setImage(stringToImage(text));
+ }
+
+ @Override
+ protected ArtifactDataType newDataTypeInstance() {
+ return new ArtifactDataType();
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/AttributeDataTypeXml.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/AttributeDataTypeXml.java
new file mode 100644
index 00000000000..345917dd9f4
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/AttributeDataTypeXml.java
@@ -0,0 +1,90 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.model.xml;
+
+import java.util.Map;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import org.eclipse.osee.framework.ui.data.model.editor.model.AttributeDataType;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class AttributeDataTypeXml extends BaseXmlDataType<AttributeDataType> {
+ private final String ATTRIBUTE_TAG = "attribute";
+ private final String MULTIPLICITY = "multiplicity";
+ private final String MIN_OCCURRENCE = "min";
+ private final String MAX_OCCURRENCE = "max";
+ private final String ATTRIBUTE_BASE = "attributeBase";
+ private final String ATTRIBUTE_PROVIDER = "attributeProvider";
+ private final String TAGGER = "tagger";
+ private final String EXTENSION = "extension";
+ private final String DEFAULT_VALUE = "defaultValue";
+ private final String ENUM_TYPE_ID = "enumTypeId";
+ private final String TOOL_TIP = "toolTip";
+
+ @Override
+ public String getElementName() {
+ return ATTRIBUTE_TAG;
+ }
+
+ @Override
+ protected void writeBody(XMLStreamWriter writer, AttributeDataType dataType) throws XMLStreamException {
+ writer.writeStartElement(MULTIPLICITY);
+ writer.writeAttribute(MIN_OCCURRENCE, String.valueOf(dataType.getMinOccurrence()));
+ writer.writeAttribute(MAX_OCCURRENCE, String.valueOf(dataType.getMaxOccurrence()));
+ writer.writeEndElement();
+ writeTextElement(writer, ATTRIBUTE_BASE, dataType.getBaseAttributeClass());
+ writeTextElement(writer, ATTRIBUTE_PROVIDER, dataType.getProviderAttributeClass());
+ writeTextElement(writer, TAGGER, dataType.getTaggerId());
+ writeTextElement(writer, EXTENSION, dataType.getFileTypeExtension());
+ writeCDataElement(writer, DEFAULT_VALUE, dataType.getDefaultValue());
+ writeCDataElement(writer, ENUM_TYPE_ID, String.valueOf(dataType.getEnumTypeId()));
+ writeTextElement(writer, TOOL_TIP, dataType.getToolTipText());
+ }
+
+ @Override
+ protected void populateFromTextElement(AttributeDataType dataType, String tag, String text) throws XMLStreamException {
+ super.populateFromTextElement(dataType, tag, text);
+ if (ATTRIBUTE_BASE.equals(tag)) dataType.setBaseAttributeClass(text);
+ if (ATTRIBUTE_PROVIDER.equals(tag)) dataType.setProviderAttributeClass(text);
+ if (TAGGER.equals(tag)) dataType.setTaggerId(text);
+ if (EXTENSION.equals(tag)) dataType.setFileTypeExtension(text);
+ if (TOOL_TIP.equals(tag)) dataType.setToolTipText(text);
+ }
+
+ @Override
+ protected void populateFromCDataElement(AttributeDataType dataType, String tag, String text) throws XMLStreamException {
+ super.populateFromCDataElement(dataType, tag, text);
+ if (DEFAULT_VALUE.equals(tag)) dataType.setDefaultValue(text);
+ if (ENUM_TYPE_ID.equals(tag)) dataType.setEnumTypeId(Integer.parseInt(text));
+ }
+
+ @Override
+ protected void populateFromAttributes(AttributeDataType dataType, String tag, Map<String, String> attributes) throws XMLStreamException {
+ super.populateFromAttributes(dataType, tag, attributes);
+ if (MULTIPLICITY.equals(tag)) {
+ String value = attributes.get(MIN_OCCURRENCE);
+ if (value != null) {
+ dataType.setMinOccurrence(Integer.parseInt(value));
+ }
+ value = attributes.get(MAX_OCCURRENCE);
+ if (value != null) {
+ dataType.setMaxOccurrence(Integer.parseInt(value));
+ }
+ }
+ }
+
+ @Override
+ protected AttributeDataType newDataTypeInstance() {
+ return new AttributeDataType();
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/BaseXmlDataType.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/BaseXmlDataType.java
new file mode 100644
index 00000000000..b0f86a068c3
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/BaseXmlDataType.java
@@ -0,0 +1,125 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.model.xml;
+
+import java.util.HashMap;
+import java.util.Map;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import javax.xml.stream.XMLStreamWriter;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.ui.data.model.editor.model.DataType;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public abstract class BaseXmlDataType<T extends DataType> {
+
+ public BaseXmlDataType() {
+ }
+
+ protected void writeCDataElement(XMLStreamWriter writer, String tag, String value) throws XMLStreamException {
+ if (value != null) {
+ value = value.trim();
+ if (Strings.isValid(value)) {
+ writer.writeStartElement(tag);
+ writer.writeCData(value);
+ writer.writeEndElement();
+ }
+ }
+ }
+
+ protected void writeTextElement(XMLStreamWriter writer, String tag, String value) throws XMLStreamException {
+ if (value != null) {
+ value = value.trim();
+ if (Strings.isValid(value)) {
+ writer.writeStartElement(tag);
+ writer.writeCharacters(value);
+ writer.writeEndElement();
+ }
+ }
+ }
+
+ protected void writeIdAttributes(XMLStreamWriter writer, DataType dataType) throws XMLStreamException {
+ writer.writeAttribute("name", dataType.getName());
+ }
+
+ public final void write(XMLStreamWriter writer, T dataType) throws XMLStreamException {
+ writer.writeStartElement(getElementName());
+ writeIdAttributes(writer, dataType);
+ writeBody(writer, dataType);
+ writer.writeEndElement();
+ }
+
+ protected abstract T newDataTypeInstance();
+
+ protected void populateFromAttributes(T dataType, String tag, Map<String, String> attributes) throws XMLStreamException {
+ if (tag.equals(getElementName())) {
+ dataType.setName(attributes.get("name"));
+ }
+ }
+
+ protected void populateFromTextElement(T dataType, String tag, String text) throws XMLStreamException {
+
+ }
+
+ protected void populateFromCDataElement(T dataType, String tag, String text) throws XMLStreamException {
+
+ }
+
+ private Map<String, String> getAttributes(XMLStreamReader reader) throws XMLStreamException {
+ int count = reader.getAttributeCount();
+ Map<String, String> attributes = new HashMap<String, String>();
+ for (int index = 0; index < count; index++) {
+ attributes.put(reader.getAttributeLocalName(index), reader.getAttributeValue(index));
+ }
+ return attributes;
+ }
+
+ public final void fromXml(XMLStreamReader reader, IDataTypeCollector<T> collector) throws XMLStreamException {
+ T object = null;
+ String currentElement = null;
+ boolean isDone = false;
+ while (reader.hasNext() && !isDone) {
+ int eventType = reader.getEventType();
+ switch (eventType) {
+ case XMLStreamConstants.START_ELEMENT:
+ currentElement = reader.getLocalName();
+ if (currentElement.equals(getElementName())) {
+ object = newDataTypeInstance();
+ }
+ populateFromAttributes(object, currentElement, getAttributes(reader));
+ break;
+ case XMLStreamConstants.END_ELEMENT:
+ if (currentElement.equals(getElementName())) {
+ isDone = true;
+ collector.collect(object);
+ }
+ currentElement = null;
+ break;
+ case XMLStreamConstants.CDATA:
+ populateFromCDataElement(object, currentElement, reader.getText());
+ break;
+ case XMLStreamConstants.CHARACTERS:
+ populateFromTextElement(object, currentElement, reader.getText());
+ break;
+ default:
+ break;
+ }
+ reader.next();
+ }
+ }
+
+ public abstract String getElementName();
+
+ protected abstract void writeBody(XMLStreamWriter writer, T dataType) throws XMLStreamException;
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/IDataTypeCollector.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/IDataTypeCollector.java
new file mode 100644
index 00000000000..6bf87878700
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/IDataTypeCollector.java
@@ -0,0 +1,21 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.model.xml;
+
+import org.eclipse.osee.framework.ui.data.model.editor.model.DataType;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public interface IDataTypeCollector<T extends DataType> {
+
+ public void collect(T object);
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/ImportDataTypeXml.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/ImportDataTypeXml.java
new file mode 100644
index 00000000000..84ee79bbaca
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/ImportDataTypeXml.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.model.xml;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import org.eclipse.osee.framework.ui.data.model.editor.model.DataType;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ImportDataTypeXml extends BaseXmlDataType<DataType> {
+
+ @Override
+ public String getElementName() {
+ return "import";
+ }
+
+ @Override
+ protected void writeBody(XMLStreamWriter writer, DataType dataType) throws XMLStreamException {
+ writer.writeAttribute("type", dataType.getClass().getSimpleName());
+ }
+
+ @Override
+ protected DataType newDataTypeInstance() {
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/ODMXmlFactory.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/ODMXmlFactory.java
new file mode 100644
index 00000000000..30ce31e0e7c
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/ODMXmlFactory.java
@@ -0,0 +1,42 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.model.xml;
+
+import java.util.HashMap;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ArtifactDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.AttributeDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.DataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.RelationDataType;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ODMXmlFactory {
+ private final HashMap<String, BaseXmlDataType<?>> writerMap;
+
+ public ODMXmlFactory() {
+ writerMap = new HashMap<String, BaseXmlDataType<?>>();
+ writerMap.put(ArtifactDataType.class.getSimpleName(), new ArtifactDataTypeXml());
+ writerMap.put(AttributeDataType.class.getSimpleName(), new AttributeDataTypeXml());
+ writerMap.put(RelationDataType.class.getSimpleName(), new RelationDataTypeXml());
+ writerMap.put(DataType.class.getSimpleName(), new ImportDataTypeXml());
+ }
+
+ @SuppressWarnings("unchecked")
+ public BaseXmlDataType<DataType> getXmlDataType(Class clazzToGet) {
+ return (BaseXmlDataType<DataType>) writerMap.get(clazzToGet.getSimpleName());
+ }
+
+ @SuppressWarnings("unchecked")
+ public BaseXmlDataType<DataType> getXmlDataType(String clazzToGet) {
+ return (BaseXmlDataType<DataType>) writerMap.get(clazzToGet);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/ODMXmlReader.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/ODMXmlReader.java
new file mode 100644
index 00000000000..2b97e109fe1
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/ODMXmlReader.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.model.xml;
+
+import java.io.InputStream;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamConstants;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeExceptions;
+import org.eclipse.osee.framework.ui.data.model.editor.model.DataType;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ODMXmlReader {
+
+ private ODMXmlFactory xmlDataTypeFactory;
+ private XMLStreamReader reader;
+
+ public ODMXmlReader(InputStream inputStream) throws OseeCoreException {
+ try {
+ XMLInputFactory factory = XMLInputFactory.newInstance();
+ reader = factory.createXMLStreamReader(inputStream, "UTF-8");
+ xmlDataTypeFactory = new ODMXmlFactory();
+ } catch (Exception ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ }
+
+ public void execute(IProgressMonitor monitor) throws XMLStreamException {
+ while (reader.hasNext()) {
+ int eventType = reader.getEventType();
+ switch (eventType) {
+ case XMLStreamConstants.START_ELEMENT:
+ String element = reader.getLocalName();
+ BaseXmlDataType<DataType> handler = xmlDataTypeFactory.getXmlDataType(element);
+ if (handler != null) {
+ // handler.fromXml(reader, collector);
+ }
+ break;
+ default:
+ break;
+ }
+ reader.next();
+ }
+ }
+
+ public void close() throws XMLStreamException {
+ if (reader != null) {
+ reader.close();
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/ODMXmlWriter.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/ODMXmlWriter.java
new file mode 100644
index 00000000000..f559178e8ea
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/ODMXmlWriter.java
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.model.xml;
+
+import java.io.OutputStream;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import javax.xml.stream.XMLOutputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeExceptions;
+import org.eclipse.osee.framework.jdk.core.util.Collections;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ArtifactDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.AttributeDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.DataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.RelationDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.utility.ODMConstants;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ODMXmlWriter {
+
+ private XMLStreamWriter writer;
+ private ODMXmlFactory xmlDataTypeFactory;
+
+ public ODMXmlWriter(OutputStream outputStream) throws OseeCoreException {
+ try {
+ XMLOutputFactory factory = XMLOutputFactory.newInstance();
+ writer = factory.createXMLStreamWriter(outputStream, "UTF-8");
+ writer.writeStartDocument("UTF-8", "1.0");
+ writer.writeStartElement("oseeTypes");
+ xmlDataTypeFactory = new ODMXmlFactory();
+ } catch (Exception ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ }
+
+ public void write(IProgressMonitor monitor, ArtifactDataType... artifacts) throws OseeCoreException {
+ try {
+ if (artifacts != null && artifacts.length > 0) {
+ Set<ArtifactDataType> superTypes = new HashSet<ArtifactDataType>();
+ Set<ArtifactDataType> artifactCache = new HashSet<ArtifactDataType>();
+ Set<AttributeDataType> attributeCache = new HashSet<AttributeDataType>();
+ Set<RelationDataType> relationCache = new HashSet<RelationDataType>();
+
+ for (ArtifactDataType artifact : artifacts) {
+ artifactCache.add(artifact);
+ if (artifact.getSuperType() != null) {
+ superTypes.add(artifact.getSuperType());
+ }
+ attributeCache.addAll(artifact.getLocalAttributes());
+ relationCache.addAll(artifact.getLocalRelations());
+ }
+
+ List<ArtifactDataType> toImport = Collections.setComplement(superTypes, artifactCache);
+ if (!toImport.isEmpty()) {
+ BaseXmlDataType<DataType> toReturn = xmlDataTypeFactory.getXmlDataType(DataType.class);
+ writer.writeStartElement("imports");
+ for (ArtifactDataType artifact : toImport) {
+ toReturn.write(writer, artifact);
+ }
+ writer.writeEndElement();
+ }
+
+ writeCollection(monitor, attributeCache);
+ writeCollection(monitor, relationCache);
+ writeCollection(monitor, artifactCache);
+ }
+ } catch (Exception ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ }
+
+ private void writeCollection(IProgressMonitor monitor, Collection<? extends DataType> collection) throws XMLStreamException {
+ if (!collection.isEmpty()) {
+ Class<?> clazz = collection.iterator().next().getClass();
+ BaseXmlDataType<DataType> toReturn = xmlDataTypeFactory.getXmlDataType(clazz);
+ String typeName = clazz.getSimpleName();
+ writer.writeStartElement(typeName);
+ int index = 0;
+ int total = collection.size();
+ for (DataType dataType : collection) {
+ monitor.subTask(String.format("Writing %s [%s of %s]", typeName, ++index, total));
+ toReturn.write(writer, dataType);
+ }
+ monitor.worked(ODMConstants.SHORT_TASK_STEPS);
+ writer.writeEndElement();
+ }
+ }
+
+ public void close() throws XMLStreamException {
+ try {
+ writer.writeEndElement();
+ writer.writeEndDocument();
+ } finally {
+ try {
+ writer.flush();
+ } finally {
+ if (writer != null) {
+ writer.close();
+ }
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/RelationDataTypeXml.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/RelationDataTypeXml.java
new file mode 100644
index 00000000000..75613386007
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/model/xml/RelationDataTypeXml.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.model.xml;
+
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamWriter;
+import org.eclipse.osee.framework.ui.data.model.editor.model.RelationDataType;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class RelationDataTypeXml extends BaseXmlDataType<RelationDataType> {
+ private final String RELATION_TAG = "relation";
+
+ private final String ORDER = "order";
+ private final String SIDE_A_NAME = "sideAName";
+ private final String SIDE_B_NAME = "sideBName";
+
+ private final String SHORT_NAME = "shortName";
+ private final String A_TO_B_PHRASE = "aToBPhrase";
+ private final String B_TO_A_PHRASE = "bToAPhrase";
+
+ public RelationDataTypeXml() {
+ }
+
+ @Override
+ public String getElementName() {
+ return RELATION_TAG;
+ }
+
+ @Override
+ protected void writeBody(XMLStreamWriter writer, RelationDataType dataType) throws XMLStreamException {
+ writeTextElement(writer, ORDER, String.valueOf(dataType.getOrdered()));
+ writeTextElement(writer, SIDE_A_NAME, dataType.getSideAName());
+ writeTextElement(writer, SIDE_B_NAME, dataType.getSideBName());
+ writeTextElement(writer, SHORT_NAME, dataType.getShortName());
+ writeTextElement(writer, A_TO_B_PHRASE, dataType.getAToBPhrase());
+ writeTextElement(writer, B_TO_A_PHRASE, dataType.getBToAPhrase());
+ }
+
+ @Override
+ protected void populateFromTextElement(RelationDataType dataType, String tag, String text) throws XMLStreamException {
+ super.populateFromTextElement(dataType, tag, text);
+ if (ORDER.equals(tag)) dataType.setOrdered(Boolean.parseBoolean(text));
+ if (SIDE_A_NAME.equals(tag)) dataType.setSideAName(text);
+ if (SIDE_B_NAME.equals(tag)) dataType.setSideBName(text);
+ if (SHORT_NAME.equals(tag)) dataType.setShortName(text);
+ if (A_TO_B_PHRASE.equals(tag)) dataType.setAToBPhrase(text);
+ if (B_TO_A_PHRASE.equals(tag)) dataType.setBToAPhrase(text);
+ }
+
+ @Override
+ protected RelationDataType newDataTypeInstance() {
+ return new RelationDataType();
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/operation/ODMLoadGraphRunnable.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/operation/ODMLoadGraphRunnable.java
new file mode 100644
index 00000000000..025371b6da8
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/operation/ODMLoadGraphRunnable.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.operation;
+
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.gef.GraphicalViewer;
+import org.eclipse.osee.framework.plugin.core.util.IExceptionableRunnable;
+import org.eclipse.osee.framework.ui.data.model.editor.core.ODMEditor;
+import org.eclipse.osee.framework.ui.data.model.editor.core.ODMEditorInput;
+import org.eclipse.osee.framework.ui.data.model.editor.input.OseeDataTypeFactory;
+import org.eclipse.osee.framework.ui.data.model.editor.model.DataTypeCache;
+import org.eclipse.osee.framework.ui.data.model.editor.model.DataTypeSource;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ODMDiagram;
+import org.eclipse.osee.framework.ui.data.model.editor.utility.ODMConstants;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ODMLoadGraphRunnable implements IExceptionableRunnable {
+
+ private GraphicalViewer viewer;
+ private ODMEditor editor;
+ private ODMEditorInput input;
+
+ public ODMLoadGraphRunnable(GraphicalViewer viewer, ODMEditor editor, ODMEditorInput input) {
+ super();
+ this.viewer = viewer;
+ this.editor = editor;
+ this.input = input;
+ }
+
+ public String getName() {
+ return "Loading Osee Data Type Graph";
+ }
+
+ @Override
+ public IStatus run(IProgressMonitor monitor) throws Exception {
+ monitor.beginTask(getName(), ODMConstants.TOTAL_STEPS);
+ monitor.worked(ODMConstants.SHORT_TASK_STEPS);
+ monitor.setTaskName("Initializating cache");
+ DataTypeCache dataTypeCache = input.getDataTypeCache();
+ dataTypeCache.clear();
+ monitor.worked(ODMConstants.SHORT_TASK_STEPS);
+
+ OseeDataTypeFactory.addTypesFromDataStore(dataTypeCache);
+ monitor.worked(ODMConstants.SHORT_TASK_STEPS);
+
+ IResource resource = input.getResource();
+ if (resource != null) {
+ DataTypeSource dataTypeSource = OseeDataTypeFactory.loadFromFile(resource.getFullPath());
+ dataTypeCache.addDataTypeSource(dataTypeSource);
+ }
+ monitor.worked(ODMConstants.SHORT_TASK_STEPS);
+
+ if (editor != null) {
+ monitor.setTaskName("Drawing graph");
+ Display.getDefault().syncExec(new Runnable() {
+ public void run() {
+ viewer.setContents(new ODMDiagram(input.getDataTypeCache()));
+ editor.updatePalette();
+ }
+ });
+ }
+ return Status.OK_STATUS;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/operation/ODMToXmlOperation.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/operation/ODMToXmlOperation.java
new file mode 100644
index 00000000000..4901e1ea830
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/operation/ODMToXmlOperation.java
@@ -0,0 +1,114 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.operation;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.OutputStream;
+import java.util.Collection;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeExceptions;
+import org.eclipse.osee.framework.jdk.core.type.HashCollection;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ArtifactDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.xml.ODMXmlWriter;
+import org.eclipse.osee.framework.ui.data.model.editor.utility.ODMConstants;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ODMToXmlOperation {
+ private final String filePath;
+ private final ArtifactDataType[] dataTypes;
+ private final boolean exportAsSingleFile;
+
+ public ODMToXmlOperation(String filePath, boolean exportAsSingleFile, ArtifactDataType... dataTypes) {
+ this.filePath = filePath;
+ this.dataTypes = dataTypes;
+ this.exportAsSingleFile = exportAsSingleFile;
+ }
+
+ public void execute(IProgressMonitor monitor) throws OseeCoreException {
+ try {
+ monitor.beginTask(String.format("Writing [%s] types to xml [%s]", dataTypes.length, filePath),
+ ODMConstants.TOTAL_STEPS);
+ if (exportAsSingleFile) {
+ writeToSingleFile(monitor);
+ } else {
+ writeToMultiFiles(monitor);
+ }
+ } catch (Exception ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ } finally {
+ monitor.subTask("");
+ monitor.done();
+ }
+ }
+
+ private void writeToSingleFile(IProgressMonitor monitor) throws Exception {
+ File file = new File(filePath);
+ File parent = file.getParentFile();
+ if (parent != null && !parent.exists()) {
+ parent.mkdirs();
+ }
+ writeXml(monitor, file, dataTypes);
+ monitor.worked(ODMConstants.VERY_LONG_TASK);
+ }
+
+ private void writeToMultiFiles(IProgressMonitor monitor) throws Exception {
+ File directory = new File(filePath);
+ if (directory != null && !directory.exists()) {
+ directory.mkdirs();
+ }
+ HashCollection<String, ArtifactDataType> typesByNamespace = new HashCollection<String, ArtifactDataType>();
+ for (ArtifactDataType type : dataTypes) {
+ typesByNamespace.put("default", type);
+ }
+ for (String key : typesByNamespace.keySet()) {
+ Collection<ArtifactDataType> types = typesByNamespace.getValues(key);
+ if (types != null && !types.isEmpty()) {
+ String fileName = getFileName(key);
+ monitor.subTask(String.format("Writing [%s] types into [%s]", types.size(), fileName));
+ File file = new File(directory, fileName);
+ writeXml(monitor, file, types.toArray(new ArtifactDataType[types.size()]));
+ }
+ monitor.worked(ODMConstants.SHORT_TASK_STEPS);
+ }
+ }
+
+ private String getFileName(String key) {
+ return String.format("osee.types.%s.xml", key);
+ }
+
+ private void writeXml(IProgressMonitor listener, File file, ArtifactDataType... types) throws Exception {
+ OutputStream outputStream = null;
+ ODMXmlWriter xmlWriter = null;
+ try {
+ if (types != null && types.length > 0) {
+ outputStream = new FileOutputStream(file);
+ xmlWriter = new ODMXmlWriter(outputStream);
+ xmlWriter.write(listener, dataTypes);
+ } else {
+ throw new Exception(String.format("Data not available - invalid artifact types"));
+ }
+ } finally {
+ try {
+ if (xmlWriter != null) {
+ xmlWriter.close();
+ }
+ } finally {
+ if (outputStream != null) {
+ outputStream.close();
+ }
+ }
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/operation/XmlToODMOperation.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/operation/XmlToODMOperation.java
new file mode 100644
index 00000000000..b32edf047d0
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/operation/XmlToODMOperation.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.operation;
+
+import java.io.File;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.exception.OseeExceptions;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class XmlToODMOperation {
+
+ private final File[] resources;
+
+ public XmlToODMOperation(File[] resources) {
+ this.resources = resources;
+ }
+
+ public void execute(IProgressMonitor listener) throws OseeCoreException {
+ try {
+
+ } catch (Exception ex) {
+ OseeExceptions.wrapAndThrow(ex);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/outline/OutlineTreePartFactory.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/outline/OutlineTreePartFactory.java
new file mode 100644
index 00000000000..9cc39a4f1a1
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/outline/OutlineTreePartFactory.java
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.outline;
+
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartFactory;
+import org.eclipse.osee.framework.ui.data.model.editor.part.StringEditPart;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class OutlineTreePartFactory implements EditPartFactory {
+
+ public OutlineTreePartFactory() {
+ super();
+ }
+
+ public EditPart createEditPart(EditPart context, Object model) {
+ EditPart toReturn = null;
+ if (model instanceof String) {
+ toReturn = new StringEditPart((String) model);
+ }
+ // if (model instanceof Diagram) {
+ // return new DiagramTreeEditPart((Diagram) model);
+ // } else if (model instanceof EPackage) {
+ // return new PackageTreeEditPart((EPackage) model);
+ // } else if (model instanceof EClassifier) {
+ // return new ClassifierTreeEditPart((EClassifier) model);
+ // } else if (model instanceof EReference) {
+ // return new ReferenceTreeEditPart((EReference) model);
+ // } else if (model instanceof InheritanceModel) {
+ // return new InheritanceTreeEditPart((InheritanceModel) model);
+ // }
+ return toReturn;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/ArtifactEditPart.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/ArtifactEditPart.java
new file mode 100644
index 00000000000..7f0ed39cb0a
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/ArtifactEditPart.java
@@ -0,0 +1,191 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.part;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gef.editpolicies.GraphicalNodeEditPolicy;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.requests.CreateConnectionRequest;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gef.requests.ReconnectRequest;
+import org.eclipse.osee.framework.ui.data.model.editor.command.CreateAttributeCommand;
+import org.eclipse.osee.framework.ui.data.model.editor.command.CreateConnectionCommand;
+import org.eclipse.osee.framework.ui.data.model.editor.command.CreateRelationCommand;
+import org.eclipse.osee.framework.ui.data.model.editor.command.ReconnectConnectionCommand;
+import org.eclipse.osee.framework.ui.data.model.editor.figure.ArtifactTypeFigure;
+import org.eclipse.osee.framework.ui.data.model.editor.figure.SelectableLabel;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ArtifactDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.AttributeDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ConnectionModel;
+import org.eclipse.osee.framework.ui.data.model.editor.model.InheritanceLinkModel;
+import org.eclipse.osee.framework.ui.data.model.editor.model.RelationDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.RelationLinkModel;
+import org.eclipse.osee.framework.ui.data.model.editor.model.helper.ContainerModel;
+import org.eclipse.osee.framework.ui.data.model.editor.model.helper.ContainerModel.ContainerType;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ArtifactEditPart extends DataTypeEditPart {
+
+ @SuppressWarnings("unchecked")
+ private List children;
+
+ public ArtifactEditPart(Object model) {
+ super((ArtifactDataType) model);
+ }
+
+ protected void createEditPolicies() {
+ super.createEditPolicies();
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, new ArtifactLayoutEditPolicy());
+ installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new ArtifactGraphicalNodeEditPolicy());
+ }
+
+ protected IFigure createFigure() {
+ return new ArtifactTypeFigure(new Label(), new SelectableLabel());
+ }
+
+ public IFigure getContentPane() {
+ return ((ArtifactTypeFigure) getFigure()).getContentPane();
+ }
+
+ protected IFigure getDirectEditFigure() {
+ return ((ArtifactTypeFigure) getFigure()).getNameFigure();
+ }
+
+ private ArtifactDataType getArtifactDataType() {
+ return (ArtifactDataType) getDataType();
+ }
+
+ public boolean canDeleteFromDiagram() {
+ return true;
+ }
+
+ @SuppressWarnings("unchecked")
+ protected List getModelChildren() {
+ ArtifactDataType model = getArtifactDataType();
+ if (children == null) {
+ children = new ArrayList();
+ children.add(new ContainerModel(model, ContainerType.INHERITED_ATTRIBUTES));
+ children.add(new ContainerModel(model, ContainerType.LOCAL_ATTRIBUTES));
+ children.add(new ContainerModel(model, ContainerType.INHERITED_RELATIONS));
+ children.add(new ContainerModel(model, ContainerType.LOCAL_RELATIONS));
+ }
+// checkInheritance();
+ return children;
+ }
+
+// private void checkInheritance() {
+// ArtifactDataType model = getArtifactDataType();
+//
+// for (ArtifactDataType key : toRemove) {
+// InheritanceLinkModel link = inheritanceMap.remove(key);
+// if (link != null) {
+// children.remove(link);
+// }
+// }
+// }
+
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ ArtifactTypeFigure artifactTypeFigure = ((ArtifactTypeFigure) getFigure());
+ artifactTypeFigure.setHeaderIcon(getArtifactDataType().getImage());
+ ((Label) artifactTypeFigure.getNameFigure()).setText(getArtifactDataType().getName());
+
+ artifactTypeFigure.getNameFigure().setFont(null);
+
+ getFigure().setBackgroundColor(ColorConstants.white);
+ super.refreshChildren();
+ }
+
+ protected void handleModelEvent(Object msg) {
+ refreshVisuals();
+ }
+
+ private final class ArtifactLayoutEditPolicy extends LayoutEditPolicy {
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ return null;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ if (request.getNewObject() instanceof AttributeDataType) {
+ return new CreateAttributeCommand((AttributeDataType) request.getNewObject(),
+ ((ArtifactEditPart) getHost()).getArtifactDataType());
+ } else if (request.getNewObject() instanceof RelationDataType) {
+ return new CreateRelationCommand(((RelationDataType) request.getNewObject()),
+ ((ArtifactEditPart) getHost()).getArtifactDataType());
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ protected Command getDeleteDependantCommand(Request request) {
+ return null;
+ }
+
+ protected Command getMoveChildrenCommand(Request request) {
+ return UnexecutableCommand.INSTANCE;
+ }
+ }
+
+ private final class ArtifactGraphicalNodeEditPolicy extends GraphicalNodeEditPolicy {
+ protected Command getConnectionCompleteCommand(CreateConnectionRequest request) {
+ CreateConnectionCommand cmd = (CreateConnectionCommand) request.getStartCommand();
+ cmd.setTarget((ArtifactDataType) getHost().getModel());
+ return cmd;
+ }
+
+ protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
+ ConnectionModel connectionModel = (ConnectionModel) request.getNewObject();
+ if (connectionModel instanceof RelationLinkModel || connectionModel instanceof InheritanceLinkModel) {
+ ArtifactDataType source = (ArtifactDataType) getHost().getModel();
+ Command cmd = new CreateConnectionCommand(connectionModel, source);
+ request.setStartCommand(cmd);
+ return cmd;
+ }
+ return null;
+ }
+
+ @SuppressWarnings("unchecked")
+ protected Command getReconnectSourceCommand(ReconnectRequest request) {
+ ConnectionModel<ArtifactDataType> connectionModel =
+ (ConnectionModel<ArtifactDataType>) request.getConnectionEditPart().getModel();
+ if (connectionModel instanceof RelationLinkModel || connectionModel instanceof InheritanceLinkModel) {
+ ArtifactDataType source = (ArtifactDataType) getHost().getModel();
+ ReconnectConnectionCommand cmd = new ReconnectConnectionCommand(connectionModel);
+ cmd.setNewSource(source);
+ return cmd;
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ @SuppressWarnings("unchecked")
+ protected Command getReconnectTargetCommand(ReconnectRequest request) {
+ ConnectionModel<ArtifactDataType> connectionModel =
+ (ConnectionModel<ArtifactDataType>) request.getConnectionEditPart().getModel();
+ if (connectionModel instanceof RelationLinkModel || connectionModel instanceof InheritanceLinkModel) {
+ ArtifactDataType target = (ArtifactDataType) getHost().getModel();
+ ReconnectConnectionCommand cmd = new ReconnectConnectionCommand(connectionModel);
+ cmd.setNewTarget(target);
+ return cmd;
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/AttributeEditPart.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/AttributeEditPart.java
new file mode 100644
index 00000000000..8962b41b8a6
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/AttributeEditPart.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.part;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.osee.framework.ui.data.model.editor.figure.SelectableLabel;
+import org.eclipse.osee.framework.ui.data.model.editor.model.AttributeDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.helper.ContainerModel.ContainerType;
+import org.eclipse.osee.framework.ui.data.model.editor.utility.ODMConstants;
+import org.eclipse.osee.framework.ui.data.model.editor.utility.ODMImage;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class AttributeEditPart extends ComponentEditPart {
+
+ public AttributeEditPart(Object model) {
+ super((AttributeDataType) model);
+ }
+
+ @Override
+ protected boolean isInherited() {
+ ContainerType value = getContainerType();
+ return value != null && value == ContainerType.INHERITED_ATTRIBUTES;
+ }
+
+ @Override
+ protected void refreshVisuals() {
+ SelectableLabel labelFigure = (SelectableLabel) getFigure();
+ String displayText = ODMConstants.getDataTypeText(getModelAsDataType());
+ labelFigure.setText(displayText);
+ labelFigure.setIcon(ImageManager.getImage(ODMImage.LOCAL_ATTRIBUTE));
+ labelFigure.setSelectable(true);
+
+ if (isInherited()) {
+ labelFigure.setBackgroundColor(ColorConstants.tooltipBackground);
+ labelFigure.setIcon(ImageManager.getImage(ODMImage.INHERITED_ATTRIBUTE));
+ labelFigure.setSelectable(false);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/BaseEditPart.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/BaseEditPart.java
new file mode 100644
index 00000000000..da47b9c366a
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/BaseEditPart.java
@@ -0,0 +1,183 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.part;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.MarginBorder;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.draw2d.text.TextFlow;
+import org.eclipse.gef.DragTracker;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.RequestConstants;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
+import org.eclipse.gef.editpolicies.ComponentEditPolicy;
+import org.eclipse.gef.editpolicies.DirectEditPolicy;
+import org.eclipse.gef.requests.GroupRequest;
+import org.eclipse.gef.tools.CellEditorLocator;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.gef.tools.SelectEditPartTracker;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.osee.framework.ui.data.model.editor.command.DeleteCommand;
+import org.eclipse.osee.framework.ui.data.model.editor.figure.SelectableLabel;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ArtifactDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.IModelListener;
+import org.eclipse.osee.framework.ui.data.model.editor.model.NodeModel;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ODMDiagram;
+import org.eclipse.osee.framework.ui.data.model.editor.model.helper.ContainerModel;
+import org.eclipse.osee.framework.ui.data.model.editor.policy.LabelSelectionEditPolicy;
+import org.eclipse.osee.framework.ui.data.model.editor.property.PropertySourceFactory;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.views.properties.IPropertySource;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public abstract class BaseEditPart extends AbstractGraphicalEditPart {
+
+ protected DirectEditManager manager;
+
+ protected IModelListener modelListener = new IModelListener() {
+
+ @Override
+ public void onModelEvent(Object object) {
+ handleModelEvent(object);
+ }
+ };
+
+ public BaseEditPart(NodeModel obj) {
+ super();
+ setModel(obj);
+ }
+
+ protected abstract void handleModelEvent(Object object);
+
+ public void activate() {
+ super.activate();
+ ((NodeModel) getModel()).addListener(modelListener);
+ }
+
+ protected abstract DirectEditPolicy createDirectEditPolicy();
+
+ public boolean canDeleteFromDiagram() {
+ return false;
+ }
+
+ protected void createEditPolicies() {
+ installEditPolicy(EditPolicy.DIRECT_EDIT_ROLE, createDirectEditPolicy());
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, new LabelSelectionEditPolicy());
+ installEditPolicy(EditPolicy.COMPONENT_ROLE, new ComponentEditPolicy() {
+ protected Command createDeleteCommand(GroupRequest deleteRequest) {
+ Command toReturn = UnexecutableCommand.INSTANCE;
+
+ Object model = ((AbstractGraphicalEditPart) getParent()).getModel();
+ if (model != null) {
+ Boolean booleanObject =
+ (Boolean) deleteRequest.getExtendedData().get(DeleteCommand.DELETE_FROM_ODM_DIAGRAM);
+ boolean isDeleteFromDiagram = booleanObject == null ? false : booleanObject.booleanValue();
+
+ if (model instanceof ContainerModel) {
+ DeleteCommand cmd = new DeleteCommand();
+ cmd.setPartToBeDeleted(getHost().getModel(), ((ContainerModel) model).getArtifact(),
+ isDeleteFromDiagram);
+ toReturn = cmd;
+ } else if (model instanceof ODMDiagram && getHost().getModel() instanceof ArtifactDataType) {
+ DeleteCommand cmd = new DeleteCommand();
+ cmd.setPartToBeDeleted(getHost().getModel(), model, isDeleteFromDiagram);
+ toReturn = cmd;
+ }
+ }
+ return toReturn;
+ }
+ });
+ }
+
+ protected IFigure createFigure() {
+ IFigure fig = new SelectableLabel();
+ fig.setBorder(new MarginBorder(0, 1, 0, 0));
+ return fig;
+ }
+
+ public void deactivate() {
+ ((NodeModel) getModel()).removeListener(modelListener);
+ super.deactivate();
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object getAdapter(Class key) {
+ if (IPropertySource.class == key) {
+ return PropertySourceFactory.getPropertySource(getModel());
+ }
+ return super.getAdapter(key);
+ }
+
+ IFigure getDirectEditFigure() {
+ return getFigure();
+ }
+
+ String getDirectEditText() {
+ IFigure fig = getDirectEditFigure();
+ if (fig instanceof Label) {
+ return ((Label) fig).getText();
+ } else if (fig instanceof TextFlow) {
+ return ((TextFlow) fig).getText();
+ }
+ return "";
+ }
+
+ public DragTracker getDragTracker(Request request) {
+ return new SelectEditPartTracker(this);
+ }
+
+ protected void performDirectEdit() {
+ if (manager == null) {
+ manager = new LabelDirectEditManager(this, new LabelCellEditorLocator(getDirectEditFigure()));
+ }
+ manager.show();
+ }
+
+ public void performRequest(Request request) {
+ if (request.getType() == RequestConstants.REQ_DIRECT_EDIT) {
+ performDirectEdit();
+ } else {
+ super.performRequest(request);
+ }
+ }
+
+ private final class LabelCellEditorLocator implements CellEditorLocator {
+
+ protected IFigure fig;
+
+ public LabelCellEditorLocator(IFigure figure) {
+ fig = figure;
+ }
+
+ public void relocate(CellEditor celleditor) {
+ Text text = (Text) celleditor.getControl();
+
+ Rectangle rect = fig.getClientArea(Rectangle.SINGLETON);
+ if (fig instanceof Label) {
+ rect = ((Label) fig).getTextBounds().intersect(rect);
+ }
+ fig.translateToAbsolute(rect);
+
+ org.eclipse.swt.graphics.Rectangle trim = text.computeTrim(0, 0, 0, 0);
+ rect.translate(trim.x, trim.y);
+ rect.width += trim.width;
+ rect.height += trim.height;
+
+ text.setBounds(rect.x, rect.y, rect.width, rect.height);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/ComponentEditPart.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/ComponentEditPart.java
new file mode 100644
index 00000000000..c977d623e78
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/ComponentEditPart.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.part;
+
+import org.eclipse.draw2d.Label;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.DirectEditPolicy;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.osee.framework.ui.data.model.editor.command.ChangeNameCommand;
+import org.eclipse.osee.framework.ui.data.model.editor.model.DataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.helper.ContainerModel.ContainerType;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public abstract class ComponentEditPart extends BaseEditPart {
+
+ public ComponentEditPart(DataType dataType) {
+ super(dataType);
+ }
+
+ @Override
+ protected DirectEditPolicy createDirectEditPolicy() {
+ return new DirectEditPolicy() {
+ protected Command getDirectEditCommand(DirectEditRequest request) {
+ return new ChangeNameCommand(getModelAsDataType(), (String) request.getCellEditor().getValue());
+ }
+
+ protected void showCurrentEditValue(DirectEditRequest request) {
+ ((Label) getFigure()).setText((String) request.getCellEditor().getValue());
+ getFigure().getUpdateManager().performUpdate();
+ }
+ };
+ }
+
+ protected ContainerType getContainerType() {
+ ContainerEditPart internalArtifactEditPart = ((ContainerEditPart) getParent());
+ return internalArtifactEditPart.getContainerType();
+ }
+
+ protected DataType getModelAsDataType() {
+ return (DataType) getModel();
+ }
+
+ @Override
+ protected void handleModelEvent(Object object) {
+ refreshVisuals();
+ }
+
+ protected String getDirectEditText() {
+ return getModelAsDataType().getName();
+ }
+
+ @Override
+ protected void performDirectEdit() {
+ if (!isInherited()) {
+ super.performDirectEdit();
+ }
+ }
+
+ protected abstract boolean isInherited();
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/ConnectionEditPart.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/ConnectionEditPart.java
new file mode 100644
index 00000000000..31c4265d776
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/ConnectionEditPart.java
@@ -0,0 +1,135 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.part;
+
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PolylineConnection;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gef.editparts.AbstractConnectionEditPart;
+import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
+import org.eclipse.gef.editpolicies.BendpointEditPolicy;
+import org.eclipse.gef.editpolicies.ConnectionEditPolicy;
+import org.eclipse.gef.requests.BendpointRequest;
+import org.eclipse.gef.requests.GroupRequest;
+import org.eclipse.osee.framework.ui.data.model.editor.command.CreateBendpointCommand;
+import org.eclipse.osee.framework.ui.data.model.editor.command.DeleteBendpointCommand;
+import org.eclipse.osee.framework.ui.data.model.editor.command.DeleteCommand;
+import org.eclipse.osee.framework.ui.data.model.editor.command.MoveBendpointCommand;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ConnectionModel;
+import org.eclipse.osee.framework.ui.data.model.editor.model.IModelListener;
+import org.eclipse.osee.framework.ui.data.model.editor.policy.ConnectionModelEndpointEditPolicy;
+import org.eclipse.osee.framework.ui.data.model.editor.property.PropertySourceFactory;
+import org.eclipse.ui.views.properties.IPropertySource;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ConnectionEditPart extends AbstractConnectionEditPart {
+
+ protected IModelListener modelListener = new IModelListener() {
+
+ @Override
+ public void onModelEvent(Object object) {
+ handleModelEvent(object);
+ }
+ };
+
+ public ConnectionEditPart(Object connectionModel) {
+ super();
+ setModel((ConnectionModel<?>) connectionModel);
+ }
+
+ public void activate() {
+ super.activate();
+ getConnectionModel().addListener(modelListener);
+ }
+
+ protected void createEditPolicies() {
+ installEditPolicy(EditPolicy.CONNECTION_ENDPOINTS_ROLE, new ConnectionModelEndpointEditPolicy());
+
+ installEditPolicy(EditPolicy.CONNECTION_ROLE, new ConnectionEditPolicy() {
+ protected Command getDeleteCommand(GroupRequest request) {
+ Command toReturn = UnexecutableCommand.INSTANCE;
+ Object model = ((AbstractGraphicalEditPart) getParent()).getModel();
+ if (model != null) {
+ Boolean isBooleanObject = (Boolean) request.getExtendedData().get(DeleteCommand.DELETE_FROM_ODM_DIAGRAM);
+ boolean isDeleteFromDiagram = isBooleanObject == null ? false : isBooleanObject.booleanValue();
+ if (isDeleteFromDiagram) {
+ DeleteCommand deleteCmd = new DeleteCommand();
+ deleteCmd.setPartToBeDeleted(getHost().getModel(), model, isDeleteFromDiagram);
+ toReturn = deleteCmd;
+ }
+ }
+ return toReturn;
+ }
+ });
+
+ installEditPolicy(EditPolicy.CONNECTION_BENDPOINTS_ROLE, new BendpointEditPolicy() {
+
+ protected Command getCreateBendpointCommand(BendpointRequest request) {
+ Point location = request.getLocation();
+ getConnection().translateToRelative(location);
+ return new CreateBendpointCommand((ConnectionModel<?>) request.getSource().getModel(), location,
+ request.getIndex());
+ }
+
+ protected Command getDeleteBendpointCommand(BendpointRequest request) {
+ return new DeleteBendpointCommand((ConnectionModel<?>) getHost().getModel(), request.getIndex());
+ }
+
+ protected Command getMoveBendpointCommand(BendpointRequest request) {
+ Point location = request.getLocation();
+ getConnection().translateToRelative(location);
+ return new MoveBendpointCommand((ConnectionModel<?>) request.getSource().getModel(), location,
+ request.getIndex());
+ }
+ });
+
+ }
+
+ protected IFigure createFigure() {
+ PolylineConnection conn = new PolylineConnection();
+ conn.setLineStyle(Graphics.LINE_DASHDOT);
+ return conn;
+ }
+
+ public void deactivate() {
+ getConnectionModel().removeListener(modelListener);
+ super.deactivate();
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object getAdapter(Class adapter) {
+ if (IPropertySource.class == adapter) {
+ return PropertySourceFactory.getPropertySource(getModel());
+ }
+ return super.getAdapter(adapter);
+ }
+
+ protected ConnectionModel<?> getConnectionModel() {
+ return (ConnectionModel<?>) getModel();
+ }
+
+ protected void handleModelEvent(Object object) {
+ refreshVisuals();
+ refreshSourceAnchor();
+ refreshTargetAnchor();
+ }
+
+ protected void refreshVisuals() {
+ getConnectionFigure().setRoutingConstraint(getConnectionModel().getBendpoints());
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/ContainerEditPart.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/ContainerEditPart.java
new file mode 100644
index 00000000000..cd9abd7c600
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/ContainerEditPart.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.part;
+
+import java.util.List;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
+import org.eclipse.osee.framework.ui.data.model.editor.figure.CompartmentFigure;
+import org.eclipse.osee.framework.ui.data.model.editor.model.helper.ContainerModel;
+import org.eclipse.osee.framework.ui.data.model.editor.model.helper.ContainerModel.ContainerType;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ContainerEditPart extends AbstractGraphicalEditPart {
+
+ public ContainerEditPart(Object model) {
+ super();
+ setModel(model);
+ }
+
+ protected void createEditPolicies() {
+ }
+
+ protected IFigure createFigure() {
+ IFigure figure = new CompartmentFigure();
+ return figure;
+ }
+
+ @SuppressWarnings("unchecked")
+ protected List getModelChildren() {
+ if (getModel() instanceof ContainerModel) {
+ return ((ContainerModel) getModel()).getChildren();
+ } else {
+ return (List) getModel();
+ }
+ }
+
+ public boolean isSelectable() {
+ return false;
+ }
+
+ public ContainerType getContainerType() {
+ if (getModel() instanceof ContainerModel) {
+ return ((ContainerModel) getModel()).getContainerType();
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/DataTypeEditPart.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/DataTypeEditPart.java
new file mode 100644
index 00000000000..14b374cf4f2
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/DataTypeEditPart.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.part;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.DirectEditPolicy;
+import org.eclipse.gef.requests.DirectEditRequest;
+import org.eclipse.osee.framework.ui.data.model.editor.command.ChangeNameCommand;
+import org.eclipse.osee.framework.ui.data.model.editor.model.DataType;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public abstract class DataTypeEditPart extends NodeModelEditPart {
+
+ public DataTypeEditPart(DataType model) {
+ super(model);
+ }
+
+ public void activate() {
+ super.activate();
+ getDataType().addListener(modelListener);
+ }
+
+ protected DirectEditPolicy createDirectEditPolicy() {
+ return new DirectEditPolicy() {
+ protected Command getDirectEditCommand(DirectEditRequest request) {
+ return new ChangeNameCommand(getDataType(), (String) request.getCellEditor().getValue());
+ }
+
+ protected void showCurrentEditValue(DirectEditRequest request) {
+ IFigure fig = getDirectEditFigure();
+ if (fig instanceof Label) {
+ ((Label) fig).setText((String) request.getCellEditor().getValue());
+ fig.getUpdateManager().performUpdate();
+ }
+ }
+ };
+ }
+
+ protected void createEditPolicies() {
+ super.createEditPolicies();
+ // installEditPolicy(EditPolicy.GRAPHICAL_NODE_ROLE, new GraphicalNodeEditPolicy() {
+ // protected Command getConnectionCompleteCommand(CreateConnectionRequest request) {
+ // Link link = (Link) request.getNewObject();
+ // if (link instanceof ReferenceView || link instanceof InheritanceView) return null;
+ // LinkCreationCommand cmd = (LinkCreationCommand) request.getStartCommand();
+ // cmd.setTarget((Node) getHost().getModel());
+ // return cmd;
+ // }
+ //
+ // protected Command getConnectionCreateCommand(CreateConnectionRequest request) {
+ // return null;
+ // }
+ //
+ // protected Command getReconnectSourceCommand(ReconnectRequest request) {
+ // return UnexecutableCommand.INSTANCE;
+ // }
+ //
+ // protected Command getReconnectTargetCommand(ReconnectRequest request) {
+ // Link link = (Link) request.getConnectionEditPart().getModel();
+ // if (link instanceof ReferenceView || link instanceof InheritanceView) return UnexecutableCommand.INSTANCE;
+ // return new ReconnectLinkCommand(link, (Node) getHost().getModel(), false);
+ // }
+ // });
+ }
+
+ public void deactivate() {
+ getDataType().removeListener(modelListener);
+ super.deactivate();
+ }
+
+ protected DataType getDataType() {
+ return (DataType) getModel();
+ }
+
+ @Override
+ protected void handleModelEvent(Object msg) {
+ refreshVisuals();
+ super.handleModelEvent(msg);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/DiagramEditPart.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/DiagramEditPart.java
new file mode 100644
index 00000000000..743f422a953
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/DiagramEditPart.java
@@ -0,0 +1,101 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.part;
+
+import java.util.List;
+import org.eclipse.draw2d.ConnectionLayer;
+import org.eclipse.draw2d.FanRouter;
+import org.eclipse.draw2d.Figure;
+import org.eclipse.draw2d.FreeformLayer;
+import org.eclipse.draw2d.FreeformLayout;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.MarginBorder;
+import org.eclipse.draw2d.ShortestPathConnectionRouter;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.LayerConstants;
+import org.eclipse.gef.SnapToGeometry;
+import org.eclipse.gef.SnapToHelper;
+import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
+import org.eclipse.gef.editpolicies.RootComponentEditPolicy;
+import org.eclipse.gef.editpolicies.SnapFeedbackPolicy;
+import org.eclipse.osee.framework.ui.data.model.editor.model.IModelListener;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ODMDiagram;
+import org.eclipse.osee.framework.ui.data.model.editor.policy.DiagramLayoutEditPolicy;
+import org.eclipse.swt.SWT;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class DiagramEditPart extends AbstractGraphicalEditPart implements LayerConstants {
+
+ protected IModelListener modelListener = new IModelListener() {
+
+ @Override
+ public void onModelEvent(Object object) {
+ handleModelEvent(object);
+ }
+ };
+
+ public DiagramEditPart(Object model) {
+ super();
+ setModel((ODMDiagram) model);
+ }
+
+ public void activate() {
+ super.activate();
+ ((ODMDiagram) getModel()).addListener(modelListener);
+ }
+
+ protected IFigure createFigure() {
+ Figure f = new FreeformLayer();
+ f.setBorder(new MarginBorder(5));
+ f.setLayoutManager(new FreeformLayout());
+
+ ConnectionLayer connLayer = (ConnectionLayer) getLayer(LayerConstants.CONNECTION_LAYER);
+ FanRouter router = new FanRouter();
+ router.setSeparation(20);
+ router.setNextRouter(new ShortestPathConnectionRouter(f));
+ connLayer.setConnectionRouter(router);
+ connLayer.setAntialias(SWT.ON);
+
+ return f;
+ }
+
+ protected void createEditPolicies() {
+ installEditPolicy(EditPolicy.COMPONENT_ROLE, new RootComponentEditPolicy());
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, new DiagramLayoutEditPolicy());
+ installEditPolicy("Snap Feedback", new SnapFeedbackPolicy());
+ }
+
+ public void deactivate() {
+ ((ODMDiagram) getModel()).removeListener(modelListener);
+ super.deactivate();
+ }
+
+ protected void handleModelEvent(Object object) {
+ refreshVisuals();
+ refreshChildren();
+ }
+
+ @SuppressWarnings("unchecked")
+ public Object getAdapter(Class adapter) {
+ if (SnapToHelper.class == adapter) {
+ Object snapPropertObject = getViewer().getProperty(SnapToGeometry.PROPERTY_SNAP_ENABLED);
+ return Boolean.TRUE.equals(snapPropertObject) ? new SnapToGeometry(this) : null;
+ }
+ return super.getAdapter(adapter);
+ }
+
+ @SuppressWarnings("unchecked")
+ protected List getModelChildren() {
+ return ((ODMDiagram) getModel()).getContent();
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/InheritanceEditPart.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/InheritanceEditPart.java
new file mode 100644
index 00000000000..d1dbb27fbd1
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/InheritanceEditPart.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.part;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.draw2d.Graphics;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PolygonDecoration;
+import org.eclipse.draw2d.PolylineConnection;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class InheritanceEditPart extends ConnectionEditPart {
+
+ public InheritanceEditPart(Object connectionModel) {
+ super(connectionModel);
+ }
+
+ protected IFigure createFigure() {
+ PolylineConnection connection = new PolylineConnection();
+ PolygonDecoration decoration = new PolygonDecoration();
+ // decor.setScale(14, 6);
+ decoration.setScale(7, 3);
+ decoration.setBackgroundColor(ColorConstants.white);
+ connection.setTargetDecoration(decoration);
+ connection.setLineStyle(Graphics.LINE_DOT);
+ return connection;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/LabelDirectEditManager.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/LabelDirectEditManager.java
new file mode 100644
index 00000000000..fc530c466db
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/LabelDirectEditManager.java
@@ -0,0 +1,149 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.part;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.editparts.ZoomListener;
+import org.eclipse.gef.editparts.ZoomManager;
+import org.eclipse.gef.tools.CellEditorLocator;
+import org.eclipse.gef.tools.DirectEditManager;
+import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IActionBars;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.actions.ActionFactory;
+import org.eclipse.ui.part.CellEditorActionHandler;
+
+public class LabelDirectEditManager extends DirectEditManager {
+
+ private IActionBars actionBars;
+ private CellEditorActionHandler actionHandler;
+ private double cachedZoom = -1.0;
+ private IAction copy, cut, paste, undo, redo, find, selectAll, delete;
+ private Font scaledFont;
+ private ZoomListener zoomListener = new ZoomListener() {
+ public void zoomChanged(double newZoom) {
+ updateScaledFont(newZoom);
+ }
+ };
+
+ public LabelDirectEditManager(GraphicalEditPart source, CellEditorLocator locator) {
+ super(source, TextCellEditor.class, locator);
+ }
+
+ protected void bringDown() {
+ ZoomManager zoomMgr = (ZoomManager) getEditPart().getViewer().getProperty(ZoomManager.class.toString());
+ zoomMgr.removeZoomListener(zoomListener);
+ if (actionHandler != null) {
+ actionHandler.dispose();
+ actionHandler = null;
+ }
+ if (actionBars != null) {
+ restoreSavedActions(actionBars);
+ actionBars.updateActionBars();
+ actionBars = null;
+ }
+ super.bringDown();
+ disposeScaledFont();
+ }
+
+ /**
+ * Creates a multi-lined text celleditor that can wrap.
+ */
+ protected CellEditor createCellEditorOn(Composite composite) {
+ return new TextCellEditor(composite, SWT.MULTI | SWT.WRAP);
+ }
+
+ private void disposeScaledFont() {
+ if (scaledFont != null) {
+ scaledFont.dispose();
+ scaledFont = null;
+ }
+ }
+
+ /**
+ * Used to determine the initial text of the cell editor and to determine the font size of the text.
+ *
+ * @return the figure being edited
+ */
+ protected IFigure getDirectEditFigure() {
+ return ((BaseEditPart) getEditPart()).getDirectEditFigure();
+ }
+
+ /**
+ * @return the initial value of the text shown in the cell editor for direct-editing; cannot return <code>null</code>
+ */
+ protected String getInitialText() {
+ return ((BaseEditPart) getEditPart()).getDirectEditText();
+ }
+
+ protected void initCellEditor() {
+ getCellEditor().setValue(getInitialText());
+ ZoomManager zoomMgr = (ZoomManager) getEditPart().getViewer().getProperty(ZoomManager.class.toString());
+ cachedZoom = -1.0;
+ updateScaledFont(zoomMgr.getZoom());
+ zoomMgr.addZoomListener(zoomListener);
+ // Hook the cell editor's copy/paste actions to the actionBars so that they can
+ // be invoked via keyboard shortcuts.
+ actionBars =
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getEditorSite().getActionBars();
+ saveCurrentActions(actionBars);
+ actionHandler = new CellEditorActionHandler(actionBars);
+ actionHandler.addCellEditor(getCellEditor());
+ actionBars.updateActionBars();
+ }
+
+ private void restoreSavedActions(IActionBars actionBars) {
+ actionBars.setGlobalActionHandler(ActionFactory.COPY.getId(), copy);
+ actionBars.setGlobalActionHandler(ActionFactory.PASTE.getId(), paste);
+ actionBars.setGlobalActionHandler(ActionFactory.DELETE.getId(), delete);
+ actionBars.setGlobalActionHandler(ActionFactory.SELECT_ALL.getId(), selectAll);
+ actionBars.setGlobalActionHandler(ActionFactory.CUT.getId(), cut);
+ actionBars.setGlobalActionHandler(ActionFactory.FIND.getId(), find);
+ actionBars.setGlobalActionHandler(ActionFactory.UNDO.getId(), undo);
+ actionBars.setGlobalActionHandler(ActionFactory.REDO.getId(), redo);
+ }
+
+ private void saveCurrentActions(IActionBars actionBars) {
+ copy = actionBars.getGlobalActionHandler(ActionFactory.COPY.getId());
+ paste = actionBars.getGlobalActionHandler(ActionFactory.PASTE.getId());
+ delete = actionBars.getGlobalActionHandler(ActionFactory.DELETE.getId());
+ selectAll = actionBars.getGlobalActionHandler(ActionFactory.SELECT_ALL.getId());
+ cut = actionBars.getGlobalActionHandler(ActionFactory.CUT.getId());
+ find = actionBars.getGlobalActionHandler(ActionFactory.FIND.getId());
+ undo = actionBars.getGlobalActionHandler(ActionFactory.UNDO.getId());
+ redo = actionBars.getGlobalActionHandler(ActionFactory.REDO.getId());
+ }
+
+ private void updateScaledFont(double zoom) {
+ if (cachedZoom == zoom) return;
+ Text text = (Text) getCellEditor().getControl();
+ Font font = getEditPart().getFigure().getFont();
+
+ disposeScaledFont();
+ cachedZoom = zoom;
+ if (zoom == 1.0) {
+ text.setFont(font);
+ } else {
+ FontData fd = font.getFontData()[0];
+ fd.setHeight((int) (fd.getHeight() * zoom));
+ text.setFont(scaledFont = new Font(null, fd));
+ }
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/NodeModelEditPart.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/NodeModelEditPart.java
new file mode 100644
index 00000000000..48b876e528e
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/NodeModelEditPart.java
@@ -0,0 +1,118 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.part;
+
+import java.util.List;
+import org.eclipse.draw2d.ChopboxAnchor;
+import org.eclipse.draw2d.ConnectionAnchor;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.ConnectionEditPart;
+import org.eclipse.gef.DragTracker;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.GraphicalEditPart;
+import org.eclipse.gef.NodeEditPart;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.editpolicies.LayoutEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.gef.tools.DragEditPartsTracker;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ConnectionModel;
+import org.eclipse.osee.framework.ui.data.model.editor.model.NodeModel;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public abstract class NodeModelEditPart extends BaseEditPart implements NodeEditPart {
+
+ private ChopboxAnchor anchor;
+
+ public NodeModelEditPart(NodeModel model) {
+ super(model);
+ }
+
+ public boolean canDeleteFromDiagram() {
+ return true;
+ }
+
+ protected void createEditPolicies() {
+ super.createEditPolicies();
+ installEditPolicy(EditPolicy.SELECTION_FEEDBACK_ROLE, null);
+ installEditPolicy(EditPolicy.LAYOUT_ROLE, new LayoutEditPolicy() {
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ return null;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ return null;
+ }
+
+ protected Command getDeleteDependantCommand(Request request) {
+ return null;
+ }
+
+ protected Command getMoveChildrenCommand(Request request) {
+ return null;
+ }
+ });
+ }
+
+ public DragTracker getDragTracker(Request request) {
+ return new DragEditPartsTracker(this);
+ }
+
+ protected NodeModel getNodeModel() {
+ return (NodeModel) getModel();
+ }
+
+ @SuppressWarnings("unchecked")
+ protected List<ConnectionModel> getModelSourceConnections() {
+ return getNodeModel().getSourceConnections();
+ }
+
+ @SuppressWarnings("unchecked")
+ protected List<ConnectionModel> getModelTargetConnections() {
+ return getNodeModel().getTargetConnections();
+ }
+
+ public ConnectionAnchor getSourceConnectionAnchor(ConnectionEditPart connection) {
+ if (anchor == null) anchor = new ChopboxAnchor(getFigure());
+ return anchor;
+ }
+
+ public ConnectionAnchor getSourceConnectionAnchor(Request request) {
+ if (anchor == null) anchor = new ChopboxAnchor(getFigure());
+ return anchor;
+ }
+
+ public ConnectionAnchor getTargetConnectionAnchor(ConnectionEditPart connection) {
+ if (anchor == null) anchor = new ChopboxAnchor(getFigure());
+ return anchor;
+ }
+
+ public ConnectionAnchor getTargetConnectionAnchor(Request request) {
+ if (anchor == null) anchor = new ChopboxAnchor(getFigure());
+ return anchor;
+ }
+
+ @Override
+ protected void handleModelEvent(Object msg) {
+ refreshVisuals();
+ }
+
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ Rectangle constraint = new Rectangle(0, 0, -1, -1);
+ constraint.setLocation(getNodeModel().getLocation());
+ constraint.width = getNodeModel().getWidth();
+ ((GraphicalEditPart) getParent()).setLayoutConstraint(this, getFigure(), constraint);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/ODMEditPartFactory.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/ODMEditPartFactory.java
new file mode 100644
index 00000000000..0398e3e2cd4
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/ODMEditPartFactory.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.part;
+
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPartFactory;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.data.model.editor.ODMEditorActivator;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ArtifactDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.AttributeDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ConnectionModel;
+import org.eclipse.osee.framework.ui.data.model.editor.model.InheritanceLinkModel;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ODMDiagram;
+import org.eclipse.osee.framework.ui.data.model.editor.model.RelationDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.RelationLinkModel;
+import org.eclipse.osee.framework.ui.data.model.editor.model.helper.ContainerModel;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ODMEditPartFactory implements EditPartFactory {
+
+ public ODMEditPartFactory() {
+ }
+
+ public EditPart createEditPart(EditPart context, Object model) {
+ EditPart editPart = null;
+ if (model instanceof ODMDiagram) {
+ editPart = new DiagramEditPart(model);
+ } else if (model instanceof ArtifactDataType) {
+ editPart = new ArtifactEditPart(model);
+ } else if (model instanceof RelationDataType) {
+ editPart = new RelationEditPart(model);
+ } else if (model instanceof AttributeDataType) {
+ editPart = new AttributeEditPart(model);
+ } else if (model instanceof ContainerModel || model instanceof List) {
+ editPart = new ContainerEditPart(model);
+ } else if (model instanceof InheritanceLinkModel) {
+ editPart = new InheritanceEditPart(model);
+ } else if (model instanceof RelationLinkModel) {
+ editPart = new RelationLinkEditPart(model);
+ } else if (model instanceof ConnectionModel) {
+ editPart = new ConnectionEditPart(model);
+ } else if (model instanceof String) {
+ editPart = new StringEditPart((String) model);
+ }
+ if (editPart == null) {
+ String message = String.format("Error no EditPart defined for: [%s]", model.getClass().getName());
+ editPart = new StringEditPart(message);
+ OseeLog.log(ODMEditorActivator.class, Level.SEVERE, message);
+ } else {
+ editPart.setModel(model);
+ }
+ return editPart;
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/RelationEditPart.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/RelationEditPart.java
new file mode 100644
index 00000000000..a0d9754632d
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/RelationEditPart.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.part;
+
+import org.eclipse.draw2d.ColorConstants;
+import org.eclipse.osee.framework.ui.data.model.editor.figure.SelectableLabel;
+import org.eclipse.osee.framework.ui.data.model.editor.model.RelationDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.helper.ContainerModel.ContainerType;
+import org.eclipse.osee.framework.ui.data.model.editor.utility.ODMConstants;
+import org.eclipse.osee.framework.ui.data.model.editor.utility.ODMImage;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class RelationEditPart extends ComponentEditPart {
+
+ public RelationEditPart(Object model) {
+ super((RelationDataType) model);
+ }
+
+ @Override
+ protected boolean isInherited() {
+ ContainerType value = getContainerType();
+ return value != null && value == ContainerType.INHERITED_RELATIONS;
+ }
+
+ @Override
+ protected void refreshVisuals() {
+ SelectableLabel labelFigure = (SelectableLabel) getFigure();
+ String text = ODMConstants.getDataTypeText(getModelAsDataType());
+ labelFigure.setText(text);
+ labelFigure.setIcon(ImageManager.getImage(ODMImage.LOCAL_RELATION));
+ labelFigure.setSelectable(true);
+
+ if (isInherited()) {
+ labelFigure.setBackgroundColor(ColorConstants.blue);
+ labelFigure.setIcon(ImageManager.getImage(ODMImage.INHERITED_RELATION));
+ labelFigure.setSelectable(false);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/RelationLinkEditPart.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/RelationLinkEditPart.java
new file mode 100644
index 00000000000..8542cfe71d5
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/RelationLinkEditPart.java
@@ -0,0 +1,218 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.part;
+
+import org.eclipse.draw2d.ConnectionEndpointLocator;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.draw2d.PolygonDecoration;
+import org.eclipse.draw2d.PolylineConnection;
+import org.eclipse.draw2d.PolylineDecoration;
+import org.eclipse.draw2d.RotatableDecoration;
+import org.eclipse.draw2d.geometry.PointList;
+import org.eclipse.osee.framework.ui.data.model.editor.model.RelationLinkModel;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class RelationLinkEditPart extends ConnectionEditPart {
+
+ private Label srcCount, srcName, targetCount, targetName;
+ private ConnectionEndpointLocator srcCountLocator, srcNameLocator, targetCountLocator, targetNameLocator;
+ private RotatableDecoration srcDecor, targetDecor;
+
+ // private EReference opposite;
+
+ public RelationLinkEditPart(Object model) {
+ super((RelationLinkModel) model);
+ }
+
+ public void activate() {
+ super.activate();
+ getRelationLink().addListener(modelListener);
+ // updateEOpposite(getEReference().getEOpposite());
+ }
+
+ // private String createCountString(EReference ref) {
+ // int lower = ref.getLowerBound();
+ // int upper = ref.getUpperBound();
+ // if (lower == upper) return "" + lower; //$NON-NLS-1$
+ // return lower + ".." + (upper == -1 ? "n" : "" + upper); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
+ // }
+
+ protected IFigure createFigure() {
+ PolylineConnection conn = new PolylineConnection();
+
+ // Create the locators
+ srcCountLocator = new ConnectionEndpointLocator(conn, false);
+ srcNameLocator = new ConnectionEndpointLocator(conn, false);
+ srcNameLocator.setVDistance(-4);
+ targetCountLocator = new ConnectionEndpointLocator(conn, true);
+ targetNameLocator = new ConnectionEndpointLocator(conn, true);
+ targetCountLocator.setVDistance(-4);
+ return conn;
+ }
+
+ private PolygonDecoration createPolygonDecoration() {
+ PolygonDecoration decoration = new PolygonDecoration();
+ PointList decorationPointList = new PointList();
+ decorationPointList.addPoint(0, 0);
+ decorationPointList.addPoint(-1, 1);
+ decorationPointList.addPoint(-2, 0);
+ decorationPointList.addPoint(-1, -1);
+ decoration.setTemplate(decorationPointList);
+ return decoration;
+ }
+
+ private PolylineDecoration createPolylineDecoration() {
+ PolylineDecoration decoration = new PolylineDecoration();
+ decoration.setScale(10, 5);
+ return decoration;
+ }
+
+ /**
+ * Upon deactivation, detach from the model element as a property change listener.
+ */
+ public void deactivate() {
+ // updateEOpposite(null);
+ getRelationLink().removeListener(modelListener);
+ super.deactivate();
+ }
+
+ private PolylineConnection getConnection() {
+ return (PolylineConnection) getFigure();
+ }
+
+ // protected EReference getEReference() {
+ // return getRefView().getEReference();
+ // }
+
+ protected RelationLinkModel getRelationLink() {
+ return (RelationLinkModel) getModel();
+ }
+
+ protected void handleModelEvent(Object object) {
+ // updateEOpposite(getEReference().getEOpposite());
+ refreshVisuals();
+ super.handleModelEvent(object);
+ }
+
+ protected void refreshVisuals() {
+ super.refreshVisuals();
+ updateSourceDecoration();
+ updateTargetDecoration();
+ updateSourceCount();
+ updateSourceName();
+ updateTargetCount();
+ updateTargetName();
+ }
+
+ // private void updateEOpposite(EReference opp) {
+ // if (opposite == opp) return;
+ // if (opposite != null) opposite.eAdapters().remove(modelListener);
+ // opposite = opp;
+ // if (opposite != null) opposite.eAdapters().add(modelListener);
+ // }
+
+ private void updateSourceCount() {
+ // if (getRelationDataType().isOppositeShown() && getRelationDataType().getOpposite() != null) {
+ // if (getEReference().isContainment()) {
+ // if (srcCount != null) {
+ // getConnection().remove(srcCount);
+ // srcCount = null;
+ // }
+ // } else {
+ // if (srcCount == null) {
+ // srcCount = new Label();
+ // srcCount.setOpaque(true);
+ // getConnection().add(srcCount, srcCountLocator);
+ // }
+ // srcCount.setText(createCountString(getEReference().getEOpposite()));
+ // }
+ // } else if (srcCount != null) {
+ // getConnection().remove(srcCount);
+ // srcCount = null;
+ // }
+ }
+
+ private void updateSourceDecoration() {
+ // if (getEReference().isContainment()) {
+ if (srcDecor == null) {
+ srcDecor = createPolygonDecoration();
+ getConnection().setSourceDecoration(srcDecor);
+ }
+ // } else
+ // if (srcDecor != null) {
+ // srcDecor = null;
+ getConnection().setSourceDecoration(srcDecor);
+ // }
+ }
+
+ private void updateTargetCount() {
+ // if (getEReference().isContainer() && getRefView().isOppositeShown() && getEReference().getEOpposite() != null) {
+ // if (targetCount != null) {
+ // getConnection().remove(targetCount);
+ // targetCount = null;
+ // }
+ // } else {
+ // if (targetCount == null) {
+ // targetCount = new Label();
+ // targetCount.setOpaque(true);
+ // getConnection().add(targetCount, targetCountLocator);
+ // }
+ // targetCount.setText(createCountString(getEReference()));
+ // }
+ }
+
+ private void updateTargetDecoration() {
+ // if (getRelationDataType().isOppositeShown() && getRelationDataType().getEOpposite() != null) {
+ // if (getEReference().isContainer()) {
+ // if (targetDecor != null && !(targetDecor instanceof PolygonDecoration)) {
+ // getConnection().setTargetDecoration(null);
+ // targetDecor = null;
+ // }
+ // if (targetDecor == null) {
+ // targetDecor = createPolygonDecoration();
+ // getConnection().setTargetDecoration(targetDecor);
+ // }
+ // } else if (targetDecor != null) {
+ // targetDecor = null;
+ // getConnection().setTargetDecoration(targetDecor);
+ // }
+ // } else if (targetDecor == null) {
+ // targetDecor = createPolylineDecoration();
+ // getConnection().setTargetDecoration(targetDecor);
+ // }
+ }
+
+ private void updateTargetName() {
+ if (targetName == null) {
+ targetName = new Label();
+ targetName.setOpaque(true);
+ getConnection().add(targetName, targetNameLocator);
+ }
+ targetName.setText("+" + getRelationLink().getRelation().getSideAName());
+ }
+
+ private void updateSourceName() {
+ // if (getRefView().isOppositeShown() && getEReference().getEOpposite() != null) {
+ if (srcName == null) {
+ srcName = new Label();
+ srcName.setOpaque(true);
+ getConnection().add(srcName, srcNameLocator);
+ }
+ srcName.setText("+" + getRelationLink().getRelation().getSideBName());
+ // } else if (srcName != null) {
+ // getConnection().remove(srcName);
+ // srcName = null;
+ // }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/StringEditPart.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/StringEditPart.java
new file mode 100644
index 00000000000..e4bf3b3d19f
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/part/StringEditPart.java
@@ -0,0 +1,35 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.part;
+
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.Label;
+import org.eclipse.gef.editparts.AbstractGraphicalEditPart;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class StringEditPart extends AbstractGraphicalEditPart {
+
+ private final String data;
+
+ public StringEditPart(String data) {
+ super();
+ this.data = data;
+ }
+
+ protected IFigure createFigure() {
+ return new Label(data);
+ }
+
+ protected void createEditPolicies() {
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/policy/ConnectionModelEndpointEditPolicy.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/policy/ConnectionModelEndpointEditPolicy.java
new file mode 100644
index 00000000000..45b1e77b1d4
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/policy/ConnectionModelEndpointEditPolicy.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.policy;
+
+import org.eclipse.draw2d.PolylineConnection;
+import org.eclipse.gef.editpolicies.ConnectionEndpointEditPolicy;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Font;
+import org.eclipse.swt.graphics.FontData;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ConnectionModelEndpointEditPolicy extends ConnectionEndpointEditPolicy {
+
+ private static Font BOLD_FONT;
+
+ protected void addSelectionHandles() {
+ super.addSelectionHandles();
+ getConnectionFigure().setLineWidth(2);
+ }
+
+ protected PolylineConnection getConnectionFigure() {
+ return (PolylineConnection) getHostFigure();
+ }
+
+ protected void hideSelection() {
+ super.hideSelection();
+ getHostFigure().setFont(null);
+ getHostFigure().invalidateTree();
+ }
+
+ protected void removeSelectionHandles() {
+ super.removeSelectionHandles();
+ getConnectionFigure().setLineWidth(0);
+ }
+
+ protected void showSelection() {
+ super.showSelection();
+ if (BOLD_FONT == null) {
+ FontData[] data = getConnectionFigure().getFont().getFontData();
+ for (int i = 0; i < data.length; i++) {
+ if ((data[i].getStyle() & SWT.BOLD) == 0) {
+ data[i].setStyle(data[i].getStyle() | SWT.BOLD);
+ }
+ }
+ BOLD_FONT = new Font(null, data);
+ }
+ getHostFigure().setFont(BOLD_FONT);
+ getHostFigure().invalidateTree();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/policy/DiagramLayoutEditPolicy.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/policy/DiagramLayoutEditPolicy.java
new file mode 100644
index 00000000000..623f5758d71
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/policy/DiagramLayoutEditPolicy.java
@@ -0,0 +1,179 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.policy;
+
+import java.util.List;
+import org.eclipse.draw2d.IFigure;
+import org.eclipse.draw2d.PositionConstants;
+import org.eclipse.draw2d.geometry.Rectangle;
+import org.eclipse.gef.EditPart;
+import org.eclipse.gef.EditPolicy;
+import org.eclipse.gef.LayerConstants;
+import org.eclipse.gef.Request;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.gef.commands.UnexecutableCommand;
+import org.eclipse.gef.editpolicies.ResizableEditPolicy;
+import org.eclipse.gef.editpolicies.XYLayoutEditPolicy;
+import org.eclipse.gef.requests.CreateRequest;
+import org.eclipse.osee.framework.ui.data.model.editor.command.ChangeBoundsCommand;
+import org.eclipse.osee.framework.ui.data.model.editor.command.CreateNodeCommand;
+import org.eclipse.osee.framework.ui.data.model.editor.model.DataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.NodeModel;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ODMDiagram;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class DiagramLayoutEditPolicy extends XYLayoutEditPolicy {
+
+ protected Command createChangeConstraintCommand(EditPart child, Object constraint) {
+ Rectangle bounds = (Rectangle) constraint;
+ return new ChangeBoundsCommand((NodeModel) child.getModel(), bounds.getLocation(), bounds.width);
+ }
+
+ protected EditPolicy createChildEditPolicy(EditPart child) {
+ ResizableEditPolicy childPolicy = new ResizableEditPolicy();
+ childPolicy.setResizeDirections(PositionConstants.EAST_WEST);
+ return childPolicy;
+ }
+
+ protected Command getCreateCommand(CreateRequest request) {
+ Object newObj = request.getNewObject();
+ if (newObj instanceof DataType) {
+ Rectangle constraint = (Rectangle) getConstraintFor(request);
+ return new CreateNodeCommand((DataType) newObj, (ODMDiagram) getHost().getModel(), constraint.getLocation(),
+ constraint.width);
+ } else if (newObj instanceof List) {
+ //List views = (List) newObj;
+ // List businessModels = (List) request.getExtendedData().get(OutlineToDiagramTransfer.TYPE_NAME);
+ // if (!(businessModels.get(businessModels.size() - 1) instanceof ProcessedMarker)) {
+ // processSelection(businessModels, views);
+ // // Once this list has been processed, we append a marker to it so that it's
+ // // not processed again
+ // businessModels.add(new ProcessedMarker());
+ // }
+ // if (views.isEmpty()) return UnexecutableCommand.INSTANCE;
+ // CompoundCommand command = new CompoundCommand("Drag from Outline");
+ // Point loc = request.getLocation().getCopy();
+ // getHostFigure().translateToRelative(loc);
+ // for (int i = 0; i < views.size(); i++) {
+ // Object view = views.get(i);
+ // if (view instanceof NamedElementView) {
+ // command.add(new CreateNodeCommand((Node) view, (Diagram) getHost().getModel(), loc.getTranslated(i * 40,
+ // i * 40)));
+ // } else if (view instanceof LinkInfoHolder) {
+ // LinkInfoHolder info = (LinkInfoHolder) view;
+ // command.add(new TransferLinkCommand(info.link, info.src, info.target));
+ // } else if (view instanceof ShowOppositeMarker) {
+ // command.add(new ShowOppositeCommand(((ShowOppositeMarker) view).refView));
+ // }
+ // }
+ // return command;
+ }
+ return UnexecutableCommand.INSTANCE;
+ }
+
+ protected Command getDeleteDependantCommand(Request request) {
+ return null;
+ }
+
+ protected IFigure getFeedbackLayer() {
+ return getLayer(LayerConstants.SCALED_FEEDBACK_LAYER);
+ }
+ /*
+ private void processSelection(List models, List views) {
+ List newModels = new ArrayList();
+ List newViews = new ArrayList();
+ // for (int i = 0; i < models.size(); i++) {
+ // Object model = models.get(i);
+ // if (Utilities.findViewFor(model, getHost().getModel()) != null) continue;
+ // if (model instanceof EReference) {
+ // EReference ref = (EReference) model;
+ // ReferenceView oppView = (ReferenceView) Utilities.findViewFor(ref.getEOpposite(), getHost().getModel());
+ // int oppIndex = newModels.indexOf(ref.getEOpposite());
+ // if (oppView != null || oppIndex != -1) {
+ // // the opposite was found
+ // newModels.add(model);
+ // if (oppView != null) {
+ // newViews.add(new ShowOppositeMarker(oppView));
+ // } else {
+ // newViews.add(new ShowOppositeMarker((ReferenceView) ((LinkInfoHolder) newViews.get(oppIndex)).link));
+ // }
+ // continue;
+ // }
+ // Node srcView = (Node) Utilities.findViewFor(ref.getEContainingClass(), getHost().getModel());
+ // Node destView = (Node) Utilities.findViewFor(ref.getEReferenceType(), getHost().getModel());
+ // if (srcView == null) {
+ // int index = models.indexOf(ref.getEContainingClass());
+ // srcView = index >= 0 ? (Node) views.get(index) : null;
+ // }
+ // if (destView == null) {
+ // int index = models.indexOf(ref.getEReferenceType());
+ // destView = index >= 0 ? (Node) views.get(index) : null;
+ // }
+ // if (srcView != null && destView != null) {
+ // ReferenceView refView = (ReferenceView) views.get(i);
+ // refView.setEReference(ref);
+ // newModels.add(model);
+ // newViews.add(new LinkInfoHolder(refView, srcView, destView));
+ // }
+ // } else if (model instanceof InheritanceModel) {
+ // InheritanceModel link = (InheritanceModel) model;
+ // Node srcView = (Node) Utilities.findViewFor(link.getSubType(), getHost().getModel());
+ // Node destView = (Node) Utilities.findViewFor(link.getSuperType(), getHost().getModel());
+ // if (srcView == null) {
+ // int index = models.indexOf(link.getSubType());
+ // srcView = index >= 0 ? (Node) views.get(index) : null;
+ // }
+ // if (destView == null) {
+ // int index = models.indexOf(link.getSuperType());
+ // destView = index >= 0 ? (Node) views.get(index) : null;
+ // }
+ // if (srcView != null && destView != null) {
+ // newModels.add(model);
+ // newViews.add(new LinkInfoHolder((Link) views.get(i), srcView, destView));
+ // }
+ // } else if (model instanceof ENamedElement) {
+ // NamedElementView classView = (NamedElementView) views.get(i);
+ // classView.setENamedElement((ENamedElement) model);
+ // newModels.add(0, model);
+ // newViews.add(0, classView);
+ // }
+ // }
+ models.clear();
+ views.clear();
+ models.addAll(newModels);
+ views.addAll(newViews);
+ }
+
+ private static class LinkInfoHolder {
+ private ConnectionModel link;
+ private NodeModel src;
+ private NodeModel target;
+
+ private LinkInfoHolder(ConnectionModel link, NodeModel src, NodeModel target) {
+ this.link = link;
+ this.src = src;
+ this.target = target;
+ }
+ }
+ */
+ // private static class ShowOppositeMarker {
+ // private ReferenceView refView;
+ //
+ // private ShowOppositeMarker(ReferenceView view) {
+ // refView = view;
+ // }
+ // }
+ //
+ // private static class ProcessedMarker {
+ // }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/policy/LabelSelectionEditPolicy.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/policy/LabelSelectionEditPolicy.java
new file mode 100644
index 00000000000..e534af05bd7
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/policy/LabelSelectionEditPolicy.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.policy;
+
+import org.eclipse.gef.editpolicies.NonResizableEditPolicy;
+import org.eclipse.osee.framework.ui.data.model.editor.figure.SelectableLabel;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class LabelSelectionEditPolicy extends NonResizableEditPolicy {
+
+ protected SelectableLabel getLabel() {
+ return (SelectableLabel) getHostFigure();
+ }
+
+ /**
+ * @see org.eclipse.gef.editpolicies.NonResizableEditPolicy#hideFocus()
+ */
+ @Override
+ protected void hideFocus() {
+ getLabel().setFocus(false);
+ }
+
+ /**
+ * @see org.eclipse.gef.editpolicies.SelectionHandlesEditPolicy#hideSelection()
+ */
+ @Override
+ protected void hideSelection() {
+ getLabel().setSelected(false);
+ getLabel().setFocus(false);
+
+ }
+
+ /**
+ * @see org.eclipse.gef.editpolicies.NonResizableEditPolicy#showFocus()
+ */
+ @Override
+ protected void showFocus() {
+ getLabel().setFocus(true);
+ }
+
+ /**
+ * @see org.eclipse.gef.editpolicies.SelectionHandlesEditPolicy#showSelection()
+ */
+ @Override
+ protected void showPrimarySelection() {
+ getLabel().setSelected(true);
+ getLabel().setFocus(true);
+ }
+
+ /**
+ * @see org.eclipse.gef.editpolicies.SelectionHandlesEditPolicy#showSelection()
+ */
+ @Override
+ protected void showSelection() {
+ getLabel().setSelected(true);
+ getLabel().setFocus(false);
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/ArtifactPropertySource.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/ArtifactPropertySource.java
new file mode 100644
index 00000000000..1e596845ce3
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/ArtifactPropertySource.java
@@ -0,0 +1,74 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.property;
+
+import java.util.List;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ArtifactDataType;
+import org.eclipse.osee.framework.ui.plugin.views.property.ImagePropertyDescriptor;
+import org.eclipse.osee.framework.ui.plugin.views.property.ModelPropertySource;
+import org.eclipse.osee.framework.ui.plugin.views.property.PropertyId;
+import org.eclipse.osee.framework.ui.plugin.views.property.ReadOnlyPropertyDescriptor;
+import org.eclipse.osee.framework.ui.plugin.views.property.StringPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ArtifactPropertySource extends ModelPropertySource {
+ protected final PropertyId idImage;
+ private final PropertyId idSuperTypes;
+
+ public ArtifactPropertySource(String categoryName, Object dataType) {
+ super(dataType);
+ idImage = new PropertyId(categoryName, "Image");
+ idSuperTypes = new PropertyId(categoryName, "Super Types");
+ }
+
+ @Override
+ protected void addPropertyDescriptors(List<IPropertyDescriptor> list) {
+ list.add(new ReadOnlyPropertyDescriptor(idSuperTypes));
+ list.add(new StringPropertyDescriptor(idImage));
+ }
+
+ protected ArtifactDataType getDataTypeElement() {
+ return (ArtifactDataType) getModel();
+ }
+
+ @Override
+ public boolean isPropertyResettable(Object id) {
+ return id == idImage;
+ }
+
+ @Override
+ public boolean isPropertySet(Object id) {
+ if (id == idImage) return getDataTypeElement().getImage() != null;
+ if (id == idSuperTypes) return true;
+ return false;
+ }
+
+ @Override
+ public Object getPropertyValue(Object id) {
+ if (id == idImage) return ImagePropertyDescriptor.fromModel(getDataTypeElement().getImage());
+ if (id == idSuperTypes) return ReadOnlyPropertyDescriptor.fromModel(getDataTypeElement().getSuperTypes().toString());
+ return false;
+ }
+
+ @Override
+ public void resetPropertyValue(Object id) {
+ if (id == idImage) getDataTypeElement().setImage(null);
+ }
+
+ @Override
+ public void setPropertyValue(Object id, Object value) {
+ if (id == idImage) getDataTypeElement().setImage(ImagePropertyDescriptor.toModel(value));
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/AttributeBaseClassPropertyDescriptor.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/AttributeBaseClassPropertyDescriptor.java
new file mode 100644
index 00000000000..d00333c9eba
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/AttributeBaseClassPropertyDescriptor.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.property;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.attribute.AttributeExtensionManager;
+import org.eclipse.osee.framework.ui.data.model.editor.ODMEditorActivator;
+import org.eclipse.osee.framework.ui.plugin.views.property.PropertyId;
+import org.eclipse.ui.views.properties.ComboBoxPropertyDescriptor;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class AttributeBaseClassPropertyDescriptor extends ComboBoxPropertyDescriptor {
+
+ private static final List<String> items = new ArrayList<String>();
+ static {
+ try {
+ items.addAll(AttributeExtensionManager.getAttributeClasses());
+ } catch (OseeStateException ex) {
+ OseeLog.log(ODMEditorActivator.class, Level.SEVERE, ex);
+ }
+ }
+
+ public AttributeBaseClassPropertyDescriptor(PropertyId propertyId) {
+ super(propertyId, propertyId.getDisplayName(), items.toArray(new String[items.size()]));
+ setCategory(propertyId.getCategoryName());
+ }
+
+ public static Integer fromModel(Object object) {
+ String value = (String) object;
+ int index = items.indexOf(value);
+ if (index < 0) {
+ items.add(value);
+ index = items.size() - 1;
+ }
+ return index;
+ }
+
+ public static String toModel(Object object) {
+ if (object != null) {
+ int index = ((Integer) object).intValue();
+ if (index > -1) {
+ return items.get(index);
+ }
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/AttributePropertySource.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/AttributePropertySource.java
new file mode 100644
index 00000000000..778e4cf46d5
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/AttributePropertySource.java
@@ -0,0 +1,215 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.property;
+
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.attribute.OseeEnumTypeManager;
+import org.eclipse.osee.framework.ui.data.model.editor.ODMEditorActivator;
+import org.eclipse.osee.framework.ui.data.model.editor.model.AttributeDataType;
+import org.eclipse.osee.framework.ui.plugin.views.property.IntegerPropertyDescriptor;
+import org.eclipse.osee.framework.ui.plugin.views.property.ModelPropertySource;
+import org.eclipse.osee.framework.ui.plugin.views.property.PropertyId;
+import org.eclipse.osee.framework.ui.plugin.views.property.StringPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class AttributePropertySource extends ModelPropertySource {
+
+ protected final PropertyId idDefaultValue;
+ protected final PropertyId idEnumType;
+ protected final PropertyId idToolTipText;
+ protected final PropertyId idFileTypeExtension;
+ protected final PropertyId idTaggerId;
+
+ protected final PropertyId idMinOccurrence;
+ protected final PropertyId idMaxOccurrence;
+
+ protected final PropertyId idBaseAttributeClass;
+ protected final PropertyId idProviderAttributeClass;
+
+ public AttributePropertySource(String categoryName, Object dataType) {
+ super(dataType);
+ idDefaultValue = new PropertyId(categoryName, "Default Value");
+ idEnumType = new PropertyId(categoryName, "Enum Type");
+ idToolTipText = new PropertyId(categoryName, "ToolTip");
+ idFileTypeExtension = new PropertyId(categoryName, "File Extension");
+ idTaggerId = new PropertyId(categoryName, "Tagger Id");
+ idMinOccurrence = new PropertyId(categoryName, "Min Occurrence");
+ idMaxOccurrence = new PropertyId(categoryName, "Max Occurrence");
+ idBaseAttributeClass = new PropertyId(categoryName, "Base Attribute Class");
+ idProviderAttributeClass = new PropertyId(categoryName, "Base Provider Attribute Class");
+ }
+
+ @Override
+ protected void addPropertyDescriptors(List<IPropertyDescriptor> list) {
+ list.add(new StringPropertyDescriptor(idDefaultValue));
+ list.add(new EnumeratedAttributeValuesPropertyDescriptor(idEnumType));
+ list.add(new StringPropertyDescriptor(idToolTipText));
+ list.add(new StringPropertyDescriptor(idFileTypeExtension));
+ list.add(new StringPropertyDescriptor(idTaggerId));
+
+ list.add(new IntegerPropertyDescriptor(idMinOccurrence));
+ list.add(new IntegerPropertyDescriptor(idMaxOccurrence));
+
+ list.add(new AttributeBaseClassPropertyDescriptor(idBaseAttributeClass));
+ list.add(new AttributeProviderPropertyDescriptor(idProviderAttributeClass));
+ }
+
+ protected AttributeDataType getDataTypeElement() {
+ return (AttributeDataType) getModel();
+ }
+
+ @Override
+ public boolean isPropertyResettable(Object id) {
+ return id == idDefaultValue || id == idEnumType || id == idToolTipText || id == idFileTypeExtension || id == idTaggerId || id == idMinOccurrence || id == idMaxOccurrence || id == idBaseAttributeClass || id == idProviderAttributeClass;
+ }
+
+ @Override
+ public boolean isPropertySet(Object id) {
+ if (id == idDefaultValue) {
+ return getDataTypeElement().getDefaultValue() != null;
+ }
+ if (id == idEnumType) {
+ return getDataTypeElement().getEnumTypeId() != -1;
+ }
+ if (id == idToolTipText) {
+ return getDataTypeElement().getToolTipText() != null;
+ }
+ if (id == idFileTypeExtension) {
+ return getDataTypeElement().getFileTypeExtension() != null;
+ }
+ if (id == idTaggerId) {
+ return getDataTypeElement().getTaggerId() != null;
+ }
+ if (id == idMinOccurrence) {
+ return getDataTypeElement().getMinOccurrence() != -1;
+ }
+ if (id == idMaxOccurrence) {
+ return getDataTypeElement().getMaxOccurrence() != -1;
+ }
+ if (id == idBaseAttributeClass) {
+ return getDataTypeElement().getBaseAttributeClass() != null;
+ }
+ if (id == idProviderAttributeClass) {
+ return getDataTypeElement().getProviderAttributeClass() != null;
+ }
+ return false;
+ }
+
+ @Override
+ public Object getPropertyValue(Object id) {
+ if (id == idDefaultValue) {
+ return StringPropertyDescriptor.fromModel(getDataTypeElement().getDefaultValue());
+ }
+ if (id == idEnumType) {
+ int enumTypeId = getDataTypeElement().getEnumTypeId();
+ try {
+ return EnumeratedAttributeValuesPropertyDescriptor.fromModel(OseeEnumTypeManager.getType(enumTypeId).getName());
+ } catch (OseeCoreException ex) {
+ return -1;
+ }
+ }
+ if (id == idToolTipText) {
+ return StringPropertyDescriptor.fromModel(getDataTypeElement().getToolTipText());
+ }
+ if (id == idFileTypeExtension) {
+ return StringPropertyDescriptor.fromModel(getDataTypeElement().getFileTypeExtension());
+ }
+ if (id == idTaggerId) {
+ return StringPropertyDescriptor.fromModel(getDataTypeElement().getTaggerId());
+ }
+ if (id == idMinOccurrence) {
+ return IntegerPropertyDescriptor.fromModel(getDataTypeElement().getMinOccurrence());
+ }
+ if (id == idMaxOccurrence) {
+ return IntegerPropertyDescriptor.fromModel(getDataTypeElement().getMaxOccurrence());
+ }
+ if (id == idBaseAttributeClass) {
+ return AttributeBaseClassPropertyDescriptor.fromModel(getDataTypeElement().getBaseAttributeClass());
+ }
+ if (id == idProviderAttributeClass) {
+ return AttributeProviderPropertyDescriptor.fromModel(getDataTypeElement().getProviderAttributeClass());
+ }
+ return false;
+ }
+
+ @Override
+ public void resetPropertyValue(Object id) {
+ if (id == idDefaultValue) {
+ getDataTypeElement().setDefaultValue(null);
+ }
+ if (id == idEnumType) {
+ getDataTypeElement().setEnumTypeId(0);
+ }
+ if (id == idToolTipText) {
+ getDataTypeElement().setToolTipText(null);
+ }
+ if (id == idFileTypeExtension) {
+ getDataTypeElement().setFileTypeExtension(null);
+ }
+ if (id == idTaggerId) {
+ getDataTypeElement().setTaggerId(null);
+ }
+ if (id == idMinOccurrence) {
+ getDataTypeElement().setMinOccurrence(-1);
+ }
+ if (id == idMaxOccurrence) {
+ getDataTypeElement().setMaxOccurrence(-1);
+ }
+ if (id == idBaseAttributeClass) {
+ getDataTypeElement().setBaseAttributeClass(null);
+ }
+ if (id == idProviderAttributeClass) {
+ getDataTypeElement().setProviderAttributeClass(null);
+ }
+ }
+
+ @Override
+ public void setPropertyValue(Object id, Object value) {
+ if (id == idDefaultValue) {
+ getDataTypeElement().setDefaultValue(StringPropertyDescriptor.toModel(value));
+ }
+ if (id == idEnumType) {
+ String enumTypeName = EnumeratedAttributeValuesPropertyDescriptor.toModel(value);
+ try {
+ getDataTypeElement().setEnumTypeId(OseeEnumTypeManager.getType(enumTypeName).getId());
+ } catch (OseeCoreException ex) {
+ OseeLog.log(ODMEditorActivator.class, Level.SEVERE, ex);
+ }
+ }
+ if (id == idToolTipText) {
+ getDataTypeElement().setToolTipText(StringPropertyDescriptor.toModel(value));
+ }
+ if (id == idFileTypeExtension) {
+ getDataTypeElement().setFileTypeExtension(StringPropertyDescriptor.toModel(value));
+ }
+ if (id == idTaggerId) {
+ getDataTypeElement().setTaggerId(StringPropertyDescriptor.toModel(value));
+ }
+ if (id == idMinOccurrence) {
+ getDataTypeElement().setMinOccurrence(IntegerPropertyDescriptor.toModel(value));
+ }
+ if (id == idMaxOccurrence) {
+ getDataTypeElement().setMaxOccurrence(IntegerPropertyDescriptor.toModel(value));
+ }
+ if (id == idBaseAttributeClass) {
+ getDataTypeElement().setBaseAttributeClass(AttributeBaseClassPropertyDescriptor.toModel(value));
+ }
+ if (id == idProviderAttributeClass) {
+ getDataTypeElement().setProviderAttributeClass(AttributeProviderPropertyDescriptor.toModel(value));
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/AttributeProviderPropertyDescriptor.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/AttributeProviderPropertyDescriptor.java
new file mode 100644
index 00000000000..d2db118f514
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/AttributeProviderPropertyDescriptor.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.property;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.osee.framework.core.exception.OseeStateException;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.attribute.AttributeExtensionManager;
+import org.eclipse.osee.framework.ui.data.model.editor.ODMEditorActivator;
+import org.eclipse.osee.framework.ui.plugin.views.property.PropertyId;
+import org.eclipse.ui.views.properties.ComboBoxPropertyDescriptor;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class AttributeProviderPropertyDescriptor extends ComboBoxPropertyDescriptor {
+
+ private static final List<String> items = new ArrayList<String>();
+ static {
+ try {
+ items.addAll(AttributeExtensionManager.getAttributeProviders());
+ } catch (OseeStateException ex) {
+ OseeLog.log(ODMEditorActivator.class, Level.SEVERE, ex);
+ }
+ }
+
+ public AttributeProviderPropertyDescriptor(PropertyId propertyId) {
+ super(propertyId, propertyId.getDisplayName(), items.toArray(new String[items.size()]));
+ setCategory(propertyId.getCategoryName());
+ }
+
+ public static Integer fromModel(Object object) {
+ String value = (String) object;
+ int index = items.indexOf(value);
+ if (index < 0) {
+ items.add(value);
+ index = items.size() - 1;
+ }
+ return index;
+ }
+
+ public static String toModel(Object object) {
+ if (object != null) {
+ return items.get(((Integer) object).intValue());
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/ConnectionPropertySource.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/ConnectionPropertySource.java
new file mode 100644
index 00000000000..ca25d4e4605
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/ConnectionPropertySource.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.property;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.draw2d.AbsoluteBendpoint;
+import org.eclipse.draw2d.Bendpoint;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ConnectionModel;
+import org.eclipse.osee.framework.ui.plugin.views.property.ModelPropertySource;
+import org.eclipse.osee.framework.ui.plugin.views.property.PropertyId;
+import org.eclipse.osee.framework.ui.plugin.views.property.StringPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ConnectionPropertySource extends ModelPropertySource {
+
+ private final PropertyId idBendpoints;
+
+ public ConnectionPropertySource(String categoryName, Object model) {
+ super(model);
+ idBendpoints = new PropertyId(categoryName, "Bendpoints");
+ }
+
+ protected void addPropertyDescriptors(List<IPropertyDescriptor> list) {
+ list.add(new StringPropertyDescriptor(idBendpoints));
+ }
+
+ public boolean isPropertyResettable(Object id) {
+ return id == idBendpoints;
+ }
+
+ protected ConnectionModel<?> getConnectionModel() {
+ return (ConnectionModel<?>) getModel();
+ }
+
+ public Object getPropertyValue(Object id) {
+ if (id == idBendpoints) {
+ StringBuffer buffer = new StringBuffer();
+ for (Object object : getConnectionModel().getBendpoints()) {
+ Bendpoint bendPoint = (Bendpoint) object;
+ Point point = bendPoint.getLocation();
+ buffer.append(point.x);
+ buffer.append(',');
+ buffer.append(point.y);
+ buffer.append(' ');
+ }
+ return buffer.toString();
+ }
+ return null;
+ }
+
+ public boolean isPropertySet(Object id) {
+ return id == idBendpoints && !getConnectionModel().getBendpoints().isEmpty();
+ }
+
+ public void resetPropertyValue(Object id) {
+ if (id == idBendpoints) getConnectionModel().getBendpoints().clear();
+ }
+
+ public void setPropertyValue(Object id, Object value) {
+ if (id == idBendpoints) {
+ List<AbsoluteBendpoint> points = new ArrayList<AbsoluteBendpoint>();
+ try {
+ String[] result = ((String) value).split(" ");
+ for (int i = 0; i < result.length; i++) {
+ String[] coordinates = result[i].split(",");
+ points.add(new AbsoluteBendpoint(Integer.parseInt(coordinates[0]), Integer.parseInt(coordinates[1])));
+ }
+ getConnectionModel().getBendpoints().clear();
+ getConnectionModel().getBendpoints().addAll(points);
+ } catch (Exception e) {
+ }
+ }
+ }
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/DataTypeElementPropertySource.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/DataTypeElementPropertySource.java
new file mode 100644
index 00000000000..7c2914d1219
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/DataTypeElementPropertySource.java
@@ -0,0 +1,78 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.property;
+
+import java.util.List;
+import org.eclipse.osee.framework.ui.data.model.editor.model.DataType;
+import org.eclipse.osee.framework.ui.plugin.views.property.ModelPropertySource;
+import org.eclipse.osee.framework.ui.plugin.views.property.PropertyId;
+import org.eclipse.osee.framework.ui.plugin.views.property.ReadOnlyPropertyDescriptor;
+import org.eclipse.osee.framework.ui.plugin.views.property.StringPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class DataTypeElementPropertySource extends ModelPropertySource {
+
+ protected final PropertyId idName;
+ protected final PropertyId idUniqueId;
+
+ public DataTypeElementPropertySource(String categoryName, Object dataType) {
+ super(dataType);
+ idUniqueId = new PropertyId(categoryName, "UniqueId");
+ idName = new PropertyId(categoryName, "Name");
+ }
+
+ protected void addPropertyDescriptors(List<IPropertyDescriptor> list) {
+ list.add(new ReadOnlyPropertyDescriptor(idUniqueId));
+ list.add(new StringPropertyDescriptor(idName));
+ }
+
+ protected DataType getDataTypeElement() {
+ return (DataType) getModel();
+ }
+
+ public Object getPropertyValue(Object id) {
+ if (id == idUniqueId)
+ return ReadOnlyPropertyDescriptor.fromModel(getDataTypeElement().getUniqueId());
+ if (id == idName)
+ return StringPropertyDescriptor.fromModel(getDataTypeElement().getName());
+ return null;
+ }
+
+ public boolean isPropertyResettable(Object id) {
+ return id == idName;
+ }
+
+ public boolean isPropertySet(Object id) {
+ if (id == idUniqueId)
+ return true;
+ if (id == idName)
+ return getDataTypeElement().getName() != null;
+ return false;
+ }
+
+ public void resetPropertyValue(Object id) {
+ if (id == idUniqueId)
+ return;
+ if (id == idName)
+ getDataTypeElement().setName(null);
+ }
+
+ public void setPropertyValue(Object id, Object value) {
+ if (id == idUniqueId)
+ return;
+ if (id == idName)
+ getDataTypeElement().setName(StringPropertyDescriptor.toModel(value));
+ }
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/EnumPropertySource.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/EnumPropertySource.java
new file mode 100644
index 00000000000..a014ef5b717
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/EnumPropertySource.java
@@ -0,0 +1,89 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.property;
+
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.OseeEnumType;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.attribute.OseeEnumTypeManager;
+import org.eclipse.osee.framework.ui.data.model.editor.ODMEditorActivator;
+import org.eclipse.osee.framework.ui.data.model.editor.model.AttributeDataType;
+import org.eclipse.osee.framework.ui.plugin.views.property.ModelPropertySource;
+import org.eclipse.osee.framework.ui.plugin.views.property.PropertyId;
+import org.eclipse.osee.framework.ui.plugin.views.property.StringPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class EnumPropertySource extends ModelPropertySource {
+ protected final PropertyId idEnumTypeList;
+
+ public EnumPropertySource(String categoryName, Object dataType) {
+ super(dataType);
+ idEnumTypeList = new PropertyId(categoryName, "Enum Type");
+ }
+
+ @Override
+ protected void addPropertyDescriptors(List<IPropertyDescriptor> list) {
+ list.add(new StringPropertyDescriptor(idEnumTypeList));
+ }
+
+ protected AttributeDataType getDataTypeElement() {
+ return (AttributeDataType) getModel();
+ }
+
+ @Override
+ public boolean isPropertyResettable(Object id) {
+ return id == idEnumTypeList;
+ }
+
+ @Override
+ public boolean isPropertySet(Object id) {
+ if (id == idEnumTypeList) {
+ return false;
+ }
+ return false;
+ }
+
+ @Override
+ public Object getPropertyValue(Object id) {
+ if (id == idEnumTypeList) {
+ int enumTypeId = getDataTypeElement().getEnumTypeId();
+ OseeEnumType enumType = null;
+ String descriptor = "";
+ try {
+ enumType = OseeEnumTypeManager.getType(enumTypeId);
+ if (enumType != null) {
+ descriptor = enumType.valuesAsOrderedStringSet().toString();
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(ODMEditorActivator.class, Level.SEVERE, ex);
+ }
+ return StringPropertyDescriptor.fromModel(descriptor);
+ }
+ return 0;
+ }
+
+ @Override
+ public void resetPropertyValue(Object id) {
+ // Here
+ System.out.println("resetPropertyValue");
+ }
+
+ @Override
+ public void setPropertyValue(Object id, Object value) {
+ // Here
+ System.out.println("setPropertyValue");
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/EnumeratedAttributeValuesPropertyDescriptor.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/EnumeratedAttributeValuesPropertyDescriptor.java
new file mode 100644
index 00000000000..60fd12ded8c
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/EnumeratedAttributeValuesPropertyDescriptor.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.property;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.attribute.OseeEnumTypeManager;
+import org.eclipse.osee.framework.ui.data.model.editor.ODMEditorActivator;
+import org.eclipse.osee.framework.ui.plugin.views.property.PropertyId;
+import org.eclipse.ui.views.properties.ComboBoxPropertyDescriptor;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class EnumeratedAttributeValuesPropertyDescriptor extends ComboBoxPropertyDescriptor {
+
+ private static final List<String> items = new ArrayList<String>();
+ static {
+ try {
+ items.addAll(OseeEnumTypeManager.getAllTypeNames());
+ } catch (OseeCoreException ex) {
+ OseeLog.log(ODMEditorActivator.class, Level.SEVERE, ex);
+ }
+ }
+
+ public EnumeratedAttributeValuesPropertyDescriptor(PropertyId propertyId) {
+ super(propertyId, propertyId.getDisplayName(), items.toArray(new String[items.size()]));
+ setCategory(propertyId.getCategoryName());
+ }
+
+ public static Integer fromModel(Object object) {
+ String value = (String) object;
+ int index = items.indexOf(value);
+ if (index < 0) {
+ items.add(value);
+ index = items.size() - 1;
+ }
+ return index;
+ }
+
+ public static String toModel(Object object) {
+ if (object != null) {
+ int index = ((Integer) object).intValue();
+ if (index > -1) {
+ return items.get(index);
+ }
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/NodePropertySource.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/NodePropertySource.java
new file mode 100644
index 00000000000..22fa4ec7ce5
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/NodePropertySource.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.property;
+
+import java.util.List;
+import org.eclipse.draw2d.geometry.Point;
+import org.eclipse.jface.viewers.ICellEditorValidator;
+import org.eclipse.osee.framework.ui.data.model.editor.model.NodeModel;
+import org.eclipse.osee.framework.ui.plugin.views.property.IntegerPropertyDescriptor;
+import org.eclipse.osee.framework.ui.plugin.views.property.ModelPropertySource;
+import org.eclipse.osee.framework.ui.plugin.views.property.PropertyId;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class NodePropertySource extends ModelPropertySource {
+
+ private final PropertyId idX;
+ private final PropertyId idY;
+ private final PropertyId idWidth;
+
+ public NodePropertySource(String categoryName, Object model) {
+ super(model);
+ idX = new PropertyId(categoryName, "X");
+ idY = new PropertyId(categoryName, "Y");
+ idWidth = new PropertyId(categoryName, "Width");
+ }
+
+ protected void addPropertyDescriptors(List<IPropertyDescriptor> list) {
+ list.add(new IntegerPropertyDescriptor(idX));
+ list.add(new IntegerPropertyDescriptor(idY));
+ IntegerPropertyDescriptor integerDescriptor = new IntegerPropertyDescriptor(idWidth);
+ integerDescriptor.setValidator(new ICellEditorValidator() {
+ public String isValid(Object value) {
+ try {
+ int val = Integer.parseInt((String) value);
+ if (val == -1 || val > 0) return null;
+ } catch (NumberFormatException nfe) {
+ }
+ return "The width has to be an integer greater than 0 (or -1 for default).";
+ }
+ });
+ list.add(integerDescriptor);
+ }
+
+ protected NodeModel getNode() {
+ return (NodeModel) getModel();
+ }
+
+ public Object getPropertyValue(Object id) {
+ if (id == idX) return IntegerPropertyDescriptor.fromModel(getNode().getLocation().x);
+ if (id == idY) return IntegerPropertyDescriptor.fromModel(getNode().getLocation().y);
+ if (id == idWidth) return IntegerPropertyDescriptor.fromModel(getNode().getWidth());
+ return null;
+ }
+
+ public boolean isPropertyResettable(Object id) {
+ return id == idWidth;
+ }
+
+ public boolean isPropertySet(Object id) {
+ if (id == idWidth) return getNode().getWidth() != -1;
+ return false;
+ }
+
+ public void resetPropertyValue(Object id) {
+ if (id == idWidth) getNode().setWidth(-1);
+ }
+
+ public void setPropertyValue(Object id, Object value) {
+ if (id == idX) {
+ Point newLoc = getNode().getLocation().getCopy();
+ newLoc.x = IntegerPropertyDescriptor.toModel(value);
+ getNode().setLocation(newLoc);
+ } else if (id == idY) {
+ Point newLoc = getNode().getLocation().getCopy();
+ newLoc.y = IntegerPropertyDescriptor.toModel(value);
+ getNode().setLocation(newLoc);
+ } else if (id == idWidth) getNode().setWidth(IntegerPropertyDescriptor.toModel(value));
+ }
+
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/PropertySourceFactory.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/PropertySourceFactory.java
new file mode 100644
index 00000000000..b5c6e172514
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/PropertySourceFactory.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.property;
+
+import org.eclipse.osee.framework.ui.data.model.editor.model.ArtifactDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.AttributeDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ConnectionModel;
+import org.eclipse.osee.framework.ui.data.model.editor.model.NodeModel;
+import org.eclipse.osee.framework.ui.data.model.editor.model.RelationDataType;
+import org.eclipse.osee.framework.ui.plugin.views.property.CompositePropertySource;
+import org.eclipse.ui.views.properties.IPropertySource;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class PropertySourceFactory {
+
+ private static final String CATEGORY_WIDGET = "Widget";
+ private static final String CATEGORY_ENUM = "Enum";
+ private static final String CATEGORY_ARTIFACT = "Artifact";
+ private static final String CATEGORY_ATTRIBUTE = "Attribute";
+ private static final String CATEGORY_RELATION = "Relation";
+ private static final String CATEGORY_DATA = " Data";
+ private static final String CATEGORY_LINK = "Link";
+
+ private PropertySourceFactory() {
+ super();
+ }
+
+ public static IPropertySource getPropertySource(Object model) {
+ IPropertySource toReturn = null;
+ if (model instanceof ConnectionModel) {
+ toReturn = new ConnectionPropertySource(CATEGORY_LINK, model);
+ } else if (model instanceof AttributeDataType) {
+ toReturn =
+ new CompositePropertySource(new DataTypeElementPropertySource(CATEGORY_ATTRIBUTE, model),
+ new AttributePropertySource(CATEGORY_ATTRIBUTE + CATEGORY_DATA, model), new EnumPropertySource(
+ CATEGORY_ENUM + CATEGORY_DATA, model));//, new NodePropertySource(CATEGORY_WIDGET, model));
+ } else if (model instanceof RelationDataType) {
+ toReturn =
+ new CompositePropertySource(new DataTypeElementPropertySource(CATEGORY_RELATION, model),
+ new RelationPropertySource(CATEGORY_RELATION + CATEGORY_DATA, model), new NodePropertySource(
+ CATEGORY_WIDGET, model));
+ } else if (model instanceof ArtifactDataType) {
+ toReturn =
+ new CompositePropertySource(new DataTypeElementPropertySource(CATEGORY_ARTIFACT, model),
+ new ArtifactPropertySource(CATEGORY_ARTIFACT + CATEGORY_DATA, model), new NodePropertySource(
+ CATEGORY_WIDGET, model));
+ } else if (model instanceof NodeModel) {
+ toReturn = new NodePropertySource(CATEGORY_WIDGET, model);
+ }
+ return toReturn;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/RelationPropertySource.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/RelationPropertySource.java
new file mode 100644
index 00000000000..b4183a35df7
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/property/RelationPropertySource.java
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.property;
+
+import java.util.List;
+import org.eclipse.osee.framework.ui.data.model.editor.model.RelationDataType;
+import org.eclipse.osee.framework.ui.plugin.views.property.BooleanPropertyDescriptor;
+import org.eclipse.osee.framework.ui.plugin.views.property.ModelPropertySource;
+import org.eclipse.osee.framework.ui.plugin.views.property.PropertyId;
+import org.eclipse.osee.framework.ui.plugin.views.property.StringPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class RelationPropertySource extends ModelPropertySource {
+
+ protected final PropertyId idSideAName;
+ protected final PropertyId idSideBName;
+ protected final PropertyId idAToBPhrase;
+ protected final PropertyId idBToAPhrase;
+ protected final PropertyId idShortName;
+ protected final PropertyId idOrdered;
+
+ public RelationPropertySource(String categoryName, Object dataType) {
+ super((RelationDataType) dataType);
+ idSideAName = new PropertyId(categoryName, "Side A Name");
+ idSideBName = new PropertyId(categoryName, "Side B Name");
+ idAToBPhrase = new PropertyId(categoryName, "A to B Phrase");
+ idBToAPhrase = new PropertyId(categoryName, "B to A Phrase");
+ idShortName = new PropertyId(categoryName, "Short Name");
+ idOrdered = new PropertyId(categoryName, "Is Ordered");
+ }
+
+ @Override
+ protected void addPropertyDescriptors(List<IPropertyDescriptor> list) {
+ list.add(new StringPropertyDescriptor(idSideAName));
+ list.add(new StringPropertyDescriptor(idSideBName));
+ list.add(new StringPropertyDescriptor(idAToBPhrase));
+ list.add(new StringPropertyDescriptor(idBToAPhrase));
+ list.add(new StringPropertyDescriptor(idShortName));
+ list.add(new BooleanPropertyDescriptor(idOrdered));
+ }
+
+ protected RelationDataType getDataTypeElement() {
+ return (RelationDataType) getModel();
+ }
+
+ @Override
+ public boolean isPropertyResettable(Object id) {
+ return id == idSideAName || id == idSideBName || id == idAToBPhrase || id == idBToAPhrase || id == idShortName || id == idOrdered;
+ }
+
+ @Override
+ public boolean isPropertySet(Object id) {
+ if (id == idSideAName) return getDataTypeElement().getSideAName() != null;
+ if (id == idSideBName) return getDataTypeElement().getSideBName() != null;
+ if (id == idAToBPhrase) return getDataTypeElement().getAToBPhrase() != null;
+ if (id == idBToAPhrase) return getDataTypeElement().getBToAPhrase() != null;
+ if (id == idShortName) return getDataTypeElement().getShortName() != null;
+ if (id == idOrdered) {
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ public Object getPropertyValue(Object id) {
+ if (id == idSideAName) return StringPropertyDescriptor.fromModel(getDataTypeElement().getSideAName());
+ if (id == idSideBName) return StringPropertyDescriptor.fromModel(getDataTypeElement().getSideBName());
+ if (id == idAToBPhrase) return StringPropertyDescriptor.fromModel(getDataTypeElement().getAToBPhrase());
+ if (id == idBToAPhrase) return StringPropertyDescriptor.fromModel(getDataTypeElement().getBToAPhrase());
+ if (id == idShortName) return StringPropertyDescriptor.fromModel(getDataTypeElement().getShortName());
+ if (id == idOrdered) return BooleanPropertyDescriptor.fromModel(getDataTypeElement().getOrdered());
+ return false;
+ }
+
+ @Override
+ public void resetPropertyValue(Object id) {
+ if (id == idSideAName) getDataTypeElement().setSideAName(null);
+ if (id == idSideBName) getDataTypeElement().setSideBName(null);
+ if (id == idAToBPhrase) getDataTypeElement().setAToBPhrase(null);
+ if (id == idBToAPhrase) getDataTypeElement().setBToAPhrase(null);
+ if (id == idShortName) getDataTypeElement().setShortName(null);
+ if (id == idOrdered) getDataTypeElement().setOrdered(true);
+ }
+
+ @Override
+ public void setPropertyValue(Object id, Object value) {
+ if (id == idSideAName) getDataTypeElement().setSideAName(StringPropertyDescriptor.toModel(value));
+ if (id == idSideBName) getDataTypeElement().setSideBName(StringPropertyDescriptor.toModel(value));
+ if (id == idAToBPhrase) getDataTypeElement().setAToBPhrase(StringPropertyDescriptor.toModel(value));
+ if (id == idBToAPhrase) getDataTypeElement().setBToAPhrase(StringPropertyDescriptor.toModel(value));
+ if (id == idShortName) getDataTypeElement().setShortName(StringPropertyDescriptor.toModel(value));
+ if (id == idOrdered) getDataTypeElement().setOrdered(BooleanPropertyDescriptor.toModel(value));
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/utility/Base64Converter.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/utility/Base64Converter.java
new file mode 100644
index 00000000000..ffc2beeea38
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/utility/Base64Converter.java
@@ -0,0 +1,193 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.utility;
+
+public class Base64Converter {
+
+ private static final byte equalSign = (byte) '=';
+
+ static char digits[] = {'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', //
+ 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', //
+ 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', //
+ 'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'};
+
+ /**
+ * This method decodes the byte array in base 64 encoding into a char array Base 64 encoding has to be according to
+ * the specification given by the RFC 1521 (5.2).
+ *
+ * @param data the encoded byte array
+ * @return the decoded byte array
+ */
+ public static byte[] decode(byte[] data) {
+ if (data.length == 0) return data;
+ int lastRealDataIndex = data.length - 1;
+ while (data[lastRealDataIndex] == equalSign)
+ lastRealDataIndex--;
+ // original data digit is 8 bits long, but base64 digit is 6 bits long
+ int padBytes = data.length - 1 - lastRealDataIndex;
+ int byteLength = data.length * 6 / 8 - padBytes;
+ byte[] result = new byte[byteLength];
+ // Each 4 bytes of input (encoded) we end up with 3 bytes of output
+ int dataIndex = 0;
+ int resultIndex = 0;
+ int allBits = 0;
+ // how many result chunks we can process before getting to pad bytes
+ int resultChunks = (lastRealDataIndex + 1) / 4;
+ for (int i = 0; i < resultChunks; i++) {
+ allBits = 0;
+ // Loop 4 times gathering input bits (4 * 6 = 24)
+ for (int j = 0; j < 4; j++)
+ allBits = (allBits << 6) | decodeDigit(data[dataIndex++]);
+ // Loop 3 times generating output bits (3 * 8 = 24)
+ for (int j = resultIndex + 2; j >= resultIndex; j--) {
+ result[j] = (byte) (allBits & 0xff); // Bottom 8 bits
+ allBits = allBits >>> 8;
+ }
+ resultIndex += 3; // processed 3 result bytes
+ }
+ // Now we do the extra bytes in case the original (non-encoded) data
+ // was not multiple of 3 bytes
+ switch (padBytes) {
+ case 1:
+ // 1 pad byte means 3 (4-1) extra Base64 bytes of input, 18
+ // bits, of which only 16 are meaningful
+ // Or: 2 bytes of result data
+ allBits = 0;
+ // Loop 3 times gathering input bits
+ for (int j = 0; j < 3; j++)
+ allBits = (allBits << 6) | decodeDigit(data[dataIndex++]);
+ // NOTE - The code below ends up being equivalent to allBits =
+ // allBits>>>2
+ // But we code it in a non-optimized way for clarity
+ // The 4th, missing 6 bits are all 0
+ allBits = allBits << 6;
+ // The 3rd, missing 8 bits are all 0
+ allBits = allBits >>> 8;
+ // Loop 2 times generating output bits
+ for (int j = resultIndex + 1; j >= resultIndex; j--) {
+ result[j] = (byte) (allBits & 0xff); // Bottom 8
+ // bits
+ allBits = allBits >>> 8;
+ }
+ break;
+ case 2:
+ // 2 pad bytes mean 2 (4-2) extra Base64 bytes of input, 12 bits
+ // of data, of which only 8 are meaningful
+ // Or: 1 byte of result data
+ allBits = 0;
+ // Loop 2 times gathering input bits
+ for (int j = 0; j < 2; j++)
+ allBits = (allBits << 6) | decodeDigit(data[dataIndex++]);
+ // NOTE - The code below ends up being equivalent to allBits =
+ // allBits>>>4
+ // But we code it in a non-optimized way for clarity
+ // The 3rd and 4th, missing 6 bits are all 0
+ allBits = allBits << 6;
+ allBits = allBits << 6;
+ // The 3rd and 4th, missing 8 bits are all 0
+ allBits = allBits >>> 8;
+ allBits = allBits >>> 8;
+ result[resultIndex] = (byte) (allBits & 0xff); // Bottom
+ // 8
+ // bits
+ break;
+ }
+ return result;
+ }
+
+ /**
+ * This method converts a Base 64 digit to its numeric value.
+ *
+ * @param data digit (character) to convert
+ * @return value for the digit
+ */
+ static int decodeDigit(byte data) {
+ char charData = (char) data;
+ if (charData <= 'Z' && charData >= 'A') return charData - 'A';
+ if (charData <= 'z' && charData >= 'a') return charData - 'a' + 26;
+ if (charData <= '9' && charData >= '0') return charData - '0' + 52;
+ switch (charData) {
+ case '+':
+ return 62;
+ case '/':
+ return 63;
+ default:
+ throw new IllegalArgumentException("Invalid char to decode: " + data); //$NON-NLS-1$
+ }
+ }
+
+ /**
+ * This method encodes the byte array into a char array in base 64 according to the specification given by the RFC
+ * 1521 (5.2).
+ *
+ * @param data the encoded char array
+ * @return the byte array that needs to be encoded
+ */
+ public static byte[] encode(byte[] data) {
+ int sourceChunks = data.length / 3;
+ int len = ((data.length + 2) / 3) * 4;
+ byte[] result = new byte[len];
+ int extraBytes = data.length - (sourceChunks * 3);
+ // Each 4 bytes of input (encoded) we end up with 3 bytes of output
+ int dataIndex = 0;
+ int resultIndex = 0;
+ int allBits = 0;
+ for (int i = 0; i < sourceChunks; i++) {
+ allBits = 0;
+ // Loop 3 times gathering input bits (3 * 8 = 24)
+ for (int j = 0; j < 3; j++)
+ allBits = (allBits << 8) | (data[dataIndex++] & 0xff);
+ // Loop 4 times generating output bits (4 * 6 = 24)
+ for (int j = resultIndex + 3; j >= resultIndex; j--) {
+ result[j] = (byte) digits[(allBits & 0x3f)]; // Bottom
+ // 6
+ // bits
+ allBits = allBits >>> 6;
+ }
+ resultIndex += 4; // processed 4 result bytes
+ }
+ // Now we do the extra bytes in case the original (non-encoded) data
+ // is not multiple of 4 bytes
+ switch (extraBytes) {
+ case 1:
+ allBits = data[dataIndex++]; // actual byte
+ allBits = allBits << 8; // 8 bits of zeroes
+ allBits = allBits << 8; // 8 bits of zeroes
+ // Loop 4 times generating output bits (4 * 6 = 24)
+ for (int j = resultIndex + 3; j >= resultIndex; j--) {
+ result[j] = (byte) digits[(allBits & 0x3f)]; // Bottom
+ // 6
+ // bits
+ allBits = allBits >>> 6;
+ }
+ // 2 pad tags
+ result[result.length - 1] = (byte) '=';
+ result[result.length - 2] = (byte) '=';
+ break;
+ case 2:
+ allBits = data[dataIndex++]; // actual byte
+ allBits = (allBits << 8) | (data[dataIndex++] & 0xff); // actual
+ // byte
+ allBits = allBits << 8; // 8 bits of zeroes
+ // Loop 4 times generating output bits (4 * 6 = 24)
+ for (int j = resultIndex + 3; j >= resultIndex; j--) {
+ result[j] = (byte) digits[(allBits & 0x3f)]; // Bottom
+ // 6
+ // bits
+ allBits = allBits >>> 6;
+ }
+ // 1 pad tag
+ result[result.length - 1] = (byte) '=';
+ break;
+ }
+ return result;
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/utility/ImageUtility.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/utility/ImageUtility.java
new file mode 100644
index 00000000000..bdace0e5903
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/utility/ImageUtility.java
@@ -0,0 +1,95 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.utility;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.ImageData;
+import org.eclipse.swt.graphics.ImageLoader;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ImageUtility {
+
+ private final static byte[] JPEG_HEADER = new byte[] {(byte) 0xff, (byte) 0xd8};
+ private final static byte[] PNG_HEADER =
+ new byte[] {(byte) 0x89, (byte) 0x50, (byte) 0x4E, (byte) 0x47, (byte) 0x0D, (byte) 0x0A, (byte) 0x1A,
+ (byte) 0x0A};
+ private final static byte[] GIF_HEADER = new byte[] {(byte) 0x47, (byte) 0x49, (byte) 0x46};
+ private final static byte[] TIFF_HEADER = new byte[] {(byte) 0x49, (byte) 0x49, (byte) 0x2A};
+ private final static byte[] BMP_HEADER = new byte[] {(byte) 0x42, (byte) 0x4D};
+ private final static byte[] ICO_HEADER = new byte[] {(byte) 0x00};
+
+ private ImageUtility() {
+ }
+
+ public static byte[] imageToBytes(Image image) {
+ ByteArrayOutputStream buffer = new ByteArrayOutputStream();
+ ImageLoader imageLoader = new ImageLoader();
+ imageLoader.data = new ImageData[] {image.getImageData()};
+ imageLoader.save(buffer, SWT.IMAGE_JPEG);
+ return buffer.toByteArray();
+ }
+
+ public static Image bytesToImage(byte[] rawData) {
+ ImageLoader imageLoader = new ImageLoader();
+ ImageData[] images = imageLoader.load(new ByteArrayInputStream(rawData));
+ if (images != null && images.length > 0) {
+ return ImageDescriptor.createFromImageData(images[0]).createImage();
+ }
+ return null;
+ }
+
+ public static byte[] imageToBase64(Image image) {
+ return Base64Converter.encode(imageToBytes(image));
+ }
+
+ public static Image base64ToImage(byte[] rawData) {
+ return bytesToImage(Base64Converter.decode(rawData));
+ }
+
+ private static boolean doesHeaderMatch(byte[] header, byte[] data) {
+ if (data != null && header != null && data.length > header.length) {
+ for (int index = 0; index < header.length; index++) {
+ if (header[index] != data[index]) {
+ return false;
+ }
+ }
+ } else {
+ return false;
+ }
+ return true;
+ }
+
+ public static int getImageType(byte[] data) {
+ if (doesHeaderMatch(ICO_HEADER, data)) return SWT.IMAGE_ICO;
+ if (doesHeaderMatch(JPEG_HEADER, data)) return SWT.IMAGE_JPEG;
+ if (doesHeaderMatch(BMP_HEADER, data)) {
+ if (data.length > 14 && data[14] == 0x40) {
+ if (data.length > 30 && data[30] == 0x00) {
+ return SWT.IMAGE_BMP;
+ } else {
+ return SWT.IMAGE_BMP_RLE;
+ }
+ } else {
+ return SWT.IMAGE_OS2_BMP;
+ }
+ }
+ if (doesHeaderMatch(GIF_HEADER, data)) return SWT.IMAGE_GIF;
+ if (doesHeaderMatch(TIFF_HEADER, data)) return SWT.IMAGE_TIFF;
+ if (doesHeaderMatch(PNG_HEADER, data)) return SWT.IMAGE_PNG;
+ return SWT.IMAGE_UNDEFINED;
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/utility/ODMConstants.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/utility/ODMConstants.java
new file mode 100644
index 00000000000..d8da9f276e7
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/utility/ODMConstants.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.utility;
+
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.osee.framework.ui.data.model.editor.model.DataType;
+import org.eclipse.swt.graphics.Font;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ODMConstants {
+
+ public static final int TOTAL_STEPS = Integer.MAX_VALUE;
+ public static final int SHORT_TASK_STEPS = TOTAL_STEPS / 50;
+ public static final int VERY_LONG_TASK = TOTAL_STEPS / 2;
+ public static final int TASK_STEPS = (TOTAL_STEPS - SHORT_TASK_STEPS * 3 - VERY_LONG_TASK) / 2;
+
+ public static final Font HEADER_FONT = JFaceResources.getTextFont();
+
+ public static String getDataTypeText(DataType dataType) {
+ return dataType.getName();
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/utility/ODMImage.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/utility/ODMImage.java
new file mode 100644
index 00000000000..d50087915d8
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/utility/ODMImage.java
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.utility;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.osee.framework.ui.data.model.editor.ODMEditorActivator;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.osee.framework.ui.swt.KeyedImage;
+
+/**
+ * @author Roberto E. Escobar
+ * @author Ryan Schmitt
+ */
+public enum ODMImage implements KeyedImage {
+
+ EXPORT_IMAGE("extractsupertype_wiz.png"),
+ IMPORT_IMAGE("importsupertype_wiz.png"),
+
+ DATASTORE_IMAGE("datastore.gif"),
+ NAMESPACE_IMAGE("package_mode.gif"),
+ FILE_SOURCE_IMAGE("file.gif"),
+ INHERITANCE("hierarchy_co.gif"),
+
+ INHERITED_ATTRIBUTE("access_restriction_attrib.gif"),
+ LOCAL_ATTRIBUTE("local_attribute.gif"),
+ INHERITED_RELATION("access_restriction_relat.gif"),
+ LOCAL_RELATION("arrows.gif"),
+
+ EXPAND_ALL("expandAll.gif"),
+ TWO_WAY_REFERENCE("two_way_reference.gif"),
+ ONE_WAY_REFERENCE("one_way_reference.gif"),
+
+ SNAP_TO_GRID("geometry.gif"),
+ SNAP_TO_GRID_DISABLED("geometry_disabled.gif");
+
+ private final String fileName;
+
+ private ODMImage(String fileName) {
+ this.fileName = fileName;
+ }
+
+ @Override
+ public ImageDescriptor createImageDescriptor() {
+ return ImageManager.createImageDescriptor(ODMEditorActivator.PLUGIN_ID, "images", fileName);
+ }
+
+ @Override
+ public String getImageKey() {
+ return ODMEditorActivator.PLUGIN_ID + ".images." + fileName;
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/FileOrFolderSelectPanel.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/FileOrFolderSelectPanel.java
new file mode 100644
index 00000000000..722905d2a2c
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/FileOrFolderSelectPanel.java
@@ -0,0 +1,198 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.wizard;
+
+import java.util.Collections;
+import java.util.HashSet;
+import java.util.Set;
+import org.eclipse.osee.framework.jdk.core.util.Lib;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.DirectoryDialog;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class FileOrFolderSelectPanel extends Composite {
+
+ public static enum ButtonType {
+ CHECK_BOX, RADIO;
+ }
+
+ private final boolean isFolderSelect;
+ private final String label;
+ private final String[] filterExtensions;
+ private final ListenerRelay eventRelay;
+ private final ButtonType buttonType;
+ private final Set<Listener> listeners;
+ private final int fileSelectStyle;
+
+ private boolean isSelected;
+ private Button button;
+ private String resource;
+ private String defaultFileName;
+
+ public static FileOrFolderSelectPanel createFileSelectPanel(Composite parent, int style, String label, int fileSelectStyle, ButtonType buttonType, String[] filterExtensions) {
+ return new FileOrFolderSelectPanel(parent, style, label, fileSelectStyle, buttonType, false, filterExtensions);
+ }
+
+ public static FileOrFolderSelectPanel createFolderSelectPanel(Composite parent, int style, String label, int fileSelectStyle, ButtonType buttonType) {
+ return new FileOrFolderSelectPanel(parent, style, label, fileSelectStyle, buttonType, true, null);
+ }
+
+ private FileOrFolderSelectPanel(Composite parent, int style, String label, int fileSelectStyle, ButtonType buttonType, boolean isFolderSelect, String[] filterExtensions) {
+ super(parent, style);
+ this.fileSelectStyle = fileSelectStyle;
+ this.isSelected = false;
+ this.buttonType = buttonType;
+ this.label = label;
+ this.filterExtensions = filterExtensions;
+ this.listeners = Collections.synchronizedSet(new HashSet<Listener>());
+ this.eventRelay = new ListenerRelay();
+ this.isFolderSelect = isFolderSelect;
+
+ GridLayout layout = new GridLayout(3, false);
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ this.setLayout(layout);
+ this.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ createControl(this);
+ }
+
+ private void createControl(Composite composite) {
+ button = new Button(composite, buttonType == ButtonType.CHECK_BOX ? SWT.CHECK : SWT.RADIO);
+ button.setText(label);
+ button.setSelection(isSelected);
+
+ final Text text = new Text(composite, SWT.BORDER | SWT.READ_ONLY);
+ GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
+ gridData.widthHint = 100;
+ text.setLayoutData(gridData);
+
+ final Button fileDialogButton = new Button(composite, SWT.PUSH);
+ fileDialogButton.setImage(PlatformUI.getWorkbench().getSharedImages().getImage(
+ isFolderSelect ? ISharedImages.IMG_OBJ_FOLDER : ISharedImages.IMG_OBJ_FILE));
+ fileDialogButton.addSelectionListener(new SelectionAdapter() {
+
+ public void widgetSelected(SelectionEvent e) {
+ String result = null;
+ if (isFolderSelect) {
+ DirectoryDialog directoryDialog = new DirectoryDialog(getShell(), fileSelectStyle);
+ if (Strings.isValid(resource)) {
+ directoryDialog.setFilterPath(resource);
+ } else {
+ if (Strings.isValid(defaultFileName)) {
+ directoryDialog.setFilterPath(defaultFileName);
+ }
+ }
+ result = directoryDialog.open();
+ } else {
+ FileDialog fileDialog = new FileDialog(getShell(), fileSelectStyle);
+ if (filterExtensions != null && filterExtensions.length > 0) {
+ fileDialog.setFilterExtensions(filterExtensions);
+ }
+ if (Strings.isValid(resource)) {
+ fileDialog.setFilterPath(Lib.removeExtension(resource));
+ }
+
+ if (Strings.isValid(resource)) {
+ fileDialog.setFileName(Lib.removeExtension(resource));
+ } else {
+ if (Strings.isValid(defaultFileName)) {
+ fileDialog.setFileName(defaultFileName);
+ }
+ }
+ fileDialog.setOverwrite(true);
+ result = fileDialog.open();
+ }
+ if (Strings.isValid(result)) {
+ resource = result;
+ text.setText(resource);
+ }
+ }
+ });
+
+ button.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ isSelected = button.getSelection();
+ text.setEnabled(isSelected);
+ fileDialogButton.setEnabled(isSelected);
+ }
+ });
+ text.addListener(SWT.Modify, eventRelay);
+ fileDialogButton.addListener(SWT.Selection, eventRelay);
+ button.addListener(SWT.Selection, eventRelay);
+ }
+
+ public void setSelected(boolean setSelected) {
+ isSelected = setSelected;
+ if (button != null && !button.isDisposed()) {
+ button.setSelection(isSelected);
+ }
+ }
+
+ public boolean isSelected() {
+ return isSelected;
+ }
+
+ public String getSelectedResource() {
+ return resource;
+ }
+
+ public void setResource(String resource) {
+ this.resource = resource;
+ }
+
+ public void setDefaultFileName(String defaultFileName) {
+ this.defaultFileName = defaultFileName;
+ }
+
+ public boolean isFile() {
+ return !isFolderSelect;
+ }
+
+ public void addListener(Listener listener) {
+ synchronized (listeners) {
+ listeners.add(listener);
+ }
+ }
+
+ public void removeListener(Listener listener) {
+ synchronized (listeners) {
+ listeners.remove(listener);
+ }
+ }
+
+ private final class ListenerRelay implements Listener {
+
+ @Override
+ public void handleEvent(Event event) {
+ synchronized (listeners) {
+ for (Listener listener : listeners) {
+ listener.handleEvent(event);
+ }
+ }
+ }
+
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/FileOrFolderTreeSelecPanel.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/FileOrFolderTreeSelecPanel.java
new file mode 100644
index 00000000000..2bcf52b136d
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/FileOrFolderTreeSelecPanel.java
@@ -0,0 +1,304 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.wizard;
+
+import java.io.File;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+import java.util.logging.Level;
+import org.eclipse.core.filesystem.EFS;
+import org.eclipse.core.filesystem.IFileStore;
+import org.eclipse.jface.viewers.CheckboxTreeViewer;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.data.model.editor.ODMEditorActivator;
+import org.eclipse.osee.framework.ui.data.model.editor.wizard.FileOrFolderSelectPanel.ButtonType;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.SashForm;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.TreeItem;
+import org.eclipse.ui.ISharedImages;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class FileOrFolderTreeSelecPanel extends Composite {
+
+ private FileOrFolderSelectPanel fileSelect;
+ private FileOrFolderSelectPanel folderSelect;
+ private CheckboxTreeViewer treeViewer;
+ private final List<IFileStore> selectedFiles;
+ private final Set<String> addedItems;
+ private Button addButton;
+ private Button removeButton;
+
+ public FileOrFolderTreeSelecPanel(Composite parent, int style) {
+ super(parent, style);
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ this.setLayout(new GridLayout());
+ this.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ selectedFiles = new ArrayList<IFileStore>();
+ addedItems = new HashSet<String>();
+
+ createControl(this);
+ }
+
+ private void createSourceSelect(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ fileSelect =
+ FileOrFolderSelectPanel.createFileSelectPanel(composite, SWT.NONE, "Select File: ", SWT.OPEN | SWT.SINGLE,
+ ButtonType.RADIO, new String[] {"*.xml"});
+
+ folderSelect =
+ FileOrFolderSelectPanel.createFolderSelectPanel(composite, SWT.NONE, "Select Folder:",
+ SWT.OPEN | SWT.SINGLE, ButtonType.RADIO);
+ }
+
+ private void createControl(Composite parent) {
+ SashForm sash = new SashForm(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ sash.setLayout(layout);
+ sash.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ sash.setOrientation(SWT.VERTICAL);
+
+ createSourceSelect(sash);
+
+ Composite composite = new Composite(sash, SWT.NONE);
+ composite.setLayout(new GridLayout(2, false));
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ createCheckBoxTree(composite);
+ createButtons(composite);
+
+ attachListeners();
+ sash.setWeights(new int[] {4, 6});
+ }
+
+ private void attachListeners() {
+ Listener listener = new Listener() {
+
+ @Override
+ public void handleEvent(Event event) {
+ if (event.widget instanceof Button) {
+ Button button = (Button) event.widget;
+ if (button.getText().equals("Select File: ") && fileSelect.isSelected()) {
+ folderSelect.setSelected(false);
+ } else if (button.getText().equals("Select Folder:") && folderSelect.isSelected()) {
+ fileSelect.setSelected(false);
+ }
+
+ String resource =
+ fileSelect.isSelected() ? fileSelect.getSelectedResource() : folderSelect.getSelectedResource();
+ addButton.setEnabled(Strings.isValid(resource) && !addedItems.contains(resource));
+ removeButton.setEnabled(!selectedFiles.isEmpty());
+ }
+ }
+ };
+ addButton.setEnabled(false);
+ removeButton.setEnabled(false);
+
+ fileSelect.addListener(listener);
+ folderSelect.addListener(listener);
+ }
+
+ private void createCheckBoxTree(Composite parent) {
+ treeViewer = new CheckboxTreeViewer(parent);
+ treeViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ treeViewer.setContentProvider(new FileContentProvider());
+ treeViewer.setLabelProvider(new FileLabelProvider());
+ treeViewer.setInput(selectedFiles);
+ }
+
+ private void createButtons(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ composite.setLayout(layout);
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false));
+
+ addButton = new Button(composite, SWT.PUSH);
+ addButton.setText("Add");
+ addButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ addButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ String resource = null;
+ if (fileSelect.isSelected()) {
+ resource = fileSelect.getSelectedResource();
+ } else if (folderSelect.isSelected()) {
+ resource = folderSelect.getSelectedResource();
+ }
+
+ if (Strings.isValid(resource) && !addedItems.contains(resource)) {
+ try {
+ IFileStore fileStore = EFS.getStore(new File(resource).toURI());
+ if (fileStore != null) {
+ boolean wasAdded = selectedFiles.add(fileStore);
+ if (wasAdded) {
+ addedItems.add(resource);
+ // treeViewer.refresh(fileStore);
+ }
+ // if (file.isDirectory()) {
+ // System.out.println("Scan for *.xml - Osee Types");
+ // } else {
+ // System.out.println("Check File");
+ // }
+ }
+ } catch (Exception ex) {
+ OseeLog.log(ODMEditorActivator.class, Level.SEVERE, ex);
+ }
+ }
+ treeViewer.refresh();
+ }
+ });
+
+ removeButton = new Button(composite, SWT.PUSH);
+ removeButton.setText("Remove");
+ removeButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ removeButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ IStructuredSelection selection = (IStructuredSelection) treeViewer.getSelection();
+ for (Object object : selection.toList()) {
+ if (object != null) {
+ // Remove Here
+ }
+ }
+ }
+ });
+
+ Button selectAllButton = new Button(composite, SWT.PUSH);
+ selectAllButton.setText("Select All");
+ selectAllButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ selectAllButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ for (TreeItem item : treeViewer.getTree().getItems()) {
+ item.setChecked(true);
+ }
+ }
+ });
+
+ Button deselectAllButton = new Button(composite, SWT.PUSH);
+ deselectAllButton.setText("Deselect All");
+ deselectAllButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ deselectAllButton.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ for (TreeItem item : treeViewer.getTree().getItems()) {
+ item.setChecked(false);
+ }
+ }
+ });
+ }
+
+ public List<String> getCheckedItems() {
+ List<String> checkedItems = new ArrayList<String>();
+ for (Object object : treeViewer.getCheckedElements()) {
+ if (object instanceof IFileStore) {
+ // ((IFileStore) object)
+ }
+ }
+ return checkedItems;
+ }
+ private final static class FileContentProvider implements ITreeContentProvider {
+ private static final Object[] EMPTY = new Object[0];
+
+ @Override
+ public Object[] getChildren(Object parentElement) {
+ if (parentElement instanceof Collection) {
+ return ((Collection) parentElement).toArray();
+ }
+ if (parentElement instanceof IFileStore) {
+ IFileStore[] children = null;
+ if (children != null) {
+ return children;
+ }
+ }
+ return EMPTY;
+ }
+
+ public Object getParent(Object element) {
+ if (element instanceof IFileStore) {
+ return ((IFileStore) element).getParent();
+ }
+ return null;
+ }
+
+ public boolean hasChildren(Object element) {
+ return getChildren(element).length > 0;
+ }
+
+ public Object[] getElements(Object element) {
+ return getChildren(element);
+ }
+
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ }
+
+ }
+
+ private static class FileLabelProvider extends LabelProvider {
+ private static final Image IMG_FOLDER =
+ PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FOLDER);
+
+ private static final Image IMG_FILE =
+ PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE);
+
+ public Image getImage(Object element) {
+ if (element instanceof IFileStore) {
+ IFileStore curr = (IFileStore) element;
+ if (curr.fetchInfo().isDirectory()) {
+ return IMG_FOLDER;
+ }
+ return IMG_FILE;
+ }
+ return null;
+ }
+
+ public String getText(Object element) {
+ if (element instanceof IFileStore) {
+ return ((IFileStore) element).getName();
+ }
+ return super.getText(element);
+ }
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/ODMExportOutputPage.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/ODMExportOutputPage.java
new file mode 100644
index 00000000000..38648c856ed
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/ODMExportOutputPage.java
@@ -0,0 +1,230 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.wizard;
+
+import java.sql.DatabaseMetaData;
+import java.util.logging.Level;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.osee.framework.core.client.ClientSessionManager;
+import org.eclipse.osee.framework.database.core.ConnectionHandler;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.data.model.editor.ODMEditorActivator;
+import org.eclipse.osee.framework.ui.data.model.editor.wizard.FileOrFolderSelectPanel.ButtonType;
+import org.eclipse.osee.framework.ui.swt.StackedViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Widget;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ODMExportOutputPage extends WizardPage {
+
+ private static final String DATASTORE_OPTIONS = "data.store.export.options";
+ private static final String XML_FILE_OPTIONS = "xml.export.options";
+
+ private StackedViewer stackedViewer;
+ private boolean isDataStoreExport;
+
+ private Button xmlExportButton;
+ private Button dataStoreExportButton;
+
+ private FileOrFolderSelectPanel dataStoreBackupOption;
+ private FileOrFolderSelectPanel xmlSingleOption;
+ private FileOrFolderSelectPanel xmlMultiOption;
+
+ protected ODMExportOutputPage(String pageName, String description) {
+ super(pageName, pageName, null);
+ setDescription(description);
+ isDataStoreExport = false;
+ }
+
+ public boolean isDataStoreExport() {
+ return isDataStoreExport;
+ }
+
+ public boolean isDataStoreBackupOption() {
+ return dataStoreBackupOption.isSelected();
+ }
+
+ public String getExportToDataStoreBackupFilePath() {
+ return dataStoreBackupOption.getSelectedResource();
+ }
+
+ public boolean isExportToSingleXmlFileSelected() {
+ return xmlSingleOption.isSelected();
+ }
+
+ public String getExportToXmlPath() {
+ return isExportToSingleXmlFileSelected() ? xmlSingleOption.getSelectedResource() : xmlMultiOption.getSelectedResource();
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout());
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ dataStoreExportButton = createDataStoreButton(composite);
+
+ xmlExportButton = new Button(composite, SWT.CHECK);
+ xmlExportButton.setText("To XML");
+
+ stackedViewer = new StackedViewer(composite, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ stackedViewer.setLayout(layout);
+ stackedViewer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ stackedViewer.addControl(DATASTORE_OPTIONS, createDataStoreOptions(stackedViewer.getStackComposite()));
+ stackedViewer.addControl(XML_FILE_OPTIONS, createXmlFileOptions(stackedViewer.getStackComposite()));
+
+ SelectionAdapter listener = new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ Object object = e.getSource();
+ if (object instanceof Button) {
+ Button button = (Button) object;
+ setOutputFormat(button.equals(dataStoreExportButton) && button.getSelection());
+ updateStatus();
+ }
+ }
+ };
+
+ setOutputFormat(isDataStoreExport);
+
+ xmlExportButton.addSelectionListener(listener);
+ dataStoreExportButton.addSelectionListener(listener);
+
+ setControl(composite);
+ }
+
+ private Control createDataStoreOptions(Composite parent) {
+ Group group = new Group(parent, SWT.NONE);
+ group.setLayout(new GridLayout());
+ group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ group.setText("DataStore Export Options");
+
+ dataStoreBackupOption =
+ FileOrFolderSelectPanel.createFileSelectPanel(group, SWT.NONE, "Backup Data Store Types",
+ SWT.SAVE | SWT.SINGLE, ButtonType.CHECK_BOX, new String[] {"xml"});
+ dataStoreBackupOption.setDefaultFileName("osee.types.db.backup.xml");
+ dataStoreBackupOption.addListener(new Listener() {
+ @Override
+ public void handleEvent(Event event) {
+ updateStatus();
+ }
+ });
+ dataStoreBackupOption.setSelected(true);
+ return group;
+ }
+
+ private Control createXmlFileOptions(Composite parent) {
+ Group group = new Group(parent, SWT.NONE);
+ group.setLayout(new GridLayout());
+ group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ group.setText("Xml Export Options");
+
+ xmlSingleOption =
+ FileOrFolderSelectPanel.createFileSelectPanel(group, SWT.NONE, "Export as single file",
+ SWT.SAVE | SWT.SINGLE, ButtonType.CHECK_BOX, new String[] {"xml"});
+ xmlSingleOption.setDefaultFileName("osee.types.xml");
+
+ xmlMultiOption =
+ FileOrFolderSelectPanel.createFolderSelectPanel(group, SWT.NONE, "Export as multiple files",
+ SWT.SAVE | SWT.SINGLE, ButtonType.CHECK_BOX);
+
+ Listener selectListener = new Listener() {
+
+ @Override
+ public void handleEvent(Event event) {
+ if (event.widget instanceof Button) {
+ Button button = (Button) event.widget;
+ if (button.getText().equals("Export as multiple files") && xmlMultiOption.isSelected()) {
+ xmlSingleOption.setSelected(false);
+ } else if (button.getText().equals("Export as single file") && xmlSingleOption.isSelected()) {
+ xmlMultiOption.setSelected(false);
+ }
+ updateStatus();
+ }
+ }
+ };
+
+ xmlMultiOption.addListener(selectListener);
+ xmlSingleOption.addListener(selectListener);
+ return group;
+ }
+
+ private void updateStatus() {
+ boolean result = false;
+ if (isDataStoreExport) {
+ if (isDataStoreBackupOption()) {
+ System.out.println("Backup Option");
+ result = Strings.isValid(getExportToDataStoreBackupFilePath());
+ } else {
+ System.out.println("Can't allow an insert without a backup");
+ }
+ } else {
+ result = Strings.isValid(getExportToXmlPath());
+ }
+ setPageComplete(result);
+ }
+
+ private Button createDataStoreButton(Composite parent) {
+ Button dataStoreButton = new Button(parent, SWT.CHECK);
+ String message = null;
+ try {
+ DatabaseMetaData meta = ConnectionHandler.getMetaData();
+ String product = meta.getDatabaseProductName();
+ int majorVersion = meta.getDatabaseMajorVersion();
+ int minorVersion = meta.getDatabaseMinorVersion();
+ message =
+ String.format("%s %s.%s - %s as %s", product, majorVersion, minorVersion,
+ ClientSessionManager.getDataStoreName(), ClientSessionManager.getDataStoreLoginName());
+
+ } catch (Exception ex) {
+ OseeLog.log(ODMEditorActivator.class, Level.WARNING, ex);
+ message = "Data Store";
+ }
+ dataStoreButton.setText(String.format("%s", message));
+ return dataStoreButton;
+ }
+
+ private void setOutputFormat(boolean isDataStoreExport) {
+ this.isDataStoreExport = isDataStoreExport;
+ if (isWidgetValid(dataStoreExportButton) && isWidgetValid(xmlExportButton) && isWidgetValid(stackedViewer)) {
+ if (isDataStoreExport) {
+ xmlExportButton.setSelection(false);
+ dataStoreExportButton.setSelection(true);
+ stackedViewer.setCurrentControl(DATASTORE_OPTIONS);
+ } else {
+ dataStoreExportButton.setSelection(false);
+ xmlExportButton.setSelection(true);
+ stackedViewer.setCurrentControl(XML_FILE_OPTIONS);
+ }
+ }
+ }
+
+ private boolean isWidgetValid(Widget widget) {
+ return widget != null & !widget.isDisposed();
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/ODMExportWizard.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/ODMExportWizard.java
new file mode 100644
index 00000000000..5579131b36f
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/ODMExportWizard.java
@@ -0,0 +1,113 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.wizard;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.plugin.core.util.IExceptionableRunnable;
+import org.eclipse.osee.framework.plugin.core.util.Jobs;
+import org.eclipse.osee.framework.ui.data.model.editor.ODMEditorActivator;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ArtifactDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.DataTypeCache;
+import org.eclipse.osee.framework.ui.data.model.editor.operation.ODMToXmlOperation;
+import org.eclipse.osee.framework.ui.data.model.editor.utility.ODMImage;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.ui.IExportWizard;
+import org.eclipse.ui.IWorkbench;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ODMExportWizard extends Wizard implements IExportWizard {
+
+ private ODMSelectPage selectTypesPage;
+ private ODMExportOutputPage exportOutputPage;
+ private final DataTypeCache dataTypeCache;
+
+ public ODMExportWizard(DataTypeCache dataTypeCache) {
+ setDefaultPageImageDescriptor(ImageManager.getImageDescriptor(ODMImage.EXPORT_IMAGE));
+ setNeedsProgressMonitor(true);
+ setWindowTitle("Osee Data Model Export Wizard");
+ this.dataTypeCache = dataTypeCache;
+ }
+
+ @Override
+ public void addPages() {
+ addPage(selectTypesPage = new ODMSelectPage("Osee Data Type Select", "Select Osee Data Types to export."));
+ addPage(exportOutputPage = new ODMExportOutputPage("Osee Data Type Export", "Select export destination."));
+ selectTypesPage.setInput(dataTypeCache);
+ }
+
+ @Override
+ public boolean canFinish() {
+ ArtifactDataType[] selectedTypes = selectTypesPage.getSelected();
+ return selectedTypes != null && selectedTypes.length > 0 && Strings.isValid(exportOutputPage.getExportToXmlPath());
+ }
+
+ @Override
+ public boolean performFinish() {
+ ArtifactDataType[] selectedTypes = selectTypesPage.getSelected();
+ if (selectedTypes != null && selectedTypes.length > 0) {
+ IExceptionableRunnable worker = null;
+ String jobName = null;
+ if (exportOutputPage.isDataStoreExport()) {
+ jobName = "Export artifact types into data store";
+ worker = createDataStoreExportWorker(selectedTypes);
+ } else {
+ jobName = "Export artifact types as xml";
+ worker = createXmlExportWorker(selectedTypes);
+ }
+ if (worker != null) {
+ Jobs.runInJob(jobName, worker, ODMEditorActivator.class, ODMEditorActivator.PLUGIN_ID, true);
+ }
+ }
+ return true;
+ }
+
+ private IExceptionableRunnable createDataStoreExportWorker(final ArtifactDataType[] selectedTypes) {
+ final String backupfilePath = exportOutputPage.getExportToDataStoreBackupFilePath();
+ final boolean isBackupEnabled = exportOutputPage.isDataStoreBackupOption();
+ return new IExceptionableRunnable() {
+
+ @Override
+ public IStatus run(IProgressMonitor monitor) throws Exception {
+ String extra = " no backup";
+ if (isBackupEnabled) {
+ extra = " backup " + backupfilePath;
+ }
+ System.out.println(String.format("Export into data store - %s", extra));
+ return Status.OK_STATUS;
+ }
+ };
+ }
+
+ private IExceptionableRunnable createXmlExportWorker(final ArtifactDataType[] selectedTypes) {
+ final String filePath = exportOutputPage.getExportToXmlPath();
+ final boolean exportToSingleFile = exportOutputPage.isExportToSingleXmlFileSelected();
+ return new IExceptionableRunnable() {
+
+ @Override
+ public IStatus run(IProgressMonitor monitor) throws Exception {
+ ODMToXmlOperation operation = new ODMToXmlOperation(filePath, exportToSingleFile, selectedTypes);
+ operation.execute(monitor);
+ return Status.OK_STATUS;
+ }
+ };
+ }
+
+ @Override
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/ODMImportPage.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/ODMImportPage.java
new file mode 100644
index 00000000000..6752b26f7a6
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/ODMImportPage.java
@@ -0,0 +1,164 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.wizard;
+
+import java.sql.DatabaseMetaData;
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.osee.framework.core.client.ClientSessionManager;
+import org.eclipse.osee.framework.database.core.ConnectionHandler;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.ui.data.model.editor.ODMEditorActivator;
+import org.eclipse.osee.framework.ui.swt.StackedViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Widget;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ODMImportPage extends WizardPage {
+
+ private static final String DATASTORE_OPTIONS = "data.store.import.options";
+ private static final String XML_FILE_OPTIONS = "xml.import.options";
+
+ private StackedViewer stackedViewer;
+ private boolean isDataStoreExport;
+
+ private Button xmlExportButton;
+ private Button dataStoreExportButton;
+
+ private FileOrFolderTreeSelecPanel xmlImportSelect;
+
+ protected ODMImportPage(String pageName, String description) {
+ super(pageName, pageName, null);
+ setDescription(description);
+ isDataStoreExport = false;
+ }
+
+ public boolean isDataStoreExport() {
+ return isDataStoreExport;
+ }
+
+ @Override
+ public void createControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout());
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ dataStoreExportButton = createDataStoreButton(composite);
+
+ xmlExportButton = new Button(composite, SWT.CHECK);
+ xmlExportButton.setText("From XML");
+
+ stackedViewer = new StackedViewer(composite, SWT.NONE);
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ stackedViewer.setLayout(layout);
+ stackedViewer.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ stackedViewer.addControl(DATASTORE_OPTIONS, createDataStoreOptions(stackedViewer.getStackComposite()));
+ stackedViewer.addControl(XML_FILE_OPTIONS, createXmlFileOptions(stackedViewer.getStackComposite()));
+
+ SelectionAdapter listener = new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ Object object = e.getSource();
+ if (object instanceof Button) {
+ Button button = (Button) object;
+ setImportFrom(button.equals(dataStoreExportButton) && button.getSelection());
+ }
+ }
+ };
+
+ setImportFrom(isDataStoreExport);
+
+ xmlExportButton.addSelectionListener(listener);
+ dataStoreExportButton.addSelectionListener(listener);
+
+ setControl(composite);
+ }
+
+ private Control createDataStoreOptions(Composite parent) {
+ Group group = new Group(parent, SWT.NONE);
+ group.setLayout(new GridLayout());
+ group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ group.setText("Import From Data Store Options");
+
+ // dataStoreBackupOption =
+ // FileOrFolderSelectPanel.createFileSelectPanel(group, SWT.NONE, "Backup Data Store Types",
+ // ButtonType.CHECK_BOX, new String[] {"xml"});
+ // dataStoreBackupOption.setDefaultFileName("osee.types.db.backup.xml");
+
+ return group;
+ }
+
+ private Control createXmlFileOptions(Composite parent) {
+ Group group = new Group(parent, SWT.NONE);
+ group.setLayout(new GridLayout());
+ group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ group.setText("Import From Xml Options");
+
+ xmlImportSelect = new FileOrFolderTreeSelecPanel(group, SWT.NONE);
+ return group;
+ }
+
+ private Button createDataStoreButton(Composite parent) {
+ Button dataStoreButton = new Button(parent, SWT.CHECK);
+ String message = null;
+ try {
+ DatabaseMetaData meta = ConnectionHandler.getMetaData();
+ String product = meta.getDatabaseProductName();
+ int majorVersion = meta.getDatabaseMajorVersion();
+ int minorVersion = meta.getDatabaseMinorVersion();
+ message =
+ String.format("%s %s.%s - %s as %s", product, majorVersion, minorVersion,
+ ClientSessionManager.getDataStoreName(), ClientSessionManager.getDataStoreLoginName());
+
+ } catch (Exception ex) {
+ OseeLog.log(ODMEditorActivator.class, Level.WARNING, ex);
+ message = "Data Store";
+ }
+ dataStoreButton.setText(String.format("%s", message));
+ return dataStoreButton;
+ }
+
+ private void setImportFrom(boolean isDataStoreExport) {
+ this.isDataStoreExport = isDataStoreExport;
+ if (isWidgetValid(dataStoreExportButton) && isWidgetValid(xmlExportButton) && isWidgetValid(stackedViewer)) {
+ if (isDataStoreExport) {
+ xmlExportButton.setSelection(false);
+ dataStoreExportButton.setSelection(true);
+ stackedViewer.setCurrentControl(DATASTORE_OPTIONS);
+ } else {
+ dataStoreExportButton.setSelection(false);
+ xmlExportButton.setSelection(true);
+ stackedViewer.setCurrentControl(XML_FILE_OPTIONS);
+ }
+ }
+ }
+
+ public List<String> getSelected() {
+ return xmlImportSelect.getCheckedItems();
+ }
+
+ private boolean isWidgetValid(Widget widget) {
+ return widget != null & !widget.isDisposed();
+ }
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/ODMImportWizard.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/ODMImportWizard.java
new file mode 100644
index 00000000000..ea2f1a1c085
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/ODMImportWizard.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.wizard;
+
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.osee.framework.ui.data.model.editor.core.ODMEditor;
+import org.eclipse.osee.framework.ui.data.model.editor.model.DataTypeCache;
+import org.eclipse.osee.framework.ui.data.model.editor.utility.ODMImage;
+import org.eclipse.osee.framework.ui.swt.ImageManager;
+import org.eclipse.ui.IImportWizard;
+import org.eclipse.ui.IWorkbench;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ODMImportWizard extends Wizard implements IImportWizard {
+
+ private final ODMEditor editor;
+ private ODMImportPage importPage;
+ private ODMSelectPage selectTypesPage;
+ private final DataTypeCache dataTypeCache;
+
+ public ODMImportWizard(ODMEditor editor) {
+ this.editor = editor;
+ dataTypeCache = new DataTypeCache();
+ setDefaultPageImageDescriptor(ImageManager.getImageDescriptor(ODMImage.IMPORT_IMAGE));
+ setNeedsProgressMonitor(true);
+ setWindowTitle("Osee Data Model Import Wizard");
+ }
+
+ @Override
+ public boolean performFinish() {
+ return false;
+ }
+
+ @Override
+ public void addPages() {
+ addPage(importPage = new ODMImportPage("Osee Data Type Source", "Select Osee Data Type Sources."));
+ addPage(selectTypesPage = new ODMSelectPage("Osee Data Type Select", "Select Osee Data Types to import."));
+ selectTypesPage.setInput(dataTypeCache);
+ }
+
+ @Override
+ public boolean canFinish() {
+ return super.canFinish();
+ }
+
+ @Override
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/ODMSelectPage.java b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/ODMSelectPage.java
new file mode 100644
index 00000000000..93f47728b41
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.data.model.editor/src/org/eclipse/osee/framework/ui/data/model/editor/wizard/ODMSelectPage.java
@@ -0,0 +1,300 @@
+/*******************************************************************************
+ * Copyright (c) 2004, 2007 Boeing.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.data.model.editor.wizard;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
+import org.eclipse.jface.viewers.CheckboxTreeViewer;
+import org.eclipse.jface.viewers.ICheckStateListener;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.osee.framework.ui.data.model.editor.model.ArtifactDataType;
+import org.eclipse.osee.framework.ui.data.model.editor.model.helper.ArtifactTypeContentProvider;
+import org.eclipse.osee.framework.ui.data.model.editor.model.helper.ArtifactTypeLabelProvider;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.BusyIndicator;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.dialogs.ContainerCheckedTreeViewer;
+import org.eclipse.ui.dialogs.ISelectionStatusValidator;
+
+/**
+ * @author Roberto E. Escobar
+ */
+public class ODMSelectPage extends WizardPage {
+
+ private CheckboxTreeViewer fViewer;
+ private ILabelProvider fLabelProvider;
+ private ITreeContentProvider fContentProvider;
+ private ISelectionStatusValidator fValidator = null;
+ private ViewerComparator fComparator;
+ private String fEmptyListMessage = "Nothing Available";
+ private IStatus fCurrStatus = new Status(IStatus.OK, PlatformUI.PLUGIN_ID, 0, "", null); //$NON-NLS-1$
+ private List<ViewerFilter> fFilters;
+ private Object fInput;
+ private boolean fIsEmpty;
+ private int fWidth = 60;
+ private int fHeight = 18;
+ private boolean fContainerMode;
+ private Object[] fExpandedElements;
+ private List<Object> fInitialSelections;
+
+ public ODMSelectPage(String pageName, String description) {
+ super(pageName, pageName, null);
+ setDescription(description);
+ fContainerMode = false;
+ fExpandedElements = null;
+ fInitialSelections = new ArrayList<Object>();
+ fLabelProvider = new ArtifactTypeLabelProvider();
+ fContentProvider = new ArtifactTypeContentProvider();
+ fContainerMode = false;
+ setPageComplete(false);
+ }
+
+ public void setInitialSelections(Object[] items) {
+ this.fInitialSelections.clear();
+ if (items != null && items.length > 0) {
+ this.fInitialSelections.addAll(Arrays.asList(items));
+ }
+ }
+
+ public void setComparator(ViewerComparator comparator) {
+ fComparator = comparator;
+ }
+
+ public void addFilter(ViewerFilter filter) {
+ if (fFilters == null) {
+ fFilters = new ArrayList<ViewerFilter>(4);
+ }
+ fFilters.add(filter);
+ }
+
+ public void setValidator(ISelectionStatusValidator validator) {
+ fValidator = validator;
+ }
+
+ public void setInput(Object input) {
+ fInput = input;
+ }
+
+ public void setExpandedElements(Object[] elements) {
+ fExpandedElements = elements;
+ }
+
+ public void setSize(int width, int height) {
+ fWidth = width;
+ fHeight = height;
+ }
+
+ protected void updateOKStatus() {
+ if (!fIsEmpty) {
+ if (fValidator != null) {
+ fCurrStatus = fValidator.validate(fViewer.getCheckedElements());
+ updateStatus(fCurrStatus);
+ } else if (!fCurrStatus.isOK()) {
+ fCurrStatus = new Status(IStatus.OK, PlatformUI.PLUGIN_ID, IStatus.OK, "", //$NON-NLS-1$
+ null);
+ }
+ } else {
+ fCurrStatus = new Status(IStatus.ERROR, PlatformUI.PLUGIN_ID, IStatus.OK, fEmptyListMessage, null);
+ }
+ updateStatus(fCurrStatus);
+ }
+
+ private void updateStatus(IStatus status) {
+
+ }
+
+ public void create() {
+ BusyIndicator.showWhile(null, new Runnable() {
+ public void run() {
+ fViewer.setCheckedElements(getInitialElementSelections().toArray());
+ if (fExpandedElements != null) {
+ fViewer.setExpandedElements(fExpandedElements);
+ }
+ updateOKStatus();
+ }
+ });
+ }
+
+ private List<Object> getInitialElementSelections() {
+ return fInitialSelections;
+ }
+
+ public void createControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout());
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+
+ Label messageLabel = new Label(composite, SWT.NONE);
+ if (messageLabel != null) {
+ messageLabel.setText("Hello");
+ }
+ messageLabel.setFont(composite.getFont());
+
+ CheckboxTreeViewer treeViewer = createTreeViewer(composite);
+ Control buttonComposite = createSelectionButtons(composite);
+ GridData data = new GridData(GridData.FILL_BOTH);
+ data.widthHint = convertWidthInCharsToPixels(fWidth);
+ data.heightHint = convertHeightInCharsToPixels(fHeight);
+ Tree treeWidget = treeViewer.getTree();
+ treeWidget.setLayoutData(data);
+ treeWidget.setFont(parent.getFont());
+ if (fIsEmpty) {
+ messageLabel.setEnabled(false);
+ treeWidget.setEnabled(false);
+ buttonComposite.setEnabled(false);
+ }
+ treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ setPageComplete(getSelected().length > 0);
+ }
+ });
+
+ setControl(composite);
+ }
+
+ protected CheckboxTreeViewer createTreeViewer(Composite parent) {
+ if (fContainerMode) {
+ fViewer = new ContainerCheckedTreeViewer(parent, SWT.BORDER);
+ } else {
+ fViewer = new CheckboxTreeViewer(parent, SWT.BORDER);
+ }
+
+ fViewer.setContentProvider(fContentProvider);
+ fViewer.setLabelProvider(fLabelProvider);
+ fViewer.addCheckStateListener(new ICheckStateListener() {
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ updateOKStatus();
+ }
+ });
+ fViewer.setComparator(fComparator);
+ if (fFilters != null) {
+ for (int i = 0; i != fFilters.size(); i++) {
+ fViewer.addFilter((ViewerFilter) fFilters.get(i));
+ }
+ }
+ fViewer.setInput(fInput);
+ return fViewer;
+ }
+
+ protected CheckboxTreeViewer getTreeViewer() {
+ return fViewer;
+ }
+
+ protected Composite createSelectionButtons(Composite composite) {
+ Composite buttonComposite = new Composite(composite, SWT.RIGHT);
+ GridLayout layout = new GridLayout();
+ layout.numColumns = 2;
+ buttonComposite.setLayout(layout);
+ buttonComposite.setFont(composite.getFont());
+ GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.GRAB_HORIZONTAL);
+ data.grabExcessHorizontalSpace = true;
+ composite.setData(data);
+ Button selectButton = createButton(buttonComposite, IDialogConstants.SELECT_ALL_ID, "Select All", false);
+ SelectionListener listener = new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ Object[] viewerElements = fContentProvider.getElements(fInput);
+ if (fContainerMode) {
+ fViewer.setCheckedElements(viewerElements);
+ } else {
+ for (int i = 0; i < viewerElements.length; i++) {
+ fViewer.setSubtreeChecked(viewerElements[i], true);
+ }
+ }
+ updateOKStatus();
+ }
+ };
+ selectButton.addSelectionListener(listener);
+ Button deselectButton = createButton(buttonComposite, IDialogConstants.DESELECT_ALL_ID, "De-select All", false);
+ listener = new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent e) {
+ fViewer.setCheckedElements(new Object[0]);
+ updateOKStatus();
+ }
+ };
+ deselectButton.addSelectionListener(listener);
+ return buttonComposite;
+ }
+
+ protected Button createButton(Composite parent, int id, String label, boolean defaultButton) {
+ // increment the number of columns in the button bar
+ ((GridLayout) parent.getLayout()).numColumns++;
+ Button button = new Button(parent, SWT.PUSH);
+ button.setText(label);
+ button.setFont(JFaceResources.getDialogFont());
+ button.setData(new Integer(id));
+ button.addSelectionListener(new SelectionAdapter() {
+ public void widgetSelected(SelectionEvent event) {
+ // buttonPressed(((Integer) event.widget.getData()).intValue());
+ }
+ });
+ if (defaultButton) {
+ Shell shell = parent.getShell();
+ if (shell != null) {
+ shell.setDefaultButton(button);
+ }
+ }
+ // buttons.put(new Integer(id), button);
+ setButtonLayoutData(button);
+ return button;
+ }
+
+ private boolean evaluateIfTreeEmpty(Object input) {
+ Object[] elements = fContentProvider.getElements(input);
+ if (elements.length > 0) {
+ if (fFilters != null) {
+ for (int i = 0; i < fFilters.size(); i++) {
+ ViewerFilter curr = (ViewerFilter) fFilters.get(i);
+ elements = curr.filter(fViewer, input, elements);
+ }
+ }
+ }
+ return elements.length == 0;
+ }
+
+ public ArtifactDataType[] getSelected() {
+ Object[] checked = getTreeViewer().getCheckedElements();
+ List<ArtifactDataType> selected = new ArrayList<ArtifactDataType>();
+ if (checked != null && checked.length > 0) {
+ for (Object object : checked) {
+ if (object instanceof ArtifactDataType) {
+ selected.add((ArtifactDataType) object);
+ }
+ }
+ }
+ return selected.toArray(new ArtifactDataType[selected.size()]);
+ }
+
+}

Back to the top