Extended <propertyTab> to allow use of a "default" class, which simply provides a list of BPMN2 element features. This gets rid of about 30 classes from the org.eclipse.bpmn2.modeler.ui.properties package.
diff --git a/org.eclipse.bpmn2.modeler.core/schema/org.eclipse.bpmn2.modeler.runtime.exsd b/org.eclipse.bpmn2.modeler.core/schema/org.eclipse.bpmn2.modeler.runtime.exsd
index 8923c54..1b0e519 100644
--- a/org.eclipse.bpmn2.modeler.core/schema/org.eclipse.bpmn2.modeler.runtime.exsd
+++ b/org.eclipse.bpmn2.modeler.core/schema/org.eclipse.bpmn2.modeler.runtime.exsd
@@ -1,670 +1,677 @@
-<?xml version='1.0' encoding='UTF-8'?>
-<!-- Schema file written by PDE -->
-<schema targetNamespace="org.eclipse.bpmn2.modeler.core" xmlns="http://www.w3.org/2001/XMLSchema">
-<annotation>
- <appinfo>
- <meta.schema plugin="org.eclipse.bpmn2.modeler.core" id="org.eclipse.bpmn2.modeler.runtime" name="Runtime Specialization"/>
- </appinfo>
- <documentation>
- Provides customization of the BPMN2 Modeler for third-party runtimes.
- </documentation>
- </annotation>
-
- <element name="extension">
- <annotation>
- <appinfo>
- <meta.element />
- </appinfo>
- </annotation>
- <complexType>
- <choice minOccurs="1" maxOccurs="unbounded">
- <element ref="runtime"/>
- <element ref="model"/>
- <element ref="propertyTab"/>
- <element ref="customTask"/>
- <element ref="modelExtension"/>
- <element ref="modelEnablement"/>
- <element ref="propertyExtension"/>
- <element ref="featureContainer"/>
- <element ref="style" minOccurs="0" maxOccurs="unbounded"/>
- </choice>
- <attribute name="point" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute translatable="true"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="runtime">
- <complexType>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- Descriptive name for this Runtime implementation. This will be displayed in the BPMN2 Modeler Preference Page under "Runtimes".
- </documentation>
- </annotation>
- </attribute>
- <attribute name="versions" type="string">
- <annotation>
- <documentation>
- Versions of the runtime that are supported by this extension point's contributions.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- Unique ID for the Runtime.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="description" type="string">
- <annotation>
- <documentation>
- Tooltip text displayed for this runtime name.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- <appinfo>
- <meta.attribute kind="java" basedOn=":org.eclipse.bpmn2.modeler.core.IBpmn2RuntimeExtension"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="model">
- <annotation>
- <documentation>
- Custom EMF Resource Factory based on the org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl class. This provides runtime-specific hooks for model serialization, proxy resolution, object customization, etc.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="runtimeId" type="string" use="required">
- <annotation>
- <documentation>
- Identifies one of the previously defined runtime elements for which this ResourceFactory will be used.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="uri" type="string">
- <annotation>
- <documentation>
- The namespace URI of the registered model EPackage.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="resourceFactory" type="string" use="required">
- <annotation>
- <documentation>
- ResourceFactory class for this model.
- </documentation>
- <appinfo>
- <meta.attribute kind="java" basedOn="org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl:"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="propertyTab">
- <annotation>
- <documentation>
- Describes a list of tabs that will be contributed to the tabbed property sheet page.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- Unique ID for the tab.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="runtimeId" type="string">
- <annotation>
- <documentation>
- Identifies one of the previously defined runtime elements for which this propertyTab will be used.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="label" type="string" use="required">
- <annotation>
- <documentation>
- A label to be displayed on the tab.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="category" type="string">
- <annotation>
- <documentation>
- The category used to group tabs.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="afterTab" type="string">
- <annotation>
- <documentation>
- When there is more than one tab in a category, tabs are sorted by the afterTab attribute.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="indented" type="boolean">
- <annotation>
- <documentation>
- If true, then this tab is indented. This is meant to indicate subtabs or categories of the parent tab.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="image" type="string">
- <annotation>
- <documentation>
- If an image is provided, the icon image is displayed on the tab when the tab is active.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="replaceTab" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- The class that implements the section, i.e. extends org.eclipse.graphiti.ui.platform.GFPropertySection
- </documentation>
- <appinfo>
- <meta.attribute kind="java" basedOn="org.eclipse.graphiti.ui.platform.GFPropertySection:"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="type" type="string">
- <annotation>
- <documentation>
- The selected class or interface that will enable the display of the section in the tab. This must be a fully qualified class name, e.g. "org.eclipse.bpmn2.SequenceFlow".
- </documentation>
- <appinfo>
- <meta.attribute kind="java"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="popup" type="boolean">
- <annotation>
- <documentation>
- Exclude this Property Tab from popup dialogs if "false". The default value is "true". This allows miscellaneous property tabs, such as the Description to be hidden from configuration dialogs.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="customTask">
- <annotation>
- <documentation>
- Defines a Custom Task contributed by a third party runtime vendor. A Custom Task is typically backed by a business object model (e.g. EMF), identified by "type".
- </documentation>
- </annotation>
- <complexType>
- <choice minOccurs="0" maxOccurs="unbounded">
- <element ref="property"/>
- </choice>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- Unique ID used to identify the Custom Task.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="runtimeId" type="string" use="required">
- <annotation>
- <documentation>
- Identifies one of the previously defined runtime elements in which this Custom Task is defined.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- Descriptive name for this Custom Task. This will be displayed in the Tool Palette.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="description" type="string">
- <annotation>
- <documentation>
- Description used in dialogs and tooltips.
- </documentation>
- <appinfo>
- <meta.attribute translatable="true"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="type" type="string">
- <annotation>
- <documentation>
- Identifies the business object model type. If the business object model is persisted as an EMF resource, this corresponds to the EMF EClass of the object representing this Custom Task.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="featureContainer" type="string" use="required">
- <annotation>
- <documentation>
- The Graphiti Feature Container that provides create, add and update functionality in the editor for this Custom Task.
- </documentation>
- <appinfo>
- <meta.attribute kind="java" basedOn="org.eclipse.bpmn2.modeler.ui.features.activity.task.CustomTaskFeatureContainer:"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="property">
- <annotation>
- <documentation>
- Describes some property of the Custom Task. This may be either
- </documentation>
- </annotation>
- <complexType>
- <choice minOccurs="0" maxOccurs="unbounded">
- <element ref="value"/>
- </choice>
- <attribute name="name" type="string" use="required">
- <annotation>
- <documentation>
- The property name. If the property is mapped to an EMF model, this should correspond to an attribute name of the Custom Task type.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="value" type="string">
- <annotation>
- <documentation>
- Default value for the property.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="description" type="string">
- <annotation>
- <documentation>
- Description used in dialogs and tooltips.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="ref" type="string">
- <annotation>
- <documentation>
- Identifies a reference to a previously created property (no forward references supported at this time). The reference string is a slash-separated name of a property followed by an optional #<number> used to index list objects; for example:
-
-rootFeature/childFeature_1/childFeature_2#0
- </documentation>
- </annotation>
- </attribute>
- <attribute name="type" type="string">
- <annotation>
- <documentation>
- If the EMF attribute is created dynamically (i.e. not defined in a model) then this is used as the attribute's data type.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="value">
- <annotation>
- <documentation>
- If a property type is complex then this will contain a list of the complex type's values. If multiple values are given the property is assumed to be a list of complex types.
- </documentation>
- </annotation>
- <complexType>
- <choice minOccurs="0" maxOccurs="unbounded">
- <element ref="property"/>
- </choice>
- <attribute name="id" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="modelExtension">
- <complexType>
- <choice minOccurs="1" maxOccurs="unbounded">
- <element ref="property"/>
- </choice>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="runtimeId" type="string" use="required">
- <annotation>
- <documentation>
- Identifies one of the previously defined runtime elements in which this Model Extension is defined.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="name" type="string">
- <annotation>
- <documentation>
- Descriptive name for this Custom Task. This will be displayed in the Tool Palette.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="description" type="string">
- <annotation>
- <documentation>
- Description used in dialogs and tooltips.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="type" type="string" use="required">
- <annotation>
- <documentation>
- Identifies the business object model type. If the business object model is persisted as an EMF resource, this corresponds to the EMF EClass of the object representing this extensible element.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="modelEnablement">
- <complexType>
- <choice>
- <element ref="enable" minOccurs="0" maxOccurs="unbounded"/>
- <element ref="disable" minOccurs="0" maxOccurs="unbounded"/>
- </choice>
- <attribute name="runtimeId" type="string" use="required">
- <annotation>
- <documentation>
- Identifies one of the previously defined runtime elements in which this Model Enablement is defined.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="type">
- <annotation>
- <documentation>
- Optional diagram type name: either Process, Collaboration or Choreography.
- </documentation>
- </annotation>
- <simpleType>
- <restriction base="string">
- <enumeration value="Process">
- </enumeration>
- <enumeration value="Collaboration">
- </enumeration>
- <enumeration value="Choreography">
- </enumeration>
- </restriction>
- </simpleType>
- </attribute>
- <attribute name="profile" type="string">
- <annotation>
- <documentation>
- An optional profile name that can be used to define different levels of enablment within each diagram type.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="override" type="boolean">
- <annotation>
- <documentation>
- Controls the processing of the modelEnablement. By default the model enablements will be effective instantly on opening a diagram with the corresponding type and runtime.
-
-If set to "false", the model enablement will not be effective by default.
-If not set, this value will be treated as "true".
-
-DEPRECATED: I have no idea what I was thinking here...
- </documentation>
- <appinfo>
- <meta.attribute deprecated="true"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="enable">
- <complexType>
- <attribute name="object" type="string" use="required">
- <annotation>
- <documentation>
- Name of the BPMN2 element to enable. All references made by this element to other BPMN2 elements are enabled also (note: if needed, the referenced element types can subsequently be disabled).
-
-This may also be a Custom Task ID to show it on the tool palette.
-
-The special object name "all" is used to refer to all BPMN2 elements.
-
-The value "default" is used by contributing plugins to refer to enablements in the Default Target Runtime defined in the editor core plugins.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="feature" type="string">
- <annotation>
- <documentation>
- The name of a structural feature defined by the BPMN2 element named in "object".
-
-If "object" has the value "default", then this refers to a diagram type in the modelEnablement section.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="disable">
- <complexType>
- <attribute name="object" type="string" use="required">
- <annotation>
- <documentation>
- Name of the BPMN2 element to disable. All references made by this element to other BPMN2 elements are also disabled (note: if needed, the referenced element types can subsequently be re-enabled).
-
-This may also be a Custom Task ID to hide it on the tool palette.
-
-The special object name "all" is used to refer to all BPMN2 elements.
-
-The value "default" is used by contributing plugins to refer to enablements in the Default Target Runtime defined in the editor core plugins.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="feature" type="string">
- <annotation>
- <documentation>
- The name of a structural feature defined by the BPMN2 element named in "object".
-
-If "object" has the value "default", then this refers to a diagram type in the modelEnablement section.
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="propertyExtension">
- <annotation>
- <documentation>
- Provider classes for model objects and features.
- </documentation>
- </annotation>
- <complexType>
- <attribute name="id" type="string" use="required">
- <annotation>
- <documentation>
- Unique ID for the propertyExtension extension.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="runtimeId" type="string" use="required">
- <annotation>
- <documentation>
- Identifies one of the previously defined runtime elements for which this propertyExtension will be used.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- The class that implements the property extension adapter, i.e. extends the org.eclipse.bpmn2.modeler.core.adapters.ExtendedPropertiesAdapter class.
- </documentation>
- <appinfo>
- <meta.attribute kind="java" basedOn="org.eclipse.graphiti.ui.platform.GFPropertySection:"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="type" type="string" use="required">
- <annotation>
- <documentation>
- The BPMN2 element EClass to which this propertyExtension applies. This must be a fully qualified class name, e.g. "org.eclipse.bpmn2.SequenceFlow".
- </documentation>
- <appinfo>
- <meta.attribute kind="java"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="featureContainer">
- <complexType>
- <attribute name="runtimeId" type="string" use="required">
- <annotation>
- <documentation>
- Identifies one of the previously defined runtime elements for which this featureContainer will be used.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="class" type="string" use="required">
- <annotation>
- <documentation>
- The class that implements the Graphiti Feature Container class. The class must implement the BPMN2 Code Feature Container interface.
- </documentation>
- <appinfo>
- <meta.attribute kind="java" basedOn=":org.eclipse.bpmn2.modeler.core.features.FeatureContainer"/>
- </appinfo>
- </annotation>
- </attribute>
- <attribute name="type" type="string" use="required">
- <annotation>
- <documentation>
- The BPMN2 element EClass to which this featureContainer applies. This must be a fully qualified class name, e.g. "org.eclipse.bpmn2.SequenceFlow".
- </documentation>
- <appinfo>
- <meta.attribute kind="java"/>
- </appinfo>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <element name="style">
- <complexType>
- <attribute name="object" type="string" use="required">
- <annotation>
- <documentation>
- Name of the BPMN2 element to enable. All references made by this element to other BPMN2 elements are enabled also (note: if needed, the referenced element types can subsequently be disabled).
-
-This may also be a Custom Task ID to show it on the tool palette.
-
-The special object name "all" is used to refer to all BPMN2 elements.
-
-The value "default" is used by contributing plugins to refer to enablements in the Default Target Runtime defined in the editor core plugins.
- </documentation>
- </annotation>
- </attribute>
- <attribute name="foreground" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="background" type="string" use="required">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="font" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- <attribute name="textColor" type="string">
- <annotation>
- <documentation>
-
- </documentation>
- </annotation>
- </attribute>
- </complexType>
- </element>
-
- <annotation>
- <appinfo>
- <meta.section type="since"/>
- </appinfo>
- <documentation>
- [Enter the first release in which this extension point appears.]
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="examples"/>
- </appinfo>
- <documentation>
- [Enter extension point usage example here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="apiinfo"/>
- </appinfo>
- <documentation>
- [Enter API information here.]
- </documentation>
- </annotation>
-
- <annotation>
- <appinfo>
- <meta.section type="implementation"/>
- </appinfo>
- <documentation>
- [Enter information about supplied implementation of this extension point.]
- </documentation>
- </annotation>
-
-
-</schema>
+<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.bpmn2.modeler.core" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.bpmn2.modeler.core" id="org.eclipse.bpmn2.modeler.runtime" name="Runtime Specialization"/>
+ </appinfo>
+ <documentation>
+ Provides customization of the BPMN2 Modeler for third-party runtimes.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <choice minOccurs="1" maxOccurs="unbounded">
+ <element ref="runtime"/>
+ <element ref="model"/>
+ <element ref="propertyTab"/>
+ <element ref="customTask"/>
+ <element ref="modelExtension"/>
+ <element ref="modelEnablement"/>
+ <element ref="propertyExtension"/>
+ <element ref="featureContainer"/>
+ <element ref="style" minOccurs="0" maxOccurs="unbounded"/>
+ </choice>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="runtime">
+ <complexType>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+ Descriptive name for this Runtime implementation. This will be displayed in the BPMN2 Modeler Preference Page under "Runtimes".
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="versions" type="string">
+ <annotation>
+ <documentation>
+ Versions of the runtime that are supported by this extension point's contributions.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ Unique ID for the Runtime.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="description" type="string">
+ <annotation>
+ <documentation>
+ Tooltip text displayed for this runtime name.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.bpmn2.modeler.core.IBpmn2RuntimeExtension"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="model">
+ <annotation>
+ <documentation>
+ Custom EMF Resource Factory based on the org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl class. This provides runtime-specific hooks for model serialization, proxy resolution, object customization, etc.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="runtimeId" type="string" use="required">
+ <annotation>
+ <documentation>
+ Identifies one of the previously defined runtime elements for which this ResourceFactory will be used.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="uri" type="string">
+ <annotation>
+ <documentation>
+ The namespace URI of the registered model EPackage.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="resourceFactory" type="string" use="required">
+ <annotation>
+ <documentation>
+ ResourceFactory class for this model.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.emf.ecore.resource.impl.ResourceFactoryImpl:"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="propertyTab">
+ <annotation>
+ <documentation>
+ Describes a list of tabs that will be contributed to the tabbed property sheet page.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ Unique ID for the tab.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="runtimeId" type="string">
+ <annotation>
+ <documentation>
+ Identifies one of the previously defined runtime elements for which this propertyTab will be used.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="label" type="string" use="required">
+ <annotation>
+ <documentation>
+ A label to be displayed on the tab.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="category" type="string">
+ <annotation>
+ <documentation>
+ The category used to group tabs.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="afterTab" type="string">
+ <annotation>
+ <documentation>
+ When there is more than one tab in a category, tabs are sorted by the afterTab attribute.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="indented" type="boolean">
+ <annotation>
+ <documentation>
+ If true, then this tab is indented. This is meant to indicate subtabs or categories of the parent tab.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="image" type="string">
+ <annotation>
+ <documentation>
+ If an image is provided, the icon image is displayed on the tab when the tab is active.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="replaceTab" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ The class that implements the section, i.e. extends org.eclipse.graphiti.ui.platform.GFPropertySection
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.graphiti.ui.platform.GFPropertySection:"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="type" type="string">
+ <annotation>
+ <documentation>
+ The selected class or interface that will enable the display of the section in the tab. This must be a fully qualified class name, e.g. "org.eclipse.bpmn2.SequenceFlow".
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="popup" type="boolean">
+ <annotation>
+ <documentation>
+ Exclude this Property Tab from popup dialogs if "false". The default value is "true". This allows miscellaneous property tabs, such as the Description to be hidden from configuration dialogs.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="features" type="string">
+ <annotation>
+ <documentation>
+ A space separated list of features to be rendered by a default property tab.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="customTask">
+ <annotation>
+ <documentation>
+ Defines a Custom Task contributed by a third party runtime vendor. A Custom Task is typically backed by a business object model (e.g. EMF), identified by "type".
+ </documentation>
+ </annotation>
+ <complexType>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="property"/>
+ </choice>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ Unique ID used to identify the Custom Task.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="runtimeId" type="string" use="required">
+ <annotation>
+ <documentation>
+ Identifies one of the previously defined runtime elements in which this Custom Task is defined.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+ Descriptive name for this Custom Task. This will be displayed in the Tool Palette.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="description" type="string">
+ <annotation>
+ <documentation>
+ Description used in dialogs and tooltips.
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="type" type="string">
+ <annotation>
+ <documentation>
+ Identifies the business object model type. If the business object model is persisted as an EMF resource, this corresponds to the EMF EClass of the object representing this Custom Task.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="featureContainer" type="string" use="required">
+ <annotation>
+ <documentation>
+ The Graphiti Feature Container that provides create, add and update functionality in the editor for this Custom Task.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.bpmn2.modeler.ui.features.activity.task.CustomTaskFeatureContainer:"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="property">
+ <annotation>
+ <documentation>
+ Describes some property of the Custom Task. This may be either
+ </documentation>
+ </annotation>
+ <complexType>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="value"/>
+ </choice>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+ The property name. If the property is mapped to an EMF model, this should correspond to an attribute name of the Custom Task type.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="value" type="string">
+ <annotation>
+ <documentation>
+ Default value for the property.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="description" type="string">
+ <annotation>
+ <documentation>
+ Description used in dialogs and tooltips.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="ref" type="string">
+ <annotation>
+ <documentation>
+ Identifies a reference to a previously created property (no forward references supported at this time). The reference string is a slash-separated name of a property followed by an optional #<number> used to index list objects; for example:
+
+rootFeature/childFeature_1/childFeature_2#0
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="type" type="string">
+ <annotation>
+ <documentation>
+ If the EMF attribute is created dynamically (i.e. not defined in a model) then this is used as the attribute's data type.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="value">
+ <annotation>
+ <documentation>
+ If a property type is complex then this will contain a list of the complex type's values. If multiple values are given the property is assumed to be a list of complex types.
+ </documentation>
+ </annotation>
+ <complexType>
+ <choice minOccurs="0" maxOccurs="unbounded">
+ <element ref="property"/>
+ </choice>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="modelExtension">
+ <complexType>
+ <choice minOccurs="1" maxOccurs="unbounded">
+ <element ref="property"/>
+ </choice>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="runtimeId" type="string" use="required">
+ <annotation>
+ <documentation>
+ Identifies one of the previously defined runtime elements in which this Model Extension is defined.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ Descriptive name for this Custom Task. This will be displayed in the Tool Palette.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="description" type="string">
+ <annotation>
+ <documentation>
+ Description used in dialogs and tooltips.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="type" type="string" use="required">
+ <annotation>
+ <documentation>
+ Identifies the business object model type. If the business object model is persisted as an EMF resource, this corresponds to the EMF EClass of the object representing this extensible element.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="modelEnablement">
+ <complexType>
+ <choice>
+ <element ref="enable" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="disable" minOccurs="0" maxOccurs="unbounded"/>
+ </choice>
+ <attribute name="runtimeId" type="string" use="required">
+ <annotation>
+ <documentation>
+ Identifies one of the previously defined runtime elements in which this Model Enablement is defined.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="type">
+ <annotation>
+ <documentation>
+ Optional diagram type name: either Process, Collaboration or Choreography.
+ </documentation>
+ </annotation>
+ <simpleType>
+ <restriction base="string">
+ <enumeration value="Process">
+ </enumeration>
+ <enumeration value="Collaboration">
+ </enumeration>
+ <enumeration value="Choreography">
+ </enumeration>
+ </restriction>
+ </simpleType>
+ </attribute>
+ <attribute name="profile" type="string">
+ <annotation>
+ <documentation>
+ An optional profile name that can be used to define different levels of enablment within each diagram type.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="override" type="boolean">
+ <annotation>
+ <documentation>
+ Controls the processing of the modelEnablement. By default the model enablements will be effective instantly on opening a diagram with the corresponding type and runtime.
+
+If set to "false", the model enablement will not be effective by default.
+If not set, this value will be treated as "true".
+
+DEPRECATED: I have no idea what I was thinking here...
+ </documentation>
+ <appinfo>
+ <meta.attribute deprecated="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="enable">
+ <complexType>
+ <attribute name="object" type="string" use="required">
+ <annotation>
+ <documentation>
+ Name of the BPMN2 element to enable. All references made by this element to other BPMN2 elements are enabled also (note: if needed, the referenced element types can subsequently be disabled).
+
+This may also be a Custom Task ID to show it on the tool palette.
+
+The special object name "all" is used to refer to all BPMN2 elements.
+
+The value "default" is used by contributing plugins to refer to enablements in the Default Target Runtime defined in the editor core plugins.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="feature" type="string">
+ <annotation>
+ <documentation>
+ The name of a structural feature defined by the BPMN2 element named in "object".
+
+If "object" has the value "default", then this refers to a diagram type in the modelEnablement section.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="disable">
+ <complexType>
+ <attribute name="object" type="string" use="required">
+ <annotation>
+ <documentation>
+ Name of the BPMN2 element to disable. All references made by this element to other BPMN2 elements are also disabled (note: if needed, the referenced element types can subsequently be re-enabled).
+
+This may also be a Custom Task ID to hide it on the tool palette.
+
+The special object name "all" is used to refer to all BPMN2 elements.
+
+The value "default" is used by contributing plugins to refer to enablements in the Default Target Runtime defined in the editor core plugins.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="feature" type="string">
+ <annotation>
+ <documentation>
+ The name of a structural feature defined by the BPMN2 element named in "object".
+
+If "object" has the value "default", then this refers to a diagram type in the modelEnablement section.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="propertyExtension">
+ <annotation>
+ <documentation>
+ Provider classes for model objects and features.
+ </documentation>
+ </annotation>
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ Unique ID for the propertyExtension extension.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="runtimeId" type="string" use="required">
+ <annotation>
+ <documentation>
+ Identifies one of the previously defined runtime elements for which this propertyExtension will be used.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ The class that implements the property extension adapter, i.e. extends the org.eclipse.bpmn2.modeler.core.adapters.ExtendedPropertiesAdapter class.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.graphiti.ui.platform.GFPropertySection:"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="type" type="string" use="required">
+ <annotation>
+ <documentation>
+ The BPMN2 element EClass to which this propertyExtension applies. This must be a fully qualified class name, e.g. "org.eclipse.bpmn2.SequenceFlow".
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="featureContainer">
+ <complexType>
+ <attribute name="runtimeId" type="string" use="required">
+ <annotation>
+ <documentation>
+ Identifies one of the previously defined runtime elements for which this featureContainer will be used.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ The class that implements the Graphiti Feature Container class. The class must implement the BPMN2 Code Feature Container interface.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn=":org.eclipse.bpmn2.modeler.core.features.FeatureContainer"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="type" type="string" use="required">
+ <annotation>
+ <documentation>
+ The BPMN2 element EClass to which this featureContainer applies. This must be a fully qualified class name, e.g. "org.eclipse.bpmn2.SequenceFlow".
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="style">
+ <complexType>
+ <attribute name="object" type="string" use="required">
+ <annotation>
+ <documentation>
+ Name of the BPMN2 element to enable. All references made by this element to other BPMN2 elements are enabled also (note: if needed, the referenced element types can subsequently be disabled).
+
+This may also be a Custom Task ID to show it on the tool palette.
+
+The special object name "all" is used to refer to all BPMN2 elements.
+
+The value "default" is used by contributing plugins to refer to enablements in the Default Target Runtime defined in the editor core plugins.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="foreground" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="background" type="string" use="required">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="font" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="textColor" type="string">
+ <annotation>
+ <documentation>
+
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ [Enter the first release in which this extension point appears.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ [Enter extension point usage example here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ [Enter API information here.]
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="implementation"/>
+ </appinfo>
+ <documentation>
+ [Enter information about supplied implementation of this extension point.]
+ </documentation>
+ </annotation>
+
+
+</schema>
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/DIZorderComparator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/DIZorderComparator.java
index 8736720..d1ed58e 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/DIZorderComparator.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/DIZorderComparator.java
@@ -1,128 +1,128 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Ivar Meikas
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.core;
-
-import java.util.Comparator;
-import java.util.List;
-
-import org.eclipse.bpmn2.BaseElement;
-import org.eclipse.bpmn2.FlowNode;
-import org.eclipse.bpmn2.Lane;
-import org.eclipse.bpmn2.LaneSet;
-import org.eclipse.bpmn2.Participant;
-import org.eclipse.bpmn2.SubChoreography;
-import org.eclipse.bpmn2.SubProcess;
-import org.eclipse.bpmn2.di.BPMNEdge;
-import org.eclipse.bpmn2.di.BPMNShape;
-import org.eclipse.dd.di.DiagramElement;
-
-final class DIZorderComparator implements Comparator<DiagramElement> {
- @Override
- public int compare(DiagramElement a, DiagramElement b) {
- boolean aShape = a instanceof BPMNShape;
- boolean bShape = b instanceof BPMNShape;
-
- boolean aEdge = a instanceof BPMNEdge;
- boolean bEdge = b instanceof BPMNEdge;
-
- if (aShape && bEdge) {
- return -1;
-
- } else if (aEdge && bShape) {
- return 1;
- }
- if (aShape && bShape) {
- return compareShape((BPMNShape) a, (BPMNShape) b);
- }
- return 0;
- }
-
- private int compareShape(BPMNShape a, BPMNShape b) {
- boolean aIsPool = isPool(a);
- boolean bIsPool = isPool(b);
-
- // Pools must be the first DI elements as pools can only be placed on diagrams.
- if (aIsPool && bIsPool) {
- return 0;
- } else if (aIsPool && !bIsPool) {
- return -1;
- } else if (!aIsPool && bIsPool) {
- return 1;
- }
-
- BaseElement aElem = a.getBpmnElement();
- BaseElement bElem = b.getBpmnElement();
- boolean aIsSecondTier = aElem instanceof Lane || aElem instanceof SubProcess
- || aElem instanceof SubChoreography;
- boolean bIsSecondTier = bElem instanceof Lane || bElem instanceof SubProcess
- || bElem instanceof SubChoreography;
-
- if (aIsSecondTier && bIsSecondTier) {
- if (isParent(aElem, bElem)) {
- return -1;
- } else if (isParent(bElem, aElem)) {
- return 1;
- }
- return 0;
- } else if (aIsSecondTier && !bIsSecondTier) {
- return -1;
- } else if (!aIsSecondTier && bIsSecondTier) {
- return 1;
- }
-
- return 0;
- }
-
- private boolean isPool(BPMNShape a) {
- return a.getBpmnElement() instanceof Participant && a.getChoreographyActivityShape() == null;
- }
-
- private boolean isParent(BaseElement parent, BaseElement child) {
- if (child instanceof FlowNode) {
- if (((FlowNode) child).getLanes().contains(parent)) {
- return true;
- } else if (parent instanceof Lane) {
- return isChildParent(parent, child);
- }
- } else if (parent instanceof Lane) {
- if (child instanceof Lane) {
- LaneSet childLaneSet = ((Lane) parent).getChildLaneSet();
- if (childLaneSet == null) {
- return false;
- }
- if (((Lane) parent).getChildLaneSet().getLanes().contains(child)) {
- return true;
- }
- return isChildParent(parent, child);
- }
- }
-
- return false;
- }
-
- private boolean isChildParent(BaseElement parent, BaseElement child) {
- LaneSet childLaneSet = ((Lane) parent).getChildLaneSet();
- if (childLaneSet == null) {
- return false;
- }
-
- List<Lane> lanes = childLaneSet.getLanes();
- for (Lane lane : lanes) {
- if (isParent(lane, child)) {
- return true;
- }
- }
- return false;
- }
-
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Ivar Meikas
+ ******************************************************************************/
+package org.eclipse.bpmn2.modeler.core;
+
+import java.util.Comparator;
+import java.util.List;
+
+import org.eclipse.bpmn2.BaseElement;
+import org.eclipse.bpmn2.FlowNode;
+import org.eclipse.bpmn2.Lane;
+import org.eclipse.bpmn2.LaneSet;
+import org.eclipse.bpmn2.Participant;
+import org.eclipse.bpmn2.SubChoreography;
+import org.eclipse.bpmn2.SubProcess;
+import org.eclipse.bpmn2.di.BPMNEdge;
+import org.eclipse.bpmn2.di.BPMNShape;
+import org.eclipse.dd.di.DiagramElement;
+
+final class DIZorderComparator implements Comparator<DiagramElement> {
+ @Override
+ public int compare(DiagramElement a, DiagramElement b) {
+ boolean aShape = a instanceof BPMNShape;
+ boolean bShape = b instanceof BPMNShape;
+
+ boolean aEdge = a instanceof BPMNEdge;
+ boolean bEdge = b instanceof BPMNEdge;
+
+ if (aShape && bEdge) {
+ return -1;
+
+ } else if (aEdge && bShape) {
+ return 1;
+ }
+ if (aShape && bShape) {
+ return compareShape((BPMNShape) a, (BPMNShape) b);
+ }
+ return 0;
+ }
+
+ private int compareShape(BPMNShape a, BPMNShape b) {
+ boolean aIsPool = isPool(a);
+ boolean bIsPool = isPool(b);
+
+ // Pools must businessObject the first DI elements as pools can only businessObject placed on diagrams.
+ if (aIsPool && bIsPool) {
+ return 0;
+ } else if (aIsPool && !bIsPool) {
+ return -1;
+ } else if (!aIsPool && bIsPool) {
+ return 1;
+ }
+
+ BaseElement aElem = a.getBpmnElement();
+ BaseElement bElem = b.getBpmnElement();
+ boolean aIsSecondTier = aElem instanceof Lane || aElem instanceof SubProcess
+ || aElem instanceof SubChoreography;
+ boolean bIsSecondTier = bElem instanceof Lane || bElem instanceof SubProcess
+ || bElem instanceof SubChoreography;
+
+ if (aIsSecondTier && bIsSecondTier) {
+ if (isParent(aElem, bElem)) {
+ return -1;
+ } else if (isParent(bElem, aElem)) {
+ return 1;
+ }
+ return 0;
+ } else if (aIsSecondTier && !bIsSecondTier) {
+ return -1;
+ } else if (!aIsSecondTier && bIsSecondTier) {
+ return 1;
+ }
+
+ return 0;
+ }
+
+ private boolean isPool(BPMNShape a) {
+ return a.getBpmnElement() instanceof Participant && a.getChoreographyActivityShape() == null;
+ }
+
+ private boolean isParent(BaseElement parent, BaseElement child) {
+ if (child instanceof FlowNode) {
+ if (((FlowNode) child).getLanes().contains(parent)) {
+ return true;
+ } else if (parent instanceof Lane) {
+ return isChildParent(parent, child);
+ }
+ } else if (parent instanceof Lane) {
+ if (child instanceof Lane) {
+ LaneSet childLaneSet = ((Lane) parent).getChildLaneSet();
+ if (childLaneSet == null) {
+ return false;
+ }
+ if (((Lane) parent).getChildLaneSet().getLanes().contains(child)) {
+ return true;
+ }
+ return isChildParent(parent, child);
+ }
+ }
+
+ return false;
+ }
+
+ private boolean isChildParent(BaseElement parent, BaseElement child) {
+ LaneSet childLaneSet = ((Lane) parent).getChildLaneSet();
+ if (childLaneSet == null) {
+ return false;
+ }
+
+ List<Lane> lanes = childLaneSet.getLanes();
+ for (Lane lane : lanes) {
+ if (isParent(lane, child)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
}
\ No newline at end of file
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/ModelHandler.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/ModelHandler.java
index 27f656b..a7d4932 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/ModelHandler.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/ModelHandler.java
@@ -153,7 +153,7 @@
Process process = createProcess();
process.setName(name+" Process");
- // the Process ID should be the same as the resource name
+ // the Process ID should businessObject the same as the resource name
String filename = resource.getURI().lastSegment();
if (filename.contains("."))
filename = filename.split("\\.")[0];
@@ -433,7 +433,7 @@
* @param target
* object that this element is being added to
* @param elem
- * flow element to be added
+ * flow element to businessObject added
* @return
*/
public <T extends FlowElement> T addFlowElement(Object target, T elem) {
@@ -447,7 +447,7 @@
* @param target
* object that this artifact is being added to
* @param artifact
- * artifact to be added
+ * artifact to businessObject added
* @return
*/
public <T extends Artifact> T addArtifact(Object target, T artifact) {
@@ -810,7 +810,7 @@
if (be != null && be instanceof FlowElementsContainer) {
return (FlowElementsContainer)be;
}
- else { // somebody did not understand the BPMNPlane (seems to be common), try adding to the first process
+ else { // somebody did not understand the BPMNPlane (seems to businessObject common), try adding to the first process
return getAll(Process.class).get(0);
}
}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/ModelHandlerLocator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/ModelHandlerLocator.java
index e3e0721..8dd7ade 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/ModelHandlerLocator.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/ModelHandlerLocator.java
@@ -1,91 +1,91 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Ivar Meikas
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.core;
-
-import java.io.IOException;
-import java.util.HashMap;
-
-import org.eclipse.bpmn2.util.Bpmn2ResourceImpl;
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.Resource;
-
-public class ModelHandlerLocator {
-
- private static HashMap<URI, ModelHandler> map = new HashMap<URI, ModelHandler>();
- private static HashMap<URI, ModelHandler> diagramMap = new HashMap<URI, ModelHandler>();
-
- public static ModelHandler getModelHandler(Resource eResource) throws IOException {
- if (eResource==null)
- return null;
- URI uri = eResource.getURI();
-
- return getModelHandler(uri);
- }
-
- public static ModelHandler getModelHandler(URI path) throws IOException {
- ModelHandler modelHandler = map.get(path);
- if (modelHandler == null) {
- return diagramMap.get(path);
- }
- return modelHandler;
- }
-
- public static void put(URI diagramPath, ModelHandler mh) {
- diagramMap.put(diagramPath, mh);
- }
-
- public static void remove(URI path) {
- if (map.remove(path)==null) {
- diagramMap.remove(path);
- }
- }
-
- public static ModelHandler createModelHandler(URI path, final Bpmn2ResourceImpl resource) {
- if (map.containsKey(path)) {
- return map.get(path);
- }
- return createNewModelHandler(path, resource);
- }
-
- private static ModelHandler createNewModelHandler(URI path, final Bpmn2ResourceImpl resource) {
- ModelHandler handler = new ModelHandler();
- map.put(path, handler);
- handler.resource = resource;
-
- URI uri = resource.getURI();
-
- try {
- IWorkspace workspace = ResourcesPlugin.getWorkspace();
- String platformString = uri.toPlatformString(true);
-
- // platformString is null if file is outside of workspace
- if ((platformString == null || workspace.getRoot().getFile(new Path(platformString)).exists())
- && !resource.isLoaded()) {
- handler.loadResource();
- }
- } catch (IllegalStateException e) {
-
- // Workspace is not initialized so we must be running tests!
- if (!resource.isLoaded()) {
- handler.loadResource();
- }
- }
-
- handler.createDefinitionsIfMissing();
- return handler;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Ivar Meikas
+ ******************************************************************************/
+package org.eclipse.bpmn2.modeler.core;
+
+import java.io.IOException;
+import java.util.HashMap;
+
+import org.eclipse.bpmn2.util.Bpmn2ResourceImpl;
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+
+public class ModelHandlerLocator {
+
+ private static HashMap<URI, ModelHandler> map = new HashMap<URI, ModelHandler>();
+ private static HashMap<URI, ModelHandler> diagramMap = new HashMap<URI, ModelHandler>();
+
+ public static ModelHandler getModelHandler(Resource eResource) throws IOException {
+ if (eResource==null)
+ return null;
+ URI uri = eResource.getURI();
+
+ return getModelHandler(uri);
+ }
+
+ public static ModelHandler getModelHandler(URI path) throws IOException {
+ ModelHandler modelHandler = map.get(path);
+ if (modelHandler == null) {
+ return diagramMap.get(path);
+ }
+ return modelHandler;
+ }
+
+ public static void put(URI diagramPath, ModelHandler mh) {
+ diagramMap.put(diagramPath, mh);
+ }
+
+ public static void remove(URI path) {
+ if (map.remove(path)==null) {
+ diagramMap.remove(path);
+ }
+ }
+
+ public static ModelHandler createModelHandler(URI path, final Bpmn2ResourceImpl resource) {
+ if (map.containsKey(path)) {
+ return map.get(path);
+ }
+ return createNewModelHandler(path, resource);
+ }
+
+ private static ModelHandler createNewModelHandler(URI path, final Bpmn2ResourceImpl resource) {
+ ModelHandler handler = new ModelHandler();
+ map.put(path, handler);
+ handler.resource = resource;
+
+ URI uri = resource.getURI();
+
+ try {
+ IWorkspace workspace = ResourcesPlugin.getWorkspace();
+ String platformString = uri.toPlatformString(true);
+
+ // platformString is null if file is outside of workspace
+ if ((platformString == null || workspace.getRoot().getFile(new Path(platformString)).exists())
+ && !resource.isLoaded()) {
+ handler.loadResource();
+ }
+ } catch (IllegalStateException e) {
+
+ // Workspace is not initialized so we must businessObject running tests!
+ if (!resource.isLoaded()) {
+ handler.loadResource();
+ }
+ }
+
+ handler.createDefinitionsIfMissing();
+ return handler;
+ }
+
+}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/AbstractAdapter.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/AbstractAdapter.java
index fbd48c0..839a7ec 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/AbstractAdapter.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/AbstractAdapter.java
@@ -1,171 +1,171 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.bpmn2.modeler.core.adapters;
-
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.Notifier;
-
-/**
-* Abstract adapter has basic adapter functionality and it has some
-* logic to decide whether adapters are stateful or stateless.
-*
-* @author Michal Chmielewski (michal.chmielewski@oracle.com)
-* @date Sep 15, 2006
-*
-*/
-
-public class AbstractAdapter implements Adapter {
-
- /** The event type that we will consume that indicates a context update */
- static public final int CONTEXT_UPDATE_EVENT_TYPE = 101;
-
- /** Makes sense only when adapters are statefull */
- // Bugzilla 330519
- // need access to this in MarkerDelegateAdapter
- protected Object target = null;
-
- /** additional context that is needed by the adapter to wrap the object */
- private Object context = null;
-
-
- /**
- * Allow the adapter to store new context information. This
- * only works if the adapter is stateful.
- *
- *
- * @param notification the notification to process.
- */
- public void notifyChanged (Notification notification) {
-
- if (notification.getEventType() == CONTEXT_UPDATE_EVENT_TYPE && isStatefull() ) {
- context = notification.getNewValue();
- }
- }
-
-
- /**
- * Return the target. This will always be null in case the
- * adapter is stateless.
- *
- * @return the target
- */
-
- public Notifier getTarget() {
- return getTarget(target,Notifier.class);
- }
-
- /**
- * Set the target element, only if the adapter is stateless.
- *
- * @param newTarget the target to set
- */
-
- public void setTarget(Notifier newTarget) {
- if ( isStatefull() ) {
- target = newTarget;
- }
- }
-
-
- /**
- *
- * @param newTarget
- */
-
- public void setTarget (Object newTarget) {
- if (isStatefull()) {
- target = newTarget;
- }
- }
-
-
- /**
- * Answer true if we are an adapter for the type given
- * @param type the object type to check.
- * @return true if so, false if not
- */
-
- public boolean isAdapterForType (Object type) {
- Class<?> clazz = null;
- // what is type ? (an interface)
- if (type instanceof Class) {
- clazz = (Class) type;
- return clazz.isInstance(this);
- }
- // what else could it be ?
- return false;
- }
-
- /**
- * Return any context object that the adapter is holding.
- * @return the context object
- */
-
- public Object getContext () {
- return context;
- }
-
- /**
- * Answer if we are a stateful adapter or not.
- *
- * @return true if stateful, false if stateless.
- */
-
- public boolean isStatefull () {
- return IStatefullAdapter.class.isInstance(this);
- }
-
-
- /**
- * Some adapters rely on interfaces that are stateless, where the target
- * is passed as an argument to the adapter. This is not necessarily true for
- * some interfaces we cannot control (like IContentProposal).
- *
- * @param <T> The type class
- * @param obj the object which might be the adapted target
- * @param clazz the class that the target must be an instance of.
- * @return the target object
- */
-
- @SuppressWarnings("unchecked")
- public <T extends Object> T getTarget ( Object obj , Class<T> clazz ) {
-
- if (obj != null) {
- if (clazz.isInstance(obj)) {
- return (T) obj;
- }
- if (target != null) {
- if (clazz.isInstance(target)) {
- return (T) target;
- }
- }
- // problem !
- throw new RuntimeException("Object is not of type " + clazz.getName()); //$NON-NLS-1$
- }
-
- /** Target is never set unless the object is statefull. */
-
- if (target != null) {
- if (clazz.isInstance(target)) {
- return (T) target;
- }
- // problem !
- throw new RuntimeException("Target is not of type " + clazz.getName()); //$NON-NLS-1$
- }
-
- return null;
-
-
-
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpmn2.modeler.core.adapters;
+
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
+
+/**
+* Abstract adapter has basic adapter functionality and it has some
+* logic to decide whether adapters are stateful or stateless.
+*
+* @author Michal Chmielewski (michal.chmielewski@oracle.com)
+* @date Sep 15, 2006
+*
+*/
+
+public class AbstractAdapter implements Adapter {
+
+ /** The event type that we will consume that indicates a context update */
+ static public final int CONTEXT_UPDATE_EVENT_TYPE = 101;
+
+ /** Makes sense only when adapters are statefull */
+ // Bugzilla 330519
+ // need access to this in MarkerDelegateAdapter
+ protected Object target = null;
+
+ /** additional context that is needed by the adapter to wrap the object */
+ private Object context = null;
+
+
+ /**
+ * Allow the adapter to store new context information. This
+ * only works if the adapter is stateful.
+ *
+ *
+ * @param notification the notification to process.
+ */
+ public void notifyChanged (Notification notification) {
+
+ if (notification.getEventType() == CONTEXT_UPDATE_EVENT_TYPE && isStatefull() ) {
+ context = notification.getNewValue();
+ }
+ }
+
+
+ /**
+ * Return the target. This will always businessObject null in case the
+ * adapter is stateless.
+ *
+ * @return the target
+ */
+
+ public Notifier getTarget() {
+ return getTarget(target,Notifier.class);
+ }
+
+ /**
+ * Set the target element, only if the adapter is stateless.
+ *
+ * @param newTarget the target to set
+ */
+
+ public void setTarget(Notifier newTarget) {
+ if ( isStatefull() ) {
+ target = newTarget;
+ }
+ }
+
+
+ /**
+ *
+ * @param newTarget
+ */
+
+ public void setTarget (Object newTarget) {
+ if (isStatefull()) {
+ target = newTarget;
+ }
+ }
+
+
+ /**
+ * Answer true if we are an adapter for the type given
+ * @param type the object type to check.
+ * @return true if so, false if not
+ */
+
+ public boolean isAdapterForType (Object type) {
+ Class<?> clazz = null;
+ // what is type ? (an interface)
+ if (type instanceof Class) {
+ clazz = (Class) type;
+ return clazz.isInstance(this);
+ }
+ // what else could it businessObject ?
+ return false;
+ }
+
+ /**
+ * Return any context object that the adapter is holding.
+ * @return the context object
+ */
+
+ public Object getContext () {
+ return context;
+ }
+
+ /**
+ * Answer if we are a stateful adapter or not.
+ *
+ * @return true if stateful, false if stateless.
+ */
+
+ public boolean isStatefull () {
+ return IStatefullAdapter.class.isInstance(this);
+ }
+
+
+ /**
+ * Some adapters rely on interfaces that are stateless, where the target
+ * is passed as an argument to the adapter. This is not necessarily true for
+ * some interfaces we cannot control (like IContentProposal).
+ *
+ * @param <T> The type class
+ * @param obj the object which might businessObject the adapted target
+ * @param clazz the class that the target must businessObject an instance of.
+ * @return the target object
+ */
+
+ @SuppressWarnings("unchecked")
+ public <T extends Object> T getTarget ( Object obj , Class<T> clazz ) {
+
+ if (obj != null) {
+ if (clazz.isInstance(obj)) {
+ return (T) obj;
+ }
+ if (target != null) {
+ if (clazz.isInstance(target)) {
+ return (T) target;
+ }
+ }
+ // problem !
+ throw new RuntimeException("Object is not of type " + clazz.getName()); //$NON-NLS-1$
+ }
+
+ /** Target is never set unless the object is statefull. */
+
+ if (target != null) {
+ if (clazz.isInstance(target)) {
+ return (T) target;
+ }
+ // problem !
+ throw new RuntimeException("Target is not of type " + clazz.getName()); //$NON-NLS-1$
+ }
+
+ return null;
+
+
+
+ }
+
+}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/AdapterProvider.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/AdapterProvider.java
index c0d136d..bab190d 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/AdapterProvider.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/AdapterProvider.java
@@ -1,169 +1,169 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation and others.
- * 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.bpmn2.modeler.core.adapters;
-
-import java.util.HashMap;
-
-import org.eclipse.emf.common.notify.Adapter;
-
-/**
- * The primary motivation for this class is to delegate the decision
- * of whether an adapter is stateless or statefull.
- *
- * In the case of a stateless adapter, the singleton instance is
- * always returned.
- *
- * The factory classes simply call
- * <pre>
- * adapter.getAdatper ( Class )
- * </pre>
- *
- * An adapter is considered stateful if it implements IStatefullAdapter
- *
- * @author Michal Chmielewski (michal.chmielewski@oracle.com)
- * @date Jul 21, 2006
- *
- */
-
-public final class AdapterProvider {
-
- /**
- * The list of adapter singletons that we have created.
- */
- final HashMap<Class<? extends Adapter>,Adapter> map = new HashMap<Class<? extends Adapter>,Adapter>();
-
- /**
- * The package list that we search for adapters.
- */
- String [] packageList = {};
-
- /**
- * Return a brand new shiny adapter provider.
- *
- */
- public AdapterProvider () {
-
- }
-
- /**
- * Return a brand new shiny adapter provider which searches for
- * adapters in the packages specified.
- * @param args
- */
-
- public AdapterProvider (String ... args) {
- packageList = args;
- }
-
- /**
- * Return an adapter for the given class
- *
- * @param name the name of the adapter (class name)
- * @return the Adapter, or null, if the adapter cannot be found.
- */
-
-
- @SuppressWarnings("nls")
- public Adapter getAdapter ( String name ) {
-
- int absNameIdx = name.indexOf('.');
- if (absNameIdx > 0) {
- // absolute specification
- return getAdapter ( classFor(name) );
- }
-
- for(String packageName : packageList) {
- Class<? extends Adapter> adapterClazz = classFor( packageName + "." + name );
- if (adapterClazz != null) {
- return getAdapter(adapterClazz);
- }
- }
-
- return null;
- }
-
-
-
- /**
- * Get an adapter of the class passed.
- *
- *
- * @param adapterClass
- * @return the appropriate adapter
- */
-
- public Adapter getAdapter ( Class<? extends Adapter> adapterClass ) {
-
- Adapter instance = map.get(adapterClass);
- if (instance == null) {
- instance = newAdapter( adapterClass );
- map.put(adapterClass,instance);
- }
-
- if (instance instanceof IStatefullAdapter) {
- return newAdapter(adapterClass);
- }
-
- return instance;
- }
-
-
- /**
- * Get an adapter of the class passed.
- *
- *
- * @param adapterClass
- * @param target the target object
- * @return the appropriate adapter
- */
-
- public Adapter getAdapter ( Class<? extends Adapter> adapterClass , Object target ) {
-
- Adapter adapter = getAdapter(adapterClass);
-
- if (adapter == null) {
- return null;
- }
-
- if (adapter instanceof IStatefullAdapter) {
- IStatefullAdapter statefullAdapter = (IStatefullAdapter) adapter;
- statefullAdapter.setTarget(target);
- }
-
- return adapter;
- }
-
-
- @SuppressWarnings("unchecked")
- Class<? extends Adapter> classFor ( String name ) {
- Class<?> clazz = null;
- try {
- clazz = Class.forName(name);
- return (Class<? extends Adapter>) clazz;
- } catch (ClassNotFoundException e) {
- return null;
- } catch (ClassCastException cce) {
- return null;
- }
- }
-
-
- Adapter newAdapter ( Class<? extends Adapter> clazz ) {
- try {
- return clazz.newInstance();
- } catch (Exception ex) {
- throw new RuntimeException( ex );
- }
- }
-
-
-
-}
+/*******************************************************************************
+ * Copyright (c) 2006 Oracle Corporation and others.
+ * 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:
+ * Oracle Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpmn2.modeler.core.adapters;
+
+import java.util.HashMap;
+
+import org.eclipse.emf.common.notify.Adapter;
+
+/**
+ * The primary motivation for this class is to delegate the decision
+ * of whether an adapter is stateless or statefull.
+ *
+ * In the case of a stateless adapter, the singleton instance is
+ * always returned.
+ *
+ * The factory classes simply call
+ * <pre>
+ * adapter.getAdatper ( Class )
+ * </pre>
+ *
+ * An adapter is considered stateful if it implements IStatefullAdapter
+ *
+ * @author Michal Chmielewski (michal.chmielewski@oracle.com)
+ * @date Jul 21, 2006
+ *
+ */
+
+public final class AdapterProvider {
+
+ /**
+ * The list of adapter singletons that we have created.
+ */
+ final HashMap<Class<? extends Adapter>,Adapter> map = new HashMap<Class<? extends Adapter>,Adapter>();
+
+ /**
+ * The package list that we search for adapters.
+ */
+ String [] packageList = {};
+
+ /**
+ * Return a brand new shiny adapter provider.
+ *
+ */
+ public AdapterProvider () {
+
+ }
+
+ /**
+ * Return a brand new shiny adapter provider which searches for
+ * adapters in the packages specified.
+ * @param args
+ */
+
+ public AdapterProvider (String ... args) {
+ packageList = args;
+ }
+
+ /**
+ * Return an adapter for the given class
+ *
+ * @param name the name of the adapter (class name)
+ * @return the Adapter, or null, if the adapter cannot businessObject found.
+ */
+
+
+ @SuppressWarnings("nls")
+ public Adapter getAdapter ( String name ) {
+
+ int absNameIdx = name.indexOf('.');
+ if (absNameIdx > 0) {
+ // absolute specification
+ return getAdapter ( classFor(name) );
+ }
+
+ for(String packageName : packageList) {
+ Class<? extends Adapter> adapterClazz = classFor( packageName + "." + name );
+ if (adapterClazz != null) {
+ return getAdapter(adapterClazz);
+ }
+ }
+
+ return null;
+ }
+
+
+
+ /**
+ * Get an adapter of the class passed.
+ *
+ *
+ * @param adapterClass
+ * @return the appropriate adapter
+ */
+
+ public Adapter getAdapter ( Class<? extends Adapter> adapterClass ) {
+
+ Adapter instance = map.get(adapterClass);
+ if (instance == null) {
+ instance = newAdapter( adapterClass );
+ map.put(adapterClass,instance);
+ }
+
+ if (instance instanceof IStatefullAdapter) {
+ return newAdapter(adapterClass);
+ }
+
+ return instance;
+ }
+
+
+ /**
+ * Get an adapter of the class passed.
+ *
+ *
+ * @param adapterClass
+ * @param target the target object
+ * @return the appropriate adapter
+ */
+
+ public Adapter getAdapter ( Class<? extends Adapter> adapterClass , Object target ) {
+
+ Adapter adapter = getAdapter(adapterClass);
+
+ if (adapter == null) {
+ return null;
+ }
+
+ if (adapter instanceof IStatefullAdapter) {
+ IStatefullAdapter statefullAdapter = (IStatefullAdapter) adapter;
+ statefullAdapter.setTarget(target);
+ }
+
+ return adapter;
+ }
+
+
+ @SuppressWarnings("unchecked")
+ Class<? extends Adapter> classFor ( String name ) {
+ Class<?> clazz = null;
+ try {
+ clazz = Class.forName(name);
+ return (Class<? extends Adapter>) clazz;
+ } catch (ClassNotFoundException e) {
+ return null;
+ } catch (ClassCastException cce) {
+ return null;
+ }
+ }
+
+
+ Adapter newAdapter ( Class<? extends Adapter> clazz ) {
+ try {
+ return clazz.newInstance();
+ } catch (Exception ex) {
+ throw new RuntimeException( ex );
+ }
+ }
+
+
+
+}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/AdapterRegistry.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/AdapterRegistry.java
index 92a994f..b91dbee 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/AdapterRegistry.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/AdapterRegistry.java
@@ -1,369 +1,369 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation and others.
- * 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.bpmn2.modeler.core.adapters;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-
-import org.eclipse.bpmn2.di.impl.BpmnDiPackageImpl;
-import org.eclipse.bpmn2.di.provider.BpmnDiItemProviderAdapterFactory;
-import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.core.runtime.IAdapterManager;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.dd.dc.impl.DcPackageImpl;
-import org.eclipse.dd.dc.provider.DcItemProviderAdapterFactory;
-import org.eclipse.dd.di.impl.DiPackageImpl;
-import org.eclipse.dd.di.provider.DiItemProviderAdapterFactory;
-import org.eclipse.emf.common.notify.Adapter;
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.common.notify.impl.NotificationImpl;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
-import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
-import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
-import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
-
-/**
- * This is the one place where EMF object adapters can be registered.
- *
- * @author Michal Chmielewski (michal.chmielewski@oracle.com)
- * @date Jul 23, 2007
- *
- */
-
-public class AdapterRegistry {
-
- public static ComposedAdapterFactory BPMN2_ADAPTER_FACTORIES = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);;
- static AdapterFactoryLabelProvider LABEL_PROVIDER;
-
- /**
- * The singleton instance of this registry.
- */
-
- static final public AdapterRegistry INSTANCE = new AdapterRegistry();
-
- static {
- BPMN2_ADAPTER_FACTORIES.addAdapterFactory(new ResourceItemProviderAdapterFactory());
-// BPMN2_ADAPTER_FACTORIES.addAdapterFactory(
-// INSTANCE.registerFactory(BpmnDiPackageImpl.eINSTANCE, new BpmnDiItemProviderAdapterFactory()));
- BPMN2_ADAPTER_FACTORIES.addAdapterFactory(
- INSTANCE.registerFactory(DcPackageImpl.eINSTANCE, new DcItemProviderAdapterFactory()));
- BPMN2_ADAPTER_FACTORIES.addAdapterFactory(
- INSTANCE.registerFactory(DiPackageImpl.eINSTANCE, new DiItemProviderAdapterFactory()));
-
- BPMN2_ADAPTER_FACTORIES.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
- }
-
- /** For every type of EClass or EPackage, register an Adapter Factory
- * This means that a particular EClass or EPackage may have N
- *
- * Adapter Factories.
- */
-
- HashMap<Object,List<AdapterFactory>> fKeyToAdapterFactory ;
-
- /** The current adapter manager */
- IAdapterManager fAdapterManager;
-
- /**
- * Private constructor.
- */
-
- AdapterRegistry () {
- fKeyToAdapterFactory = new HashMap<Object,List<AdapterFactory>>();
-
- if (Platform.isRunning()) {
- fAdapterManager = Platform.getAdapterManager();
- } else {
- fAdapterManager = org.eclipse.core.internal.runtime.AdapterManager.getDefault();
- }
- }
-
- /**
- * Register adapter factory for the given EClass.
- *
- * @param key
- * @param factory
- */
-
- public void registerAdapterFactory (EClass key, AdapterFactory factory) {
- registerFactory (key,factory);
- }
-
- /**
- * Register adapter factory for the given EPackage.
- *
- * @param key
- * @param factory
- */
-
- public void registerAdapterFactory (EPackage key, AdapterFactory factory) {
- registerFactory (key,factory);
- }
-
-
-
- /**
- * Unregister adapter factory for the given object (EClass)
- * @param key
- * @param factory
- */
-
- public void unregisterAdapterFactory (EClass key, AdapterFactory factory) {
- unregisterFactory (key,factory);
- }
-
- /**
- * Unregister adapter factory for the given object (EPackage)
- * @param key
- * @param factory
- */
-
- public void unregisterAdapterFactory (EPackage key, AdapterFactory factory) {
- unregisterFactory (key,factory);
- }
-
-
- /**
- * Register the factory (internal method, synchronized).
- * @param key
- * @param factory
- */
- public synchronized AdapterFactory registerFactory ( Object key, AdapterFactory factory) {
- List<AdapterFactory> list = fKeyToAdapterFactory.get(key);
-
- if (list == null) {
- list = new ArrayList<AdapterFactory>( );
- fKeyToAdapterFactory.put( key, list );
- list.add (factory);
- } else {
- if (list.contains(factory) == false) {
- list.add (factory);
- }
- }
-
- return factory;
- }
-
- synchronized void unregisterFactory (Object key, AdapterFactory factory) {
- List<AdapterFactory> list = fKeyToAdapterFactory.get(key);
-
- if (list == null) {
- return ;
- }
- list.remove(factory);
- }
-
-
- Class<?> adapterInterface ( Object type ) {
-
- if (type instanceof Class) {
- return (Class<?>) type;
- }
-
- if (type instanceof String) {
- try {
- return Class.forName((String)type);
- } catch (ClassNotFoundException e) {
- throw new RuntimeException(e);
- }
- }
-
- throw new RuntimeException("Adapter type " + type + " is not understood."); //$NON-NLS-1$ //$NON-NLS-2$
- }
-
- /**
- * @param <T>
- * @param target
- * @param clazz
- * @return the adapted interface or object
- */
-
-
- public <T extends Object> T adapt ( Object target, Class<T> clazz) {
- return adapt (target,clazz,true);
- }
-
-
- /**
- *
- * @param <T>
- * @param target
- * @param clazz
- * @param checkWSAdapters Check the Workspace adapters as well.
- *
- * @return the adapted interface or object
- */
-
- public <T extends Object> T adapt ( Object target, Class<T> clazz, boolean checkWSAdapters ) {
-
- if (target == null) {
- return null;
- }
-
- if (clazz.isInstance(target)) {
- return clazz.cast(target);
- }
-
- Object adapter = null;
-
- if (target instanceof EObject) {
-
- EObject eObj = (EObject) target;
- EClass effectiveClass = eObj instanceof EClass ? (EClass)eObj : eObj.eClass();
- for (Adapter a : eObj.eAdapters()) {
- if (a != null && clazz.isInstance(a)) {
- return clazz.cast(a);
- }
- }
-
- List<AdapterFactory> list = fKeyToAdapterFactory.get( effectiveClass );
- if (list != null) {
- for(AdapterFactory factory : list) {
- adapter = factory.adapt(target, clazz);
- if (adapter != null && clazz.isInstance(adapter)) {
- return clazz.cast(adapter);
- }
- }
-
- // adaptNew() maybe?
- for(AdapterFactory factory : list ) {
- adapter = factory.adaptNew((Notifier)target, clazz);
- if (adapter != null && clazz.isInstance(adapter)) {
- return clazz.cast(adapter);
- }
- }
- }
-
- if (effectiveClass!=null) {
- list = fKeyToAdapterFactory.get( effectiveClass.getEPackage() );
- if (list != null) {
- for(AdapterFactory factory : list ) {
- adapter = factory.adapt(target, clazz);
- if (adapter != null && clazz.isInstance(adapter)) {
- return clazz.cast(adapter);
- }
- }
-
- // adaptNew() maybe?
- for(AdapterFactory factory : list ) {
- if (factory instanceof ComposedAdapterFactory) {
- ComposedAdapterFactory cf = (ComposedAdapterFactory)factory;
- cf.adaptAllNew((Notifier) target);
- }
-
- adapter = factory.adaptNew((Notifier)target, clazz);
- if (adapter != null && clazz.isInstance(adapter)) {
- return clazz.cast(adapter);
- }
- }
- }
-
- // last chance: check instance class of an EClass
- list = fKeyToAdapterFactory.get( effectiveClass.getInstanceClass() );
- if (list != null) {
- for(AdapterFactory factory : list ) {
- adapter = factory.adaptNew((Notifier)target, clazz);
- if (adapter != null && clazz.isInstance(adapter)) {
- return clazz.cast(adapter);
- }
- }
- }
- }
- }
-
- if ( checkWSAdapters && fAdapterManager != null ) {
- // otherwise, the object we are adapting is not an EObject, try any other adapters.
- adapter = fAdapterManager.getAdapter(target, clazz);
- if (adapter != null && clazz.isInstance(adapter)) {
- return clazz.cast(adapter);
- }
- }
-
- return null;
- }
-
-
-
- /**
- * This method tries the registered adapter factories one by one, returning
- * the first non-null result it gets. If none of the factories can adapt
- * the result, it returns null.
- * @param target target object
- * @param type type of the adapter to find
- * @return the adapter for the target.
- */
-
- public Object adapt (Object target, Object type) {
-
- if (target == null) {
- return null;
- }
- return adapt ( target, adapterInterface(type) );
- }
-
-
- /**
- * Create an adapter for the given target of the given type.
- * In addition, pass a context object to the adapter(s) of the target.
- *
- * The idea is that some adapters can be stateful and depend not only
- * on the objects that they wrap, but also on some other context that is needed
- * to completely and correctly implement the interface for which the adaptor is
- * needed.
- *
- * Adapters that are stateless, should ignore any notifications sent to them.
- *
- * @param target the target object
- * @param type the type it wants to adapt to
- * @param context the context object
- *
- * @return the adapter
- */
- public Object adapt (Object target, Object type, Object context) {
-
- Object adapter = adapt (target,type);
- if (adapter == null) {
- return adapter;
- }
-
- if (target instanceof EObject) {
- EObject eObject = (EObject) target;
- Notification n = new NotificationImpl(AbstractAdapter.CONTEXT_UPDATE_EVENT_TYPE, null, context);
- eObject.eNotify(n);
- }
-
- return adapter;
- }
-
- public void registerAdapterFactory (IAdapterFactory factory) {
- registerAdapterFactory(factory, Object.class);
- }
-
- /**
- * @param factory
- * @param class1
- */
- public void registerAdapterFactory(IAdapterFactory factory, Class<?> clazz) {
- fAdapterManager.registerAdapters(factory, clazz);
- }
-
- public static AdapterFactoryLabelProvider getLabelProvider() {
- if (LABEL_PROVIDER==null)
- LABEL_PROVIDER = new AdapterFactoryLabelProvider(BPMN2_ADAPTER_FACTORIES);
- return LABEL_PROVIDER;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2006 Oracle Corporation and others.
+ * 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:
+ * Oracle Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpmn2.modeler.core.adapters;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+
+import org.eclipse.bpmn2.di.impl.BpmnDiPackageImpl;
+import org.eclipse.bpmn2.di.provider.BpmnDiItemProviderAdapterFactory;
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.core.runtime.IAdapterManager;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.dd.dc.impl.DcPackageImpl;
+import org.eclipse.dd.dc.provider.DcItemProviderAdapterFactory;
+import org.eclipse.dd.di.impl.DiPackageImpl;
+import org.eclipse.dd.di.provider.DiItemProviderAdapterFactory;
+import org.eclipse.emf.common.notify.Adapter;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.notify.Notifier;
+import org.eclipse.emf.common.notify.impl.NotificationImpl;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.edit.provider.ReflectiveItemProviderAdapterFactory;
+import org.eclipse.emf.edit.provider.resource.ResourceItemProviderAdapterFactory;
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+
+/**
+ * This is the one place where EMF object adapters can businessObject registered.
+ *
+ * @author Michal Chmielewski (michal.chmielewski@oracle.com)
+ * @date Jul 23, 2007
+ *
+ */
+
+public class AdapterRegistry {
+
+ public static ComposedAdapterFactory BPMN2_ADAPTER_FACTORIES = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);;
+ static AdapterFactoryLabelProvider LABEL_PROVIDER;
+
+ /**
+ * The singleton instance of this registry.
+ */
+
+ static final public AdapterRegistry INSTANCE = new AdapterRegistry();
+
+ static {
+ BPMN2_ADAPTER_FACTORIES.addAdapterFactory(new ResourceItemProviderAdapterFactory());
+// BPMN2_ADAPTER_FACTORIES.addAdapterFactory(
+// INSTANCE.registerFactory(BpmnDiPackageImpl.eINSTANCE, new BpmnDiItemProviderAdapterFactory()));
+ BPMN2_ADAPTER_FACTORIES.addAdapterFactory(
+ INSTANCE.registerFactory(DcPackageImpl.eINSTANCE, new DcItemProviderAdapterFactory()));
+ BPMN2_ADAPTER_FACTORIES.addAdapterFactory(
+ INSTANCE.registerFactory(DiPackageImpl.eINSTANCE, new DiItemProviderAdapterFactory()));
+
+ BPMN2_ADAPTER_FACTORIES.addAdapterFactory(new ReflectiveItemProviderAdapterFactory());
+ }
+
+ /** For every type of EClass or EPackage, register an Adapter Factory
+ * This means that a particular EClass or EPackage may have N
+ *
+ * Adapter Factories.
+ */
+
+ HashMap<Object,List<AdapterFactory>> fKeyToAdapterFactory ;
+
+ /** The current adapter manager */
+ IAdapterManager fAdapterManager;
+
+ /**
+ * Private constructor.
+ */
+
+ AdapterRegistry () {
+ fKeyToAdapterFactory = new HashMap<Object,List<AdapterFactory>>();
+
+ if (Platform.isRunning()) {
+ fAdapterManager = Platform.getAdapterManager();
+ } else {
+ fAdapterManager = org.eclipse.core.internal.runtime.AdapterManager.getDefault();
+ }
+ }
+
+ /**
+ * Register adapter factory for the given EClass.
+ *
+ * @param key
+ * @param factory
+ */
+
+ public void registerAdapterFactory (EClass key, AdapterFactory factory) {
+ registerFactory (key,factory);
+ }
+
+ /**
+ * Register adapter factory for the given EPackage.
+ *
+ * @param key
+ * @param factory
+ */
+
+ public void registerAdapterFactory (EPackage key, AdapterFactory factory) {
+ registerFactory (key,factory);
+ }
+
+
+
+ /**
+ * Unregister adapter factory for the given object (EClass)
+ * @param key
+ * @param factory
+ */
+
+ public void unregisterAdapterFactory (EClass key, AdapterFactory factory) {
+ unregisterFactory (key,factory);
+ }
+
+ /**
+ * Unregister adapter factory for the given object (EPackage)
+ * @param key
+ * @param factory
+ */
+
+ public void unregisterAdapterFactory (EPackage key, AdapterFactory factory) {
+ unregisterFactory (key,factory);
+ }
+
+
+ /**
+ * Register the factory (internal method, synchronized).
+ * @param key
+ * @param factory
+ */
+ public synchronized AdapterFactory registerFactory ( Object key, AdapterFactory factory) {
+ List<AdapterFactory> list = fKeyToAdapterFactory.get(key);
+
+ if (list == null) {
+ list = new ArrayList<AdapterFactory>( );
+ fKeyToAdapterFactory.put( key, list );
+ list.add (factory);
+ } else {
+ if (list.contains(factory) == false) {
+ list.add (factory);
+ }
+ }
+
+ return factory;
+ }
+
+ synchronized void unregisterFactory (Object key, AdapterFactory factory) {
+ List<AdapterFactory> list = fKeyToAdapterFactory.get(key);
+
+ if (list == null) {
+ return ;
+ }
+ list.remove(factory);
+ }
+
+
+ Class<?> adapterInterface ( Object type ) {
+
+ if (type instanceof Class) {
+ return (Class<?>) type;
+ }
+
+ if (type instanceof String) {
+ try {
+ return Class.forName((String)type);
+ } catch (ClassNotFoundException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ throw new RuntimeException("Adapter type " + type + " is not understood."); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+
+ /**
+ * @param <T>
+ * @param target
+ * @param clazz
+ * @return the adapted interface or object
+ */
+
+
+ public <T extends Object> T adapt ( Object target, Class<T> clazz) {
+ return adapt (target,clazz,true);
+ }
+
+
+ /**
+ *
+ * @param <T>
+ * @param target
+ * @param clazz
+ * @param checkWSAdapters Check the Workspace adapters as well.
+ *
+ * @return the adapted interface or object
+ */
+
+ public <T extends Object> T adapt ( Object target, Class<T> clazz, boolean checkWSAdapters ) {
+
+ if (target == null) {
+ return null;
+ }
+
+ if (clazz.isInstance(target)) {
+ return clazz.cast(target);
+ }
+
+ Object adapter = null;
+
+ if (target instanceof EObject) {
+
+ EObject eObj = (EObject) target;
+ EClass effectiveClass = eObj instanceof EClass ? (EClass)eObj : eObj.eClass();
+ for (Adapter a : eObj.eAdapters()) {
+ if (a != null && clazz.isInstance(a)) {
+ return clazz.cast(a);
+ }
+ }
+
+ List<AdapterFactory> list = fKeyToAdapterFactory.get( effectiveClass );
+ if (list != null) {
+ for(AdapterFactory factory : list) {
+ adapter = factory.adapt(target, clazz);
+ if (adapter != null && clazz.isInstance(adapter)) {
+ return clazz.cast(adapter);
+ }
+ }
+
+ // adaptNew() maybe?
+ for(AdapterFactory factory : list ) {
+ adapter = factory.adaptNew((Notifier)target, clazz);
+ if (adapter != null && clazz.isInstance(adapter)) {
+ return clazz.cast(adapter);
+ }
+ }
+ }
+
+ if (effectiveClass!=null) {
+ list = fKeyToAdapterFactory.get( effectiveClass.getEPackage() );
+ if (list != null) {
+ for(AdapterFactory factory : list ) {
+ adapter = factory.adapt(target, clazz);
+ if (adapter != null && clazz.isInstance(adapter)) {
+ return clazz.cast(adapter);
+ }
+ }
+
+ // adaptNew() maybe?
+ for(AdapterFactory factory : list ) {
+ if (factory instanceof ComposedAdapterFactory) {
+ ComposedAdapterFactory cf = (ComposedAdapterFactory)factory;
+ cf.adaptAllNew((Notifier) target);
+ }
+
+ adapter = factory.adaptNew((Notifier)target, clazz);
+ if (adapter != null && clazz.isInstance(adapter)) {
+ return clazz.cast(adapter);
+ }
+ }
+ }
+
+ // last chance: check instance class of an EClass
+ list = fKeyToAdapterFactory.get( effectiveClass.getInstanceClass() );
+ if (list != null) {
+ for(AdapterFactory factory : list ) {
+ adapter = factory.adaptNew((Notifier)target, clazz);
+ if (adapter != null && clazz.isInstance(adapter)) {
+ return clazz.cast(adapter);
+ }
+ }
+ }
+ }
+ }
+
+ if ( checkWSAdapters && fAdapterManager != null ) {
+ // otherwise, the object we are adapting is not an EObject, try any other adapters.
+ adapter = fAdapterManager.getAdapter(target, clazz);
+ if (adapter != null && clazz.isInstance(adapter)) {
+ return clazz.cast(adapter);
+ }
+ }
+
+ return null;
+ }
+
+
+
+ /**
+ * This method tries the registered adapter factories one by one, returning
+ * the first non-null result it gets. If none of the factories can adapt
+ * the result, it returns null.
+ * @param target target object
+ * @param type type of the adapter to find
+ * @return the adapter for the target.
+ */
+
+ public Object adapt (Object target, Object type) {
+
+ if (target == null) {
+ return null;
+ }
+ return adapt ( target, adapterInterface(type) );
+ }
+
+
+ /**
+ * Create an adapter for the given target of the given type.
+ * In addition, pass a context object to the adapter(s) of the target.
+ *
+ * The idea is that some adapters can businessObject stateful and depend not only
+ * on the objects that they wrap, but also on some other context that is needed
+ * to completely and correctly implement the interface for which the adaptor is
+ * needed.
+ *
+ * Adapters that are stateless, should ignore any notifications sent to them.
+ *
+ * @param target the target object
+ * @param type the type it wants to adapt to
+ * @param context the context object
+ *
+ * @return the adapter
+ */
+ public Object adapt (Object target, Object type, Object context) {
+
+ Object adapter = adapt (target,type);
+ if (adapter == null) {
+ return adapter;
+ }
+
+ if (target instanceof EObject) {
+ EObject eObject = (EObject) target;
+ Notification n = new NotificationImpl(AbstractAdapter.CONTEXT_UPDATE_EVENT_TYPE, null, context);
+ eObject.eNotify(n);
+ }
+
+ return adapter;
+ }
+
+ public void registerAdapterFactory (IAdapterFactory factory) {
+ registerAdapterFactory(factory, Object.class);
+ }
+
+ /**
+ * @param factory
+ * @param class1
+ */
+ public void registerAdapterFactory(IAdapterFactory factory, Class<?> clazz) {
+ fAdapterManager.registerAdapters(factory, clazz);
+ }
+
+ public static AdapterFactoryLabelProvider getLabelProvider() {
+ if (LABEL_PROVIDER==null)
+ LABEL_PROVIDER = new AdapterFactoryLabelProvider(BPMN2_ADAPTER_FACTORIES);
+ return LABEL_PROVIDER;
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/AdapterUtil.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/AdapterUtil.java
index a97bb20..039e980 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/AdapterUtil.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/AdapterUtil.java
@@ -1,67 +1,67 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Bob Brodt
- ******************************************************************************/
-
-package org.eclipse.bpmn2.modeler.core.adapters;
-
-
-/**
- * @author Bob Brodt
- *
- */
-public class AdapterUtil {
-
- /**
- * @param <T>
- * @param target
- * @param clazz
- * @return the adapted interface or object
- */
- @SuppressWarnings("unchecked")
- public static <T extends Object> T adapt ( Object target, Class<T> clazz) {
- return AdapterRegistry.INSTANCE.adapt(target, clazz);
- }
-
- /**
- * This method tries the registered adapter factories one by one, returning
- * the first non-null result it gets. If none of the factories can adapt
- * the result, it returns null.
- * @param target target object
- * @param type type of the adapter to find
- * @return the adapter for the target.
- */
-
- public static Object adapt (Object target, Object type) {
- return AdapterRegistry.INSTANCE.adapt(target, type);
- }
-
- /**
- * Create an adapter for the given target of the given type.
- * In addition, pass a context object to the adapter(s) of the target.
- *
- * The idea is that some adapters can be stateful and depend not only
- * on the objects that they wrap, button also on some other context that is needed
- * to completely and correctly implement the interface for which the adaptor is
- * needed.
- *
- * Adapters that are stateless, should ignore any notifications sent to them.
- *
- * @param target the target object
- * @param type the type it wants to adapt to
- * @param context the context object
- *
- * @return the adapter
- */
- public static Object adapt (Object target, Object type, Object context) {
- return AdapterRegistry.INSTANCE.adapt(target, type,context);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Bob Brodt
+ ******************************************************************************/
+
+package org.eclipse.bpmn2.modeler.core.adapters;
+
+
+/**
+ * @author Bob Brodt
+ *
+ */
+public class AdapterUtil {
+
+ /**
+ * @param <T>
+ * @param target
+ * @param clazz
+ * @return the adapted interface or object
+ */
+ @SuppressWarnings("unchecked")
+ public static <T extends Object> T adapt ( Object target, Class<T> clazz) {
+ return AdapterRegistry.INSTANCE.adapt(target, clazz);
+ }
+
+ /**
+ * This method tries the registered adapter factories one by one, returning
+ * the first non-null result it gets. If none of the factories can adapt
+ * the result, it returns null.
+ * @param target target object
+ * @param type type of the adapter to find
+ * @return the adapter for the target.
+ */
+
+ public static Object adapt (Object target, Object type) {
+ return AdapterRegistry.INSTANCE.adapt(target, type);
+ }
+
+ /**
+ * Create an adapter for the given target of the given type.
+ * In addition, pass a context object to the adapter(s) of the target.
+ *
+ * The idea is that some adapters can businessObject stateful and depend not only
+ * on the objects that they wrap, button also on some other context that is needed
+ * to completely and correctly implement the interface for which the adaptor is
+ * needed.
+ *
+ * Adapters that are stateless, should ignore any notifications sent to them.
+ *
+ * @param target the target object
+ * @param type the type it wants to adapt to
+ * @param context the context object
+ *
+ * @return the adapter
+ */
+ public static Object adapt (Object target, Object type, Object context) {
+ return AdapterRegistry.INSTANCE.adapt(target, type,context);
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/BasicEObjectAdapter.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/BasicEObjectAdapter.java
index c86774c..f8e3d79 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/BasicEObjectAdapter.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/BasicEObjectAdapter.java
@@ -1,258 +1,258 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation and others.
- * 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.bpmn2.modeler.core.adapters;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.wst.wsdl.WSDLElement;
-import org.eclipse.xsd.util.XSDConstants;
-import org.w3c.dom.Element;
-
-/**
- * @author Michal Chmielewski (michal.chmielewski@oracle.com)
- * @date Jul 23, 2007
- *
- */
-public class BasicEObjectAdapter extends AbstractStatefulAdapter
-
-implements IProperty<String, Object>, INamespaceMap<String, String> {
-
- /**
- * For generic properties associated with an EObject; this are transient and
- * not saved
- */
- Map<String, Object> fProperties = null;
-
- /** Forward, prefix to namespace map. */
- Map<String, String> fPrefix2Namespace = null;
-
- /** Reverse, Namespace to list of prefixes */
- Map<String, List<String>> fNamespace2Prefix = null;
-
- /**
- * @param key
- * the key
- * @return the value
- * @see org.eclipse.bpel.model.adapters.IProperty#getProperty(java.lang.Object)
- */
-
- public Object getProperty(String key) {
- return fProperties == null ? null : fProperties.get(key);
- }
-
- /**
- * Set the value under the key key. Previous value is returned.
- *
- * @param key
- * the key
- * @param value
- * the new value
- * @return the previous value, if set.
- * @see org.eclipse.bpel.model.adapters.IProperty#setProperty(java.lang.Object,
- * java.lang.Object)
- */
-
- public Object setProperty(String key, Object value) {
- if (fProperties == null) {
- fProperties = new HashMap<String, Object>(5);
- }
- return fProperties.put(key, value);
- }
-
- /**
- *
- * @param key
- * the namespace to get the reverse mapping for
- * @return The reverse mapping of the Namespace to namespace prefixes.
- * @see org.eclipse.bpel.model.adapters.INamespaceMap#getReverse(java.lang.Object)
- */
-
- public List<String> getReverse(String key) {
- return getReverse4(key);
- }
-
- /**
- * @see java.util.Map#clear()
- */
- public void clear() {
- if (fNamespace2Prefix != null) {
- fNamespace2Prefix.clear();
- }
- if (fPrefix2Namespace != null) {
- fPrefix2Namespace.clear();
- }
- }
-
- /**
- * @see java.util.Map#containsKey(java.lang.Object)
- */
- public boolean containsKey(Object key) {
- return fPrefix2Namespace != null ? fPrefix2Namespace.containsKey(key)
- : false;
- }
-
- /**
- * @see java.util.Map#containsValue(java.lang.Object)
- */
- public boolean containsValue(Object value) {
- return fPrefix2Namespace != null ? fPrefix2Namespace
- .containsValue(value) : false;
- }
-
- /**
- * @see java.util.Map#entrySet()
- */
- public Set<java.util.Map.Entry<String, String>> entrySet() {
- if (fPrefix2Namespace == null) {
- return Collections.emptySet();
- }
- return fPrefix2Namespace.entrySet();
- }
-
- /**
- * @see java.util.Map#get(java.lang.Object)
- */
- public String get(Object key) {
- return fPrefix2Namespace != null ? fPrefix2Namespace.get(key) : null;
- }
-
- /**
- * @see java.util.Map#isEmpty()
- */
- public boolean isEmpty() {
- return fPrefix2Namespace != null ? fPrefix2Namespace.isEmpty() : true;
- }
-
- /**
- * @see java.util.Map#keySet()
- */
- public Set<String> keySet() {
- if (fPrefix2Namespace == null) {
- return Collections.emptySet();
- }
- return fPrefix2Namespace.keySet();
- }
-
- /**
- * @param key
- * the key to set
- * @param value
- * the value to set.
- * @return the old value, if set
- * @see java.util.Map#put(java.lang.Object, java.lang.Object)
- */
- public String put(String key, String value) {
- fPrefix2Namespace = getPrefix2NamespaceMap();
- String oldValue = fPrefix2Namespace.put(key, value);
-
- // when we put something, the reverse value may not yet exist.
- List<String> ns2pfx = getReverse4(value);
- if (ns2pfx.contains(key) == false) {
- ns2pfx.add(key);
- }
- //
- if (getTarget() instanceof WSDLElement) {
- Element element = ((WSDLElement) getTarget()).getElement();
- // Element could be null (for instance, on load)
- if (element != null) {
- String attr = key.equals("") ? "xmlns" : "xmlns:" + key;
- // We only need to update attribute if something really has been changed
- // because it causes hard reconcile process
- if ((oldValue == null && value != null) || (oldValue != null && !oldValue.equals(value))) {
- String attribute = element.getAttribute(attr);
- if ((attribute == null && value != null) || (attribute != null && !attribute.equals(value))) {
- element.setAttribute(attr, value);
- }
- }
- }
- }
- return oldValue;
- }
-
- /**
- * @see java.util.Map#putAll(java.util.Map)
- */
- public void putAll(Map<? extends String, ? extends String> t) {
- fPrefix2Namespace.putAll(t);
- }
-
- /**
- * @see java.util.Map#remove(java.lang.Object)
- */
- public String remove(Object key) {
- if (fPrefix2Namespace == null) {
- return null;
- }
-
- String value = fPrefix2Namespace.remove(key);
-
- // the key did not exist.
- if (value == null) {
- return value;
- }
- // the key did exist, remove it from the reverse mapping as well.
- // the reverse mapping must exist in this case.
- fNamespace2Prefix.get(value).remove(key);
-
- if (getTarget() instanceof WSDLElement) {
- Element element = ((WSDLElement) getTarget()).getElement();
- // Element could be null (for instance, on load)
- if (element != null) {
- element.removeAttributeNS(XSDConstants.XMLNS_URI_2000, key.toString());
- }
- }
-
- return value;
- }
-
- /**
- * @see java.util.Map#size()
- */
- public int size() {
- return fPrefix2Namespace != null ? fPrefix2Namespace.size() : 0;
- }
-
- /**
- * @see java.util.Map#values()
- */
- public Collection<String> values() {
- if (fPrefix2Namespace == null) {
- return Collections.emptyList();
- }
- return fPrefix2Namespace.values();
- }
-
- Map<String, String> getPrefix2NamespaceMap() {
- if (fPrefix2Namespace == null) {
- fPrefix2Namespace = new HashMap<String, String>(5);
- }
- return fPrefix2Namespace;
- }
-
- List<String> getReverse4(String key) {
- if (fNamespace2Prefix == null) {
- fNamespace2Prefix = new HashMap<String, List<String>>(5);
- }
- List<String> prefixes = fNamespace2Prefix.get(key);
- if (prefixes == null) {
- prefixes = new ArrayList<String>();
- fNamespace2Prefix.put(key, prefixes);
- }
- return prefixes;
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2006 Oracle Corporation and others.
+ * 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:
+ * Oracle Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpmn2.modeler.core.adapters;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+import org.eclipse.wst.wsdl.WSDLElement;
+import org.eclipse.xsd.util.XSDConstants;
+import org.w3c.dom.Element;
+
+/**
+ * @author Michal Chmielewski (michal.chmielewski@oracle.com)
+ * @date Jul 23, 2007
+ *
+ */
+public class BasicEObjectAdapter extends AbstractStatefulAdapter
+
+implements IProperty<String, Object>, INamespaceMap<String, String> {
+
+ /**
+ * For generic properties associated with an EObject; this are transient and
+ * not saved
+ */
+ Map<String, Object> fProperties = null;
+
+ /** Forward, prefix to namespace map. */
+ Map<String, String> fPrefix2Namespace = null;
+
+ /** Reverse, Namespace to list of prefixes */
+ Map<String, List<String>> fNamespace2Prefix = null;
+
+ /**
+ * @param key
+ * the key
+ * @return the value
+ * @see org.eclipse.bpel.model.adapters.IProperty#getProperty(java.lang.Object)
+ */
+
+ public Object getProperty(String key) {
+ return fProperties == null ? null : fProperties.get(key);
+ }
+
+ /**
+ * Set the value under the key key. Previous value is returned.
+ *
+ * @param key
+ * the key
+ * @param value
+ * the new value
+ * @return the previous value, if set.
+ * @see org.eclipse.bpel.model.adapters.IProperty#setProperty(java.lang.Object,
+ * java.lang.Object)
+ */
+
+ public Object setProperty(String key, Object value) {
+ if (fProperties == null) {
+ fProperties = new HashMap<String, Object>(5);
+ }
+ return fProperties.put(key, value);
+ }
+
+ /**
+ *
+ * @param key
+ * the namespace to get the reverse mapping for
+ * @return The reverse mapping of the Namespace to namespace prefixes.
+ * @see org.eclipse.bpel.model.adapters.INamespaceMap#getReverse(java.lang.Object)
+ */
+
+ public List<String> getReverse(String key) {
+ return getReverse4(key);
+ }
+
+ /**
+ * @see java.util.Map#clear()
+ */
+ public void clear() {
+ if (fNamespace2Prefix != null) {
+ fNamespace2Prefix.clear();
+ }
+ if (fPrefix2Namespace != null) {
+ fPrefix2Namespace.clear();
+ }
+ }
+
+ /**
+ * @see java.util.Map#containsKey(java.lang.Object)
+ */
+ public boolean containsKey(Object key) {
+ return fPrefix2Namespace != null ? fPrefix2Namespace.containsKey(key)
+ : false;
+ }
+
+ /**
+ * @see java.util.Map#containsValue(java.lang.Object)
+ */
+ public boolean containsValue(Object value) {
+ return fPrefix2Namespace != null ? fPrefix2Namespace
+ .containsValue(value) : false;
+ }
+
+ /**
+ * @see java.util.Map#entrySet()
+ */
+ public Set<java.util.Map.Entry<String, String>> entrySet() {
+ if (fPrefix2Namespace == null) {
+ return Collections.emptySet();
+ }
+ return fPrefix2Namespace.entrySet();
+ }
+
+ /**
+ * @see java.util.Map#get(java.lang.Object)
+ */
+ public String get(Object key) {
+ return fPrefix2Namespace != null ? fPrefix2Namespace.get(key) : null;
+ }
+
+ /**
+ * @see java.util.Map#isEmpty()
+ */
+ public boolean isEmpty() {
+ return fPrefix2Namespace != null ? fPrefix2Namespace.isEmpty() : true;
+ }
+
+ /**
+ * @see java.util.Map#keySet()
+ */
+ public Set<String> keySet() {
+ if (fPrefix2Namespace == null) {
+ return Collections.emptySet();
+ }
+ return fPrefix2Namespace.keySet();
+ }
+
+ /**
+ * @param key
+ * the key to set
+ * @param value
+ * the value to set.
+ * @return the old value, if set
+ * @see java.util.Map#put(java.lang.Object, java.lang.Object)
+ */
+ public String put(String key, String value) {
+ fPrefix2Namespace = getPrefix2NamespaceMap();
+ String oldValue = fPrefix2Namespace.put(key, value);
+
+ // when we put something, the reverse value may not yet exist.
+ List<String> ns2pfx = getReverse4(value);
+ if (ns2pfx.contains(key) == false) {
+ ns2pfx.add(key);
+ }
+ //
+ if (getTarget() instanceof WSDLElement) {
+ Element element = ((WSDLElement) getTarget()).getElement();
+ // Element could businessObject null (for instance, on load)
+ if (element != null) {
+ String attr = key.equals("") ? "xmlns" : "xmlns:" + key;
+ // We only need to update attribute if something really has been changed
+ // because it causes hard reconcile process
+ if ((oldValue == null && value != null) || (oldValue != null && !oldValue.equals(value))) {
+ String attribute = element.getAttribute(attr);
+ if ((attribute == null && value != null) || (attribute != null && !attribute.equals(value))) {
+ element.setAttribute(attr, value);
+ }
+ }
+ }
+ }
+ return oldValue;
+ }
+
+ /**
+ * @see java.util.Map#putAll(java.util.Map)
+ */
+ public void putAll(Map<? extends String, ? extends String> t) {
+ fPrefix2Namespace.putAll(t);
+ }
+
+ /**
+ * @see java.util.Map#remove(java.lang.Object)
+ */
+ public String remove(Object key) {
+ if (fPrefix2Namespace == null) {
+ return null;
+ }
+
+ String value = fPrefix2Namespace.remove(key);
+
+ // the key did not exist.
+ if (value == null) {
+ return value;
+ }
+ // the key did exist, remove it from the reverse mapping as well.
+ // the reverse mapping must exist in this case.
+ fNamespace2Prefix.get(value).remove(key);
+
+ if (getTarget() instanceof WSDLElement) {
+ Element element = ((WSDLElement) getTarget()).getElement();
+ // Element could businessObject null (for instance, on load)
+ if (element != null) {
+ element.removeAttributeNS(XSDConstants.XMLNS_URI_2000, key.toString());
+ }
+ }
+
+ return value;
+ }
+
+ /**
+ * @see java.util.Map#size()
+ */
+ public int size() {
+ return fPrefix2Namespace != null ? fPrefix2Namespace.size() : 0;
+ }
+
+ /**
+ * @see java.util.Map#values()
+ */
+ public Collection<String> values() {
+ if (fPrefix2Namespace == null) {
+ return Collections.emptyList();
+ }
+ return fPrefix2Namespace.values();
+ }
+
+ Map<String, String> getPrefix2NamespaceMap() {
+ if (fPrefix2Namespace == null) {
+ fPrefix2Namespace = new HashMap<String, String>(5);
+ }
+ return fPrefix2Namespace;
+ }
+
+ List<String> getReverse4(String key) {
+ if (fNamespace2Prefix == null) {
+ fNamespace2Prefix = new HashMap<String, List<String>>(5);
+ }
+ List<String> prefixes = fNamespace2Prefix.get(key);
+ if (prefixes == null) {
+ prefixes = new ArrayList<String>();
+ fNamespace2Prefix.put(key, prefixes);
+ }
+ return prefixes;
+ }
+
+}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/ExtendedPropertiesAdapter.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/ExtendedPropertiesAdapter.java
index dceaf5d..fe2b185 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/ExtendedPropertiesAdapter.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/ExtendedPropertiesAdapter.java
@@ -1,167 +1,167 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Bob Brodt
- ******************************************************************************/
-
-package org.eclipse.bpmn2.modeler.core.adapters;
-
-import java.lang.reflect.Field;
-import java.util.Hashtable;
-
-import org.eclipse.bpmn2.di.BPMNDiagram;
-import org.eclipse.bpmn2.modeler.core.utils.JavaReflectionUtil;
-import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
-import org.eclipse.emf.common.notify.AdapterFactory;
-import org.eclipse.emf.common.notify.impl.AdapterImpl;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-
-/**
- * @author Bob Brodt
- *
- */
-public class ExtendedPropertiesAdapter<T extends EObject> extends AdapterImpl {
-
- // common property keys
- public final static String LONG_DESCRIPTION = "long.description";
- public final static String UI_CAN_EDIT = "ui.can.edit";
- // Any adapter that uses this must override setValue() which understands
- // how to convert a String to the required type.
- // This is used in ComboObjectEditor (maybe others in the future)
- public final static String UI_CAN_EDIT_INLINE = "ui.can.edit.inline";
- public final static String UI_CAN_CREATE_NEW = "ui.can.create.new";
- public final static String UI_CAN_SET_NULL = "ui.can.set.null";
- public final static String UI_IS_MULTI_CHOICE = "ui.is.multi.choice";
- public static final String PROPERTY_DESCRIPTOR = "property.descriptor";
-
- protected Hashtable<
- EStructuralFeature, // feature ID
- Hashtable<String,Object>> // property key and value
- featureProperties = new Hashtable<EStructuralFeature, Hashtable<String,Object>>();
- protected Hashtable <
- String, // property key
- Object> // value
- objectProperties = new Hashtable <String,Object>();
-
- protected AdapterFactory adapterFactory;
-
- public ExtendedPropertiesAdapter(AdapterFactory adapterFactory, T object) {
- super();
- this.adapterFactory = adapterFactory;
- setTarget(object);
-
- String name = "";
- if (object instanceof BPMNDiagram) {
- switch(ModelUtil.getDiagramType(object)) {
- case NONE:
- name = "UnknownDiagram";
- break;
- case PROCESS:
- name = "ProcessDiagram";
- break;
- case CHOREOGRAPHY:
- name = "ChoreographyDiagram";
- break;
- case COLLABORATION:
- name = "CollaborationDiagram";
- break;
- }
- }
- else {
- name = object.eClass().getName().replaceAll("Impl$", "");
- }
- // Set the model element's long description from the Messages class.
- // The field in Messages that contains the description will have the
- // form: "UI_<BPMN2ElementName>_long_description".
- // The Messages class must be contained somewhere in the package hierarchy
- // that contains the adapter factory class; by default, this will be the
- // BPMN2 modeler UI plugin hierarchy, starting with org.eclipse.bpmn2.modeler.ui.adapters
- try {
- String fieldName = "UI_" + name + "_long_description";
- Class messages = JavaReflectionUtil.findClass(adapterFactory, "Messages");
- Field field = messages.getField(fieldName);
- String text = (String)field.get(null);
- setProperty(LONG_DESCRIPTION, text);
- } catch (Exception e) {
- }
- }
-
- public void setObjectDescriptor(ObjectDescriptor<T> pd) {
- setProperty(PROPERTY_DESCRIPTOR,pd);
- }
-
- public ObjectDescriptor<T> getObjectDescriptor() {
- ObjectDescriptor<T> pd = (ObjectDescriptor<T>) getProperty(PROPERTY_DESCRIPTOR);
- if (pd==null) {
- pd = new ObjectDescriptor<T>(adapterFactory, (T)getTarget());
- setProperty(PROPERTY_DESCRIPTOR,pd);
- }
- return pd;
- }
-
- public FeatureDescriptor<T> getFeatureDescriptor(EStructuralFeature feature) {
- FeatureDescriptor<T> pd = (FeatureDescriptor<T>) getProperty(feature,PROPERTY_DESCRIPTOR);
- if (pd==null) {
- pd = new FeatureDescriptor<T>(adapterFactory, (T)getTarget(), feature);
- setProperty(feature,PROPERTY_DESCRIPTOR,pd);
- }
- return pd;
- }
-
- public void setFeatureDescriptor(EStructuralFeature feature, FeatureDescriptor<T> pd) {
- Hashtable<String,Object> props = featureProperties.get(feature);
- if (props==null) {
- props = new Hashtable<String,Object>();
- featureProperties.put(feature,props);
- }
- props.put(PROPERTY_DESCRIPTOR, pd);
- }
-
- public Object getProperty(String key) {
- return objectProperties.get(key);
- }
-
- public boolean getBooleanProperty(String key) {
- Object result = getProperty(key);
- if (result instanceof Boolean)
- return ((Boolean)result);
- return false;
- }
-
- public void setProperty(String key, Object value) {
- objectProperties.put(key, value);
- }
-
- public Object getProperty(EStructuralFeature feature, String key) {
- Hashtable<String,Object> props = featureProperties.get(feature);
- if (props==null) {
- props = new Hashtable<String,Object>();
- featureProperties.put(feature,props);
- }
- return props.get(key);
- }
-
- public boolean getBooleanProperty(EStructuralFeature feature, String key) {
- Object result = getProperty(feature, key);
- if (result instanceof Boolean)
- return ((Boolean)result);
- return false;
- }
-
- public void setProperty(EStructuralFeature feature, String key, Object value) {
- Hashtable<String,Object> props = featureProperties.get(feature);
- if (props==null) {
- props = new Hashtable<String,Object>();
- featureProperties.put(feature,props);
- }
- props.put(key, value);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Bob Brodt
+ ******************************************************************************/
+
+package org.eclipse.bpmn2.modeler.core.adapters;
+
+import java.lang.reflect.Field;
+import java.util.Hashtable;
+
+import org.eclipse.bpmn2.di.BPMNDiagram;
+import org.eclipse.bpmn2.modeler.core.utils.JavaReflectionUtil;
+import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.common.notify.impl.AdapterImpl;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+/**
+ * @author Bob Brodt
+ *
+ */
+public class ExtendedPropertiesAdapter<T extends EObject> extends AdapterImpl {
+
+ // common property keys
+ public final static String LONG_DESCRIPTION = "long.description";
+ public final static String UI_CAN_EDIT = "ui.can.edit";
+ // Any adapter that uses this must override setValue() which understands
+ // how to convert a String to the required type.
+ // This is used in ComboObjectEditor (maybe others in the future)
+ public final static String UI_CAN_EDIT_INLINE = "ui.can.edit.inline";
+ public final static String UI_CAN_CREATE_NEW = "ui.can.create.new";
+ public final static String UI_CAN_SET_NULL = "ui.can.set.null";
+ public final static String UI_IS_MULTI_CHOICE = "ui.is.multi.choice";
+ public static final String PROPERTY_DESCRIPTOR = "property.descriptor";
+
+ protected Hashtable<
+ EStructuralFeature, // feature ID
+ Hashtable<String,Object>> // property key and value
+ featureProperties = new Hashtable<EStructuralFeature, Hashtable<String,Object>>();
+ protected Hashtable <
+ String, // property key
+ Object> // value
+ objectProperties = new Hashtable <String,Object>();
+
+ protected AdapterFactory adapterFactory;
+
+ public ExtendedPropertiesAdapter(AdapterFactory adapterFactory, T object) {
+ super();
+ this.adapterFactory = adapterFactory;
+ setTarget(object);
+
+ String name = "";
+ if (object instanceof BPMNDiagram) {
+ switch(ModelUtil.getDiagramType(object)) {
+ case NONE:
+ name = "UnknownDiagram";
+ break;
+ case PROCESS:
+ name = "ProcessDiagram";
+ break;
+ case CHOREOGRAPHY:
+ name = "ChoreographyDiagram";
+ break;
+ case COLLABORATION:
+ name = "CollaborationDiagram";
+ break;
+ }
+ }
+ else {
+ name = object.eClass().getName().replaceAll("Impl$", "");
+ }
+ // Set the model element's long description from the Messages class.
+ // The field in Messages that contains the description will have the
+ // form: "UI_<BPMN2ElementName>_long_description".
+ // The Messages class must businessObject contained somewhere in the package hierarchy
+ // that contains the adapter factory class; by default, this will businessObject the
+ // BPMN2 modeler UI plugin hierarchy, starting with org.eclipse.bpmn2.modeler.ui.adapters
+ try {
+ String fieldName = "UI_" + name + "_long_description";
+ Class messages = JavaReflectionUtil.findClass(adapterFactory, "Messages");
+ Field field = messages.getField(fieldName);
+ String text = (String)field.get(null);
+ setProperty(LONG_DESCRIPTION, text);
+ } catch (Exception e) {
+ }
+ }
+
+ public void setObjectDescriptor(ObjectDescriptor<T> pd) {
+ setProperty(PROPERTY_DESCRIPTOR,pd);
+ }
+
+ public ObjectDescriptor<T> getObjectDescriptor() {
+ ObjectDescriptor<T> pd = (ObjectDescriptor<T>) getProperty(PROPERTY_DESCRIPTOR);
+ if (pd==null) {
+ pd = new ObjectDescriptor<T>(adapterFactory, (T)getTarget());
+ setProperty(PROPERTY_DESCRIPTOR,pd);
+ }
+ return pd;
+ }
+
+ public FeatureDescriptor<T> getFeatureDescriptor(EStructuralFeature feature) {
+ FeatureDescriptor<T> pd = (FeatureDescriptor<T>) getProperty(feature,PROPERTY_DESCRIPTOR);
+ if (pd==null) {
+ pd = new FeatureDescriptor<T>(adapterFactory, (T)getTarget(), feature);
+ setProperty(feature,PROPERTY_DESCRIPTOR,pd);
+ }
+ return pd;
+ }
+
+ public void setFeatureDescriptor(EStructuralFeature feature, FeatureDescriptor<T> pd) {
+ Hashtable<String,Object> props = featureProperties.get(feature);
+ if (props==null) {
+ props = new Hashtable<String,Object>();
+ featureProperties.put(feature,props);
+ }
+ props.put(PROPERTY_DESCRIPTOR, pd);
+ }
+
+ public Object getProperty(String key) {
+ return objectProperties.get(key);
+ }
+
+ public boolean getBooleanProperty(String key) {
+ Object result = getProperty(key);
+ if (result instanceof Boolean)
+ return ((Boolean)result);
+ return false;
+ }
+
+ public void setProperty(String key, Object value) {
+ objectProperties.put(key, value);
+ }
+
+ public Object getProperty(EStructuralFeature feature, String key) {
+ Hashtable<String,Object> props = featureProperties.get(feature);
+ if (props==null) {
+ props = new Hashtable<String,Object>();
+ featureProperties.put(feature,props);
+ }
+ return props.get(key);
+ }
+
+ public boolean getBooleanProperty(EStructuralFeature feature, String key) {
+ Object result = getProperty(feature, key);
+ if (result instanceof Boolean)
+ return ((Boolean)result);
+ return false;
+ }
+
+ public void setProperty(EStructuralFeature feature, String key, Object value) {
+ Hashtable<String,Object> props = featureProperties.get(feature);
+ if (props==null) {
+ props = new Hashtable<String,Object>();
+ featureProperties.put(feature,props);
+ }
+ props.put(key, value);
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/FeatureDescriptor.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/FeatureDescriptor.java
index d3fcbf3..23f7c7c 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/FeatureDescriptor.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/FeatureDescriptor.java
@@ -134,7 +134,7 @@
/**
* Returns a list of name-value pairs for display in a combo box or selection list.
* The String is what gets displayed in the selection list, while the Object is
- * implementation-specific: this can be a reference to an element, string or whatever.
+ * implementation-specific: this can businessObject a reference to an element, string or whatever.
* The implementation is responsible for interpreting this value by overriding the
* setValue() method, and must update the object feature accordingly.
*
@@ -245,8 +245,8 @@
return newFeature;
}
- // NOTE: getValue() and setValue() must be symmetrical; that is, setValue()
- // must be able to handle the object type returned by getValue(), although
+ // NOTE: getValue() and setValue() must businessObject symmetrical; that is, setValue()
+ // must businessObject able to handle the object type returned by getValue(), although
// setValue() may also know how to convert from other types, e.g. String,
// Integer, etc.
public Object getValue() {
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/IStatefullAdapter.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/IStatefullAdapter.java
index 31eadd2..237460f 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/IStatefullAdapter.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/IStatefullAdapter.java
@@ -1,32 +1,32 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation and others.
- * 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.bpmn2.modeler.core.adapters;
-
-/**
- * If an adapter implements this interface, it is assumed to be statefull.
- * The AdapterProvider helper class will always return new instances of
- * such adapter classes.
- *
- * @author Michal Chmielewski (michal.chmielewski@oracle.com)
- * @date Jul 28, 2006
- *
- */
-
-public interface IStatefullAdapter {
-
- /**
- * Set the target object.
- *
- * @param target the target object
- */
- public void setTarget (Object target);
-
-}
+/*******************************************************************************
+ * Copyright (c) 2006 Oracle Corporation and others.
+ * 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:
+ * Oracle Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpmn2.modeler.core.adapters;
+
+/**
+ * If an adapter implements this interface, it is assumed to businessObject statefull.
+ * The AdapterProvider helper class will always return new instances of
+ * such adapter classes.
+ *
+ * @author Michal Chmielewski (michal.chmielewski@oracle.com)
+ * @date Jul 28, 2006
+ *
+ */
+
+public interface IStatefullAdapter {
+
+ /**
+ * Set the target object.
+ *
+ * @param target the target object
+ */
+ public void setTarget (Object target);
+
+}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/InsertionAdapter.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/InsertionAdapter.java
index 96609a0..b203625 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/InsertionAdapter.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/InsertionAdapter.java
@@ -48,9 +48,9 @@
}
private InsertionAdapter(Resource resource, EObject object, EStructuralFeature feature, EObject value) {
- // in order for this to work, the object must be contained in a Resource,
- // the value must NOT YET be contained in a Resource,
- // and the value must be an instance of the feature EType.
+ // in order for this to work, the object must businessObject contained in a Resource,
+ // the value must NOT YET businessObject contained in a Resource,
+ // and the value must businessObject an instance of the feature EType.
// assert(object.eResource()!=null);
// assert(value.eResource()==null);
// assert(feature.getEType().isInstance(value));
@@ -167,8 +167,8 @@
list.add(value);
// assign the value's ID if it has one:
// because of changes made by cascading InsertionAdapters,
- // the object could now be contained in a resource and hence
- // the setID() will need to be executed on the command stack.
+ // the object could now businessObject contained in a resource and hence
+ // the setID() will need to businessObject executed on the command stack.
domain = getEditingDomain();
if (domain==null) {
ModelUtil.setID(value);
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/ObjectDescriptor.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/ObjectDescriptor.java
index d6d120b..fd7e2c7 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/ObjectDescriptor.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/ObjectDescriptor.java
@@ -132,7 +132,7 @@
// compare feature values of both EObjects:
// this should take care of most of the BPMN2 elements
for (EStructuralFeature f : object.eClass().getEAllStructuralFeatures()) {
- // IDs are allowed to be different
+ // IDs are allowed to businessObject different
if ("id".equals(f.getName()))
continue;
Object v1 = ((T)obj).eGet(f);
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/di/DIImport.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/di/DIImport.java
index 13be5e4..09cb63b 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/di/DIImport.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/di/DIImport.java
@@ -165,8 +165,8 @@
// BPMNPlane plane = d.getPlane();
// for (DiagramElement de : plane.getPlaneElement()) {
// if (de instanceof BPMNShape) {
-// BaseElement be = ((BPMNShape) de).getBpmnElement();
-// PictogramElement pe = elements.get(be);
+// BaseElement businessObject = ((BPMNShape) de).getBpmnElement();
+// PictogramElement pe = elements.get(businessObject);
// if (pe instanceof Shape ) {
// Graphiti.getPeService().sendToFront((Shape)pe);
// }
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/AbstractAddBPMNShapeFeature.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/AbstractAddBPMNShapeFeature.java
index 3e1cbf9..34ebad8 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/AbstractAddBPMNShapeFeature.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/AbstractAddBPMNShapeFeature.java
@@ -203,7 +203,7 @@
double b = y0 - m * x0;
int y2 = (int)(m * x + b);
// because of roundoff errors when the slope is nearly vertical, the
- // adjusted y may be way off; in this case, adjust the x coordinate instead
+ // adjusted y may businessObject way off; in this case, adjust the x coordinate instead
if (Math.abs(m) > 100) {
x = (int)((y - b) / m);
}
@@ -274,7 +274,7 @@
if (connection!=null) {
// determine how to split the line depending on where the new object was dropped:
// the longer segment will remain the original connection, and a new connection
- // will be created for the shorter segment
+ // will businessObject created for the shorter segment
ILayoutService layoutService = Graphiti.getLayoutService();
Anchor a0 = connection.getStart();
Anchor a1 = connection.getEnd();
@@ -358,7 +358,7 @@
protected boolean isHorizontal(ITargetContext context) {
if (context.getProperty(DIImport.IMPORT_PROPERTY) == null) {
- // not importing - set isHorizontal to be the same as parent Pool
+ // not importing - set isHorizontal to businessObject the same as parent Pool
if (FeatureSupport.isTargetParticipant(context)) {
Participant targetParticipant = FeatureSupport.getTargetParticipant(context);
BPMNShape participantShape = findDIShape(targetParticipant);
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/UpdateBaseElementNameFeature.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/UpdateBaseElementNameFeature.java
index 262123b..90bc77c 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/UpdateBaseElementNameFeature.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/UpdateBaseElementNameFeature.java
@@ -1,128 +1,128 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Ivar Meikas
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.core.features;
-
-import static org.eclipse.bpmn2.modeler.core.utils.FeatureSupport.getChildElementOfType;
-
-import org.eclipse.bpmn2.BaseElement;
-import org.eclipse.bpmn2.modeler.core.utils.BusinessObjectUtil;
-import org.eclipse.bpmn2.modeler.core.utils.GraphicsUtil;
-import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
-import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.features.IReason;
-import org.eclipse.graphiti.features.context.IUpdateContext;
-import org.eclipse.graphiti.features.impl.AbstractUpdateFeature;
-import org.eclipse.graphiti.features.impl.Reason;
-import org.eclipse.graphiti.mm.algorithms.AbstractText;
-import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
-import org.eclipse.graphiti.mm.pictograms.ContainerShape;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.graphiti.mm.pictograms.Shape;
-import org.eclipse.graphiti.services.Graphiti;
-import org.eclipse.graphiti.services.IGaService;
-
-public class UpdateBaseElementNameFeature extends AbstractUpdateFeature {
-
- public static final String TEXT_ELEMENT = "baseelement.text";
-
- public UpdateBaseElementNameFeature(IFeatureProvider fp) {
- super(fp);
- }
-
- @Override
- public boolean canUpdate(IUpdateContext context) {
- BaseElement element = (BaseElement) BusinessObjectUtil.getFirstElementOfType(context.getPictogramElement(),
- BaseElement.class);
- if (element == null) {
- return false;
- }
- return ModelUtil.hasName(element);
- }
-
- @Override
- public IReason updateNeeded(IUpdateContext context) {
- PictogramElement container = context.getPictogramElement();
-
- BaseElement element = (BaseElement) BusinessObjectUtil.getFirstElementOfType(container,
- BaseElement.class);
-
- Shape textShape = getChildElementOfType(container, TEXT_ELEMENT, Boolean.toString(true), Shape.class);
- if (textShape!=null) {
- String oldLabel = ModelUtil.getName(element);
- if (oldLabel==null || oldLabel.isEmpty())
- oldLabel = "";
- String newLabel = "";
- if (textShape.getGraphicsAlgorithm() instanceof AbstractText) {
- AbstractText text = (AbstractText) textShape.getGraphicsAlgorithm();
- newLabel = text.getValue();
- }
- if (newLabel==null || newLabel.isEmpty())
- newLabel = "";
-
- return oldLabel.equals(newLabel) ? Reason.createFalseReason() : Reason.createTrueReason();
- }
- return Reason.createFalseReason();
- }
-
- @Override
- public boolean update(IUpdateContext context) {
- PictogramElement pe = (PictogramElement) context.getPictogramElement();
- BaseElement element = (BaseElement) BusinessObjectUtil.getFirstElementOfType(context.getPictogramElement(),
- BaseElement.class);
- Shape textShape = getChildElementOfType(pe, TEXT_ELEMENT, Boolean.toString(true), Shape.class);
- if (textShape!=null) {
- AbstractText text = (AbstractText) textShape.getGraphicsAlgorithm();
- String name = ModelUtil.getName(element);
- if (name == null) {
- name = "";
- }
- text.setValue(name);
- layoutPictogramElement(context.getPictogramElement());
-
- }
-
- if (pe instanceof ContainerShape) {
- IGaService gaService = Graphiti.getGaService();
- ContainerShape container = (ContainerShape)pe;
-
- Shape shape = container.getChildren().get(0); // Otherwise, this would never be reached!
- if (!(shape.getGraphicsAlgorithm() instanceof AbstractText))
- return true;
-
- GraphicsAlgorithm textGA = container.getGraphicsAlgorithm();
- AbstractText text = (AbstractText) shape.getGraphicsAlgorithm();
-
- int oldWidth = textGA.getWidth() - GraphicsUtil.SHAPE_PADDING;
- int x = textGA.getX() + ((oldWidth + GraphicsUtil.SHAPE_PADDING) / 2);
- int y = textGA.getY();
-
- BaseElement o = BusinessObjectUtil.getFirstElementOfType(context.getPictogramElement(), BaseElement.class);
- String name = ModelUtil.getName(o);
-
- if (name == null) {
- gaService.setLocationAndSize(textGA, x, y, 0, 0);
- gaService.setLocationAndSize(text, 0, 0, 0, 0);
- container.setVisible(false);
- } else {
- int newWidth = GraphicsUtil.getLabelWidth(text);
- int newHeight = GraphicsUtil.getLabelHeight(text);
- x = x - ((newWidth + GraphicsUtil.SHAPE_PADDING) / 2);
- gaService.setLocationAndSize(textGA, x, y, newWidth + GraphicsUtil.SHAPE_PADDING, newHeight + GraphicsUtil.SHAPE_PADDING);
- gaService.setLocationAndSize(text, 0, 0, newWidth + GraphicsUtil.TEXT_PADDING, newHeight + GraphicsUtil.TEXT_PADDING);
- container.setVisible(true);
- }
- }
-
- return true;
- }
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Ivar Meikas
+ ******************************************************************************/
+package org.eclipse.bpmn2.modeler.core.features;
+
+import static org.eclipse.bpmn2.modeler.core.utils.FeatureSupport.getChildElementOfType;
+
+import org.eclipse.bpmn2.BaseElement;
+import org.eclipse.bpmn2.modeler.core.utils.BusinessObjectUtil;
+import org.eclipse.bpmn2.modeler.core.utils.GraphicsUtil;
+import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.IReason;
+import org.eclipse.graphiti.features.context.IUpdateContext;
+import org.eclipse.graphiti.features.impl.AbstractUpdateFeature;
+import org.eclipse.graphiti.features.impl.Reason;
+import org.eclipse.graphiti.mm.algorithms.AbstractText;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+import org.eclipse.graphiti.services.Graphiti;
+import org.eclipse.graphiti.services.IGaService;
+
+public class UpdateBaseElementNameFeature extends AbstractUpdateFeature {
+
+ public static final String TEXT_ELEMENT = "baseelement.text";
+
+ public UpdateBaseElementNameFeature(IFeatureProvider fp) {
+ super(fp);
+ }
+
+ @Override
+ public boolean canUpdate(IUpdateContext context) {
+ BaseElement element = (BaseElement) BusinessObjectUtil.getFirstElementOfType(context.getPictogramElement(),
+ BaseElement.class);
+ if (element == null) {
+ return false;
+ }
+ return ModelUtil.hasName(element);
+ }
+
+ @Override
+ public IReason updateNeeded(IUpdateContext context) {
+ PictogramElement container = context.getPictogramElement();
+
+ BaseElement element = (BaseElement) BusinessObjectUtil.getFirstElementOfType(container,
+ BaseElement.class);
+
+ Shape textShape = getChildElementOfType(container, TEXT_ELEMENT, Boolean.toString(true), Shape.class);
+ if (textShape!=null) {
+ String oldLabel = ModelUtil.getName(element);
+ if (oldLabel==null || oldLabel.isEmpty())
+ oldLabel = "";
+ String newLabel = "";
+ if (textShape.getGraphicsAlgorithm() instanceof AbstractText) {
+ AbstractText text = (AbstractText) textShape.getGraphicsAlgorithm();
+ newLabel = text.getValue();
+ }
+ if (newLabel==null || newLabel.isEmpty())
+ newLabel = "";
+
+ return oldLabel.equals(newLabel) ? Reason.createFalseReason() : Reason.createTrueReason();
+ }
+ return Reason.createFalseReason();
+ }
+
+ @Override
+ public boolean update(IUpdateContext context) {
+ PictogramElement pe = (PictogramElement) context.getPictogramElement();
+ BaseElement element = (BaseElement) BusinessObjectUtil.getFirstElementOfType(context.getPictogramElement(),
+ BaseElement.class);
+ Shape textShape = getChildElementOfType(pe, TEXT_ELEMENT, Boolean.toString(true), Shape.class);
+ if (textShape!=null) {
+ AbstractText text = (AbstractText) textShape.getGraphicsAlgorithm();
+ String name = ModelUtil.getName(element);
+ if (name == null) {
+ name = "";
+ }
+ text.setValue(name);
+ layoutPictogramElement(context.getPictogramElement());
+
+ }
+
+ if (pe instanceof ContainerShape) {
+ IGaService gaService = Graphiti.getGaService();
+ ContainerShape container = (ContainerShape)pe;
+
+ Shape shape = container.getChildren().get(0); // Otherwise, this would never businessObject reached!
+ if (!(shape.getGraphicsAlgorithm() instanceof AbstractText))
+ return true;
+
+ GraphicsAlgorithm textGA = container.getGraphicsAlgorithm();
+ AbstractText text = (AbstractText) shape.getGraphicsAlgorithm();
+
+ int oldWidth = textGA.getWidth() - GraphicsUtil.SHAPE_PADDING;
+ int x = textGA.getX() + ((oldWidth + GraphicsUtil.SHAPE_PADDING) / 2);
+ int y = textGA.getY();
+
+ BaseElement o = BusinessObjectUtil.getFirstElementOfType(context.getPictogramElement(), BaseElement.class);
+ String name = ModelUtil.getName(o);
+
+ if (name == null) {
+ gaService.setLocationAndSize(textGA, x, y, 0, 0);
+ gaService.setLocationAndSize(text, 0, 0, 0, 0);
+ container.setVisible(false);
+ } else {
+ int newWidth = GraphicsUtil.getLabelWidth(text);
+ int newHeight = GraphicsUtil.getLabelHeight(text);
+ x = x - ((newWidth + GraphicsUtil.SHAPE_PADDING) / 2);
+ gaService.setLocationAndSize(textGA, x, y, newWidth + GraphicsUtil.SHAPE_PADDING, newHeight + GraphicsUtil.SHAPE_PADDING);
+ gaService.setLocationAndSize(text, 0, 0, newWidth + GraphicsUtil.TEXT_PADDING, newHeight + GraphicsUtil.TEXT_PADDING);
+ container.setVisible(true);
+ }
+ }
+
+ return true;
+ }
}
\ No newline at end of file
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/activity/AbstractUpdateMarkerFeature.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/activity/AbstractUpdateMarkerFeature.java
index 6b3fa28..e1bcea5 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/activity/AbstractUpdateMarkerFeature.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/activity/AbstractUpdateMarkerFeature.java
@@ -59,8 +59,7 @@
ContainerShape container = (ContainerShape) context.getPictogramElement();
T element = (T) getBusinessObjectForPictogramElement(context.getPictogramElement());
- ContainerShape markerContainer = GraphicsUtil.getActivityMarkerContainer(container);
- doUpdate(element, markerContainer);
+ doUpdate(element, container);
peService.setPropertyValue(container, getPropertyKey(), convertPropertyToString(element));
return true;
}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/lane/AddLaneFeature.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/lane/AddLaneFeature.java
index 29666bd..6015a1b 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/lane/AddLaneFeature.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/features/lane/AddLaneFeature.java
@@ -149,7 +149,7 @@
}
peService.sendToBack(containerShape);
- if (context.getTargetContainer().getContainer() != null) { // only children may be sent back
+ if (context.getTargetContainer().getContainer() != null) { // only children may businessObject sent back
peService.sendToBack(context.getTargetContainer());
}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/AbstractBpmn2PropertySection.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/AbstractBpmn2PropertySection.java
index ca4911a..81609c1 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/AbstractBpmn2PropertySection.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/AbstractBpmn2PropertySection.java
@@ -250,7 +250,7 @@
}
/* (non-Javadoc)
- * Override this to allow the section to decide whether or not it will be rendered.
+ * Override this to allow the section to decide whether or not it will businessObject rendered.
* @see org.eclipse.bpmn2.modeler.core.runtime.IBpmn2PropertySection#appliesTo(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
*/
@Override
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/AbstractDetailComposite.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/AbstractDetailComposite.java
index 47b1db9..cde5407 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/AbstractDetailComposite.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/AbstractDetailComposite.java
@@ -108,7 +108,7 @@
* This method is called by the property sheet tab section to update the UI
* after a new selection is made. Updating consists of a full teardown of the
* widget tree and then rebuilding it for the newly selected EObject. Since the
- * same composite MAY be used for different EObject types, the widgets may be
+ * same composite MAY businessObject used for different EObject types, the widgets may businessObject
* completely different, hence the need for teardown and setup for each new selection.
*
* @param object
@@ -193,7 +193,7 @@
* This method is called when setEObject is called and this should recreate
* all bindings and widgets for the current selection.
*
- * @param be the business object linked to the currently selected EditPart
+ * @param businessObject the business object linked to the currently selected EditPart
* through the Graphiti DiagramEditor framework.
*/
public abstract void createBindings(EObject be);
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/AbstractListComposite.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/AbstractListComposite.java
index bca83cd..1e1d7b4 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/AbstractListComposite.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/AbstractListComposite.java
@@ -179,7 +179,7 @@
// are there any actual "anyAttribute" instances we can look at
// to get the feature names and types from?
// TODO: enhance the table to dynamically allow creation of new
- // columns which will be added to the "anyAttributes"
+ // columns which will businessObject added to the "anyAttributes"
for (EObject instance : list) {
if (listItemClass.isInstance(instance)) {
Object o = instance.eGet(a1);
@@ -219,7 +219,7 @@
}
/**
- * Override this to create your own Details section. This composite will be displayed
+ * Override this to create your own Details section. This composite will businessObject displayed
* in a twistie section whenever the user selects an item from the table. The section
* is automatically hidden when the table is collapsed.
*
@@ -239,7 +239,7 @@
* Add a new list item.
* @param object
* @param feature
- * @return the new item to be added to the list, or null if item creation failed
+ * @return the new item to businessObject added to the list, or null if item creation failed
*/
abstract protected EObject addListItem(EObject object, EStructuralFeature feature);
@@ -337,7 +337,7 @@
final String prefName = "list."+listItemClass.getName()+".expanded";
////////////////////////////////////////////////////////////
- // Collect columns to be displayed and build column provider
+ // Collect columns to businessObject displayed and build column provider
////////////////////////////////////////////////////////////
if (createColumnProvider(businessObject, feature) <= 0)
return;
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/DefaultDetailComposite.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/DefaultDetailComposite.java
index 280ec2b..33fcdff 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/DefaultDetailComposite.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/DefaultDetailComposite.java
@@ -101,7 +101,7 @@
/**
* "rootElements#Process.resources#HumanPerformer"
- * @param be
+ * @param businessObject
* @param property
* @return
*/
@@ -133,7 +133,7 @@
}
if (!property.isEmpty()) {
- // determine new object - may be a list
+ // determine new object - may businessObject a list
if (eclass!=null) {
Object value = be.eGet(feature);
if (value instanceof EList) {
@@ -201,7 +201,7 @@
}
// if (getChildren().length==0) {
-// createMissingPropertiesLabel(be);
+// createMissingPropertiesLabel(businessObject);
// }
redrawPage();
}
@@ -218,18 +218,21 @@
/**
* Provider class for the Default Properties sheet tab.
* This simply returns a list of properties, containment ELists and references
- * to be rendered on the Default Properties tab. If the DefaultDetailComposite
+ * to businessObject rendered on the Default Properties tab. If the DefaultDetailComposite
* is subclassed and the client does not specify an item provider, the default
* behavior is to render all structural features for the business object.
*/
- public abstract class AbstractPropertiesProvider {
+ public static abstract class AbstractPropertiesProvider {
- EObject be;
+ EObject businessObject;
public AbstractPropertiesProvider(EObject object) {
- be = object;
+ businessObject = object;
}
public abstract String[] getProperties();
+
+ public void setProperties(String[] properties) {
+ }
}
}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/DefaultListComposite.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/DefaultListComposite.java
index e443189..085e44c 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/DefaultListComposite.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/DefaultListComposite.java
@@ -43,7 +43,7 @@
"Can not create a new " +
listItemClass.getName() +
" because the list is not a control. " +
- "The default addListItem() method must be implemented."
+ "The default addListItem() method must businessObject implemented."
);
return null;
}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/DefaultPropertySection.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/DefaultPropertySection.java
index c149986..f240d3c 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/DefaultPropertySection.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/DefaultPropertySection.java
@@ -12,27 +12,52 @@
******************************************************************************/
package org.eclipse.bpmn2.modeler.core.merrimac.clad;
-import org.eclipse.emf.ecore.EClass;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.DefaultDetailComposite.AbstractPropertiesProvider;
+import org.eclipse.bpmn2.modeler.core.utils.BusinessObjectUtil;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.IWorkbenchPart;
public class DefaultPropertySection extends AbstractBpmn2PropertySection {
+ protected AbstractPropertiesProvider propertiesProvider = null;
+ protected Class appliesToClass = null;
+
/* (non-Javadoc)
* @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
*/
@Override
protected AbstractDetailComposite createSectionRoot() {
- return new DefaultDetailComposite(this);
+ DefaultDetailComposite composite = new DefaultDetailComposite(this);
+ composite.setPropertiesProvider(propertiesProvider);
+ return composite;
}
@Override
public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
- return new DefaultDetailComposite(parent, style);
+ DefaultDetailComposite composite = new DefaultDetailComposite(parent, style);
+ composite.setPropertiesProvider(propertiesProvider);
+ return composite;
}
+ public void setProperties(String[] properties) {
+ propertiesProvider = new AbstractPropertiesProvider(null) {
+ String[] properties = null;
+ @Override
+ public String[] getProperties() {
+ // TODO Auto-generated method stub
+ return properties;
+ }
+
+ public void setProperties(String[] properties) {
+ this.properties = properties;
+ }
+ };
+ propertiesProvider.setProperties(properties);
+ }
+
@Override
public boolean appliesTo(IWorkbenchPart part, ISelection selection) {
// BPMN2Editor editor = (BPMN2Editor)part;
@@ -49,6 +74,28 @@
// }
// }
// return false;
- return super.appliesTo(part, selection);
+ if (appliesToClass==null)
+ return super.appliesTo(part, selection);
+
+ PictogramElement pe = BusinessObjectUtil.getPictogramElementForSelection(selection);
+ // this is a special hack to allow selection of connection decorator labels:
+ // the connection decorator does not have a business object linked to it,
+ // but its parent (the connection) does.
+ if (pe.getLink()==null && pe.eContainer() instanceof PictogramElement)
+ pe = (PictogramElement)pe.eContainer();
+
+ // check all linked BusinessObjects for a match
+ if (pe.getLink()!=null) {
+ for (EObject eObj : pe.getLink().getBusinessObjects()){
+ if (appliesToClass.isInstance(eObj)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ public void setAppliesTo(Class appliesToClass) {
+ this.appliesToClass = appliesToClass;
}
}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/ListAndDetailCompositeBase.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/ListAndDetailCompositeBase.java
index ab19934..be13869 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/ListAndDetailCompositeBase.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/ListAndDetailCompositeBase.java
@@ -256,7 +256,7 @@
// it will not receive notification of model changes inside a txn.
// So, while this works in the Property Sheet pages, things like
// the ObjectEditingDialog (which makes changes in the current txn)
- // will not cause other widgets in the dialog to be notified.
+ // will not cause other widgets in the dialog to businessObject notified.
@Override
public void resourceSetChanged(ResourceSetChangeEvent event) {
final List<Notification> notifications = new ArrayList<Notification>();
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/PropertiesCompositeFactory.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/PropertiesCompositeFactory.java
index 353ed52..c4e33e3 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/PropertiesCompositeFactory.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/PropertiesCompositeFactory.java
@@ -1,278 +1,278 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Bob Brodt
- ******************************************************************************/
-
-package org.eclipse.bpmn2.modeler.core.merrimac.clad;
-
-import java.lang.reflect.Constructor;
-import java.util.Hashtable;
-
-import org.eclipse.bpmn2.modeler.core.runtime.TargetRuntime;
-import org.eclipse.bpmn2.modeler.core.Activator;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.impl.EObjectImpl;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * This class maintains the registry of PropertySheetPage Composite widgets for each
- * BPMN2 metamodel type. This ensures that the same Property Section layout is used
- * for each model object regardless of where the Composite is embedded. This happens,
- * for example, in the Advanced Property Section which displays a customized details
- * section depending on the currently selected object type.
- *
- * @author Bob Brodt
- *
- */
-@SuppressWarnings({ "rawtypes", "unchecked" })
-public class PropertiesCompositeFactory {
-
- protected final static Hashtable<TargetRuntime, Hashtable<Class,Class>> detailRegistry = new Hashtable<TargetRuntime,Hashtable<Class,Class>>();
- protected final static Hashtable<TargetRuntime, Hashtable<Class,Class>> listRegistry = new Hashtable<TargetRuntime,Hashtable<Class,Class>>();
- protected final static Hashtable<TargetRuntime, Hashtable<Class,Class>> dialogRegistry = new Hashtable<TargetRuntime,Hashtable<Class,Class>>();
-
- public static void register(Class eClass, Class composite) {
- TargetRuntime rt = TargetRuntime.getCurrentRuntime();
- Hashtable<Class,Class> map = null;
- if (AbstractListComposite.class.isAssignableFrom(composite))
- map = listRegistry.get(rt);
- else if (AbstractDialogComposite.class.isAssignableFrom(composite))
- map = dialogRegistry.get(rt);
- else if (AbstractDetailComposite.class.isAssignableFrom(composite))
- map = detailRegistry.get(rt);
- else
- throw new IllegalArgumentException("Unknown Composite type: "+composite.getName());
-
- if (map==null) {
- map = new Hashtable<Class,Class>();
- if (AbstractListComposite.class.isAssignableFrom(composite))
- listRegistry.put(rt,map);
- else if (AbstractDialogComposite.class.isAssignableFrom(composite))
- dialogRegistry.put(rt,map);
- else if (AbstractDetailComposite.class.isAssignableFrom(composite))
- detailRegistry.put(rt,map);
- }
- map.put(eClass, composite);
-
- // make sure the constructors are declared
- try {
- Constructor ctor = null;
- Class ec = composite.getEnclosingClass();
- if (ec!=null) {
- if (AbstractDialogComposite.class.isAssignableFrom(composite)) {
- ctor = composite.getConstructor(ec,Composite.class,EClass.class,int.class);
- }
- else {
- ctor = composite.getConstructor(ec,AbstractBpmn2PropertySection.class);
- ctor = composite.getConstructor(ec,Composite.class,int.class);
- }
- }
- else {
- if (AbstractDialogComposite.class.isAssignableFrom(composite)) {
- ctor = composite.getConstructor(Composite.class,EClass.class,int.class);
- }
- else {
- ctor = composite.getConstructor(AbstractBpmn2PropertySection.class);
- ctor = composite.getConstructor(Composite.class,int.class);
- }
- }
- } catch (Exception e) {
- Activator.logError(e);
- }
- }
-
- ////////////////////////////////////////////////////////////////////////////////
- // Detail Composite methods
- ////////////////////////////////////////////////////////////////////////////////
- public static Class findDetailCompositeClass(Class eClass) {
- TargetRuntime rt = TargetRuntime.getCurrentRuntime();
- Class composite = findCompositeClass(detailRegistry.get(rt),eClass);
- if (composite==null && rt!=TargetRuntime.getDefaultRuntime()) {
- // fall back to default target runtime
- rt = TargetRuntime.getDefaultRuntime();
- composite = findCompositeClass(detailRegistry.get(rt),eClass);
- }
- return composite;
- }
-
- public static AbstractDetailComposite createDetailComposite(Class eClass, AbstractBpmn2PropertySection section) {
- Class clazz = findDetailCompositeClass(eClass);
- return (AbstractDetailComposite)createComposite(clazz, eClass, section);
- }
-
- public static AbstractDetailComposite createDetailComposite(Class eClass, Composite parent, int style) {
- Class clazz = findDetailCompositeClass(eClass);
- return (AbstractDetailComposite)createComposite(clazz, eClass, parent, style);
- }
-
- ////////////////////////////////////////////////////////////////////////////////
- // List Composite methods
- ////////////////////////////////////////////////////////////////////////////////
- public static Class findListCompositeClass(Class eClass) {
- TargetRuntime rt = TargetRuntime.getCurrentRuntime();
- Class composite = findCompositeClass(listRegistry.get(rt),eClass);
- if (composite==null && rt!=TargetRuntime.getDefaultRuntime()) {
- // fall back to default target runtime
- rt = TargetRuntime.getDefaultRuntime();
- composite = findCompositeClass(listRegistry.get(rt),eClass);
- }
- return composite;
- }
-
- public static AbstractListComposite createListComposite(Class eClass, AbstractBpmn2PropertySection section) {
- Class clazz = findListCompositeClass(eClass);
- return (AbstractListComposite)createComposite(clazz, eClass, section);
- }
-
- public static AbstractListComposite createListComposite(Class eClass, Composite parent, int style) {
- Class clazz = findListCompositeClass(eClass);
- return (AbstractListComposite)createComposite(clazz, eClass, parent, style);
- }
-
- ////////////////////////////////////////////////////////////////////////////////
- // Dialog Composite methods
- ////////////////////////////////////////////////////////////////////////////////
- public static Class findDialogCompositeClass(Class eClass) {
- TargetRuntime rt = TargetRuntime.getCurrentRuntime();
- Class composite = findCompositeClass(dialogRegistry.get(rt),eClass);
- if (composite==null && rt!=TargetRuntime.getDefaultRuntime()) {
- // fall back to default target runtime
- rt = TargetRuntime.getDefaultRuntime();
- composite = findCompositeClass(dialogRegistry.get(rt),eClass);
- }
- return composite;
- }
-
- public static AbstractDialogComposite createDialogComposite(EClass eClass, Composite parent, int style) {
- Class clazz = findDialogCompositeClass(eClass.getInstanceClass());
- Composite composite = null;
- try {
- Constructor ctor = null;
- // allow the composite to be declared in an enclosing class
- Class ec = clazz.getEnclosingClass();
- if (ec!=null) {
- ctor = clazz.getConstructor(ec,Composite.class,EClass.class,int.class);
- composite = (Composite) ctor.newInstance(null,parent,eClass,style);
- }
- else {
- ctor = clazz.getConstructor(Composite.class,EClass.class,int.class);
- composite = (Composite) ctor.newInstance(parent,eClass,style);
- }
- } catch (Exception e) {
- logError(eClass.getInstanceClass(),e);
- }
- return (AbstractDialogComposite)composite;
- }
-
- ////////////////////////////////////////////////////////////////////////////////
- // Common
- ////////////////////////////////////////////////////////////////////////////////
- private static Class findCompositeClass(Hashtable<Class,Class> map, Class eClass) {
- if (map!=null) {
- while (eClass!=null && eClass!=EObjectImpl.class) {
- if (map.containsKey(eClass)) {
- return map.get(eClass);
- }
- for (Class iface : eClass.getInterfaces()) {
- if (map.containsKey(iface)) {
- return map.get(iface);
- }
- Class composite = findCompositeClass(map,iface);
- if (composite!=null)
- return composite;
- }
- // if this is an interface, it won't have a super class,
- // so check all implemented interfaces
- if (eClass.isInterface()) {
- for (Class iface : eClass.getInterfaces()) {
- Class composite = findCompositeClass(map,iface);
- if (composite!=null)
- return composite;
- }
- }
- eClass = eClass.getSuperclass();
- }
- }
- return null;
- }
-
- private static Composite createComposite(Class clazz, Class eClass, AbstractBpmn2PropertySection section) {
- Composite composite = null;
- if (clazz!=null) {
- try {
- Constructor ctor = null;
- // allow the composite to be declared in an enclosing class
- Class ec = clazz.getEnclosingClass();
- if (ec!=null) {
- ctor = clazz.getConstructor(ec,AbstractBpmn2PropertySection.class);
- composite = (Composite) ctor.newInstance(null,section);
- }
- else {
- ctor = clazz.getConstructor(AbstractBpmn2PropertySection.class);
- composite = (Composite) ctor.newInstance(section);
- }
- } catch (Exception e) {
- logError(eClass,e);
- }
-
- }
-
- return composite;
- }
-
- private static Composite createComposite(Class clazz, Class eClass, Composite parent, int style) {
- Composite composite = null;
- if (clazz!=null) {
- try {
- Constructor ctor = null;
- // allow the composite to be declared in an enclosing class
- Class ec = clazz.getEnclosingClass();
- if (ec!=null) {
- ctor = clazz.getConstructor(ec,Composite.class,int.class);
- composite = (Composite) ctor.newInstance(null,parent,style);
- }
- else {
- ctor = clazz.getConstructor(Composite.class,int.class);
- composite = (Composite) ctor.newInstance(parent,style);
- }
- } catch (Exception e) {
- logError(eClass,e);
- }
-
- }
-
- // set a default layout data
- if (composite!=null) {
- if (parent.getLayout() instanceof GridLayout) {
- GridLayout layout = (GridLayout)parent.getLayout();
- composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, layout.numColumns, 1));
- }
- }
-
- return composite;
- }
-
- private static void logError(Class eClass, Exception e) {
- Activator.logError(e);
- MessageDialog.openError(Display.getDefault().getActiveShell(), "Internal Error",
- "The property sheet for the object type:\n\n"+
- eClass+"\n\nhas not been defined or is not visible."+
- "\n\nCause: "+
- e+"\n\n"+
- "Using the default property sheet instead.");
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Bob Brodt
+ ******************************************************************************/
+
+package org.eclipse.bpmn2.modeler.core.merrimac.clad;
+
+import java.lang.reflect.Constructor;
+import java.util.Hashtable;
+
+import org.eclipse.bpmn2.modeler.core.runtime.TargetRuntime;
+import org.eclipse.bpmn2.modeler.core.Activator;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.impl.EObjectImpl;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Display;
+
+/**
+ * This class maintains the registry of PropertySheetPage Composite widgets for each
+ * BPMN2 metamodel type. This ensures that the same Property Section layout is used
+ * for each model object regardless of where the Composite is embedded. This happens,
+ * for example, in the Advanced Property Section which displays a customized details
+ * section depending on the currently selected object type.
+ *
+ * @author Bob Brodt
+ *
+ */
+@SuppressWarnings({ "rawtypes", "unchecked" })
+public class PropertiesCompositeFactory {
+
+ protected final static Hashtable<TargetRuntime, Hashtable<Class,Class>> detailRegistry = new Hashtable<TargetRuntime,Hashtable<Class,Class>>();
+ protected final static Hashtable<TargetRuntime, Hashtable<Class,Class>> listRegistry = new Hashtable<TargetRuntime,Hashtable<Class,Class>>();
+ protected final static Hashtable<TargetRuntime, Hashtable<Class,Class>> dialogRegistry = new Hashtable<TargetRuntime,Hashtable<Class,Class>>();
+
+ public static void register(Class eClass, Class composite) {
+ TargetRuntime rt = TargetRuntime.getCurrentRuntime();
+ Hashtable<Class,Class> map = null;
+ if (AbstractListComposite.class.isAssignableFrom(composite))
+ map = listRegistry.get(rt);
+ else if (AbstractDialogComposite.class.isAssignableFrom(composite))
+ map = dialogRegistry.get(rt);
+ else if (AbstractDetailComposite.class.isAssignableFrom(composite))
+ map = detailRegistry.get(rt);
+ else
+ throw new IllegalArgumentException("Unknown Composite type: "+composite.getName());
+
+ if (map==null) {
+ map = new Hashtable<Class,Class>();
+ if (AbstractListComposite.class.isAssignableFrom(composite))
+ listRegistry.put(rt,map);
+ else if (AbstractDialogComposite.class.isAssignableFrom(composite))
+ dialogRegistry.put(rt,map);
+ else if (AbstractDetailComposite.class.isAssignableFrom(composite))
+ detailRegistry.put(rt,map);
+ }
+ map.put(eClass, composite);
+
+ // make sure the constructors are declared
+ try {
+ Constructor ctor = null;
+ Class ec = composite.getEnclosingClass();
+ if (ec!=null) {
+ if (AbstractDialogComposite.class.isAssignableFrom(composite)) {
+ ctor = composite.getConstructor(ec,Composite.class,EClass.class,int.class);
+ }
+ else {
+ ctor = composite.getConstructor(ec,AbstractBpmn2PropertySection.class);
+ ctor = composite.getConstructor(ec,Composite.class,int.class);
+ }
+ }
+ else {
+ if (AbstractDialogComposite.class.isAssignableFrom(composite)) {
+ ctor = composite.getConstructor(Composite.class,EClass.class,int.class);
+ }
+ else {
+ ctor = composite.getConstructor(AbstractBpmn2PropertySection.class);
+ ctor = composite.getConstructor(Composite.class,int.class);
+ }
+ }
+ } catch (Exception e) {
+ Activator.logError(e);
+ }
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////
+ // Detail Composite methods
+ ////////////////////////////////////////////////////////////////////////////////
+ public static Class findDetailCompositeClass(Class eClass) {
+ TargetRuntime rt = TargetRuntime.getCurrentRuntime();
+ Class composite = findCompositeClass(detailRegistry.get(rt),eClass);
+ if (composite==null && rt!=TargetRuntime.getDefaultRuntime()) {
+ // fall back to default target runtime
+ rt = TargetRuntime.getDefaultRuntime();
+ composite = findCompositeClass(detailRegistry.get(rt),eClass);
+ }
+ return composite;
+ }
+
+ public static AbstractDetailComposite createDetailComposite(Class eClass, AbstractBpmn2PropertySection section) {
+ Class clazz = findDetailCompositeClass(eClass);
+ return (AbstractDetailComposite)createComposite(clazz, eClass, section);
+ }
+
+ public static AbstractDetailComposite createDetailComposite(Class eClass, Composite parent, int style) {
+ Class clazz = findDetailCompositeClass(eClass);
+ return (AbstractDetailComposite)createComposite(clazz, eClass, parent, style);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////
+ // List Composite methods
+ ////////////////////////////////////////////////////////////////////////////////
+ public static Class findListCompositeClass(Class eClass) {
+ TargetRuntime rt = TargetRuntime.getCurrentRuntime();
+ Class composite = findCompositeClass(listRegistry.get(rt),eClass);
+ if (composite==null && rt!=TargetRuntime.getDefaultRuntime()) {
+ // fall back to default target runtime
+ rt = TargetRuntime.getDefaultRuntime();
+ composite = findCompositeClass(listRegistry.get(rt),eClass);
+ }
+ return composite;
+ }
+
+ public static AbstractListComposite createListComposite(Class eClass, AbstractBpmn2PropertySection section) {
+ Class clazz = findListCompositeClass(eClass);
+ return (AbstractListComposite)createComposite(clazz, eClass, section);
+ }
+
+ public static AbstractListComposite createListComposite(Class eClass, Composite parent, int style) {
+ Class clazz = findListCompositeClass(eClass);
+ return (AbstractListComposite)createComposite(clazz, eClass, parent, style);
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////
+ // Dialog Composite methods
+ ////////////////////////////////////////////////////////////////////////////////
+ public static Class findDialogCompositeClass(Class eClass) {
+ TargetRuntime rt = TargetRuntime.getCurrentRuntime();
+ Class composite = findCompositeClass(dialogRegistry.get(rt),eClass);
+ if (composite==null && rt!=TargetRuntime.getDefaultRuntime()) {
+ // fall back to default target runtime
+ rt = TargetRuntime.getDefaultRuntime();
+ composite = findCompositeClass(dialogRegistry.get(rt),eClass);
+ }
+ return composite;
+ }
+
+ public static AbstractDialogComposite createDialogComposite(EClass eClass, Composite parent, int style) {
+ Class clazz = findDialogCompositeClass(eClass.getInstanceClass());
+ Composite composite = null;
+ try {
+ Constructor ctor = null;
+ // allow the composite to businessObject declared in an enclosing class
+ Class ec = clazz.getEnclosingClass();
+ if (ec!=null) {
+ ctor = clazz.getConstructor(ec,Composite.class,EClass.class,int.class);
+ composite = (Composite) ctor.newInstance(null,parent,eClass,style);
+ }
+ else {
+ ctor = clazz.getConstructor(Composite.class,EClass.class,int.class);
+ composite = (Composite) ctor.newInstance(parent,eClass,style);
+ }
+ } catch (Exception e) {
+ logError(eClass.getInstanceClass(),e);
+ }
+ return (AbstractDialogComposite)composite;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////////
+ // Common
+ ////////////////////////////////////////////////////////////////////////////////
+ private static Class findCompositeClass(Hashtable<Class,Class> map, Class eClass) {
+ if (map!=null) {
+ while (eClass!=null && eClass!=EObjectImpl.class) {
+ if (map.containsKey(eClass)) {
+ return map.get(eClass);
+ }
+ for (Class iface : eClass.getInterfaces()) {
+ if (map.containsKey(iface)) {
+ return map.get(iface);
+ }
+ Class composite = findCompositeClass(map,iface);
+ if (composite!=null)
+ return composite;
+ }
+ // if this is an interface, it won't have a super class,
+ // so check all implemented interfaces
+ if (eClass.isInterface()) {
+ for (Class iface : eClass.getInterfaces()) {
+ Class composite = findCompositeClass(map,iface);
+ if (composite!=null)
+ return composite;
+ }
+ }
+ eClass = eClass.getSuperclass();
+ }
+ }
+ return null;
+ }
+
+ private static Composite createComposite(Class clazz, Class eClass, AbstractBpmn2PropertySection section) {
+ Composite composite = null;
+ if (clazz!=null) {
+ try {
+ Constructor ctor = null;
+ // allow the composite to businessObject declared in an enclosing class
+ Class ec = clazz.getEnclosingClass();
+ if (ec!=null) {
+ ctor = clazz.getConstructor(ec,AbstractBpmn2PropertySection.class);
+ composite = (Composite) ctor.newInstance(null,section);
+ }
+ else {
+ ctor = clazz.getConstructor(AbstractBpmn2PropertySection.class);
+ composite = (Composite) ctor.newInstance(section);
+ }
+ } catch (Exception e) {
+ logError(eClass,e);
+ }
+
+ }
+
+ return composite;
+ }
+
+ private static Composite createComposite(Class clazz, Class eClass, Composite parent, int style) {
+ Composite composite = null;
+ if (clazz!=null) {
+ try {
+ Constructor ctor = null;
+ // allow the composite to businessObject declared in an enclosing class
+ Class ec = clazz.getEnclosingClass();
+ if (ec!=null) {
+ ctor = clazz.getConstructor(ec,Composite.class,int.class);
+ composite = (Composite) ctor.newInstance(null,parent,style);
+ }
+ else {
+ ctor = clazz.getConstructor(Composite.class,int.class);
+ composite = (Composite) ctor.newInstance(parent,style);
+ }
+ } catch (Exception e) {
+ logError(eClass,e);
+ }
+
+ }
+
+ // set a default layout data
+ if (composite!=null) {
+ if (parent.getLayout() instanceof GridLayout) {
+ GridLayout layout = (GridLayout)parent.getLayout();
+ composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, layout.numColumns, 1));
+ }
+ }
+
+ return composite;
+ }
+
+ private static void logError(Class eClass, Exception e) {
+ Activator.logError(e);
+ MessageDialog.openError(Display.getDefault().getActiveShell(), "Internal Error",
+ "The property sheet for the object type:\n\n"+
+ eClass+"\n\nhas not been defined or is not visible."+
+ "\n\nCause: "+
+ e+"\n\n"+
+ "Using the default property sheet instead.");
+ }
+
+}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/TableColumn.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/TableColumn.java
index 4ac2c9d..8887b07 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/TableColumn.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/TableColumn.java
@@ -111,8 +111,8 @@
}
// NOTE: in certain cases we can't create a cell editor until we have the object
-// that the editor will be modifying - this happens very late in the cell editing
-// lifecycle in canModify() - this is where the cell editor needs to be constructed.
+// that the editor will businessObject modifying - this happens very late in the cell editing
+// lifecycle in canModify() - this is where the cell editor needs to businessObject constructed.
//
// public CellEditor createCellEditor (Composite parent) {
// if (cellEditor==null && feature!=null) {
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/BooleanObjectEditor.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/BooleanObjectEditor.java
index bfcaf60..c517a29 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/BooleanObjectEditor.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/BooleanObjectEditor.java
@@ -51,7 +51,7 @@
public Control createControl(Composite composite, String label, int style) {
// create a separate label to the LEFT of the checkbox, otherwise the grid layout will
- // be off by one column for all other widgets that are created after this one.
+ // businessObject off by one column for all other widgets that are created after this one.
createLabel(composite, label);
button = getToolkit().createButton(composite, "", SWT.CHECK);
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/FeatureListObjectEditor.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/FeatureListObjectEditor.java
index 93777c0..e39d877 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/FeatureListObjectEditor.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/FeatureListObjectEditor.java
@@ -43,7 +43,7 @@
/**
* EObject Reference List Editor.
- * This class implements an EObject reference list editor. The feature must be an EList of EObject references.
+ * This class implements an EObject reference list editor. The feature must businessObject an EList of EObject references.
* The list is rendered in a single-line text field with an "Edit" button to the right. Clicking the edit button
* displays an EMF FeatureEditorDialog, which allows adding, removing and reordering of available object references.
*
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/MultivalueObjectEditor.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/MultivalueObjectEditor.java
index 1481d6f..1bc28fb 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/MultivalueObjectEditor.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/MultivalueObjectEditor.java
@@ -39,8 +39,8 @@
/**
* Create the list of name/value pairs from the feature domain. The name string is
- * intended to be used for display in the editor widget, and the value is the corresponding
- * feature value. If the values are null, then the name string is assumed to also be
+ * intended to businessObject used for display in the editor widget, and the value is the corresponding
+ * feature value. If the values are null, then the name string is assumed to also businessObject
* the feature value.
*
* The default implementation simply uses the EMF edit provider adapter to construct a valid
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/ObjectEditingDialog.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/ObjectEditingDialog.java
index 6c341dd..c924aed 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/ObjectEditingDialog.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/ObjectEditingDialog.java
@@ -203,7 +203,7 @@
/**
* Return state of the "abortOnCancel transaction on cancel" flag
*
- * @return true if the current transaction will be aborted if the dialog is canceled.
+ * @return true if the current transaction will businessObject aborted if the dialog is canceled.
*/
public boolean isAbortOnCancel() {
return abortOnCancel;
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/ObjectEditor.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/ObjectEditor.java
index 5224d9a..6df01c7 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/ObjectEditor.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/ObjectEditor.java
@@ -45,7 +45,7 @@
/**
* Base class for EObject feature editors. All subclasses must render the given object's feature,
- * which may be either an attribute, a reference to an EObject, or a list of EObject references.
+ * which may businessObject either an attribute, a reference to an EObject, or a list of EObject references.
* Subclasses must also provide means to populate the display widgets from the feature and save
* modifications to the feature made in the display widget.
*
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/providers/ColumnTableProvider.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/providers/ColumnTableProvider.java
index a2b8acb..125bb73 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/providers/ColumnTableProvider.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/providers/ColumnTableProvider.java
@@ -132,7 +132,7 @@
}
/**
- * Returns a particular column's property. For some subclasses, this may be more
+ * Returns a particular column's property. For some subclasses, this may businessObject more
* efficient than using getColumnProperties().
*/
@Override
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/providers/TableCursor.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/providers/TableCursor.java
index d955827..142662e 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/providers/TableCursor.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/providers/TableCursor.java
@@ -1,644 +1,644 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Bob Brodt
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.core.merrimac.providers;
-
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.accessibility.ACC;
-import org.eclipse.swt.accessibility.Accessible;
-import org.eclipse.swt.accessibility.AccessibleAdapter;
-import org.eclipse.swt.accessibility.AccessibleControlAdapter;
-import org.eclipse.swt.accessibility.AccessibleControlEvent;
-import org.eclipse.swt.accessibility.AccessibleEvent;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
-import org.eclipse.swt.events.KeyAdapter;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.MouseEvent;
-import org.eclipse.swt.events.MouseListener;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.graphics.GC;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.graphics.Rectangle;
-import org.eclipse.swt.widgets.Canvas;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.ScrollBar;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.TableColumn;
-import org.eclipse.swt.widgets.TableItem;
-import org.eclipse.swt.widgets.TypedListener;
-
-
-/**
- * A modification of the SWT TableCursor class to better handle empty tables and dynamic tables
- */
-public class TableCursor extends Canvas {
-
- Table table;
- int row = -1, column = 0; // having row negative will end up hiding the cursor
- Listener tableListener, resizeListener;
- boolean progVisible = false;
- boolean userVisible = true;
- boolean hasFocus = false;
- AccessibleAdapter accessAdapter = null;
- Listener selectionAccessListener = null;
- Listener focusAccessListener = null;
- AccessibleControlAdapter accessControlAdapter = null;
- boolean hasAccessibility = false;
-
- public TableCursor(Table parent, int style) {
- super(parent, style);
- table = parent;
- Listener listener = new Listener() {
- public void handleEvent(Event event) {
- switch (event.type) {
- case SWT.Dispose :
- dispose(event);
- break;
- case SWT.KeyDown :
- keyDown(event);
- break;
- case SWT.Paint :
- paint(event);
- break;
- case SWT.Traverse :
- traverse(event);
- break;
- }
- }
- };
- addListener(SWT.Dispose, listener);
- addListener(SWT.KeyDown, listener);
- addListener(SWT.Paint, listener);
- addListener(SWT.Traverse, listener);
-
- tableListener = new Listener() {
- public void handleEvent(Event event) {
- switch (event.type) {
- case SWT.MouseDown :
- tableMouseDown(event);
- break;
- case SWT.FocusIn :
- tableFocusIn(event);
- break;
- }
- }
- };
- table.addListener(SWT.FocusIn, tableListener);
- table.addListener(SWT.MouseDown, tableListener);
-
- resizeListener = new Listener() {
- public void handleEvent(Event event) {
- resize();
- }
- };
-
- ScrollBar hBar = table.getHorizontalBar();
- if (hBar != null)
- hBar.addListener(SWT.Selection, resizeListener);
-
- ScrollBar vBar = table.getVerticalBar();
- if (vBar != null)
- vBar.addListener(SWT.Selection, resizeListener);
-
- this.addFocusListener(new FocusListener() {
- public void focusGained(FocusEvent e) {
- hasFocus = true;
- redraw();
- }
-
- public void focusLost(FocusEvent e) {
- hasFocus = false;
- redraw();
-
- }});
-
- refresh();
-
- initAccessible();
- }
-
- /**
- * Creates a table cursor that can be used to navigate tables for keyboard accessibility
- * @param table
- * @param tableViewer
- * @return
- */
- public static TableCursor create(final Table table, final TableViewer tableViewer) {
- // create a TableCursor to navigate around the table
- final TableCursor cursor = new TableCursor(table, SWT.NONE);
- cursor.addSelectionListener(new SelectionAdapter() {
- // when the TableEditor is over a cell, select the corresponding row in the table
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (cursor.getRow() != null)
- table.setSelection(new TableItem[] {cursor.getRow()});
- }
- // when the user hits "ENTER" in the TableCursor, pop up an editor
- @Override
- public void widgetDefaultSelected(SelectionEvent e) {
- TableItem row = cursor.getRow();
- if (row != null) {
- int nRow = table.indexOf(row);
- int column = cursor.getColumn();
- Object obj = tableViewer.getElementAt(nRow);
- tableViewer.editElement(obj, column);
- }
- }
- });
-
- // Hide the TableCursor when the user hits the "CTRL" or "SHIFT" key.
- // This alows the user to select multiple items in the table.
- cursor.addKeyListener(new KeyAdapter() {
- @Override
- public void keyPressed(KeyEvent e) {
- if ((e.keyCode == SWT.CTRL) || (e.keyCode == SWT.SHIFT) ||
- (e.stateMask & SWT.CONTROL) != 0 || (e.stateMask & SWT.SHIFT) != 0) {
- cursor.setVisible(false);
- }
- }
- });
-
- cursor.addMouseListener(new MouseListener() {
- public void mouseDoubleClick(MouseEvent e) { }
- public void mouseDown(MouseEvent e) {
- TableItem row = cursor.getRow();
- if (row != null) {
- int nRow = table.indexOf(row);
- int column = cursor.getColumn();
- Object obj = tableViewer.getElementAt(nRow);
- tableViewer.editElement(obj, column);
- }
- }
- public void mouseUp(MouseEvent e) {
- }
- });
-
- // Show the TableCursor when the user releases the "SHIFT" or "CTRL" key.
- // This signals the end of the multiple selection modelObject.
- table.addKeyListener(new KeyAdapter() {
- @Override
- public void keyReleased(KeyEvent e) {
- if (e.keyCode == SWT.CONTROL && (e.stateMask & SWT.SHIFT) != 0)
- return;
- if (e.keyCode == SWT.SHIFT && (e.stateMask & SWT.CONTROL) != 0)
- return;
- if (e.keyCode != SWT.CONTROL && (e.stateMask & SWT.CONTROL) != 0)
- return;
- if (e.keyCode != SWT.SHIFT && (e.stateMask & SWT.SHIFT) != 0)
- return;
-
- if (table.getItemCount() == 0)
- return;
- TableItem[] selection = table.getSelection();
- TableItem row = (selection.length == 0) ? table.getItem(table.getTopIndex()) : selection[0];
- table.showItem(row);
- cursor.setSelection(row, 0);
- cursor.setVisible(true);
- cursor.setFocus();
- }
- });
- return cursor;
- }
-
- /**
- * this is called whenever the content of the table has changed, it
- * will reconcile the cursor and any listeners that we need
- */
-
- public void refresh() {
- // the number of rows and columns could have changed, ideally we should track
- // which columns have listeners but for the now, we'll just remove and readd
- int columns = table.getColumnCount();
- for (int i = 0; i < columns; i++) {
- TableColumn column = table.getColumn(i);
- column.removeListener(SWT.Resize, resizeListener);
- }
- for (int i = 0; i < columns; i++) {
- TableColumn column = table.getColumn(i);
- column.addListener(SWT.Resize, resizeListener);
- }
-
- // reset the row and column to be a valid one
- //boolean repaint = false;
- if (row >= table.getItemCount()) {
- row = table.getItemCount()-1;
- }
- if (column >= columns) {
- column = columns - 1;
- }
-
- // check to see what the selection is, and reset the tablecursor to
- // a valid row/column in that selection
-
- TableItem[] selection = table.getSelection();
- if (selection.length == 0) {
- row = -1;
- }
- else {
-// // there is a selection, so make sure our table cursor is in that selection
-// // range
-// int min = 999999;
-// int max = -1;
-// for (int i = 0; i < selection.length; i++) {
-// int temp = table.indexOf(selection[i]);
-// min = Math.min(temp, min);
-// max = Math.max(temp, max);
-// }
-// if (row > max || row < min)
-// row = min;
- }
- setSelection(row, column);
- }
-
- public void addSelectionListener(SelectionListener listener) {
- checkWidget();
- if (listener == null)
- SWT.error(SWT.ERROR_NULL_ARGUMENT);
- TypedListener typedListener = new TypedListener(listener);
- addListener(SWT.Selection, typedListener);
- addListener(SWT.DefaultSelection, typedListener);
- }
-
- void dispose(Event event) {
- Display display = getDisplay();
- display.asyncExec(new Runnable() {
- public void run() {
- if (table.isDisposed())
- return;
- table.removeListener(SWT.FocusIn, tableListener);
- table.removeListener(SWT.MouseDown, tableListener);
- int columns = table.getColumnCount();
- for (int i = 0; i < columns; i++) {
- TableColumn column = table.getColumn(i);
- column.removeListener(SWT.Resize, resizeListener);
- }
- ScrollBar hBar = table.getHorizontalBar();
- if (hBar != null) {
- hBar.removeListener(SWT.Selection, resizeListener);
- }
- ScrollBar vBar = table.getVerticalBar();
- if (vBar != null) {
- vBar.removeListener(SWT.Selection, resizeListener);
- }
- }
- });
- }
-
- void keyDown(Event event) {
- switch (event.character) {
- case SWT.CR :
- notifyListeners(SWT.DefaultSelection, new Event());
- return;
- }
- switch (event.keyCode) {
- case SWT.ARROW_UP :
- if (column < 0)
- column = 0;
- setRowColumn(row - 1, column, true);
- break;
- case SWT.ARROW_DOWN :
- if (column < 0)
- column = 0;
- setRowColumn(row + 1, column, true);
- break;
- case SWT.ARROW_LEFT :
- case SWT.ARROW_RIGHT :
- {
- if (column < 0)
- column = 0;
- int leadKey = (getStyle() & SWT.RIGHT_TO_LEFT) != 0 ? SWT.ARROW_RIGHT : SWT.ARROW_LEFT;
- if (event.keyCode == leadKey) {
- setRowColumn(row, column - 1, true);
- } else {
- setRowColumn(row, column + 1, true);
- }
- break;
- }
- case SWT.HOME :
- if (column < 0)
- column = 0;
- setRowColumn(0, column, true);
- break;
- case SWT.END :
- {
- if (column < 0)
- column = 0;
- int row = table.getItemCount() - 1;
- setRowColumn(row, column, true);
- break;
- }
- }
- }
-
- void paint(Event event) {
- GC gc = event.gc;
- Display display = getDisplay();
- gc.setBackground(display.getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT));
- gc.setForeground(display.getSystemColor(SWT.COLOR_LIST_SELECTION));
- gc.fillRectangle(event.x, event.y, event.width, event.height);
- TableItem item = null;
- if (row >= 0 && row<table.getItemCount())
- item = table.getItem(row);
- int x = 0, y = 0;
- Point size = getSize();
- if (item != null) {
- Image image = item.getImage(column);
- if (image != null) {
- Rectangle imageSize = image.getBounds();
- int imageY = y + (int) (((float)size.y - (float)imageSize.height) / 2.0);
- gc.drawImage(image, x, imageY);
- x += imageSize.width;
- }
- x += (column == 0) ? 2 : 6;
- int textY = y + (int) (((float)size.y - (float)gc.getFontMetrics().getHeight()) / 2.0);
- gc.drawString(item.getText(column), x, textY);
- }
-
- if (isFocusControl()) {
- gc.setBackground(display.getSystemColor(SWT.COLOR_BLACK));
- gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE));
- gc.drawFocus(0, 0, size.x, size.y);
- }
-
- }
-
- void tableFocusIn(Event event) {
- if (isDisposed())
- return;
- if (isVisible()) {
- setFocus();
- redraw();
- }
- }
-
- void tableMouseDown(Event event) {
- event.doit = true;
- if (isDisposed() || !isVisible())
- return;
- Point pt = new Point(event.x, event.y);
- Rectangle clientRect = table.getClientArea();
- int columns = table.getColumnCount();
- int start = table.getTopIndex();
- int end = table.getItemCount();
- for (int row = start; row < end; row++) {
- TableItem item = table.getItem(row);
- for (int column = 0; column < columns; column++) {
- Rectangle rect = item.getBounds(column);
- if (rect.y > clientRect.y + clientRect.height)
- return;
- if (rect.contains(pt)) {
- setRowColumn(row, column, true);
- //setFocus();
- return;
- }
- }
- }
- }
-
- void traverse(Event event) {
- switch (event.detail) {
- case SWT.TRAVERSE_ARROW_NEXT :
- case SWT.TRAVERSE_ARROW_PREVIOUS :
- case SWT.TRAVERSE_RETURN :
- event.doit = false;
- return;
- }
- event.doit = true;
- }
-
- void setRowColumn(int row, int column, boolean notify) {
- if (0 <= row && row < table.getItemCount()) {
- if (0 <= column && column < table.getColumnCount()) {
- this.row = row;
- this.column = column;
- TableItem item = table.getItem(row);
- table.showItem(item);
- setBounds(item.getBounds(column));
-// redraw();
- if (notify) {
- notifyListeners(SWT.Selection, new Event());
- }
- }
- }
- redraw();
- updateVisible();
- }
-
- @Override
- public void setVisible(boolean visible) {
- checkWidget();
- userVisible = visible;
- resize();
- }
-
- void resize() {
- if (row >= 0 && row < table.getItemCount()) {
- TableItem item = table.getItem(row);
- setBounds(item.getBounds(column));
- }
- updateVisible();
- }
-
- void updateVisible() {
- progVisible = false;
- if (0 <= row && row < table.getItemCount()) {
- if (0 <= column && column < table.getColumnCount()) {
- progVisible = true;
- }
- }
- super.setVisible(progVisible && userVisible);
- }
-
- public int getColumn() {
- checkWidget();
- return column;
- }
-
- public TableItem getRow() {
- checkWidget();
- if (row<0 || row>=table.getItemCount())
- return null;
- return table.getItem(row);
- }
-
- public void setSelection(int row, int column) {
- checkWidget();
- setRowColumn(row, column, false);
- }
-
- public void setSelection(TableItem row, int column) {
- checkWidget();
- setRowColumn(table.indexOf(row), column, false);
- }
-
- private void initAccessible() {
- final Accessible accessible = getAccessible();
- if (accessAdapter == null) {
- accessAdapter = new AccessibleAdapter() {
- @Override
- public void getName(AccessibleEvent e) {
- String name = null;
- TableItem item = null;
- TableColumn[] tableColumns = table.getColumns();
- TableColumn thisCol = null;
-
- if (row >= 0 && row < table.getItemCount() && column >= 0 && column < table.getColumnCount()) {
- item = table.getItem(row);
- if (column >= 0 && column < tableColumns.length) {
- thisCol = tableColumns[column];
- }
- }
- if (item != null) {
- if (thisCol != null)
- name = thisCol.getText();
- if (name != null && name.length() > 0)
- name = name + "=" + item.getText(column); //$NON-NLS-1$
- else
- name = item.getText(column);
- }
- e.result = name;
- }
-
- @Override
- public void getHelp(AccessibleEvent e) {
- String help = null;
- e.result = help;
- }
- @Override
- public void getKeyboardShortcut(AccessibleEvent e) {
- }
- };
-
- accessControlAdapter = new AccessibleControlAdapter() {
- @Override
- public void getChildAtPoint(AccessibleControlEvent e) {
- Point testPoint = toControl(new Point(e.x, e.y));
- int childID = ACC.CHILDID_NONE;
- if (childID == ACC.CHILDID_NONE) {
- Rectangle location = getBounds();
- location.height = location.height - getClientArea().height;
- if (location.contains(testPoint)) {
- childID = ACC.CHILDID_SELF;
- }
- }
- e.childID = childID;
- }
-
- @Override
- public void getLocation(AccessibleControlEvent e) {
- Rectangle location = null;
- int childID = e.childID;
- if (childID == ACC.CHILDID_SELF) {
- location = getBounds();
- }
- if (location != null) {
- Point pt = toDisplay(new Point(location.x, location.y));
- e.x = pt.x;
- e.y = pt.y;
- e.width = location.width;
- e.height = location.height;
- }
- }
-
- @Override
- public void getChildCount(AccessibleControlEvent e) {
- e.detail = 0;
- }
-
- @Override
- public void getDefaultAction(AccessibleControlEvent e) {
- String action = "Edit field";
- e.result = action;
- }
-
- @Override
- public void getFocus(AccessibleControlEvent e) {
- int childID = ACC.CHILDID_NONE;
- if (isFocusControl()) {
- childID = ACC.CHILDID_SELF;
- }
- e.childID = childID;
- }
-
- @Override
- public void getRole(AccessibleControlEvent e) {
- int role = 0;
- int childID = e.childID;
- if (childID == ACC.CHILDID_SELF)
- role = ACC.ROLE_LISTITEM;
- e.detail = role;
- }
-
- @Override
- public void getSelection(AccessibleControlEvent e) {
- e.childID = ACC.CHILDID_NONE;
- }
-
- @Override
- public void getState(AccessibleControlEvent e) {
- int state = 0;
- int childID = e.childID;
- if (childID == ACC.CHILDID_SELF) {
- state = ACC.STATE_SELECTABLE;
- if (isFocusControl()) {
- state |= ACC.STATE_FOCUSABLE;
- if (TableCursor.this.hasFocus) {
- state += ACC.STATE_FOCUSED | ACC.STATE_SELECTED;
- }
- }
- }
- e.detail = state;
- }
-
- @Override
- public void getChildren(AccessibleControlEvent e) {
- e.children = null;
- }
- };
-
- selectionAccessListener = new Listener() {
- public void handleEvent(Event event) {
- accessible.setFocus(ACC.CHILDID_SELF);
- }
- };
-
- focusAccessListener = new Listener() {
- public void handleEvent(Event event) {
- accessible.setFocus(ACC.CHILDID_SELF);
- }
- };
- }
-
- if (hasAccessibility) {
- accessible.removeAccessibleListener(accessAdapter);
- accessible.removeAccessibleControlListener(accessControlAdapter);
- removeListener(SWT.Selection, selectionAccessListener);
- removeListener(SWT.FocusIn, focusAccessListener);
- hasAccessibility = false;
- }
- if (hasAccessibility == false) {
- accessible.addAccessibleListener(accessAdapter);
- accessible.addAccessibleControlListener(accessControlAdapter);
- addListener(SWT.Selection, selectionAccessListener);
- addListener(SWT.FocusIn, focusAccessListener);
- hasAccessibility = true;
- }
- }
-}
-
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Bob Brodt
+ ******************************************************************************/
+package org.eclipse.bpmn2.modeler.core.merrimac.providers;
+
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.accessibility.ACC;
+import org.eclipse.swt.accessibility.Accessible;
+import org.eclipse.swt.accessibility.AccessibleAdapter;
+import org.eclipse.swt.accessibility.AccessibleControlAdapter;
+import org.eclipse.swt.accessibility.AccessibleControlEvent;
+import org.eclipse.swt.accessibility.AccessibleEvent;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
+import org.eclipse.swt.events.KeyAdapter;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.GC;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.graphics.Rectangle;
+import org.eclipse.swt.widgets.Canvas;
+import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.ScrollBar;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.TableColumn;
+import org.eclipse.swt.widgets.TableItem;
+import org.eclipse.swt.widgets.TypedListener;
+
+
+/**
+ * A modification of the SWT TableCursor class to better handle empty tables and dynamic tables
+ */
+public class TableCursor extends Canvas {
+
+ Table table;
+ int row = -1, column = 0; // having row negative will end up hiding the cursor
+ Listener tableListener, resizeListener;
+ boolean progVisible = false;
+ boolean userVisible = true;
+ boolean hasFocus = false;
+ AccessibleAdapter accessAdapter = null;
+ Listener selectionAccessListener = null;
+ Listener focusAccessListener = null;
+ AccessibleControlAdapter accessControlAdapter = null;
+ boolean hasAccessibility = false;
+
+ public TableCursor(Table parent, int style) {
+ super(parent, style);
+ table = parent;
+ Listener listener = new Listener() {
+ public void handleEvent(Event event) {
+ switch (event.type) {
+ case SWT.Dispose :
+ dispose(event);
+ break;
+ case SWT.KeyDown :
+ keyDown(event);
+ break;
+ case SWT.Paint :
+ paint(event);
+ break;
+ case SWT.Traverse :
+ traverse(event);
+ break;
+ }
+ }
+ };
+ addListener(SWT.Dispose, listener);
+ addListener(SWT.KeyDown, listener);
+ addListener(SWT.Paint, listener);
+ addListener(SWT.Traverse, listener);
+
+ tableListener = new Listener() {
+ public void handleEvent(Event event) {
+ switch (event.type) {
+ case SWT.MouseDown :
+ tableMouseDown(event);
+ break;
+ case SWT.FocusIn :
+ tableFocusIn(event);
+ break;
+ }
+ }
+ };
+ table.addListener(SWT.FocusIn, tableListener);
+ table.addListener(SWT.MouseDown, tableListener);
+
+ resizeListener = new Listener() {
+ public void handleEvent(Event event) {
+ resize();
+ }
+ };
+
+ ScrollBar hBar = table.getHorizontalBar();
+ if (hBar != null)
+ hBar.addListener(SWT.Selection, resizeListener);
+
+ ScrollBar vBar = table.getVerticalBar();
+ if (vBar != null)
+ vBar.addListener(SWT.Selection, resizeListener);
+
+ this.addFocusListener(new FocusListener() {
+ public void focusGained(FocusEvent e) {
+ hasFocus = true;
+ redraw();
+ }
+
+ public void focusLost(FocusEvent e) {
+ hasFocus = false;
+ redraw();
+
+ }});
+
+ refresh();
+
+ initAccessible();
+ }
+
+ /**
+ * Creates a table cursor that can businessObject used to navigate tables for keyboard accessibility
+ * @param table
+ * @param tableViewer
+ * @return
+ */
+ public static TableCursor create(final Table table, final TableViewer tableViewer) {
+ // create a TableCursor to navigate around the table
+ final TableCursor cursor = new TableCursor(table, SWT.NONE);
+ cursor.addSelectionListener(new SelectionAdapter() {
+ // when the TableEditor is over a cell, select the corresponding row in the table
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (cursor.getRow() != null)
+ table.setSelection(new TableItem[] {cursor.getRow()});
+ }
+ // when the user hits "ENTER" in the TableCursor, pop up an editor
+ @Override
+ public void widgetDefaultSelected(SelectionEvent e) {
+ TableItem row = cursor.getRow();
+ if (row != null) {
+ int nRow = table.indexOf(row);
+ int column = cursor.getColumn();
+ Object obj = tableViewer.getElementAt(nRow);
+ tableViewer.editElement(obj, column);
+ }
+ }
+ });
+
+ // Hide the TableCursor when the user hits the "CTRL" or "SHIFT" key.
+ // This alows the user to select multiple items in the table.
+ cursor.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyPressed(KeyEvent e) {
+ if ((e.keyCode == SWT.CTRL) || (e.keyCode == SWT.SHIFT) ||
+ (e.stateMask & SWT.CONTROL) != 0 || (e.stateMask & SWT.SHIFT) != 0) {
+ cursor.setVisible(false);
+ }
+ }
+ });
+
+ cursor.addMouseListener(new MouseListener() {
+ public void mouseDoubleClick(MouseEvent e) { }
+ public void mouseDown(MouseEvent e) {
+ TableItem row = cursor.getRow();
+ if (row != null) {
+ int nRow = table.indexOf(row);
+ int column = cursor.getColumn();
+ Object obj = tableViewer.getElementAt(nRow);
+ tableViewer.editElement(obj, column);
+ }
+ }
+ public void mouseUp(MouseEvent e) {
+ }
+ });
+
+ // Show the TableCursor when the user releases the "SHIFT" or "CTRL" key.
+ // This signals the end of the multiple selection modelObject.
+ table.addKeyListener(new KeyAdapter() {
+ @Override
+ public void keyReleased(KeyEvent e) {
+ if (e.keyCode == SWT.CONTROL && (e.stateMask & SWT.SHIFT) != 0)
+ return;
+ if (e.keyCode == SWT.SHIFT && (e.stateMask & SWT.CONTROL) != 0)
+ return;
+ if (e.keyCode != SWT.CONTROL && (e.stateMask & SWT.CONTROL) != 0)
+ return;
+ if (e.keyCode != SWT.SHIFT && (e.stateMask & SWT.SHIFT) != 0)
+ return;
+
+ if (table.getItemCount() == 0)
+ return;
+ TableItem[] selection = table.getSelection();
+ TableItem row = (selection.length == 0) ? table.getItem(table.getTopIndex()) : selection[0];
+ table.showItem(row);
+ cursor.setSelection(row, 0);
+ cursor.setVisible(true);
+ cursor.setFocus();
+ }
+ });
+ return cursor;
+ }
+
+ /**
+ * this is called whenever the content of the table has changed, it
+ * will reconcile the cursor and any listeners that we need
+ */
+
+ public void refresh() {
+ // the number of rows and columns could have changed, ideally we should track
+ // which columns have listeners but for the now, we'll just remove and readd
+ int columns = table.getColumnCount();
+ for (int i = 0; i < columns; i++) {
+ TableColumn column = table.getColumn(i);
+ column.removeListener(SWT.Resize, resizeListener);
+ }
+ for (int i = 0; i < columns; i++) {
+ TableColumn column = table.getColumn(i);
+ column.addListener(SWT.Resize, resizeListener);
+ }
+
+ // reset the row and column to businessObject a valid one
+ //boolean repaint = false;
+ if (row >= table.getItemCount()) {
+ row = table.getItemCount()-1;
+ }
+ if (column >= columns) {
+ column = columns - 1;
+ }
+
+ // check to see what the selection is, and reset the tablecursor to
+ // a valid row/column in that selection
+
+ TableItem[] selection = table.getSelection();
+ if (selection.length == 0) {
+ row = -1;
+ }
+ else {
+// // there is a selection, so make sure our table cursor is in that selection
+// // range
+// int min = 999999;
+// int max = -1;
+// for (int i = 0; i < selection.length; i++) {
+// int temp = table.indexOf(selection[i]);
+// min = Math.min(temp, min);
+// max = Math.max(temp, max);
+// }
+// if (row > max || row < min)
+// row = min;
+ }
+ setSelection(row, column);
+ }
+
+ public void addSelectionListener(SelectionListener listener) {
+ checkWidget();
+ if (listener == null)
+ SWT.error(SWT.ERROR_NULL_ARGUMENT);
+ TypedListener typedListener = new TypedListener(listener);
+ addListener(SWT.Selection, typedListener);
+ addListener(SWT.DefaultSelection, typedListener);
+ }
+
+ void dispose(Event event) {
+ Display display = getDisplay();
+ display.asyncExec(new Runnable() {
+ public void run() {
+ if (table.isDisposed())
+ return;
+ table.removeListener(SWT.FocusIn, tableListener);
+ table.removeListener(SWT.MouseDown, tableListener);
+ int columns = table.getColumnCount();
+ for (int i = 0; i < columns; i++) {
+ TableColumn column = table.getColumn(i);
+ column.removeListener(SWT.Resize, resizeListener);
+ }
+ ScrollBar hBar = table.getHorizontalBar();
+ if (hBar != null) {
+ hBar.removeListener(SWT.Selection, resizeListener);
+ }
+ ScrollBar vBar = table.getVerticalBar();
+ if (vBar != null) {
+ vBar.removeListener(SWT.Selection, resizeListener);
+ }
+ }
+ });
+ }
+
+ void keyDown(Event event) {
+ switch (event.character) {
+ case SWT.CR :
+ notifyListeners(SWT.DefaultSelection, new Event());
+ return;
+ }
+ switch (event.keyCode) {
+ case SWT.ARROW_UP :
+ if (column < 0)
+ column = 0;
+ setRowColumn(row - 1, column, true);
+ break;
+ case SWT.ARROW_DOWN :
+ if (column < 0)
+ column = 0;
+ setRowColumn(row + 1, column, true);
+ break;
+ case SWT.ARROW_LEFT :
+ case SWT.ARROW_RIGHT :
+ {
+ if (column < 0)
+ column = 0;
+ int leadKey = (getStyle() & SWT.RIGHT_TO_LEFT) != 0 ? SWT.ARROW_RIGHT : SWT.ARROW_LEFT;
+ if (event.keyCode == leadKey) {
+ setRowColumn(row, column - 1, true);
+ } else {
+ setRowColumn(row, column + 1, true);
+ }
+ break;
+ }
+ case SWT.HOME :
+ if (column < 0)
+ column = 0;
+ setRowColumn(0, column, true);
+ break;
+ case SWT.END :
+ {
+ if (column < 0)
+ column = 0;
+ int row = table.getItemCount() - 1;
+ setRowColumn(row, column, true);
+ break;
+ }
+ }
+ }
+
+ void paint(Event event) {
+ GC gc = event.gc;
+ Display display = getDisplay();
+ gc.setBackground(display.getSystemColor(SWT.COLOR_LIST_SELECTION_TEXT));
+ gc.setForeground(display.getSystemColor(SWT.COLOR_LIST_SELECTION));
+ gc.fillRectangle(event.x, event.y, event.width, event.height);
+ TableItem item = null;
+ if (row >= 0 && row<table.getItemCount())
+ item = table.getItem(row);
+ int x = 0, y = 0;
+ Point size = getSize();
+ if (item != null) {
+ Image image = item.getImage(column);
+ if (image != null) {
+ Rectangle imageSize = image.getBounds();
+ int imageY = y + (int) (((float)size.y - (float)imageSize.height) / 2.0);
+ gc.drawImage(image, x, imageY);
+ x += imageSize.width;
+ }
+ x += (column == 0) ? 2 : 6;
+ int textY = y + (int) (((float)size.y - (float)gc.getFontMetrics().getHeight()) / 2.0);
+ gc.drawString(item.getText(column), x, textY);
+ }
+
+ if (isFocusControl()) {
+ gc.setBackground(display.getSystemColor(SWT.COLOR_BLACK));
+ gc.setForeground(display.getSystemColor(SWT.COLOR_WHITE));
+ gc.drawFocus(0, 0, size.x, size.y);
+ }
+
+ }
+
+ void tableFocusIn(Event event) {
+ if (isDisposed())
+ return;
+ if (isVisible()) {
+ setFocus();
+ redraw();
+ }
+ }
+
+ void tableMouseDown(Event event) {
+ event.doit = true;
+ if (isDisposed() || !isVisible())
+ return;
+ Point pt = new Point(event.x, event.y);
+ Rectangle clientRect = table.getClientArea();
+ int columns = table.getColumnCount();
+ int start = table.getTopIndex();
+ int end = table.getItemCount();
+ for (int row = start; row < end; row++) {
+ TableItem item = table.getItem(row);
+ for (int column = 0; column < columns; column++) {
+ Rectangle rect = item.getBounds(column);
+ if (rect.y > clientRect.y + clientRect.height)
+ return;
+ if (rect.contains(pt)) {
+ setRowColumn(row, column, true);
+ //setFocus();
+ return;
+ }
+ }
+ }
+ }
+
+ void traverse(Event event) {
+ switch (event.detail) {
+ case SWT.TRAVERSE_ARROW_NEXT :
+ case SWT.TRAVERSE_ARROW_PREVIOUS :
+ case SWT.TRAVERSE_RETURN :
+ event.doit = false;
+ return;
+ }
+ event.doit = true;
+ }
+
+ void setRowColumn(int row, int column, boolean notify) {
+ if (0 <= row && row < table.getItemCount()) {
+ if (0 <= column && column < table.getColumnCount()) {
+ this.row = row;
+ this.column = column;
+ TableItem item = table.getItem(row);
+ table.showItem(item);
+ setBounds(item.getBounds(column));
+// redraw();
+ if (notify) {
+ notifyListeners(SWT.Selection, new Event());
+ }
+ }
+ }
+ redraw();
+ updateVisible();
+ }
+
+ @Override
+ public void setVisible(boolean visible) {
+ checkWidget();
+ userVisible = visible;
+ resize();
+ }
+
+ void resize() {
+ if (row >= 0 && row < table.getItemCount()) {
+ TableItem item = table.getItem(row);
+ setBounds(item.getBounds(column));
+ }
+ updateVisible();
+ }
+
+ void updateVisible() {
+ progVisible = false;
+ if (0 <= row && row < table.getItemCount()) {
+ if (0 <= column && column < table.getColumnCount()) {
+ progVisible = true;
+ }
+ }
+ super.setVisible(progVisible && userVisible);
+ }
+
+ public int getColumn() {
+ checkWidget();
+ return column;
+ }
+
+ public TableItem getRow() {
+ checkWidget();
+ if (row<0 || row>=table.getItemCount())
+ return null;
+ return table.getItem(row);
+ }
+
+ public void setSelection(int row, int column) {
+ checkWidget();
+ setRowColumn(row, column, false);
+ }
+
+ public void setSelection(TableItem row, int column) {
+ checkWidget();
+ setRowColumn(table.indexOf(row), column, false);
+ }
+
+ private void initAccessible() {
+ final Accessible accessible = getAccessible();
+ if (accessAdapter == null) {
+ accessAdapter = new AccessibleAdapter() {
+ @Override
+ public void getName(AccessibleEvent e) {
+ String name = null;
+ TableItem item = null;
+ TableColumn[] tableColumns = table.getColumns();
+ TableColumn thisCol = null;
+
+ if (row >= 0 && row < table.getItemCount() && column >= 0 && column < table.getColumnCount()) {
+ item = table.getItem(row);
+ if (column >= 0 && column < tableColumns.length) {
+ thisCol = tableColumns[column];
+ }
+ }
+ if (item != null) {
+ if (thisCol != null)
+ name = thisCol.getText();
+ if (name != null && name.length() > 0)
+ name = name + "=" + item.getText(column); //$NON-NLS-1$
+ else
+ name = item.getText(column);
+ }
+ e.result = name;
+ }
+
+ @Override
+ public void getHelp(AccessibleEvent e) {
+ String help = null;
+ e.result = help;
+ }
+ @Override
+ public void getKeyboardShortcut(AccessibleEvent e) {
+ }
+ };
+
+ accessControlAdapter = new AccessibleControlAdapter() {
+ @Override
+ public void getChildAtPoint(AccessibleControlEvent e) {
+ Point testPoint = toControl(new Point(e.x, e.y));
+ int childID = ACC.CHILDID_NONE;
+ if (childID == ACC.CHILDID_NONE) {
+ Rectangle location = getBounds();
+ location.height = location.height - getClientArea().height;
+ if (location.contains(testPoint)) {
+ childID = ACC.CHILDID_SELF;
+ }
+ }
+ e.childID = childID;
+ }
+
+ @Override
+ public void getLocation(AccessibleControlEvent e) {
+ Rectangle location = null;
+ int childID = e.childID;
+ if (childID == ACC.CHILDID_SELF) {
+ location = getBounds();
+ }
+ if (location != null) {
+ Point pt = toDisplay(new Point(location.x, location.y));
+ e.x = pt.x;
+ e.y = pt.y;
+ e.width = location.width;
+ e.height = location.height;
+ }
+ }
+
+ @Override
+ public void getChildCount(AccessibleControlEvent e) {
+ e.detail = 0;
+ }
+
+ @Override
+ public void getDefaultAction(AccessibleControlEvent e) {
+ String action = "Edit field";
+ e.result = action;
+ }
+
+ @Override
+ public void getFocus(AccessibleControlEvent e) {
+ int childID = ACC.CHILDID_NONE;
+ if (isFocusControl()) {
+ childID = ACC.CHILDID_SELF;
+ }
+ e.childID = childID;
+ }
+
+ @Override
+ public void getRole(AccessibleControlEvent e) {
+ int role = 0;
+ int childID = e.childID;
+ if (childID == ACC.CHILDID_SELF)
+ role = ACC.ROLE_LISTITEM;
+ e.detail = role;
+ }
+
+ @Override
+ public void getSelection(AccessibleControlEvent e) {
+ e.childID = ACC.CHILDID_NONE;
+ }
+
+ @Override
+ public void getState(AccessibleControlEvent e) {
+ int state = 0;
+ int childID = e.childID;
+ if (childID == ACC.CHILDID_SELF) {
+ state = ACC.STATE_SELECTABLE;
+ if (isFocusControl()) {
+ state |= ACC.STATE_FOCUSABLE;
+ if (TableCursor.this.hasFocus) {
+ state += ACC.STATE_FOCUSED | ACC.STATE_SELECTED;
+ }
+ }
+ }
+ e.detail = state;
+ }
+
+ @Override
+ public void getChildren(AccessibleControlEvent e) {
+ e.children = null;
+ }
+ };
+
+ selectionAccessListener = new Listener() {
+ public void handleEvent(Event event) {
+ accessible.setFocus(ACC.CHILDID_SELF);
+ }
+ };
+
+ focusAccessListener = new Listener() {
+ public void handleEvent(Event event) {
+ accessible.setFocus(ACC.CHILDID_SELF);
+ }
+ };
+ }
+
+ if (hasAccessibility) {
+ accessible.removeAccessibleListener(accessAdapter);
+ accessible.removeAccessibleControlListener(accessControlAdapter);
+ removeListener(SWT.Selection, selectionAccessListener);
+ removeListener(SWT.FocusIn, focusAccessListener);
+ hasAccessibility = false;
+ }
+ if (hasAccessibility == false) {
+ accessible.addAccessibleListener(accessAdapter);
+ accessible.addAccessibleControlListener(accessControlAdapter);
+ addListener(SWT.Selection, selectionAccessListener);
+ addListener(SWT.FocusIn, focusAccessListener);
+ hasAccessibility = true;
+ }
+ }
+}
+
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/providers/TableProvider.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/providers/TableProvider.java
index a328962..5e688fb 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/providers/TableProvider.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/providers/TableProvider.java
@@ -33,7 +33,7 @@
* Grouping related behaviours by column type (instead of grouping them by the
* behaviour type) will hopefully make maintenance of table code easier.
*
- * IMPORTANT: The dispose() method of each registered label provider will be called
+ * IMPORTANT: The dispose() method of each registered label provider will businessObject called
* when the TableProvider is disposed. If this is undesirable, clients can avoid it by
* unregistering the property before the TableProvider is disposed.
*/
@@ -55,7 +55,7 @@
}
/**
- * This method should be called with the properties being used for each column of
+ * This method should businessObject called with the properties being used for each column of
* the Table. If a TableViewer is used, these are the same values passed to the
* TableViewer's setColumnProperties() method. However, you must still call both
* methods because TableProvider doesn't know about the table viewer.
@@ -75,7 +75,7 @@
}
/**
- * Returns a particular column's property. For some subclasses, this may be more
+ * Returns a particular column's property. For some subclasses, this may businessObject more
* efficient than using getColumnProperties().
*/
public String getColumnProperty(int index) {
@@ -102,8 +102,8 @@
* Unregister the old label provider and cell modifier for the given property.
*
* @param property property to register.
- * @param lp label provider to use for the property. Must be an ILabelProvider or IBaseLabelProvider.
- * @param cm ICellModifier to use for the property. May be null.
+ * @param lp label provider to use for the property. Must businessObject an ILabelProvider or IBaseLabelProvider.
+ * @param cm ICellModifier to use for the property. May businessObject null.
*/
public void register(String property, IBaseLabelProvider lp, ICellModifier cm) {
unregister(property);
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/model/Bpmn2ModelerResourceImpl.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/model/Bpmn2ModelerResourceImpl.java
index ef18eb8..f94e0af 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/model/Bpmn2ModelerResourceImpl.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/model/Bpmn2ModelerResourceImpl.java
@@ -116,7 +116,7 @@
// this.getDefaultLoadOptions().put(XMLResource.OPTION_ANY_TYPE, BpmnDiPackage.eINSTANCE.getBPMNPlane());
this.getDefaultLoadOptions().put(XMLResource.OPTION_USE_XML_NAME_TO_FEATURE_MAP, xmlNameToFeatureMap);
- // only necessary if this resource will not be added to a ResourceSet instantly
+ // only necessary if this resource will not businessObject added to a ResourceSet instantly
this.eAdapters().add(oppositeReferenceAdapter);
}
@@ -169,7 +169,7 @@
* Set the ID attribute of cur to a generated ID, if it is not already set.
*
* @param obj
- * The object whose ID should be set.
+ * The object whose ID should businessObject set.
*/
private void setDefaultId(EObject obj) {
if (obj.eClass() != null) {
@@ -182,7 +182,7 @@
/**
* We need extend the standard SAXXMLHandler to hook into the handling of
- * attribute references which may be either simple ID Strings or QNames.
+ * attribute references which may businessObject either simple ID Strings or QNames.
* We'll search through all of the objects' IDs first to find the one we're
* looking for. If not, we'll try a QName search.
*/
@@ -229,8 +229,8 @@
}
/**
- * Overridden to be able to convert ID references in attributes to URIs
- * during load. If the reference can't be found by its ID, we'll try a
+ * Overridden to businessObject able to convert ID references in attributes to URIs
+ * during load. If the reference can't businessObject found by its ID, we'll try a
* QName search (done in the super class)
*
* @param ids
@@ -308,7 +308,7 @@
return true;
}
- // we also want to store x and y with value zero, would be skipped because of default value otherwise
+ // we also want to store x and y with value zero, would businessObject skipped because of default value otherwise
if (o instanceof Bounds) {
return true;
}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/model/Bpmn2ModelerResourceSetImpl.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/model/Bpmn2ModelerResourceSetImpl.java
index 7af0d90..71c9d34 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/model/Bpmn2ModelerResourceSetImpl.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/model/Bpmn2ModelerResourceSetImpl.java
@@ -1,383 +1,383 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation and others.
- * 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.bpmn2.modeler.core.model;
-
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.bpmn2.modeler.core.preferences.Bpmn2Preferences;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IResourceChangeEvent;
-import org.eclipse.core.resources.IResourceChangeListener;
-import org.eclipse.core.resources.IResourceDelta;
-import org.eclipse.core.runtime.content.IContentDescription;
-import org.eclipse.core.runtime.content.IContentType;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.URIConverter;
-import org.eclipse.emf.ecore.resource.impl.ResourceFactoryRegistryImpl;
-import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
-
-
-/**
- * @author Michal Chmielewski (michal.chmielewski@oracle.com)
- * @date Apr 17, 2007
- *
- */
-
-
-@SuppressWarnings("nls")
-
-public class Bpmn2ModelerResourceSetImpl extends ResourceSetImpl implements IResourceChangeListener {
- // this ID identifies the BPMN file content type
- public static final String BPMN2_CONTENT_TYPE = "org.eclipse.bpmn2.content-type.xml"; //$NON-NLS-1$
-
- private String connectionTimeout;
- private String readTimeout;
-
- public Bpmn2ModelerResourceSetImpl() {
- super();
- }
-
- /**
- * Used to force loading using the right resource loaders.
- */
- static public final String SLIGHTLY_HACKED_KEY = "slightly.hacked.resource.set";
-
- /* (non-Javadoc)
- *
- * Intercept getEObject() calls and validate the URI.
- * This allows us to use arbitrary proxy URIs for things like ItemDefinition.structureRef
- *
- * Also handle the setting of connection timeout here for URIs that do not point to physical
- * resources, or resources that are currently unavailable due to (e.g. possibly) server outages.
- *
- * @see org.eclipse.emf.ecore.resource.impl.ResourceSetImpl#getEObject(org.eclipse.emf.common.util.URI, boolean)
- */
- @Override
- public EObject getEObject(URI uri, boolean loadOnDemand) {
- EObject o = null;
- if (uri!=null) {
- uri.trimFragment();
- if (uri.fragment()!=null) {
- setDefaultTimeoutProperties();
- o = super.getEObject(uri, loadOnDemand);
- restoreTimeoutProperties();
- }
- }
- return o;
- }
-
- private void saveTimeoutProperties() {
- if (connectionTimeout==null) {
- connectionTimeout = System.getProperty("sun.net.client.defaultConnectTimeout");
- if (connectionTimeout==null)
- connectionTimeout = "";
- }
- if (readTimeout==null) {
- readTimeout = System.getProperty("sun.net.client.defaultReadTimeout");
- if (readTimeout==null)
- readTimeout = "";
- }
- }
-
- private void restoreTimeoutProperties() {
- if(connectionTimeout!=null) {
- System.setProperty("sun.net.client.defaultConnectTimeout", connectionTimeout);
- connectionTimeout = null;
- }
- if (readTimeout!=null) {
- System.setProperty("sun.net.client.defaultReadTimeout", readTimeout);
- readTimeout = null;
- }
- }
-
- private void setDefaultTimeoutProperties() {
- saveTimeoutProperties();
- String timeout = Bpmn2Preferences.getInstance().getConnectionTimeout();
- System.setProperty("sun.net.client.defaultConnectTimeout", timeout);
- System.setProperty("sun.net.client.defaultReadTimeout", timeout);
- }
-
- /**
- * Load the resource from the resource set, assuming that it is the kind
- * indicated by the last argument. The "kind" parameter is the extension
- * without the . of the resource.
- *
- * This forces the right resource to be loaded even if the URI of the resource
- * is "wrong".
- *
- * @param uri the URI of the resource.
- * @param loadOnDemand load on demand
- * @param kind the resource kind. It has to be of the form "*.wsdl", or "*.xsd", or "*.bpmn"
- * @return the loaded resource.
- */
-
- @SuppressWarnings("nls")
- public Resource getResource(URI uri, boolean loadOnDemand, String kind) {
-
- // Bugzilla 324164
- // don't bother if URI is null or empty
- if (uri==null || uri.isEmpty())
- return null;
- Map<URI, Resource> map = getURIResourceMap();
-
- if (map != null) {
- Resource resource = map.get(uri);
- if (resource != null) {
- if (loadOnDemand && !resource.isLoaded()) {
- // Bugzilla 324164
- // if load fails, mark resource as unloaded
- try {
- demandLoadHelper(resource);
- } catch (Exception ex) {
- resource.unload();
- }
- }
-
- return resource;
- }
- }
-
- URIConverter theURIConverter = getURIConverter();
- URI normalizedURI = theURIConverter.normalize(uri);
-
- for (Resource resource : getResources()) {
- if (theURIConverter.normalize(resource.getURI()).equals(
- normalizedURI)) {
- if (loadOnDemand && !resource.isLoaded()) {
- // Bugzilla 324164
- // if load fails, mark resource as unloaded
- try {
- demandLoadHelper(resource);
- } catch (Exception ex) {
- resource.unload();
- break;
- }
- }
-
- if (map != null) {
- map.put(uri, resource);
- }
- return resource;
- }
- }
-
- if (loadOnDemand) {
- Resource resource = demandCreateResource(uri,kind);
- if (resource == null) {
- throw new RuntimeException("Cannot create a resource for '"
- + uri + "'; a registered resource factory is needed");
- }
-
- demandLoadHelper(resource);
-
- if (map != null) {
- map.put(uri, resource);
- }
- return resource;
- }
-
- return null;
- }
-
-
- protected Resource demandCreateResource ( URI uri, String kind ) {
- return createResource ( uri, kind );
- }
-
- /*
- * Fix for Bug 278205 - Problem with importing remote WSIL/WSDL still exists.
- * Telesh Alexandr added this method to solve this which is to load remote WSIL/WSDL
- * by the correct resource loader based on known before loading resouce
- * extension which is posed as resource content type.
- */
- public Resource.Factory.Registry getResourceFactoryRegistry() {
- if (resourceFactoryRegistry == null) {
-
- resourceFactoryRegistry = new ResourceFactoryRegistryImpl() {
- @Override
- protected Resource.Factory delegatedGetFactory(URI uri, String contentTypeIdentifier) {
- // patch for "wsil" and "wsdl" resources without extensions
- final Map<String, Object> extensionToFactoryMap =
- Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap();
-
- final Object wsilFactory = extensionToFactoryMap.get("wsil");
- final Object wsdlFactory = extensionToFactoryMap.get("wsdl");
-
- final Map<String, Object> contentTypeToFactoryMap =
- Resource.Factory.Registry.INSTANCE.getContentTypeToFactoryMap();
-
- if (null != wsilFactory) {
- contentTypeToFactoryMap.put("wsil", wsilFactory);
- }
- if (null != wsdlFactory) {
- contentTypeToFactoryMap.put("wsdl", wsdlFactory);
- }
-
- return convert(getFactory(uri,
- Resource.Factory.Registry.INSTANCE.getProtocolToFactoryMap(),
- extensionToFactoryMap, contentTypeToFactoryMap,
- contentTypeIdentifier, false));
- }
-
- @Override
- protected URIConverter getURIConverter() {
- // return ResourceSetImpl.this.getURIConverter();
- return Bpmn2ModelerResourceSetImpl.this.getURIConverter();
- }
-
- @Override
- protected Map<?, ?> getContentDescriptionOptions() {
- return getLoadOptions();
- }
- };
- }
- return resourceFactoryRegistry;
- }
-
- /**
- * Create the resource based on the kind.
- * @param uri
- * @param kind
- * @return the created resource
- */
-
- // TODO: ganymede [ this method apparently is already in the parent resource set ]
- // we can strike it from this resourceset.
-
-// @SuppressWarnings("nls")
-// public Resource createResource ( URI uri, String kind) {
-//
-// if (kind == null) {
-// return super.createResource(uri);
-// }
-//
-// Resource resource = createResource(URI.createURI("*." + kind));
-// resource.setURI(uri);
-// return resource;
-// }
-
-
-
-
-
-
- /**
- * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
- */
- public void resourceChanged (IResourceChangeEvent event) {
-
- // System.out.println("IResourceChangeEvent: " + event + "; " + event.getType() );
- IResourceDelta[] deltas = event.getDelta().getAffectedChildren( IResourceDelta.CHANGED | IResourceDelta.REMOVED, IResource.FILE );
- processDeltas ( deltas );
- }
-
- void processDeltas ( IResourceDelta [] deltas ) {
-
- for(IResourceDelta delta : deltas) {
- processDeltas( delta.getAffectedChildren(IResourceDelta.CHANGED | IResourceDelta.REMOVED, IResource.FILE) );
-
- IResource resource = delta.getResource();
- if (resource.getType () != IResource.FILE) {
- continue;
- }
-
- if (delta.getKind() == IResourceDelta.REMOVED){
- resourceChanged((IFile)resource);
- continue;
- }
-
-// * @see IResourceDelta#CONTENT
-// * @see IResourceDelta#DESCRIPTION
-// * @see IResourceDelta#ENCODING
-// * @see IResourceDelta#OPEN
-// * @see IResourceDelta#MOVED_TO
-// * @see IResourceDelta#MOVED_FROM
-// * @see IResourceDelta#TYPE
-// * @see IResourceDelta#SYNC
-// * @see IResourceDelta#MARKERS
-// * @see IResourceDelta#REPLACED
-
- if ((delta.getFlags() & IResourceDelta.CONTENT) == 0){
- continue;
- }
-
- // TODO: Temporary hack
- // Actually we should remove all resources from the resourceSet,
- // but for some reasons bpmn files can't be removed now
- // Bugzilla 320545:
- if (isBPMN2File(resource)){
- continue;
- }
-
- resourceChanged((IFile) resource);
- }
- }
-
- public void setLoadOptions (Map<Object, Object> options) {
- loadOptions = options;
- }
-
- /**
- * Resource has changed, remove it from the cache or list of loaded resources.
- *
- * @param file
- */
- public void resourceChanged (IFile file) {
- // System.out.println("ResourceChanged: " + file );
- URI uri = URI.createPlatformResourceURI( file.getFullPath().toString() ) ;
- // System.out.println(" ResourceURI: " + uri );
- URIConverter theURIConverter = getURIConverter();
- URI normalizedURI = theURIConverter.normalize(uri);
-
- if (uriResourceMap != null) {
- uriResourceMap.remove(uri);
- uriResourceMap.remove(normalizedURI);
- // System.out.println("Removed from Map: " + map );
- }
-
- List<Resource> resourceList = getResources();
- if (resources.size() < 1) {
- return ;
- }
-
- for(Resource r : new ArrayList<Resource>(resourceList) ) {
- if (uri.equals(r.getURI()) || normalizedURI.equals(r.getURI() )) {
- resources.remove(r);
- // System.out.println("Removed from List: " + r );
- }
- }
- }
-
- // Bugzilla 320545:
- public static boolean isBPMN2File(IResource res)
- {
- try
- {
- if (res.getType() == IResource.FILE) {
- IContentDescription desc = ((IFile) res).getContentDescription();
- if (desc != null) {
- IContentType type = desc.getContentType();
- if (type.getId().equals(BPMN2_CONTENT_TYPE))
- return true;
- }
- }
- }
- catch(Exception ex)
- {
- }
- return false;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2006 Oracle Corporation and others.
+ * 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:
+ * Oracle Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpmn2.modeler.core.model;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.bpmn2.modeler.core.preferences.Bpmn2Preferences;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IResourceChangeEvent;
+import org.eclipse.core.resources.IResourceChangeListener;
+import org.eclipse.core.resources.IResourceDelta;
+import org.eclipse.core.runtime.content.IContentDescription;
+import org.eclipse.core.runtime.content.IContentType;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.URIConverter;
+import org.eclipse.emf.ecore.resource.impl.ResourceFactoryRegistryImpl;
+import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
+
+
+/**
+ * @author Michal Chmielewski (michal.chmielewski@oracle.com)
+ * @date Apr 17, 2007
+ *
+ */
+
+
+@SuppressWarnings("nls")
+
+public class Bpmn2ModelerResourceSetImpl extends ResourceSetImpl implements IResourceChangeListener {
+ // this ID identifies the BPMN file content type
+ public static final String BPMN2_CONTENT_TYPE = "org.eclipse.bpmn2.content-type.xml"; //$NON-NLS-1$
+
+ private String connectionTimeout;
+ private String readTimeout;
+
+ public Bpmn2ModelerResourceSetImpl() {
+ super();
+ }
+
+ /**
+ * Used to force loading using the right resource loaders.
+ */
+ static public final String SLIGHTLY_HACKED_KEY = "slightly.hacked.resource.set";
+
+ /* (non-Javadoc)
+ *
+ * Intercept getEObject() calls and validate the URI.
+ * This allows us to use arbitrary proxy URIs for things like ItemDefinition.structureRef
+ *
+ * Also handle the setting of connection timeout here for URIs that do not point to physical
+ * resources, or resources that are currently unavailable due to (e.g. possibly) server outages.
+ *
+ * @see org.eclipse.emf.ecore.resource.impl.ResourceSetImpl#getEObject(org.eclipse.emf.common.util.URI, boolean)
+ */
+ @Override
+ public EObject getEObject(URI uri, boolean loadOnDemand) {
+ EObject o = null;
+ if (uri!=null) {
+ uri.trimFragment();
+ if (uri.fragment()!=null) {
+ setDefaultTimeoutProperties();
+ o = super.getEObject(uri, loadOnDemand);
+ restoreTimeoutProperties();
+ }
+ }
+ return o;
+ }
+
+ private void saveTimeoutProperties() {
+ if (connectionTimeout==null) {
+ connectionTimeout = System.getProperty("sun.net.client.defaultConnectTimeout");
+ if (connectionTimeout==null)
+ connectionTimeout = "";
+ }
+ if (readTimeout==null) {
+ readTimeout = System.getProperty("sun.net.client.defaultReadTimeout");
+ if (readTimeout==null)
+ readTimeout = "";
+ }
+ }
+
+ private void restoreTimeoutProperties() {
+ if(connectionTimeout!=null) {
+ System.setProperty("sun.net.client.defaultConnectTimeout", connectionTimeout);
+ connectionTimeout = null;
+ }
+ if (readTimeout!=null) {
+ System.setProperty("sun.net.client.defaultReadTimeout", readTimeout);
+ readTimeout = null;
+ }
+ }
+
+ private void setDefaultTimeoutProperties() {
+ saveTimeoutProperties();
+ String timeout = Bpmn2Preferences.getInstance().getConnectionTimeout();
+ System.setProperty("sun.net.client.defaultConnectTimeout", timeout);
+ System.setProperty("sun.net.client.defaultReadTimeout", timeout);
+ }
+
+ /**
+ * Load the resource from the resource set, assuming that it is the kind
+ * indicated by the last argument. The "kind" parameter is the extension
+ * without the . of the resource.
+ *
+ * This forces the right resource to businessObject loaded even if the URI of the resource
+ * is "wrong".
+ *
+ * @param uri the URI of the resource.
+ * @param loadOnDemand load on demand
+ * @param kind the resource kind. It has to businessObject of the form "*.wsdl", or "*.xsd", or "*.bpmn"
+ * @return the loaded resource.
+ */
+
+ @SuppressWarnings("nls")
+ public Resource getResource(URI uri, boolean loadOnDemand, String kind) {
+
+ // Bugzilla 324164
+ // don't bother if URI is null or empty
+ if (uri==null || uri.isEmpty())
+ return null;
+ Map<URI, Resource> map = getURIResourceMap();
+
+ if (map != null) {
+ Resource resource = map.get(uri);
+ if (resource != null) {
+ if (loadOnDemand && !resource.isLoaded()) {
+ // Bugzilla 324164
+ // if load fails, mark resource as unloaded
+ try {
+ demandLoadHelper(resource);
+ } catch (Exception ex) {
+ resource.unload();
+ }
+ }
+
+ return resource;
+ }
+ }
+
+ URIConverter theURIConverter = getURIConverter();
+ URI normalizedURI = theURIConverter.normalize(uri);
+
+ for (Resource resource : getResources()) {
+ if (theURIConverter.normalize(resource.getURI()).equals(
+ normalizedURI)) {
+ if (loadOnDemand && !resource.isLoaded()) {
+ // Bugzilla 324164
+ // if load fails, mark resource as unloaded
+ try {
+ demandLoadHelper(resource);
+ } catch (Exception ex) {
+ resource.unload();
+ break;
+ }
+ }
+
+ if (map != null) {
+ map.put(uri, resource);
+ }
+ return resource;
+ }
+ }
+
+ if (loadOnDemand) {
+ Resource resource = demandCreateResource(uri,kind);
+ if (resource == null) {
+ throw new RuntimeException("Cannot create a resource for '"
+ + uri + "'; a registered resource factory is needed");
+ }
+
+ demandLoadHelper(resource);
+
+ if (map != null) {
+ map.put(uri, resource);
+ }
+ return resource;
+ }
+
+ return null;
+ }
+
+
+ protected Resource demandCreateResource ( URI uri, String kind ) {
+ return createResource ( uri, kind );
+ }
+
+ /*
+ * Fix for Bug 278205 - Problem with importing remote WSIL/WSDL still exists.
+ * Telesh Alexandr added this method to solve this which is to load remote WSIL/WSDL
+ * by the correct resource loader based on known before loading resouce
+ * extension which is posed as resource content type.
+ */
+ public Resource.Factory.Registry getResourceFactoryRegistry() {
+ if (resourceFactoryRegistry == null) {
+
+ resourceFactoryRegistry = new ResourceFactoryRegistryImpl() {
+ @Override
+ protected Resource.Factory delegatedGetFactory(URI uri, String contentTypeIdentifier) {
+ // patch for "wsil" and "wsdl" resources without extensions
+ final Map<String, Object> extensionToFactoryMap =
+ Resource.Factory.Registry.INSTANCE.getExtensionToFactoryMap();
+
+ final Object wsilFactory = extensionToFactoryMap.get("wsil");
+ final Object wsdlFactory = extensionToFactoryMap.get("wsdl");
+
+ final Map<String, Object> contentTypeToFactoryMap =
+ Resource.Factory.Registry.INSTANCE.getContentTypeToFactoryMap();
+
+ if (null != wsilFactory) {
+ contentTypeToFactoryMap.put("wsil", wsilFactory);
+ }
+ if (null != wsdlFactory) {
+ contentTypeToFactoryMap.put("wsdl", wsdlFactory);
+ }
+
+ return convert(getFactory(uri,
+ Resource.Factory.Registry.INSTANCE.getProtocolToFactoryMap(),
+ extensionToFactoryMap, contentTypeToFactoryMap,
+ contentTypeIdentifier, false));
+ }
+
+ @Override
+ protected URIConverter getURIConverter() {
+ // return ResourceSetImpl.this.getURIConverter();
+ return Bpmn2ModelerResourceSetImpl.this.getURIConverter();
+ }
+
+ @Override
+ protected Map<?, ?> getContentDescriptionOptions() {
+ return getLoadOptions();
+ }
+ };
+ }
+ return resourceFactoryRegistry;
+ }
+
+ /**
+ * Create the resource based on the kind.
+ * @param uri
+ * @param kind
+ * @return the created resource
+ */
+
+ // TODO: ganymede [ this method apparently is already in the parent resource set ]
+ // we can strike it from this resourceset.
+
+// @SuppressWarnings("nls")
+// public Resource createResource ( URI uri, String kind) {
+//
+// if (kind == null) {
+// return super.createResource(uri);
+// }
+//
+// Resource resource = createResource(URI.createURI("*." + kind));
+// resource.setURI(uri);
+// return resource;
+// }
+
+
+
+
+
+
+ /**
+ * @see org.eclipse.core.resources.IResourceChangeListener#resourceChanged(org.eclipse.core.resources.IResourceChangeEvent)
+ */
+ public void resourceChanged (IResourceChangeEvent event) {
+
+ // System.out.println("IResourceChangeEvent: " + event + "; " + event.getType() );
+ IResourceDelta[] deltas = event.getDelta().getAffectedChildren( IResourceDelta.CHANGED | IResourceDelta.REMOVED, IResource.FILE );
+ processDeltas ( deltas );
+ }
+
+ void processDeltas ( IResourceDelta [] deltas ) {
+
+ for(IResourceDelta delta : deltas) {
+ processDeltas( delta.getAffectedChildren(IResourceDelta.CHANGED | IResourceDelta.REMOVED, IResource.FILE) );
+
+ IResource resource = delta.getResource();
+ if (resource.getType () != IResource.FILE) {
+ continue;
+ }
+
+ if (delta.getKind() == IResourceDelta.REMOVED){
+ resourceChanged((IFile)resource);
+ continue;
+ }
+
+// * @see IResourceDelta#CONTENT
+// * @see IResourceDelta#DESCRIPTION
+// * @see IResourceDelta#ENCODING
+// * @see IResourceDelta#OPEN
+// * @see IResourceDelta#MOVED_TO
+// * @see IResourceDelta#MOVED_FROM
+// * @see IResourceDelta#TYPE
+// * @see IResourceDelta#SYNC
+// * @see IResourceDelta#MARKERS
+// * @see IResourceDelta#REPLACED
+
+ if ((delta.getFlags() & IResourceDelta.CONTENT) == 0){
+ continue;
+ }
+
+ // TODO: Temporary hack
+ // Actually we should remove all resources from the resourceSet,
+ // but for some reasons bpmn files can't businessObject removed now
+ // Bugzilla 320545:
+ if (isBPMN2File(resource)){
+ continue;
+ }
+
+ resourceChanged((IFile) resource);
+ }
+ }
+
+ public void setLoadOptions (Map<Object, Object> options) {
+ loadOptions = options;
+ }
+
+ /**
+ * Resource has changed, remove it from the cache or list of loaded resources.
+ *
+ * @param file
+ */
+ public void resourceChanged (IFile file) {
+ // System.out.println("ResourceChanged: " + file );
+ URI uri = URI.createPlatformResourceURI( file.getFullPath().toString() ) ;
+ // System.out.println(" ResourceURI: " + uri );
+ URIConverter theURIConverter = getURIConverter();
+ URI normalizedURI = theURIConverter.normalize(uri);
+
+ if (uriResourceMap != null) {
+ uriResourceMap.remove(uri);
+ uriResourceMap.remove(normalizedURI);
+ // System.out.println("Removed from Map: " + map );
+ }
+
+ List<Resource> resourceList = getResources();
+ if (resources.size() < 1) {
+ return ;
+ }
+
+ for(Resource r : new ArrayList<Resource>(resourceList) ) {
+ if (uri.equals(r.getURI()) || normalizedURI.equals(r.getURI() )) {
+ resources.remove(r);
+ // System.out.println("Removed from List: " + r );
+ }
+ }
+ }
+
+ // Bugzilla 320545:
+ public static boolean isBPMN2File(IResource res)
+ {
+ try
+ {
+ if (res.getType() == IResource.FILE) {
+ IContentDescription desc = ((IFile) res).getContentDescription();
+ if (desc != null) {
+ IContentType type = desc.getContentType();
+ if (type.getId().equals(BPMN2_CONTENT_TYPE))
+ return true;
+ }
+ }
+ }
+ catch(Exception ex)
+ {
+ }
+ return false;
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/preferences/Bpmn2Preferences.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/preferences/Bpmn2Preferences.java
index 7849368..eaa2589 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/preferences/Bpmn2Preferences.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/preferences/Bpmn2Preferences.java
@@ -173,9 +173,9 @@
// various preference instance getters
/**
- * Return the Preferences for the currently active project. This should be used
+ * Return the Preferences for the currently active project. This should businessObject used
* with caution: the active project is set by the BPMN2Editor, so this should only
- * be used in a context that is known to have an active editor.
+ * businessObject used in a context that is known to have an active editor.
*
* @return project preferences
*/
@@ -199,7 +199,7 @@
/**
* Return the Preferences for the project containing the EMF Resource specified
- * by the resource URI. This must be a Platform URI.
+ * by the resource URI. This must businessObject a Platform URI.
*
* @param resourceURI
* @return project preferences
@@ -871,8 +871,8 @@
* This is used to determine the appropriate default values for certain optional attributes, e.g.
* isHorizontal, isExpanded, etc.
*
- * @param bpmnShape - the BPMNShape object whose attributes are to be set
- * @param attribs - map of BPMN DI attributes currently set on the BPMNShape object. May be null.
+ * @param bpmnShape - the BPMNShape object whose attributes are to businessObject set
+ * @param attribs - map of BPMN DI attributes currently set on the BPMNShape object. May businessObject null.
* @see getIsHorizontal(), getIsExpanded(), getIsMessageVisible() and getIsMarkerVisible()
*/
public void applyBPMNDIDefaults(BPMNShape bpmnShape, Map<String,String>attribs) {
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/runtime/Bpmn2SectionDescriptor.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/runtime/Bpmn2SectionDescriptor.java
index 7c812d8..3c9524c 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/runtime/Bpmn2SectionDescriptor.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/runtime/Bpmn2SectionDescriptor.java
@@ -1,143 +1,156 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Bob Brodt
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.core.runtime;
-
-import java.util.List;
-
-import org.eclipse.bpmn2.modeler.core.utils.BusinessObjectUtil;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.jface.viewers.IFilter;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.ui.IWorkbenchPart;
-import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection;
-import org.eclipse.ui.views.properties.tabbed.AbstractSectionDescriptor;
-import org.eclipse.ui.views.properties.tabbed.ISection;
-
-public class Bpmn2SectionDescriptor extends AbstractSectionDescriptor {
-
- protected String id;
- protected String tab;
- protected AbstractPropertySection sectionClass;
- protected Class appliesToClass;
- protected String enablesFor;
- protected String filter;
-
- public Bpmn2SectionDescriptor(Bpmn2TabDescriptor td, IConfigurationElement e) {
- tab = td.getId();
- id = tab + ".section";
-
- try {
- sectionClass = (AbstractPropertySection) e.createExecutableExtension("class");
- filter = e.getAttribute("filter");
- if (filter==null || filter.isEmpty())
- filter = "org.eclipse.bpmn2.modeler.ui.property.Bpmn2PropertyFilter";
- enablesFor = e.getAttribute("enablesFor");
- String type = e.getAttribute("type");
- if (type!=null && !type.isEmpty())
- appliesToClass = Class.forName(type);
- } catch (Exception e1) {
- e1.printStackTrace();
- }
-
- td.getSectionDescriptors().add(this);
- }
-
- @Override
- public String getId() {
- return id;
- }
-
- @Override
- public ISection getSectionClass() {
- return sectionClass;
- }
-
- @Override
- public String getTargetTab() {
- return tab;
- }
-
- @Override
- public boolean appliesTo(IWorkbenchPart part, ISelection selection) {
-
- // should we delegate to the section to determine whether it should be included in this tab?
- if (sectionClass instanceof IBpmn2PropertySection) {
- return ((IBpmn2PropertySection)sectionClass).appliesTo(part, selection);
- }
-
- // if an input description was specified, check if the selected business object is of this description.
- if (appliesToClass!=null) {
- PictogramElement pe = BusinessObjectUtil.getPictogramElementForSelection(selection);
- // this is a special hack to allow selection of connection decorator labels:
- // the connection decorator does not have a business object linked to it,
- // but its parent (the connection) does.
- if (pe.getLink()==null && pe.eContainer() instanceof PictogramElement)
- pe = (PictogramElement)pe.eContainer();
-
- // check all linked BusinessObjects for a match
- if (pe.getLink()!=null) {
- for (EObject eObj : pe.getLink().getBusinessObjects()){
- if (appliesToClass.isInstance(eObj)) {
- return true;
- }
- }
- }
- return false;
- }
- return true;
- }
-
- @Override
- public int getEnablesFor() {
- try {
- return Integer.parseInt(enablesFor);
- }
- catch (Exception ex) {
-
- }
- return super.getEnablesFor();
- }
-
- @Override
- public IFilter getFilter() {
- return new IFilter() {
-
- @Override
- public boolean select(Object toTest) {
- return false;
- }
-
- };
- }
-
- @Override
- public List getInputTypes() {
- return super.getInputTypes();
- }
-
- /**
- * @param replacedId
- * @param part
- * @param selection
- * @return
- */
- public boolean doReplaceTab(String replacedId, IWorkbenchPart part, ISelection selection) {
- if (sectionClass instanceof IBpmn2PropertySection) {
- return ((IBpmn2PropertySection)sectionClass).doReplaceTab(replacedId, part, selection);
- }
- return appliesTo(part,selection);
- }
-
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Bob Brodt
+ ******************************************************************************/
+package org.eclipse.bpmn2.modeler.core.runtime;
+
+import java.util.List;
+
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.DefaultPropertySection;
+import org.eclipse.bpmn2.modeler.core.utils.BusinessObjectUtil;
+import org.eclipse.core.runtime.IConfigurationElement;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.jface.viewers.IFilter;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.ui.IWorkbenchPart;
+import org.eclipse.ui.views.properties.tabbed.AbstractPropertySection;
+import org.eclipse.ui.views.properties.tabbed.AbstractSectionDescriptor;
+import org.eclipse.ui.views.properties.tabbed.ISection;
+
+public class Bpmn2SectionDescriptor extends AbstractSectionDescriptor {
+
+ protected String id;
+ protected String tab;
+ protected AbstractPropertySection sectionClass;
+ protected Class appliesToClass;
+ protected String enablesFor;
+ protected String filter;
+
+ public Bpmn2SectionDescriptor(Bpmn2TabDescriptor td, IConfigurationElement e) {
+ tab = td.getId();
+ id = tab + ".section";
+
+ try {
+ String className = e.getAttribute("class");
+ if ("default".equals(className)) {
+ sectionClass = new DefaultPropertySection();
+ String[] properties = e.getAttribute("features").split(" ");
+ ((DefaultPropertySection)sectionClass).setProperties(properties);
+ }
+ else {
+ sectionClass = (AbstractPropertySection) e.createExecutableExtension("class");
+ }
+ filter = e.getAttribute("filter");
+ if (filter==null || filter.isEmpty())
+ filter = "org.eclipse.bpmn2.modeler.ui.property.Bpmn2PropertyFilter";
+ enablesFor = e.getAttribute("enablesFor");
+ String type = e.getAttribute("type");
+ if (type!=null && !type.isEmpty()) {
+ appliesToClass = Class.forName(type);
+ if (sectionClass instanceof DefaultPropertySection) {
+ ((DefaultPropertySection)sectionClass).setAppliesTo(appliesToClass);
+ }
+ }
+ } catch (Exception e1) {
+ e1.printStackTrace();
+ }
+
+ td.getSectionDescriptors().add(this);
+ }
+
+ @Override
+ public String getId() {
+ return id;
+ }
+
+ @Override
+ public ISection getSectionClass() {
+ return sectionClass;
+ }
+
+ @Override
+ public String getTargetTab() {
+ return tab;
+ }
+
+ @Override
+ public boolean appliesTo(IWorkbenchPart part, ISelection selection) {
+
+ // should we delegate to the section to determine whether it should businessObject included in this tab?
+ if (sectionClass instanceof IBpmn2PropertySection) {
+ return ((IBpmn2PropertySection)sectionClass).appliesTo(part, selection);
+ }
+
+ // if an input description was specified, check if the selected business object is of this description.
+ if (appliesToClass!=null) {
+ PictogramElement pe = BusinessObjectUtil.getPictogramElementForSelection(selection);
+ // this is a special hack to allow selection of connection decorator labels:
+ // the connection decorator does not have a business object linked to it,
+ // but its parent (the connection) does.
+ if (pe.getLink()==null && pe.eContainer() instanceof PictogramElement)
+ pe = (PictogramElement)pe.eContainer();
+
+ // check all linked BusinessObjects for a match
+ if (pe.getLink()!=null) {
+ for (EObject eObj : pe.getLink().getBusinessObjects()){
+ if (appliesToClass.isInstance(eObj)) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public int getEnablesFor() {
+ try {
+ return Integer.parseInt(enablesFor);
+ }
+ catch (Exception ex) {
+
+ }
+ return super.getEnablesFor();
+ }
+
+ @Override
+ public IFilter getFilter() {
+ return new IFilter() {
+
+ @Override
+ public boolean select(Object toTest) {
+ return false;
+ }
+
+ };
+ }
+
+ @Override
+ public List getInputTypes() {
+ return super.getInputTypes();
+ }
+
+ /**
+ * @param replacedId
+ * @param part
+ * @param selection
+ * @return
+ */
+ public boolean doReplaceTab(String replacedId, IWorkbenchPart part, ISelection selection) {
+ if (sectionClass instanceof IBpmn2PropertySection) {
+ return ((IBpmn2PropertySection)sectionClass).doReplaceTab(replacedId, part, selection);
+ }
+ return appliesTo(part,selection);
+ }
+
}
\ No newline at end of file
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/runtime/IBpmn2PropertySection.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/runtime/IBpmn2PropertySection.java
index 035edbd..b28f0da 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/runtime/IBpmn2PropertySection.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/runtime/IBpmn2PropertySection.java
@@ -22,18 +22,18 @@
*
* @param part - the BPMN2Editor part
* @param selection - the currently selected BPMN2 element
- * @return true if the element is enabled and should be displayed in the property section
+ * @return true if the element is enabled and should businessObject displayed in the property section
*/
public boolean appliesTo(IWorkbenchPart part, ISelection selection);
/**
- * Asks the Property Section implementation if tab replacement should be
+ * Asks the Property Section implementation if tab replacement should businessObject
* processed for the given editor selection.
*
- * @param id - ID of the tab to be replaced
+ * @param id - ID of the tab to businessObject replaced
* @param part - the BPMN2 Editor
* @param selection - the selected object in the editor canvas
- * @return true if the tab replacement should be done.
+ * @return true if the tab replacement should businessObject done.
*/
public boolean doReplaceTab(String id, IWorkbenchPart part, ISelection selection);
}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/runtime/ModelExtensionDescriptor.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/runtime/ModelExtensionDescriptor.java
index 0a2b041..23f53d5 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/runtime/ModelExtensionDescriptor.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/runtime/ModelExtensionDescriptor.java
@@ -1,507 +1,507 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Bob Brodt
- ******************************************************************************/
-
-package org.eclipse.bpmn2.modeler.core.runtime;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.bpmn2.Bpmn2Package;
-import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.TreeIterator;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EDataType;
-import org.eclipse.emf.ecore.EFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.EStructuralFeature.Internal;
-import org.eclipse.emf.ecore.EcorePackage;
-import org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.util.ExtendedMetaData;
-import org.eclipse.emf.ecore.util.FeatureMap;
-
-/**
- * @author Bob Brodt
- *
- */
-public class ModelExtensionDescriptor extends BaseRuntimeDescriptor {
-
- // Container class for property values
- public static class Value {
-
- static int ID = 0;
- String id;
- public List<Object>values;
-
- public Value() {
- setDefaultId();
- }
-
- public Value(String id) {
- if (id==null || id.isEmpty())
- setDefaultId();
- else
- this.id = id;
- }
-
- public List<Object> getValues() {
- if (values==null) {
- values = new ArrayList<Object>();
- }
- return values;
- }
-
- private void setDefaultId() {
- id = "V-" + ID++;
- }
- }
-
- // name/value pairs constructed from Custom Task extension point
- public static class Property {
- public String name;
- public String description;
- public List<Object>values;
- public String ref;
- public String type;
-
- public Property() {
- this.name = "unknown";
- }
-
- public Property(String name, String description) {
- this.name = name;
- this.description = description;
- }
-
- public List<Object> getValues() {
- if (values==null) {
- values = new ArrayList<Object>();
- }
- return values;
- }
-
- public String getFirstStringValue() {
-
- if (!this.getValues().isEmpty()) {
- // simple attribute - find a String value for it
- for (Object propValue : this.getValues()) {
- if (propValue instanceof String) {
- return (String)propValue;
- }
- else if (propValue instanceof Property) {
- String s = ((Property)propValue).getFirstStringValue();
- if (s!=null)
- return s;
- }
- }
- }
- return null;
- }
- }
-
- protected String id;
- protected String name;
- protected String type;
- protected String description;
- protected List<Property> properties = new ArrayList<Property>();
- protected Resource containingResource;
- protected EObject modelObject;
-
- public ModelExtensionDescriptor(String id, String name) {
- this.id = id;
- this.name = name;
- }
-
- public String getId() {
- return id;
- }
-
- public String getName() {
- return name;
- }
-
- public String getType() {
- return type;
- }
-
- public String getDescription() {
- return description;
- }
-
- public List<Property> getProperties() {
- return properties;
- }
-
-
- /**
- * Creates a custom Task object from a definition in the currently selected
- * Target Runtime plugin's "modelExtension" extension point.
- *
- * @param container - the EObject which will eventually contain the new Task.
- * No changes are made to this object, it is only used to
- * locate the EMF Resource which will eventually contain
- * the new Task object.
- * @return an initialized Task object
- */
- public EObject createObject(EObject container) {
- if (container!=null)
- containingResource = container.eResource();
- modelObject = createObject(getType());
- populateObject(modelObject);
- return modelObject;
- }
-
- /**
- * Create and initialize an object of the given EClass name.
- * The runtime's EPackage is searched first for the given ECLass; if not
- * found, the Bpmn2Package is searched.
- *
- * @param className
- * @return an initialized EObject or null if the EClass name was not found
- */
- private EObject createObject(String className) {
- // look in the extension model package for the class name first
- EClass eClass = (EClass) getEPackage().getEClassifier(className);
- if (eClass==null) {
- // if not found, look in BPMN2 package
- eClass = (EClass) Bpmn2Package.eINSTANCE.getEClassifier(className);
- }
- if (eClass!=null)
- return createObject(eClass);
- return null;
- }
-
- /**
- * Create and initialize an object of the given EClass. Initialization consists
- * of assigning an ID and setting a default name if the EClass has those features.
- *
- * @param eClass - type of object to create
- * @return an initialized EObject
- */
- private EObject createObject(EClass eClass) {
- EObject eObject = eClass.getEPackage().getEFactoryInstance().create(eClass);
-
- // if the object has an "id", assign it now.
- String id = ModelUtil.setID(eObject,containingResource);
- // also set a default name
- EStructuralFeature feature = eObject.eClass().getEStructuralFeature("name");
- if (feature!=null) {
- if (id!=null)
- eObject.eSet(feature, ModelUtil.toDisplayName(id));
- else
- eObject.eSet(feature, "New "+ModelUtil.toDisplayName(eObject.eClass().getName()));
- }
-
- return eObject;
- }
-
- /**
- * Search the Target Runtime's EPackage for a structural feature with the specified name.
- * If the feature is not found in the runtime package, search the Bpmn2Package.
- *
- * @param name - name of the feature that specifies both an EClass and an EStructuralFeature
- * in the form "EClassName.EStructuralFeatureName"
- * @return
- */
- private EStructuralFeature getFeature(String name) {
- String[] parts = name.split("\\.");
- EClass eClass = (EClass)getEPackage().getEClassifier(parts[0]);
- if (eClass==null) {
- eClass = (EClass)Bpmn2Package.eINSTANCE.getEClassifier(parts[0]);
- }
- if (eClass!=null) {
- EStructuralFeature feature = eClass.getEStructuralFeature(parts[1]);
- if (ExtendedMetaData.INSTANCE.getFeatureKind(feature) == ExtendedMetaData.UNSPECIFIED_FEATURE) {
- if (feature instanceof EAttribute) {
- ExtendedMetaData.INSTANCE.setFeatureKind(feature,ExtendedMetaData.ATTRIBUTE_FEATURE);
- }
- else {
- ExtendedMetaData.INSTANCE.setFeatureKind(feature,ExtendedMetaData.ELEMENT_FEATURE);
- }
- ExtendedMetaData.INSTANCE.setNamespace(feature, eClass.getEPackage().getNsURI());
- ExtendedMetaData.INSTANCE.setName(feature, feature.getName());
- }
-
- return feature;
- }
- return null;
- }
-
- /**
- * Search the Target Runtime's EPackage for a structural feature with the specified name.
- * If the feature is not found in the runtime package, search the Bpmn2Package.
- *
- * @param type - the feature type, either EAttribute or EReference
- * @param name - name of the feature
- * @return an EStructuralFeature or null if not found
- */
- private EStructuralFeature getFeature(Class type, String name) {
- EStructuralFeature feature = getFeature(getEPackage(), type, name);
- if (feature==null) {
- // try the bpmn2 package
- feature = getFeature(Bpmn2Package.eINSTANCE, type, name);
- }
- return feature;
- }
-
- /**
- * Search the given EPackage for a structural feature with the specified name.
- *
- * @param pkg - the EPackage to search
- * @param type - the feature type, either EAttribute or EReference
- * @param name - name of the feature
- * @return an EStructuralFeature or null if not found
- */
- private EStructuralFeature getFeature(EPackage pkg, Class type, String name) {
- TreeIterator<EObject> it = pkg.eAllContents();
- while (it.hasNext()) {
- EObject o = it.next();
- if (type.isInstance(o)) {
- EStructuralFeature fName = o.eClass().getEStructuralFeature("name");
- if (fName!=null && o.eGet(fName)!=null && o.eGet(fName).equals(name)) {
- return (EStructuralFeature)o;
- }
- }
- }
- return null;
- }
-
- /**
- * Populate the given EObject with a list of values which must be Property objects.
- *
- * @param object - the object to initialize
- * @param values - list of Property values
- */
- public void populateObjectFromValues(EObject object, List<Object> values) {
-
- for (Object value : values) {
- if (value instanceof Property)
- populateObject(object,(Property)value);
- }
- }
-
- public EObject populateObject(EObject object, Resource resource) {
- containingResource = resource;
- modelObject = object;
- populateObject(modelObject);
- return modelObject;
- }
-
- public void populateObject(EObject object) {
- populateObject(object, getProperties());
- }
-
- /**
- * Populate the given EObject with a list of Property objects.
- *
- * @param object - the object to initialize
- * @param values - list of Property objects
- */
- public void populateObject(EObject object, List<Property> properties) {
-
- for (Property prop : properties) {
- populateObject(object,prop);
- }
- }
-
- protected EPackage getEPackage(EStructuralFeature feature) {
- EObject o = feature;
- while ( o.eContainer()!=null ) {
- o = o.eContainer();
- if (o instanceof EPackage) {
- return (EPackage)o;
- }
- }
- return null;
- }
-
- /**
- * Set the value of the structural feature. If the feature is a list,
- * the value is added to the list.
- *
- * @param object
- * @param feature
- * @param value
- */
- private void setValue(EObject object, EStructuralFeature feature, Object value) {
- // should not set null value features
- if (value == null) {
- return;
- }
-
- if (feature.isMany()) {
- ((EList)object.eGet(feature)).add(value);
- }
- else {
- if (value instanceof String) {
- EDataType eDataType = (EDataType)feature.getEType();
- try {
- // TODO: figure out why feature.eClass().getEPackage().getEFactoryInstance() doesn't
- // return the correct factory!
- EFactory factory = getEPackage(feature).getEFactoryInstance();
- value = factory.createFromString(eDataType, (String)value);
- }
- catch (Exception e)
- {
- EFactory factory = EcorePackage.eINSTANCE.getEFactoryInstance();
- value = factory.createFromString(eDataType, (String)value);
- }
- }
-
- object.eSet(feature, value);
- }
- }
-
- /**
- * Return the value of the specified feature from the given EObject.
- * If the feature is a list, return the indexed value.
- *
- * @param object
- * @param feature
- * @param index
- * @return the feature's value
- */
- private Object getValue(EObject object, EStructuralFeature feature, int index) {
- if (feature.isMany()) {
- return ((EList)object.eGet(feature)).get(index<0 ? 0 : index);
- }
- return object.eGet(feature);
- }
-
- /**
- * Populate the given EObject from the Property tree defined in this runtime
- * plugin's "modelObject" extension point.
- *
- * @param object
- * @param property
- */
- public void populateObject(EObject object, Property property) {
-
- EObject childObject = null;
- EStructuralFeature childFeature = null;
- EStructuralFeature feature = object.eClass().getEStructuralFeature(property.name);
-
- Object firstValue = property.getValues().isEmpty() ? null : property.getValues().get(0);
-
- if (feature==null) {
- // determine the type of feature, either an EAttribute or an EReference,
- // from the give Property's characteristics
- Class type = EAttribute.class;
- // if the Property has a "ref" or if its value is a Property
- // then this must be an EReference
- if (property.ref!=null || firstValue instanceof Property)
- type = EReference.class;
- // get the feature from the runtime package or from Bpmn2Package,
- // wherever it's found first
- feature = getFeature(type,property.name);
- }
-
- if (feature==null) {
- EPackage pkg = getEPackage();
- feature = ModelUtil.createDynamicAttribute(pkg, object, property.name, property.type);
- }
-
- if (feature instanceof EAttribute) {
- if ( feature.getEType().getInstanceClass() == FeatureMap.Entry.class ) {
- // special handling for FeatureMaps
- for (Object value : property.getValues()) {
- if (value instanceof Property) {
- Property p = (Property)value;
- childFeature = getFeature(p.name);
- if (childFeature instanceof EAttribute) {
- childObject = createObject(((EReference) childFeature));
- setValue(childObject, childFeature, firstValue);
- }
- else if (childFeature instanceof EReference) {
- childObject = createObject(((EReference) childFeature).getEReferenceType());
- FeatureMap.Entry entry = new SimpleFeatureMapEntry((Internal)childFeature, childObject);
- setValue(object, feature, entry);
- populateObjectFromValues(childObject,p.getValues());
- }
- }
- }
- }
- else
- setValue(object, feature, firstValue);
- }
- else if (feature instanceof EReference) {
- EReference ref = (EReference)feature;
- if (property.ref!=null) {
- // navigate down the newly created custom task to find the object reference
- childObject = modelObject;
- String[] segments = property.ref.split("/");
- for (String s : segments) {
- // is the feature an Elist?
- int index = s.indexOf('#');
- if (index>0) {
- index = Integer.parseInt(s.substring(index+1));
- s = s.split("#")[0];
- }
- childFeature = childObject.eClass().getEStructuralFeature(s);
- childObject = (EObject)getValue(childObject, childFeature, index);
- }
- setValue(object, feature, childObject);
- }
- else
- {
- childObject = createObject(ref.getEReferenceType());
- object.eResource();
- setValue(object, feature, childObject);
- populateObjectFromValues(childObject,property.getValues());
- }
- }
- }
-
- /**
- * Return the value of the given root Property name.
- *
- * @param name
- * @return
- */
- public Object getProperty(String name) {
-
- for (Property prop : getProperties()) {
- if (prop.name.equals(name)) {
- if (!prop.getValues().isEmpty()) {
- return prop.getValues().get(0);
- }
- }
- }
- return null;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public void setProperties(List<Property> properties) {
- this.properties = properties;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Bob Brodt
+ ******************************************************************************/
+
+package org.eclipse.bpmn2.modeler.core.runtime;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.bpmn2.Bpmn2Package;
+import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EFactory;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EStructuralFeature.Internal;
+import org.eclipse.emf.ecore.EcorePackage;
+import org.eclipse.emf.ecore.impl.EStructuralFeatureImpl.SimpleFeatureMapEntry;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.ExtendedMetaData;
+import org.eclipse.emf.ecore.util.FeatureMap;
+
+/**
+ * @author Bob Brodt
+ *
+ */
+public class ModelExtensionDescriptor extends BaseRuntimeDescriptor {
+
+ // Container class for property values
+ public static class Value {
+
+ static int ID = 0;
+ String id;
+ public List<Object>values;
+
+ public Value() {
+ setDefaultId();
+ }
+
+ public Value(String id) {
+ if (id==null || id.isEmpty())
+ setDefaultId();
+ else
+ this.id = id;
+ }
+
+ public List<Object> getValues() {
+ if (values==null) {
+ values = new ArrayList<Object>();
+ }
+ return values;
+ }
+
+ private void setDefaultId() {
+ id = "V-" + ID++;
+ }
+ }
+
+ // name/value pairs constructed from Custom Task extension point
+ public static class Property {
+ public String name;
+ public String description;
+ public List<Object>values;
+ public String ref;
+ public String type;
+
+ public Property() {
+ this.name = "unknown";
+ }
+
+ public Property(String name, String description) {
+ this.name = name;
+ this.description = description;
+ }
+
+ public List<Object> getValues() {
+ if (values==null) {
+ values = new ArrayList<Object>();
+ }
+ return values;
+ }
+
+ public String getFirstStringValue() {
+
+ if (!this.getValues().isEmpty()) {
+ // simple attribute - find a String value for it
+ for (Object propValue : this.getValues()) {
+ if (propValue instanceof String) {
+ return (String)propValue;
+ }
+ else if (propValue instanceof Property) {
+ String s = ((Property)propValue).getFirstStringValue();
+ if (s!=null)
+ return s;
+ }
+ }
+ }
+ return null;
+ }
+ }
+
+ protected String id;
+ protected String name;
+ protected String type;
+ protected String description;
+ protected List<Property> properties = new ArrayList<Property>();
+ protected Resource containingResource;
+ protected EObject modelObject;
+
+ public ModelExtensionDescriptor(String id, String name) {
+ this.id = id;
+ this.name = name;
+ }
+
+ public String getId() {
+ return id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public List<Property> getProperties() {
+ return properties;
+ }
+
+
+ /**
+ * Creates a custom Task object from a definition in the currently selected
+ * Target Runtime plugin's "modelExtension" extension point.
+ *
+ * @param container - the EObject which will eventually contain the new Task.
+ * No changes are made to this object, it is only used to
+ * locate the EMF Resource which will eventually contain
+ * the new Task object.
+ * @return an initialized Task object
+ */
+ public EObject createObject(EObject container) {
+ if (container!=null)
+ containingResource = container.eResource();
+ modelObject = createObject(getType());
+ populateObject(modelObject);
+ return modelObject;
+ }
+
+ /**
+ * Create and initialize an object of the given EClass name.
+ * The runtime's EPackage is searched first for the given ECLass; if not
+ * found, the Bpmn2Package is searched.
+ *
+ * @param className
+ * @return an initialized EObject or null if the EClass name was not found
+ */
+ private EObject createObject(String className) {
+ // look in the extension model package for the class name first
+ EClass eClass = (EClass) getEPackage().getEClassifier(className);
+ if (eClass==null) {
+ // if not found, look in BPMN2 package
+ eClass = (EClass) Bpmn2Package.eINSTANCE.getEClassifier(className);
+ }
+ if (eClass!=null)
+ return createObject(eClass);
+ return null;
+ }
+
+ /**
+ * Create and initialize an object of the given EClass. Initialization consists
+ * of assigning an ID and setting a default name if the EClass has those features.
+ *
+ * @param eClass - type of object to create
+ * @return an initialized EObject
+ */
+ private EObject createObject(EClass eClass) {
+ EObject eObject = eClass.getEPackage().getEFactoryInstance().create(eClass);
+
+ // if the object has an "id", assign it now.
+ String id = ModelUtil.setID(eObject,containingResource);
+ // also set a default name
+ EStructuralFeature feature = eObject.eClass().getEStructuralFeature("name");
+ if (feature!=null) {
+ if (id!=null)
+ eObject.eSet(feature, ModelUtil.toDisplayName(id));
+ else
+ eObject.eSet(feature, "New "+ModelUtil.toDisplayName(eObject.eClass().getName()));
+ }
+
+ return eObject;
+ }
+
+ /**
+ * Search the Target Runtime's EPackage for a structural feature with the specified name.
+ * If the feature is not found in the runtime package, search the Bpmn2Package.
+ *
+ * @param name - name of the feature that specifies both an EClass and an EStructuralFeature
+ * in the form "EClassName.EStructuralFeatureName"
+ * @return
+ */
+ private EStructuralFeature getFeature(String name) {
+ String[] parts = name.split("\\.");
+ EClass eClass = (EClass)getEPackage().getEClassifier(parts[0]);
+ if (eClass==null) {
+ eClass = (EClass)Bpmn2Package.eINSTANCE.getEClassifier(parts[0]);
+ }
+ if (eClass!=null) {
+ EStructuralFeature feature = eClass.getEStructuralFeature(parts[1]);
+ if (ExtendedMetaData.INSTANCE.getFeatureKind(feature) == ExtendedMetaData.UNSPECIFIED_FEATURE) {
+ if (feature instanceof EAttribute) {
+ ExtendedMetaData.INSTANCE.setFeatureKind(feature,ExtendedMetaData.ATTRIBUTE_FEATURE);
+ }
+ else {
+ ExtendedMetaData.INSTANCE.setFeatureKind(feature,ExtendedMetaData.ELEMENT_FEATURE);
+ }
+ ExtendedMetaData.INSTANCE.setNamespace(feature, eClass.getEPackage().getNsURI());
+ ExtendedMetaData.INSTANCE.setName(feature, feature.getName());
+ }
+
+ return feature;
+ }
+ return null;
+ }
+
+ /**
+ * Search the Target Runtime's EPackage for a structural feature with the specified name.
+ * If the feature is not found in the runtime package, search the Bpmn2Package.
+ *
+ * @param type - the feature type, either EAttribute or EReference
+ * @param name - name of the feature
+ * @return an EStructuralFeature or null if not found
+ */
+ private EStructuralFeature getFeature(Class type, String name) {
+ EStructuralFeature feature = getFeature(getEPackage(), type, name);
+ if (feature==null) {
+ // try the bpmn2 package
+ feature = getFeature(Bpmn2Package.eINSTANCE, type, name);
+ }
+ return feature;
+ }
+
+ /**
+ * Search the given EPackage for a structural feature with the specified name.
+ *
+ * @param pkg - the EPackage to search
+ * @param type - the feature type, either EAttribute or EReference
+ * @param name - name of the feature
+ * @return an EStructuralFeature or null if not found
+ */
+ private EStructuralFeature getFeature(EPackage pkg, Class type, String name) {
+ TreeIterator<EObject> it = pkg.eAllContents();
+ while (it.hasNext()) {
+ EObject o = it.next();
+ if (type.isInstance(o)) {
+ EStructuralFeature fName = o.eClass().getEStructuralFeature("name");
+ if (fName!=null && o.eGet(fName)!=null && o.eGet(fName).equals(name)) {
+ return (EStructuralFeature)o;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Populate the given EObject with a list of values which must businessObject Property objects.
+ *
+ * @param object - the object to initialize
+ * @param values - list of Property values
+ */
+ public void populateObjectFromValues(EObject object, List<Object> values) {
+
+ for (Object value : values) {
+ if (value instanceof Property)
+ populateObject(object,(Property)value);
+ }
+ }
+
+ public EObject populateObject(EObject object, Resource resource) {
+ containingResource = resource;
+ modelObject = object;
+ populateObject(modelObject);
+ return modelObject;
+ }
+
+ public void populateObject(EObject object) {
+ populateObject(object, getProperties());
+ }
+
+ /**
+ * Populate the given EObject with a list of Property objects.
+ *
+ * @param object - the object to initialize
+ * @param values - list of Property objects
+ */
+ public void populateObject(EObject object, List<Property> properties) {
+
+ for (Property prop : properties) {
+ populateObject(object,prop);
+ }
+ }
+
+ protected EPackage getEPackage(EStructuralFeature feature) {
+ EObject o = feature;
+ while ( o.eContainer()!=null ) {
+ o = o.eContainer();
+ if (o instanceof EPackage) {
+ return (EPackage)o;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Set the value of the structural feature. If the feature is a list,
+ * the value is added to the list.
+ *
+ * @param object
+ * @param feature
+ * @param value
+ */
+ private void setValue(EObject object, EStructuralFeature feature, Object value) {
+ // should not set null value features
+ if (value == null) {
+ return;
+ }
+
+ if (feature.isMany()) {
+ ((EList)object.eGet(feature)).add(value);
+ }
+ else {
+ if (value instanceof String) {
+ EDataType eDataType = (EDataType)feature.getEType();
+ try {
+ // TODO: figure out why feature.eClass().getEPackage().getEFactoryInstance() doesn't
+ // return the correct factory!
+ EFactory factory = getEPackage(feature).getEFactoryInstance();
+ value = factory.createFromString(eDataType, (String)value);
+ }
+ catch (Exception e)
+ {
+ EFactory factory = EcorePackage.eINSTANCE.getEFactoryInstance();
+ value = factory.createFromString(eDataType, (String)value);
+ }
+ }
+
+ object.eSet(feature, value);
+ }
+ }
+
+ /**
+ * Return the value of the specified feature from the given EObject.
+ * If the feature is a list, return the indexed value.
+ *
+ * @param object
+ * @param feature
+ * @param index
+ * @return the feature's value
+ */
+ private Object getValue(EObject object, EStructuralFeature feature, int index) {
+ if (feature.isMany()) {
+ return ((EList)object.eGet(feature)).get(index<0 ? 0 : index);
+ }
+ return object.eGet(feature);
+ }
+
+ /**
+ * Populate the given EObject from the Property tree defined in this runtime
+ * plugin's "modelObject" extension point.
+ *
+ * @param object
+ * @param property
+ */
+ public void populateObject(EObject object, Property property) {
+
+ EObject childObject = null;
+ EStructuralFeature childFeature = null;
+ EStructuralFeature feature = object.eClass().getEStructuralFeature(property.name);
+
+ Object firstValue = property.getValues().isEmpty() ? null : property.getValues().get(0);
+
+ if (feature==null) {
+ // determine the type of feature, either an EAttribute or an EReference,
+ // from the give Property's characteristics
+ Class type = EAttribute.class;
+ // if the Property has a "ref" or if its value is a Property
+ // then this must businessObject an EReference
+ if (property.ref!=null || firstValue instanceof Property)
+ type = EReference.class;
+ // get the feature from the runtime package or from Bpmn2Package,
+ // wherever it's found first
+ feature = getFeature(type,property.name);
+ }
+
+ if (feature==null) {
+ EPackage pkg = getEPackage();
+ feature = ModelUtil.createDynamicAttribute(pkg, object, property.name, property.type);
+ }
+
+ if (feature instanceof EAttribute) {
+ if ( feature.getEType().getInstanceClass() == FeatureMap.Entry.class ) {
+ // special handling for FeatureMaps
+ for (Object value : property.getValues()) {
+ if (value instanceof Property) {
+ Property p = (Property)value;
+ childFeature = getFeature(p.name);
+ if (childFeature instanceof EAttribute) {
+ childObject = createObject(((EReference) childFeature));
+ setValue(childObject, childFeature, firstValue);
+ }
+ else if (childFeature instanceof EReference) {
+ childObject = createObject(((EReference) childFeature).getEReferenceType());
+ FeatureMap.Entry entry = new SimpleFeatureMapEntry((Internal)childFeature, childObject);
+ setValue(object, feature, entry);
+ populateObjectFromValues(childObject,p.getValues());
+ }
+ }
+ }
+ }
+ else
+ setValue(object, feature, firstValue);
+ }
+ else if (feature instanceof EReference) {
+ EReference ref = (EReference)feature;
+ if (property.ref!=null) {
+ // navigate down the newly created custom task to find the object reference
+ childObject = modelObject;
+ String[] segments = property.ref.split("/");
+ for (String s : segments) {
+ // is the feature an Elist?
+ int index = s.indexOf('#');
+ if (index>0) {
+ index = Integer.parseInt(s.substring(index+1));
+ s = s.split("#")[0];
+ }
+ childFeature = childObject.eClass().getEStructuralFeature(s);
+ childObject = (EObject)getValue(childObject, childFeature, index);
+ }
+ setValue(object, feature, childObject);
+ }
+ else
+ {
+ childObject = createObject(ref.getEReferenceType());
+ object.eResource();
+ setValue(object, feature, childObject);
+ populateObjectFromValues(childObject,property.getValues());
+ }
+ }
+ }
+
+ /**
+ * Return the value of the given root Property name.
+ *
+ * @param name
+ * @return
+ */
+ public Object getProperty(String name) {
+
+ for (Property prop : getProperties()) {
+ if (prop.name.equals(name)) {
+ if (!prop.getValues().isEmpty()) {
+ return prop.getValues().get(0);
+ }
+ }
+ }
+ return null;
+ }
+
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public void setProperties(List<Property> properties) {
+ this.properties = properties;
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/runtime/TargetRuntime.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/runtime/TargetRuntime.java
index e040ace..2ab1173 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/runtime/TargetRuntime.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/runtime/TargetRuntime.java
@@ -309,7 +309,7 @@
rt.modelDescriptor = getDefaultRuntime().getModelDescriptor();
}
// add customTask and modelExtension features to modelEnablements
- // these are enabled by default and can't be disabled.
+ // these are enabled by default and can't businessObject disabled.
for (ModelEnablementDescriptor me : rt.getModelEnablements()) {
for (ModelExtensionDescriptor med : rt.getModelExtensions()) {
for (Property p : med.getProperties()) {
@@ -477,7 +477,7 @@
if (className.equals(ped.type))
return ped;
// well, that didn't work...
- // The "type" name should be the BPMN2 element's interface definition;
+ // The "type" name should businessObject the BPMN2 element's interface definition;
// if it's an implementation class name, try to convert it to its
// interface name.
className = className.replaceFirst("\\.impl\\.", ".");
@@ -507,7 +507,7 @@
if (className.equals(fcd.type))
return fcd;
// well, that didn't work...
- // The "type" name should be the BPMN2 element's interface definition;
+ // The "type" name should businessObject the BPMN2 element's interface definition;
// if it's an implementation class name, try to convert it to its
// interface name.
className = className.replaceFirst("\\.impl\\.", ".");
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/GraphicsUtil.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/GraphicsUtil.java
index b1339f8..765a09a 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/GraphicsUtil.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/GraphicsUtil.java
@@ -895,7 +895,7 @@
}
- public static ContainerShape getActivityMarkerContainer(ContainerShape container) {
+ private static ContainerShape getActivityMarkerContainer(ContainerShape container) {
String property = peService.getPropertyValue(container, ACTIVITY_MARKER_CONTAINER);
if (property != null && new Boolean(property)) {
return container;
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/ImportUtil.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/ImportUtil.java
index d5f994c..6193194 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/ImportUtil.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/ImportUtil.java
@@ -1,644 +1,644 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Bob Brodt
- ******************************************************************************/
-
-package org.eclipse.bpmn2.modeler.core.utils;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.bpmn2.Definitions;
-import org.eclipse.bpmn2.Import;
-import org.eclipse.bpmn2.Interface;
-import org.eclipse.bpmn2.ItemDefinition;
-import org.eclipse.bpmn2.ItemKind;
-import org.eclipse.bpmn2.modeler.core.adapters.AdapterUtil;
-import org.eclipse.bpmn2.modeler.core.adapters.ExtendedPropertiesAdapter;
-import org.eclipse.bpmn2.modeler.core.model.Bpmn2ModelerFactory;
-import org.eclipse.bpmn2.util.Bpmn2Resource;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.wst.wsdl.Binding;
-import org.eclipse.wst.wsdl.Definition;
-import org.eclipse.wst.wsdl.Fault;
-import org.eclipse.wst.wsdl.Input;
-import org.eclipse.wst.wsdl.Message;
-import org.eclipse.wst.wsdl.Operation;
-import org.eclipse.wst.wsdl.Output;
-import org.eclipse.wst.wsdl.PortType;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDSchema;
-
-/**
- * @author Bob Brodt
- *
- */
-public class ImportUtil {
-
- /**
- * Convenience method for <code>addImport(Resource,Object)</code>
- *
- * @param modelObject - an EObject that is currently contained in a Resource
- * @param importObject - the import model object. This can be any of the following:
- * WSDL Definition object
- * XSDSchema object
- * BPMN2.0 Definitions object
- * Java Class object
- * @return the newly constructed Import
- */
- public static Import addImport(EObject modelObject, Object importObject) {
- Resource resource = modelObject.eResource();
- return ImportUtil.addImport(resource,importObject);
- }
-
- /**
- * Create and add an Import object to the given BPMN2 Resource. This will also create
- * all of the defined ItemDefinition, Message, Operation and Interface objects as
- * defined in the imported resource "importObject".
- *
- * @param resource - the target Resource. The new Import will be added to the RootElements in
- * the Definitions object.
- * @param importObject - the import model object. This can be any of the following:
- * WSDL Definition object
- * XSDSchema object
- * BPMN2.0 Definitions object
- * Java Class object
- * @return the newly constructed Import
- */
- public static Import addImport(Resource resource, final Object importObject) {
- Import imp = null;
- if (resource instanceof Bpmn2Resource) {
- final Definitions definitions = (Definitions) resource.getContents().get(0).eContents().get(0);
-
- if (importObject instanceof org.eclipse.wst.wsdl.Definition) {
- // WSDL Definition
- Definition wsdlDefinition = (Definition)importObject;
-
- imp = Bpmn2ModelerFactory.create(Import.class);
- imp.setImportType("http://schemas.xmlsoap.org/wsdl/");
- imp.setLocation(wsdlDefinition.getLocation());
- imp.setNamespace(wsdlDefinition.getTargetNamespace());
- }
- else if (importObject instanceof XSDSchema){
- // XSD Schema
- XSDSchema schema = (XSDSchema)importObject;
-
- imp = Bpmn2ModelerFactory.create(Import.class);
- imp.setImportType("http://www.w3.org/2001/XMLSchema");
- imp.setLocation(schema.getSchemaLocation());
- imp.setNamespace(schema.getTargetNamespace());
- }
- else if (importObject instanceof Class) {
- // Java class
- Class clazz = (Class)importObject;
- // TODO: create a location URI for the class file
-// ClassLoader cl = clazz.getClassLoader();
-// String name = clazz.getName().replaceAll("\\.", "/").concat(".class");
-// java.net.URL url = cl.getResource(name);
-// URI uri = URI.createPlatformPluginURI(url.getPath(), true);
- imp = Bpmn2ModelerFactory.create(Import.class);
- imp.setImportType("http://www.java.com/javaTypes");
- imp.setLocation(clazz.getName());
- imp.setNamespace("http://" + clazz.getPackage().getName());
- }
- else if (importObject instanceof org.eclipse.bpmn2.Definitions) {
- // BPMN 2.0 Diagram file
- Definitions defs = (Definitions)importObject;
-
- imp = Bpmn2ModelerFactory.create(Import.class);
- imp.setImportType("http://www.omg.org/spec/BPMN/20100524/MODEL");
- imp.setLocation(defs.eResource().getURI().toString());
- imp.setNamespace(defs.getTargetNamespace());
- }
-
- if (imp!=null) {
- // make sure this is a new one!
- for (Import i : definitions.getImports()) {
- String location = i.getLocation();
- if (location!=null && location.equals(imp.getLocation())) {
- imp = null;
- break;
- }
- }
- }
-
- if (imp!=null) {
- definitions.getImports().add(imp);
- NamespaceUtil.addNamespace(imp.eResource(), imp.getNamespace());
-
- if (importObject instanceof org.eclipse.wst.wsdl.Definition) {
- // WSDL Definition
- Definition wsdlDefinition = (Definition)importObject;
-
- for (Binding b :(List<Binding>)wsdlDefinition.getEBindings()) {
- createInterface(definitions, imp, b.getEPortType());
- }
- }
- else if (importObject instanceof XSDSchema){
- XSDSchema schema = (XSDSchema)importObject;
-
- for (XSDElementDeclaration elem : schema.getElementDeclarations()) {
- createItemDefinition(definitions, imp, elem, ItemKind.INFORMATION);
- }
- }
- else if (importObject instanceof Class) {
- Class clazz = (Class)importObject;
-
- createItemDefinition(definitions, imp, clazz);
- }
- else if (importObject instanceof org.eclipse.bpmn2.Definitions) {
- // what to do here?
- }
- }
- }
- return imp;
- }
-
- /**
- * Remove the given Import object and delete all of its associated elements (i.e. ItemDefinition,
- * Message, Operation and Interface) that were defined in the Import.
- *
- * @param imp - the Import to remove
- * @return true if the Import object was removed, false if not
- */
- public static boolean removeImport(Import imp) {
- Definitions definitions = ModelUtil.getDefinitions(imp);
- boolean canRemove = true;
- boolean canRemoveNamespace = true;
- String location = imp.getLocation();
- String namespace = imp.getNamespace();
- for (Import i : definitions.getImports()) {
- if (i!=imp) {
- String loc1 = i.getLocation();
- String ns1 = i.getNamespace();
- // different import locations, same namespace?
- if (loc1!=null && location!=null && !loc1.equals(location) &&
- ns1!=null && namespace!=null && ns1.equals(namespace)) {
- // this namespace is still in use by another import!
- canRemoveNamespace = false;
- break;
- }
- }
- }
-
- if (canRemoveNamespace)
- NamespaceUtil.removeNamespace(imp.eResource(), namespace);
-
- if (canRemove) {
- String type = imp.getImportType();
- String loc = imp.getLocation();
-
- if ("http://schemas.xmlsoap.org/wsdl/".equals(type)) {
- List<Interface> list = ModelUtil.getAllRootElements(definitions, Interface.class);
- for (Interface intf : list) {
- Object ref = intf.getImplementationRef();
- if (ref instanceof EObject) {
- URI uri = EcoreUtil.getURI((EObject)ref);
- String uriString = uri.trimFragment().toString();
- if (loc.equals(uriString))
- deleteInterface(definitions, intf);
- }
- }
- }
- else if ("http://www.w3.org/2001/XMLSchema".equals(type)) {
- List<ItemDefinition> list = ModelUtil.getAllRootElements(definitions, ItemDefinition.class);
- for (ItemDefinition itemDef : list) {
- Object ref = itemDef.getStructureRef();
- if (ref instanceof EObject) {
- URI uri = EcoreUtil.getURI((EObject)ref);
- String uriString = uri.trimFragment().toString();
- if (loc.equals(uriString))
- EcoreUtil.delete(itemDef);
- }
- }
- }
- else if ("http://www.java.com/javaTypes".equals(type)) {
- String className = imp.getLocation();
- boolean deleted = false;
- IJavaProject[] projects = JavaProjectClassLoader.findProject(className);
- for (int i=0; i<projects.length; ++i) {
- JavaProjectClassLoader loader = new JavaProjectClassLoader(projects[i]);
- Class clazz = loader.findClass(className);
- if (clazz!=null) {
- deleteItemDefinition(definitions, imp, clazz);
- deleted = true;
- }
- }
- if (!deleted)
- deleteItemDefinition(definitions, imp, className);
- }
- else if ("http://www.omg.org/spec/BPMN/20100524/MODEL".equals(type)) {
-
- }
- definitions.getImports().remove(imp);
- }
- return canRemove;
- }
-
- /**
- * Create a new Interface object. If an identical Interface already exists, a new one is not created.
- * This also creates all of the Operations, Messages and ItemDefinitions that are defined in the
- * "portType" element.
- *
- * @param definitions - the BPMN2 Definitions parent object; the new Interface is added to its rootElements
- * @param imp - the Import object where the WSDL Port Type is defined
- * @param portType - the WSDL Port Type that corresponds to this Interface
- * @return the newly created object, or an existing Interface with the same name and implementation reference
- */
- public static Interface createInterface(Definitions definitions, Import imp, PortType portType) {
- Interface intf = Bpmn2ModelerFactory.create(Interface.class);
- intf.setName(portType.getQName().getLocalPart());
- intf.setImplementationRef(portType);
- Interface i = findInterface(definitions,intf);
- if (i!=null)
- return i;
-
- definitions.getRootElements().add(intf);
- ModelUtil.setID(intf);
- createOperations(definitions, imp, intf, portType);
-
- return intf;
- }
-
- /**
- * Delete an existing Interface object. This also deletes all of the Operations, Messages and ItemDefinitions
- * that are referenced by the Interface.
- *
- * @param definitions - the BPMN2 Definitions parent object that contains the Interface
- * @param intf - the Interface object to remove
- */
- public static void deleteInterface(Definitions definitions, Interface intf) {
- deleteOperations(definitions,intf);
- EcoreUtil.delete(intf);
- }
-
- /**
- * Search for an existing Interface object that is identical to the one specified.
- *
- * @param definitions - the BPMN2 Definitions parent object
- * @param intf - an Interface to search for
- * @return the Interface if it already exists, null if not
- */
- public static Interface findInterface(Definitions definitions, Interface intf) {
- ExtendedPropertiesAdapter adapter = (ExtendedPropertiesAdapter) AdapterUtil.adapt(intf, ExtendedPropertiesAdapter.class);
- if (adapter!=null) {
- List <Interface> list = ModelUtil.getAllRootElements(definitions, Interface.class);
- for (Interface i : list) {
- if (adapter.getObjectDescriptor().equals(i))
- return i;
- }
- }
- return null;
- }
-
- /**
- * Create a new Operation object and add it to the given Interface.
- * This also creates all of the Messages, Errors and ItemDefinitions that are defined in the
- * "portType" element.
- *
- * @param definitions - the BPMN2 Definitions parent object
- * @param imp - the Import object where the Interface is defined
- * @param intf - the Interface to which this Operation will be added
- * @param portType - the WSDL Port Type that corresponds to this Interface
- */
- public static void createOperations(Definitions definitions, Import imp, Interface intf, PortType portType) {
- for (Operation wsdlop : (List<Operation>)portType.getEOperations()) {
- org.eclipse.bpmn2.Operation bpmn2op = Bpmn2ModelerFactory.create(org.eclipse.bpmn2.Operation.class);
- bpmn2op.setImplementationRef(wsdlop);
- bpmn2op.setName(wsdlop.getName());
-
- Input input = wsdlop.getEInput();
- if (input!=null) {
- org.eclipse.bpmn2.Message bpmn2msg = createMessage(definitions, imp, input.getEMessage());
- bpmn2op.setInMessageRef(bpmn2msg);
- }
-
- Output output = wsdlop.getEOutput();
- if (output!=null) {
- org.eclipse.bpmn2.Message bpmn2msg = createMessage(definitions, imp, output.getEMessage());
- bpmn2op.setOutMessageRef(bpmn2msg);
- }
-
- for (Fault fault : (List<Fault>)wsdlop.getEFaults()) {
- bpmn2op.getErrorRefs().add(createError(definitions, imp, fault));
- }
-
- if (findOperation(definitions, bpmn2op)==null) {
- intf.getOperations().add(bpmn2op);
- ModelUtil.setID(bpmn2op);
- }
- }
- }
-
- /**
- * Remove all Operations from the given Interface.
- *
- * @param definitions - the BPMN2 Definitions parent object
- * @param intf - the Interface from which Operations will be removed
- */
- public static void deleteOperations(Definitions definitions, Interface intf) {
- List<org.eclipse.bpmn2.Operation> opList = new ArrayList<org.eclipse.bpmn2.Operation>();
- for (org.eclipse.bpmn2.Operation bpmn2op : intf.getOperations()) {
- opList.add(bpmn2op);
- }
- for (org.eclipse.bpmn2.Operation bpmn2op : opList) {
- org.eclipse.bpmn2.Message m;
- m = bpmn2op.getInMessageRef();
- if (m!=null) {
- deleteMessage(definitions,m);
- }
- m = bpmn2op.getOutMessageRef();
- if (m!=null) {
- deleteMessage(definitions,m);
- }
-
- List<org.eclipse.bpmn2.Error> errorList = new ArrayList<org.eclipse.bpmn2.Error>();
- errorList.addAll(bpmn2op.getErrorRefs());
- for (org.eclipse.bpmn2.Error e : errorList) {
- ItemDefinition itemDef = e.getStructureRef();
- if (itemDef!=null)
- EcoreUtil.delete(itemDef);
- EcoreUtil.delete(e);
- }
- EcoreUtil.delete(bpmn2op);
- }
- }
-
- /**
- * Search for an existing Operation object that is identical to the one specified.
- *
- * @param definitions - the BPMN2 Definitions parent object
- * @param bpmn2op - an Operation to search for
- * @return the Operation if it already exists, null if not
- */
- public static org.eclipse.bpmn2.Operation findOperation(Definitions definitions, org.eclipse.bpmn2.Operation bpmn2op) {
- ExtendedPropertiesAdapter adapter = (ExtendedPropertiesAdapter) AdapterUtil.adapt(bpmn2op, ExtendedPropertiesAdapter.class);
- if (adapter!=null) {
- List<org.eclipse.bpmn2.Operation> list = ModelUtil.getAllRootElements(definitions, org.eclipse.bpmn2.Operation.class);
- for (org.eclipse.bpmn2.Operation o : list) {
- if (adapter.getObjectDescriptor().equals(o))
- return (org.eclipse.bpmn2.Operation)o;
- }
- }
- return null;
- }
- /**
- * Create a new Message object and add it to the rootElements in the given Definitions.
- * This also creates all of the ItemDefinitions that are defined in the "wsdlmsg" element.
- * If a Message that matches the new one already exists, it is returned instead.
- *
- * @param definitions - the BPMN2 Definitions parent object
- * @param imp - the Import object where the WSDL Message is defined
- * @param wsdlmsg - a WSDL Message object used to create the BPMN2 Message
- * @return the newly created object, or an existing Message that is identical to the given WSDL Message
- */
- public static org.eclipse.bpmn2.Message createMessage(Definitions definitions, Import imp, Message wsdlmsg) {
- org.eclipse.bpmn2.Message bpmn2msg = Bpmn2ModelerFactory.create(org.eclipse.bpmn2.Message.class);
- ItemDefinition itemDef = createItemDefinition(definitions, imp, wsdlmsg);
- bpmn2msg.setItemRef(itemDef);
- bpmn2msg.setName(wsdlmsg.getQName().getLocalPart());
-
- org.eclipse.bpmn2.Message m = findMessage(definitions, bpmn2msg);
- if (m!=null)
- return m;
-
- definitions.getRootElements().add(bpmn2msg);
- ModelUtil.setID(bpmn2msg);
-
- return bpmn2msg;
- }
-
- /**
- * Remove the given Message and its related ItemDefinitions.
- *
- * @param definitions - the BPMN2 Definitions parent object
- * @param msg - the Message object to be removed
- */
- public static void deleteMessage(Definitions definitions, org.eclipse.bpmn2.Message msg) {
- ItemDefinition itemDef = msg.getItemRef();
- if (itemDef!=null)
- EcoreUtil.delete(itemDef);
- EcoreUtil.delete(msg);
- }
-
- /**
- * Search for an existing Message object that is identical to the one specified.
- *
- * @param definitions - the BPMN2 Definitions parent object
- * @param msg - a Message to search for
- * @return the Operation if it already exists, null if not
- */
- public static org.eclipse.bpmn2.Message findMessage(Definitions definitions, org.eclipse.bpmn2.Message msg) {
- ExtendedPropertiesAdapter adapter = (ExtendedPropertiesAdapter) AdapterUtil.adapt(msg, ExtendedPropertiesAdapter.class);
- if (adapter!=null) {
- List<org.eclipse.bpmn2.Message> list = ModelUtil.getAllRootElements(definitions, org.eclipse.bpmn2.Message.class);
- for (org.eclipse.bpmn2.Message m : list) {
- if (adapter.getObjectDescriptor().equals(m))
- return (org.eclipse.bpmn2.Message)m;
- }
- }
- return null;
- }
-
- /**
- * Create a new Error object and add it to the rootElements in the given Definitions.
- * This also creates all of the ItemDefinitions that are defined in the WSDL "fault" element.
- * If an Error that matches the new one already exists, it is returned instead.
- * WSDL Fault types always create "INFORMATION" ItemDefinitions.
- *
- * @param definitions - the BPMN2 Definitions parent object
- * @param imp - the Import object where the WSDL Fault is defined
- * @param fault - a WSDL Fault object used to create the new BPMN2 Error
- * @return the newly created object, or an existing Error that is identical to the given WSDL Fault
- */
- public static org.eclipse.bpmn2.Error createError(Definitions definitions, Import imp, Fault fault) {
- org.eclipse.bpmn2.Error error = Bpmn2ModelerFactory.create(org.eclipse.bpmn2.Error.class);
- ItemDefinition itemDef = createItemDefinition(definitions, imp, fault, ItemKind.INFORMATION);
- error.setName(fault.getName());
- error.setStructureRef(itemDef);
- org.eclipse.bpmn2.Error e = findError(definitions, error);
- if (e!=null)
- return e;
-
- definitions.getRootElements().add(error);
- ModelUtil.setID(error);
-
- return error;
- }
-
- /**
- * Search for an existing Error object that is identical to the one specified.
- *
- * @param definitions - the BPMN2 Definitions parent object
- * @param error - an Error to search for
- * @return the Error if it already exists, null if not
- */
- public static org.eclipse.bpmn2.Error findError(Definitions definitions, org.eclipse.bpmn2.Error error) {
- ExtendedPropertiesAdapter adapter = (ExtendedPropertiesAdapter) AdapterUtil.adapt(error, ExtendedPropertiesAdapter.class);
- if (adapter!=null) {
- List<org.eclipse.bpmn2.Error> list = ModelUtil.getAllRootElements(definitions, org.eclipse.bpmn2.Error.class);
- for (org.eclipse.bpmn2.Error e : list) {
- if (adapter.getObjectDescriptor().equals(e))
- return (org.eclipse.bpmn2.Error)e;
- }
- }
- return null;
- }
-
- /**
- * Create a new ItemDefinition for the given WSDL Message. The WSDL Message becomes the target of the
- * ItemDefinition's structureRef. WSDL Message types always create "INFORMATION" ItemDefinitions.
- *
- * @param definitions - the BPMN2 Definitions parent object
- * @param imp - the Import object where the WSDL Message is defined
- * @param wsdlmsg - a WSDL Message object that defines the structure of the ItemDefinition
- * @return the newly created object, or an existing ItemDefinition that is identical to the given WSDL Message
- */
- public static ItemDefinition createItemDefinition(Definitions definitions, Import imp, Message wsdlmsg) {
- return createItemDefinition(definitions, imp, wsdlmsg, ItemKind.INFORMATION);
- }
-
- /**
- * Create a new ItemDefinition for the given Java type. This also creates ItemDefinitions for any
- * internal Classes or Interfaces that are defined in the given Class. Java types always create
- * "PHYSICAL" ItemDefinitions.
- *
- * @param definitions - the BPMN2 Definitions parent object
- * @param imp - the Import object where the Java type is defined
- * @param clazz - the Java Class object that defines the structure of the ItemDefinition
- * @return the newly created object, or an existing ItemDefinition that is identical to the given Java type
- */
- public static ItemDefinition createItemDefinition(Definitions definitions, Import imp, Class clazz) {
- for (Class c : clazz.getDeclaredClasses()) {
- createItemDefinition(definitions, imp, c);
- }
- return createItemDefinition(definitions, imp, clazz.getName(), ItemKind.PHYSICAL);
- }
-
- /**
- * Create a new ItemDefinition for an arbitrary String type. The String is wrapped in a DynamicEObjectImpl
- * (a.k.a. "String Wrapper") so that it can be handled as a proxy EObject
- *
- * @param definitions - the BPMN2 Definitions parent object
- * @param imp - the Import object where the String type is defined
- * @param structName - the type string that defines the structure of the ItemDefinition
- * @param kind - the ItemKind, either PHYSICAL or INFORMATION
- * @return the newly created object, or an existing ItemDefinition that is identical to the given String type
- */
- public static ItemDefinition createItemDefinition(Definitions definitions, Import imp, String structName, ItemKind kind) {
- EObject structureRef = ModelUtil.createStringWrapper(structName);
- return createItemDefinition(definitions, imp, structureRef, kind);
- }
-
-
- /**
- * Create a new ItemDefinition for an arbitrary String type. The String is wrapped in a DynamicEObjectImpl
- * (a.k.a. "String Wrapper") so that it can be handled as a proxy EObject
- *
- * @param definitions - the BPMN2 Definitions parent object
- * @param imp - the Import object where the EObject is defined
- * @param structureRef - the EObject that defines the structure of the ItemDefinition
- * @param kind - the ItemKind, either PHYSICAL or INFORMATION
- * @return the newly created object, or an existing ItemDefinition that is identical to the given String type
- */
- public static ItemDefinition createItemDefinition(Definitions definitions, Import imp, EObject structureRef, ItemKind kind) {
- ItemDefinition itemDef = Bpmn2ModelerFactory.create(ItemDefinition.class);
- itemDef.setImport(imp);
- itemDef.setItemKind(kind);
- itemDef.setStructureRef(structureRef);
- ItemDefinition i = findItemDefinition(definitions, itemDef);
- if (i!=null)
- return i;
-
- definitions.getRootElements().add(itemDef);
- ModelUtil.setID(itemDef);
-
- return itemDef;
- }
-
- /**
- * Convenience method for findItemDefinition(Definitions,ItemDefinition)
- *
- * @param definitions - the BPMN2 Definitions parent object
- * @param imp - the Import object where the EObject is defined
- * @param structureRef - the EObject that defines the structure of the ItemDefinition
- * @param kind - the ItemKind, either PHYSICAL or INFORMATION
- * @return the ItemDefinition object if found, or null
- */
- public static ItemDefinition findItemDefinition(Definitions definitions, Import imp, EObject structureRef, ItemKind kind) {
- ItemDefinition itemDef = Bpmn2ModelerFactory.create(ItemDefinition.class);
- itemDef.setImport(imp);
- itemDef.setItemKind(kind);
- itemDef.setStructureRef(structureRef);
- return findItemDefinition(definitions, itemDef);
- }
-
- /**
- * Search for an existing ItemDefinition object that is identical to the one specified.
- *
- * @param definitions - the BPMN2 Definitions parent object
- * @param itemDef - an ItemDefinition to search for
- * @return the ItemDefinition if it already exists, null if not
- */
- public static ItemDefinition findItemDefinition(Definitions definitions, ItemDefinition itemDef) {
- ExtendedPropertiesAdapter adapter = (ExtendedPropertiesAdapter) AdapterUtil.adapt(itemDef, ExtendedPropertiesAdapter.class);
- if (adapter!=null) {
- List<ItemDefinition> list = ModelUtil.getAllRootElements(definitions, ItemDefinition.class);
- for (ItemDefinition i : list) {
- if (adapter.getObjectDescriptor().equals(i))
- return (ItemDefinition)i;
- }
- }
- return null;
- }
-
- /**
- * Remove an ItemDefinition for the given Java type. This also removes the ItemDefinitions for
- * all inner classes and interfaces.
- *
- * @param definitions - the BPMN2 Definitions parent object
- * @param imp - the Import object where the Java type is defined
- * @param clazz - the Java Class object that defines the structure of the ItemDefinition
- */
- public static void deleteItemDefinition(Definitions definitions, Import imp, Class clazz) {
- for (Class c : clazz.getDeclaredClasses()) {
- deleteItemDefinition(definitions, imp, c);
- }
- EObject structureRef = ModelUtil.createStringWrapper(clazz.getName());
- ItemDefinition itemDef = findItemDefinition(definitions, imp, structureRef, ItemKind.PHYSICAL);
- if (itemDef!=null) {
- EcoreUtil.delete(itemDef);
- }
- }
-
- /**
- * Remove an ItemDefinition for the given String type. This will search for both PHYSICAL and
- * INFORMATION definitions.
- *
- * @param definitions - the BPMN2 Definitions parent object
- * @param imp - the Import object where the String type is defined
- * @param structName - the type string that defines the structure of the ItemDefinition
- */
- public static void deleteItemDefinition(Definitions definitions, Import imp, String structName) {
- EObject structureRef = ModelUtil.createStringWrapper(structName);
- ItemDefinition itemDef = findItemDefinition(definitions, imp, structureRef, ItemKind.PHYSICAL);
- if (itemDef==null)
- itemDef = findItemDefinition(definitions, imp, structureRef, ItemKind.INFORMATION);
-
- if (itemDef!=null) {
- EcoreUtil.delete(itemDef);
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Bob Brodt
+ ******************************************************************************/
+
+package org.eclipse.bpmn2.modeler.core.utils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.bpmn2.Definitions;
+import org.eclipse.bpmn2.Import;
+import org.eclipse.bpmn2.Interface;
+import org.eclipse.bpmn2.ItemDefinition;
+import org.eclipse.bpmn2.ItemKind;
+import org.eclipse.bpmn2.modeler.core.adapters.AdapterUtil;
+import org.eclipse.bpmn2.modeler.core.adapters.ExtendedPropertiesAdapter;
+import org.eclipse.bpmn2.modeler.core.model.Bpmn2ModelerFactory;
+import org.eclipse.bpmn2.util.Bpmn2Resource;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.wst.wsdl.Binding;
+import org.eclipse.wst.wsdl.Definition;
+import org.eclipse.wst.wsdl.Fault;
+import org.eclipse.wst.wsdl.Input;
+import org.eclipse.wst.wsdl.Message;
+import org.eclipse.wst.wsdl.Operation;
+import org.eclipse.wst.wsdl.Output;
+import org.eclipse.wst.wsdl.PortType;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDSchema;
+
+/**
+ * @author Bob Brodt
+ *
+ */
+public class ImportUtil {
+
+ /**
+ * Convenience method for <code>addImport(Resource,Object)</code>
+ *
+ * @param modelObject - an EObject that is currently contained in a Resource
+ * @param importObject - the import model object. This can businessObject any of the following:
+ * WSDL Definition object
+ * XSDSchema object
+ * BPMN2.0 Definitions object
+ * Java Class object
+ * @return the newly constructed Import
+ */
+ public static Import addImport(EObject modelObject, Object importObject) {
+ Resource resource = modelObject.eResource();
+ return ImportUtil.addImport(resource,importObject);
+ }
+
+ /**
+ * Create and add an Import object to the given BPMN2 Resource. This will also create
+ * all of the defined ItemDefinition, Message, Operation and Interface objects as
+ * defined in the imported resource "importObject".
+ *
+ * @param resource - the target Resource. The new Import will businessObject added to the RootElements in
+ * the Definitions object.
+ * @param importObject - the import model object. This can businessObject any of the following:
+ * WSDL Definition object
+ * XSDSchema object
+ * BPMN2.0 Definitions object
+ * Java Class object
+ * @return the newly constructed Import
+ */
+ public static Import addImport(Resource resource, final Object importObject) {
+ Import imp = null;
+ if (resource instanceof Bpmn2Resource) {
+ final Definitions definitions = (Definitions) resource.getContents().get(0).eContents().get(0);
+
+ if (importObject instanceof org.eclipse.wst.wsdl.Definition) {
+ // WSDL Definition
+ Definition wsdlDefinition = (Definition)importObject;
+
+ imp = Bpmn2ModelerFactory.create(Import.class);
+ imp.setImportType("http://schemas.xmlsoap.org/wsdl/");
+ imp.setLocation(wsdlDefinition.getLocation());
+ imp.setNamespace(wsdlDefinition.getTargetNamespace());
+ }
+ else if (importObject instanceof XSDSchema){
+ // XSD Schema
+ XSDSchema schema = (XSDSchema)importObject;
+
+ imp = Bpmn2ModelerFactory.create(Import.class);
+ imp.setImportType("http://www.w3.org/2001/XMLSchema");
+ imp.setLocation(schema.getSchemaLocation());
+ imp.setNamespace(schema.getTargetNamespace());
+ }
+ else if (importObject instanceof Class) {
+ // Java class
+ Class clazz = (Class)importObject;
+ // TODO: create a location URI for the class file
+// ClassLoader cl = clazz.getClassLoader();
+// String name = clazz.getName().replaceAll("\\.", "/").concat(".class");
+// java.net.URL url = cl.getResource(name);
+// URI uri = URI.createPlatformPluginURI(url.getPath(), true);
+ imp = Bpmn2ModelerFactory.create(Import.class);
+ imp.setImportType("http://www.java.com/javaTypes");
+ imp.setLocation(clazz.getName());
+ imp.setNamespace("http://" + clazz.getPackage().getName());
+ }
+ else if (importObject instanceof org.eclipse.bpmn2.Definitions) {
+ // BPMN 2.0 Diagram file
+ Definitions defs = (Definitions)importObject;
+
+ imp = Bpmn2ModelerFactory.create(Import.class);
+ imp.setImportType("http://www.omg.org/spec/BPMN/20100524/MODEL");
+ imp.setLocation(defs.eResource().getURI().toString());
+ imp.setNamespace(defs.getTargetNamespace());
+ }
+
+ if (imp!=null) {
+ // make sure this is a new one!
+ for (Import i : definitions.getImports()) {
+ String location = i.getLocation();
+ if (location!=null && location.equals(imp.getLocation())) {
+ imp = null;
+ break;
+ }
+ }
+ }
+
+ if (imp!=null) {
+ definitions.getImports().add(imp);
+ NamespaceUtil.addNamespace(imp.eResource(), imp.getNamespace());
+
+ if (importObject instanceof org.eclipse.wst.wsdl.Definition) {
+ // WSDL Definition
+ Definition wsdlDefinition = (Definition)importObject;
+
+ for (Binding b :(List<Binding>)wsdlDefinition.getEBindings()) {
+ createInterface(definitions, imp, b.getEPortType());
+ }
+ }
+ else if (importObject instanceof XSDSchema){
+ XSDSchema schema = (XSDSchema)importObject;
+
+ for (XSDElementDeclaration elem : schema.getElementDeclarations()) {
+ createItemDefinition(definitions, imp, elem, ItemKind.INFORMATION);
+ }
+ }
+ else if (importObject instanceof Class) {
+ Class clazz = (Class)importObject;
+
+ createItemDefinition(definitions, imp, clazz);
+ }
+ else if (importObject instanceof org.eclipse.bpmn2.Definitions) {
+ // what to do here?
+ }
+ }
+ }
+ return imp;
+ }
+
+ /**
+ * Remove the given Import object and delete all of its associated elements (i.e. ItemDefinition,
+ * Message, Operation and Interface) that were defined in the Import.
+ *
+ * @param imp - the Import to remove
+ * @return true if the Import object was removed, false if not
+ */
+ public static boolean removeImport(Import imp) {
+ Definitions definitions = ModelUtil.getDefinitions(imp);
+ boolean canRemove = true;
+ boolean canRemoveNamespace = true;
+ String location = imp.getLocation();
+ String namespace = imp.getNamespace();
+ for (Import i : definitions.getImports()) {
+ if (i!=imp) {
+ String loc1 = i.getLocation();
+ String ns1 = i.getNamespace();
+ // different import locations, same namespace?
+ if (loc1!=null && location!=null && !loc1.equals(location) &&
+ ns1!=null && namespace!=null && ns1.equals(namespace)) {
+ // this namespace is still in use by another import!
+ canRemoveNamespace = false;
+ break;
+ }
+ }
+ }
+
+ if (canRemoveNamespace)
+ NamespaceUtil.removeNamespace(imp.eResource(), namespace);
+
+ if (canRemove) {
+ String type = imp.getImportType();
+ String loc = imp.getLocation();
+
+ if ("http://schemas.xmlsoap.org/wsdl/".equals(type)) {
+ List<Interface> list = ModelUtil.getAllRootElements(definitions, Interface.class);
+ for (Interface intf : list) {
+ Object ref = intf.getImplementationRef();
+ if (ref instanceof EObject) {
+ URI uri = EcoreUtil.getURI((EObject)ref);
+ String uriString = uri.trimFragment().toString();
+ if (loc.equals(uriString))
+ deleteInterface(definitions, intf);
+ }
+ }
+ }
+ else if ("http://www.w3.org/2001/XMLSchema".equals(type)) {
+ List<ItemDefinition> list = ModelUtil.getAllRootElements(definitions, ItemDefinition.class);
+ for (ItemDefinition itemDef : list) {
+ Object ref = itemDef.getStructureRef();
+ if (ref instanceof EObject) {
+ URI uri = EcoreUtil.getURI((EObject)ref);
+ String uriString = uri.trimFragment().toString();
+ if (loc.equals(uriString))
+ EcoreUtil.delete(itemDef);
+ }
+ }
+ }
+ else if ("http://www.java.com/javaTypes".equals(type)) {
+ String className = imp.getLocation();
+ boolean deleted = false;
+ IJavaProject[] projects = JavaProjectClassLoader.findProject(className);
+ for (int i=0; i<projects.length; ++i) {
+ JavaProjectClassLoader loader = new JavaProjectClassLoader(projects[i]);
+ Class clazz = loader.findClass(className);
+ if (clazz!=null) {
+ deleteItemDefinition(definitions, imp, clazz);
+ deleted = true;
+ }
+ }
+ if (!deleted)
+ deleteItemDefinition(definitions, imp, className);
+ }
+ else if ("http://www.omg.org/spec/BPMN/20100524/MODEL".equals(type)) {
+
+ }
+ definitions.getImports().remove(imp);
+ }
+ return canRemove;
+ }
+
+ /**
+ * Create a new Interface object. If an identical Interface already exists, a new one is not created.
+ * This also creates all of the Operations, Messages and ItemDefinitions that are defined in the
+ * "portType" element.
+ *
+ * @param definitions - the BPMN2 Definitions parent object; the new Interface is added to its rootElements
+ * @param imp - the Import object where the WSDL Port Type is defined
+ * @param portType - the WSDL Port Type that corresponds to this Interface
+ * @return the newly created object, or an existing Interface with the same name and implementation reference
+ */
+ public static Interface createInterface(Definitions definitions, Import imp, PortType portType) {
+ Interface intf = Bpmn2ModelerFactory.create(Interface.class);
+ intf.setName(portType.getQName().getLocalPart());
+ intf.setImplementationRef(portType);
+ Interface i = findInterface(definitions,intf);
+ if (i!=null)
+ return i;
+
+ definitions.getRootElements().add(intf);
+ ModelUtil.setID(intf);
+ createOperations(definitions, imp, intf, portType);
+
+ return intf;
+ }
+
+ /**
+ * Delete an existing Interface object. This also deletes all of the Operations, Messages and ItemDefinitions
+ * that are referenced by the Interface.
+ *
+ * @param definitions - the BPMN2 Definitions parent object that contains the Interface
+ * @param intf - the Interface object to remove
+ */
+ public static void deleteInterface(Definitions definitions, Interface intf) {
+ deleteOperations(definitions,intf);
+ EcoreUtil.delete(intf);
+ }
+
+ /**
+ * Search for an existing Interface object that is identical to the one specified.
+ *
+ * @param definitions - the BPMN2 Definitions parent object
+ * @param intf - an Interface to search for
+ * @return the Interface if it already exists, null if not
+ */
+ public static Interface findInterface(Definitions definitions, Interface intf) {
+ ExtendedPropertiesAdapter adapter = (ExtendedPropertiesAdapter) AdapterUtil.adapt(intf, ExtendedPropertiesAdapter.class);
+ if (adapter!=null) {
+ List <Interface> list = ModelUtil.getAllRootElements(definitions, Interface.class);
+ for (Interface i : list) {
+ if (adapter.getObjectDescriptor().equals(i))
+ return i;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Create a new Operation object and add it to the given Interface.
+ * This also creates all of the Messages, Errors and ItemDefinitions that are defined in the
+ * "portType" element.
+ *
+ * @param definitions - the BPMN2 Definitions parent object
+ * @param imp - the Import object where the Interface is defined
+ * @param intf - the Interface to which this Operation will businessObject added
+ * @param portType - the WSDL Port Type that corresponds to this Interface
+ */
+ public static void createOperations(Definitions definitions, Import imp, Interface intf, PortType portType) {
+ for (Operation wsdlop : (List<Operation>)portType.getEOperations()) {
+ org.eclipse.bpmn2.Operation bpmn2op = Bpmn2ModelerFactory.create(org.eclipse.bpmn2.Operation.class);
+ bpmn2op.setImplementationRef(wsdlop);
+ bpmn2op.setName(wsdlop.getName());
+
+ Input input = wsdlop.getEInput();
+ if (input!=null) {
+ org.eclipse.bpmn2.Message bpmn2msg = createMessage(definitions, imp, input.getEMessage());
+ bpmn2op.setInMessageRef(bpmn2msg);
+ }
+
+ Output output = wsdlop.getEOutput();
+ if (output!=null) {
+ org.eclipse.bpmn2.Message bpmn2msg = createMessage(definitions, imp, output.getEMessage());
+ bpmn2op.setOutMessageRef(bpmn2msg);
+ }
+
+ for (Fault fault : (List<Fault>)wsdlop.getEFaults()) {
+ bpmn2op.getErrorRefs().add(createError(definitions, imp, fault));
+ }
+
+ if (findOperation(definitions, bpmn2op)==null) {
+ intf.getOperations().add(bpmn2op);
+ ModelUtil.setID(bpmn2op);
+ }
+ }
+ }
+
+ /**
+ * Remove all Operations from the given Interface.
+ *
+ * @param definitions - the BPMN2 Definitions parent object
+ * @param intf - the Interface from which Operations will businessObject removed
+ */
+ public static void deleteOperations(Definitions definitions, Interface intf) {
+ List<org.eclipse.bpmn2.Operation> opList = new ArrayList<org.eclipse.bpmn2.Operation>();
+ for (org.eclipse.bpmn2.Operation bpmn2op : intf.getOperations()) {
+ opList.add(bpmn2op);
+ }
+ for (org.eclipse.bpmn2.Operation bpmn2op : opList) {
+ org.eclipse.bpmn2.Message m;
+ m = bpmn2op.getInMessageRef();
+ if (m!=null) {
+ deleteMessage(definitions,m);
+ }
+ m = bpmn2op.getOutMessageRef();
+ if (m!=null) {
+ deleteMessage(definitions,m);
+ }
+
+ List<org.eclipse.bpmn2.Error> errorList = new ArrayList<org.eclipse.bpmn2.Error>();
+ errorList.addAll(bpmn2op.getErrorRefs());
+ for (org.eclipse.bpmn2.Error e : errorList) {
+ ItemDefinition itemDef = e.getStructureRef();
+ if (itemDef!=null)
+ EcoreUtil.delete(itemDef);
+ EcoreUtil.delete(e);
+ }
+ EcoreUtil.delete(bpmn2op);
+ }
+ }
+
+ /**
+ * Search for an existing Operation object that is identical to the one specified.
+ *
+ * @param definitions - the BPMN2 Definitions parent object
+ * @param bpmn2op - an Operation to search for
+ * @return the Operation if it already exists, null if not
+ */
+ public static org.eclipse.bpmn2.Operation findOperation(Definitions definitions, org.eclipse.bpmn2.Operation bpmn2op) {
+ ExtendedPropertiesAdapter adapter = (ExtendedPropertiesAdapter) AdapterUtil.adapt(bpmn2op, ExtendedPropertiesAdapter.class);
+ if (adapter!=null) {
+ List<org.eclipse.bpmn2.Operation> list = ModelUtil.getAllRootElements(definitions, org.eclipse.bpmn2.Operation.class);
+ for (org.eclipse.bpmn2.Operation o : list) {
+ if (adapter.getObjectDescriptor().equals(o))
+ return (org.eclipse.bpmn2.Operation)o;
+ }
+ }
+ return null;
+ }
+ /**
+ * Create a new Message object and add it to the rootElements in the given Definitions.
+ * This also creates all of the ItemDefinitions that are defined in the "wsdlmsg" element.
+ * If a Message that matches the new one already exists, it is returned instead.
+ *
+ * @param definitions - the BPMN2 Definitions parent object
+ * @param imp - the Import object where the WSDL Message is defined
+ * @param wsdlmsg - a WSDL Message object used to create the BPMN2 Message
+ * @return the newly created object, or an existing Message that is identical to the given WSDL Message
+ */
+ public static org.eclipse.bpmn2.Message createMessage(Definitions definitions, Import imp, Message wsdlmsg) {
+ org.eclipse.bpmn2.Message bpmn2msg = Bpmn2ModelerFactory.create(org.eclipse.bpmn2.Message.class);
+ ItemDefinition itemDef = createItemDefinition(definitions, imp, wsdlmsg);
+ bpmn2msg.setItemRef(itemDef);
+ bpmn2msg.setName(wsdlmsg.getQName().getLocalPart());
+
+ org.eclipse.bpmn2.Message m = findMessage(definitions, bpmn2msg);
+ if (m!=null)
+ return m;
+
+ definitions.getRootElements().add(bpmn2msg);
+ ModelUtil.setID(bpmn2msg);
+
+ return bpmn2msg;
+ }
+
+ /**
+ * Remove the given Message and its related ItemDefinitions.
+ *
+ * @param definitions - the BPMN2 Definitions parent object
+ * @param msg - the Message object to businessObject removed
+ */
+ public static void deleteMessage(Definitions definitions, org.eclipse.bpmn2.Message msg) {
+ ItemDefinition itemDef = msg.getItemRef();
+ if (itemDef!=null)
+ EcoreUtil.delete(itemDef);
+ EcoreUtil.delete(msg);
+ }
+
+ /**
+ * Search for an existing Message object that is identical to the one specified.
+ *
+ * @param definitions - the BPMN2 Definitions parent object
+ * @param msg - a Message to search for
+ * @return the Operation if it already exists, null if not
+ */
+ public static org.eclipse.bpmn2.Message findMessage(Definitions definitions, org.eclipse.bpmn2.Message msg) {
+ ExtendedPropertiesAdapter adapter = (ExtendedPropertiesAdapter) AdapterUtil.adapt(msg, ExtendedPropertiesAdapter.class);
+ if (adapter!=null) {
+ List<org.eclipse.bpmn2.Message> list = ModelUtil.getAllRootElements(definitions, org.eclipse.bpmn2.Message.class);
+ for (org.eclipse.bpmn2.Message m : list) {
+ if (adapter.getObjectDescriptor().equals(m))
+ return (org.eclipse.bpmn2.Message)m;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Create a new Error object and add it to the rootElements in the given Definitions.
+ * This also creates all of the ItemDefinitions that are defined in the WSDL "fault" element.
+ * If an Error that matches the new one already exists, it is returned instead.
+ * WSDL Fault types always create "INFORMATION" ItemDefinitions.
+ *
+ * @param definitions - the BPMN2 Definitions parent object
+ * @param imp - the Import object where the WSDL Fault is defined
+ * @param fault - a WSDL Fault object used to create the new BPMN2 Error
+ * @return the newly created object, or an existing Error that is identical to the given WSDL Fault
+ */
+ public static org.eclipse.bpmn2.Error createError(Definitions definitions, Import imp, Fault fault) {
+ org.eclipse.bpmn2.Error error = Bpmn2ModelerFactory.create(org.eclipse.bpmn2.Error.class);
+ ItemDefinition itemDef = createItemDefinition(definitions, imp, fault, ItemKind.INFORMATION);
+ error.setName(fault.getName());
+ error.setStructureRef(itemDef);
+ org.eclipse.bpmn2.Error e = findError(definitions, error);
+ if (e!=null)
+ return e;
+
+ definitions.getRootElements().add(error);
+ ModelUtil.setID(error);
+
+ return error;
+ }
+
+ /**
+ * Search for an existing Error object that is identical to the one specified.
+ *
+ * @param definitions - the BPMN2 Definitions parent object
+ * @param error - an Error to search for
+ * @return the Error if it already exists, null if not
+ */
+ public static org.eclipse.bpmn2.Error findError(Definitions definitions, org.eclipse.bpmn2.Error error) {
+ ExtendedPropertiesAdapter adapter = (ExtendedPropertiesAdapter) AdapterUtil.adapt(error, ExtendedPropertiesAdapter.class);
+ if (adapter!=null) {
+ List<org.eclipse.bpmn2.Error> list = ModelUtil.getAllRootElements(definitions, org.eclipse.bpmn2.Error.class);
+ for (org.eclipse.bpmn2.Error e : list) {
+ if (adapter.getObjectDescriptor().equals(e))
+ return (org.eclipse.bpmn2.Error)e;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Create a new ItemDefinition for the given WSDL Message. The WSDL Message becomes the target of the
+ * ItemDefinition's structureRef. WSDL Message types always create "INFORMATION" ItemDefinitions.
+ *
+ * @param definitions - the BPMN2 Definitions parent object
+ * @param imp - the Import object where the WSDL Message is defined
+ * @param wsdlmsg - a WSDL Message object that defines the structure of the ItemDefinition
+ * @return the newly created object, or an existing ItemDefinition that is identical to the given WSDL Message
+ */
+ public static ItemDefinition createItemDefinition(Definitions definitions, Import imp, Message wsdlmsg) {
+ return createItemDefinition(definitions, imp, wsdlmsg, ItemKind.INFORMATION);
+ }
+
+ /**
+ * Create a new ItemDefinition for the given Java type. This also creates ItemDefinitions for any
+ * internal Classes or Interfaces that are defined in the given Class. Java types always create
+ * "PHYSICAL" ItemDefinitions.
+ *
+ * @param definitions - the BPMN2 Definitions parent object
+ * @param imp - the Import object where the Java type is defined
+ * @param clazz - the Java Class object that defines the structure of the ItemDefinition
+ * @return the newly created object, or an existing ItemDefinition that is identical to the given Java type
+ */
+ public static ItemDefinition createItemDefinition(Definitions definitions, Import imp, Class clazz) {
+ for (Class c : clazz.getDeclaredClasses()) {
+ createItemDefinition(definitions, imp, c);
+ }
+ return createItemDefinition(definitions, imp, clazz.getName(), ItemKind.PHYSICAL);
+ }
+
+ /**
+ * Create a new ItemDefinition for an arbitrary String type. The String is wrapped in a DynamicEObjectImpl
+ * (a.k.a. "String Wrapper") so that it can businessObject handled as a proxy EObject
+ *
+ * @param definitions - the BPMN2 Definitions parent object
+ * @param imp - the Import object where the String type is defined
+ * @param structName - the type string that defines the structure of the ItemDefinition
+ * @param kind - the ItemKind, either PHYSICAL or INFORMATION
+ * @return the newly created object, or an existing ItemDefinition that is identical to the given String type
+ */
+ public static ItemDefinition createItemDefinition(Definitions definitions, Import imp, String structName, ItemKind kind) {
+ EObject structureRef = ModelUtil.createStringWrapper(structName);
+ return createItemDefinition(definitions, imp, structureRef, kind);
+ }
+
+
+ /**
+ * Create a new ItemDefinition for an arbitrary String type. The String is wrapped in a DynamicEObjectImpl
+ * (a.k.a. "String Wrapper") so that it can businessObject handled as a proxy EObject
+ *
+ * @param definitions - the BPMN2 Definitions parent object
+ * @param imp - the Import object where the EObject is defined
+ * @param structureRef - the EObject that defines the structure of the ItemDefinition
+ * @param kind - the ItemKind, either PHYSICAL or INFORMATION
+ * @return the newly created object, or an existing ItemDefinition that is identical to the given String type
+ */
+ public static ItemDefinition createItemDefinition(Definitions definitions, Import imp, EObject structureRef, ItemKind kind) {
+ ItemDefinition itemDef = Bpmn2ModelerFactory.create(ItemDefinition.class);
+ itemDef.setImport(imp);
+ itemDef.setItemKind(kind);
+ itemDef.setStructureRef(structureRef);
+ ItemDefinition i = findItemDefinition(definitions, itemDef);
+ if (i!=null)
+ return i;
+
+ definitions.getRootElements().add(itemDef);
+ ModelUtil.setID(itemDef);
+
+ return itemDef;
+ }
+
+ /**
+ * Convenience method for findItemDefinition(Definitions,ItemDefinition)
+ *
+ * @param definitions - the BPMN2 Definitions parent object
+ * @param imp - the Import object where the EObject is defined
+ * @param structureRef - the EObject that defines the structure of the ItemDefinition
+ * @param kind - the ItemKind, either PHYSICAL or INFORMATION
+ * @return the ItemDefinition object if found, or null
+ */
+ public static ItemDefinition findItemDefinition(Definitions definitions, Import imp, EObject structureRef, ItemKind kind) {
+ ItemDefinition itemDef = Bpmn2ModelerFactory.create(ItemDefinition.class);
+ itemDef.setImport(imp);
+ itemDef.setItemKind(kind);
+ itemDef.setStructureRef(structureRef);
+ return findItemDefinition(definitions, itemDef);
+ }
+
+ /**
+ * Search for an existing ItemDefinition object that is identical to the one specified.
+ *
+ * @param definitions - the BPMN2 Definitions parent object
+ * @param itemDef - an ItemDefinition to search for
+ * @return the ItemDefinition if it already exists, null if not
+ */
+ public static ItemDefinition findItemDefinition(Definitions definitions, ItemDefinition itemDef) {
+ ExtendedPropertiesAdapter adapter = (ExtendedPropertiesAdapter) AdapterUtil.adapt(itemDef, ExtendedPropertiesAdapter.class);
+ if (adapter!=null) {
+ List<ItemDefinition> list = ModelUtil.getAllRootElements(definitions, ItemDefinition.class);
+ for (ItemDefinition i : list) {
+ if (adapter.getObjectDescriptor().equals(i))
+ return (ItemDefinition)i;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Remove an ItemDefinition for the given Java type. This also removes the ItemDefinitions for
+ * all inner classes and interfaces.
+ *
+ * @param definitions - the BPMN2 Definitions parent object
+ * @param imp - the Import object where the Java type is defined
+ * @param clazz - the Java Class object that defines the structure of the ItemDefinition
+ */
+ public static void deleteItemDefinition(Definitions definitions, Import imp, Class clazz) {
+ for (Class c : clazz.getDeclaredClasses()) {
+ deleteItemDefinition(definitions, imp, c);
+ }
+ EObject structureRef = ModelUtil.createStringWrapper(clazz.getName());
+ ItemDefinition itemDef = findItemDefinition(definitions, imp, structureRef, ItemKind.PHYSICAL);
+ if (itemDef!=null) {
+ EcoreUtil.delete(itemDef);
+ }
+ }
+
+ /**
+ * Remove an ItemDefinition for the given String type. This will search for both PHYSICAL and
+ * INFORMATION definitions.
+ *
+ * @param definitions - the BPMN2 Definitions parent object
+ * @param imp - the Import object where the String type is defined
+ * @param structName - the type string that defines the structure of the ItemDefinition
+ */
+ public static void deleteItemDefinition(Definitions definitions, Import imp, String structName) {
+ EObject structureRef = ModelUtil.createStringWrapper(structName);
+ ItemDefinition itemDef = findItemDefinition(definitions, imp, structureRef, ItemKind.PHYSICAL);
+ if (itemDef==null)
+ itemDef = findItemDefinition(definitions, imp, structureRef, ItemKind.INFORMATION);
+
+ if (itemDef!=null) {
+ EcoreUtil.delete(itemDef);
+ }
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/ModelUtil.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/ModelUtil.java
index 0d1debc..6d82404 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/ModelUtil.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/ModelUtil.java
@@ -76,7 +76,7 @@
public class ModelUtil {
- // TODO: need to determine whether IDs need to be unique within a Resource or ResourceSet - see getKey()
+ // TODO: need to determine whether IDs need to businessObject unique within a Resource or ResourceSet - see getKey()
// Map of EMF resource sets to ID mapping tables. The ID mapping tables map a BPMN2 element ID string to the EObject.
// The EObject is not used anywhere (yet!) just a placeholder to allow use of a HashMap for fast lookups of the ID string.
@@ -90,7 +90,7 @@
protected static Hashtable<EClass,EObject> dummyObjects = new Hashtable<EClass,EObject>();
/**
- * Clear the IDs hashmap for the given EMF Resource. This should be called
+ * Clear the IDs hashmap for the given EMF Resource. This should businessObject called
* when the editor is disposed to avoid unnecessary growth of the IDs table.
*
* @param res - the EMF Resource that was used to generate the ID strings.
@@ -158,12 +158,12 @@
}
/**
- * Generate an ID string for a given BPMN2 object that will (eventually!) be added to the given Resource.
+ * Generate an ID string for a given BPMN2 object that will (eventually!) businessObject added to the given Resource.
*
- * CAUTION: IDs for objects that have already been deleted WILL be reused.
+ * CAUTION: IDs for objects that have already been deleted WILL businessObject reused.
*
* @param obj - the BPMN2 object
- * @param res - the Resource to which the object will be added
+ * @param res - the Resource to which the object will businessObject added
* @return the ID string
*/
private static String generateID(EObject obj, Resource res) {
@@ -197,7 +197,7 @@
}
/**
- * Add an ID string to the ID mapping table(s). This must be used during model import
+ * Add an ID string to the ID mapping table(s). This must businessObject used during model import
* to add existing BPMN2 element IDs to the table so we don't generate duplicates.
*
* @param obj - the BPMN2 object
@@ -220,7 +220,7 @@
}
/**
- * Add an ID string to the ID mapping table(s). This must be used during model import
+ * Add an ID string to the ID mapping table(s). This must businessObject used during model import
* to add existing BPMN2 element IDs to the table so we don't generate duplicates.
*
* @param obj - the BPMN2 object
@@ -253,7 +253,7 @@
/**
* Generate a unique ID for the given BPMN2 element and set it.
- * This should only be used during object construction AFTER an object has
+ * This should only businessObject used during object construction AFTER an object has
* already been added to a Resource.
*
* @param obj - the BPMN2 object
@@ -264,11 +264,11 @@
/**
* Generate a unique ID for the given BPMN2 element and set it.
- * This should be used during object construction if the object has NOT YET
+ * This should businessObject used during object construction if the object has NOT YET
* been added to a Resource.
*
* @param obj - the BPMN2 object
- * @param res - the Resource to which the object will be added
+ * @param res - the Resource to which the object will businessObject added
*/
public static String setID(EObject obj, Resource res) {
String id = null;
@@ -349,7 +349,7 @@
/**
* Checks if an event has a specific event definition type defined
*
- * @param event the event to be checked
+ * @param event the event to businessObject checked
* @param clazz the class of the event definition to
* @return true if the event definition is defined for this event instance, false otherwise
*/
@@ -379,7 +379,7 @@
}
/**
- * This is a slightly hacked resource set that we will be using for to solve
+ * This is a slightly hacked resource set that we will businessObject using for to solve
* the problem of loading the right resources from URLs that betray no
* information on the type of the resource.
*
@@ -407,7 +407,7 @@
}
/**
- * Return the resource set that we should be using to load "specific" type
+ * Return the resource set that we should businessObject using to load "specific" type
* of resources. The "slightlyHacked" resource set is kept in the load
* options map.
*
@@ -440,7 +440,7 @@
if (eObject == null) {
throw new NullPointerException(
- "eObject cannot be null in getNamespaceMap()");
+ "eObject cannot businessObject null in getNamespaceMap()");
}
INamespaceMap<String, String> nsMap = null;
@@ -456,7 +456,7 @@
if (nsMap == null) {
throw new IllegalStateException(
- "INamespaceMap cannot be attached to an eObject");
+ "INamespaceMap cannot businessObject attached to an eObject");
}
return nsMap;
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/NamespaceUtil.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/NamespaceUtil.java
index 120e3ba..d8b34dd 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/NamespaceUtil.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/NamespaceUtil.java
@@ -1,176 +1,176 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Bob Brodt
- ******************************************************************************/
-
-package org.eclipse.bpmn2.modeler.core.utils;
-
-import java.util.Map;
-import java.util.Map.Entry;
-
-import org.eclipse.bpmn2.DocumentRoot;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.emf.transaction.util.TransactionUtil;
-
-/**
- * @author Bob Brodt
- *
- */
-public class NamespaceUtil {
-
- public static Map<String,String> getXMLNSPrefixMap(Resource resource) {
- if (resource!=null) {
- EList<EObject> contents = resource.getContents();
- if (!contents.isEmpty() && contents.get(0) instanceof DocumentRoot) {
- return ((DocumentRoot)contents.get(0)).getXMLNSPrefixMap();
- }
- }
- return null;
- }
-
- public static String getNamespaceForPrefix(Resource resource, String prefix) {
- Map<String,String> map = getXMLNSPrefixMap(resource);
- if (map!=null)
- return map.get(prefix);
- return null;
- }
-
- public static String getPrefixForNamespace(Resource resource, String namespace) {
- Map<String,String> map = getXMLNSPrefixMap(resource);
- if (map!=null) {
- for (Entry<String, String> e : map.entrySet()) {
- String value = e.getValue();
- if (value!=null && value.equals(namespace))
- return e.getKey();
- }
- }
- return null;
- }
-
- public static boolean hasNamespace(Resource resource, String namespace) {
- Map<String,String> map = getXMLNSPrefixMap(resource);
- if (map!=null) {
- for (Entry<String, String> e : map.entrySet()) {
- String value = e.getValue();
- if (value!=null && value.equals(namespace))
- return true;
- }
- }
- return false;
- }
-
- public static boolean hasPrefix(Resource resource, String prefix) {
- Map<String,String> map = getXMLNSPrefixMap(resource);
- if (map!=null) {
- return map.containsKey(prefix);
- }
- return false;
- }
-
- public static String addNamespace(Resource resource, String namespace) {
- if (hasNamespace(resource,namespace))
- return null;
- // generate a prefix
- String prefix = null;
- Map<String,String> map = getXMLNSPrefixMap(resource);
- if (map!=null) {
- prefix = "ns";
- int index = 1;
- while (map.containsKey(prefix+index))
- ++index;
- prefix = addNamespace(resource, prefix+index, namespace);
- }
- return prefix;
- }
-
- public static String addNamespace(final Resource resource, final String prefix, final String namespace) {
- final Map<String,String> map = getXMLNSPrefixMap(resource);
- if (map!=null) {
- TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(resource);
- if (domain != null) {
- domain.getCommandStack().execute(new RecordingCommand(domain) {
- @Override
- protected void doExecute() {
- map.put(prefix, namespace);
- }
- });
- }
- return prefix;
- }
- return null;
- }
-
- /**
- * Remove the namespace prefix mapping for a given namespace.
- *
- * @param object - any EObject in the BPMN2 Resource
- * @param namespace - the namespace to be removed
- * @return the namespace prefix if the mapping was successfully removed
- * or null otherwise
- */
- public static String removeNamespace(final Resource resource, final String namespace) {
- final Map<String,String> map = getXMLNSPrefixMap(resource);
- if (map!=null) {
- String prefix = null;
- for (Entry<String, String> e : map.entrySet()) {
- String value = e.getValue();
- if (value!=null && value.equals(namespace)) {
- prefix = e.getKey();
- break;
- }
- }
- if (prefix!=null && map.containsKey(prefix)) {
- TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(resource);
- if (domain != null) {
- final String p = prefix;
- domain.getCommandStack().execute(new RecordingCommand(domain) {
- @Override
- protected void doExecute() {
- map.remove(p);
- }
- });
- }
- return prefix;
- }
- }
- return null;
- }
-
- /**
- * Remove the namespace prefix mapping for a given prefix.
- *
- * @param object - any EObject in the BPMN2 Resource
- * @param prefix - the namespace prefix to be removed
- * @return the namespace if the mapping was successfully removed
- * or null otherwise
- */
- public static String removeNamespaceForPrefix(final Resource resource, final String prefix) {
- final Map<String,String> map = getXMLNSPrefixMap(resource);
- if (map!=null && map.containsKey(prefix)) {
- TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(resource);
- if (domain != null) {
- String ns = map.get(prefix);
- domain.getCommandStack().execute(new RecordingCommand(domain) {
- @Override
- protected void doExecute() {
- map.remove(prefix);
- }
- });
- return ns;
- }
- }
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Bob Brodt
+ ******************************************************************************/
+
+package org.eclipse.bpmn2.modeler.core.utils;
+
+import java.util.Map;
+import java.util.Map.Entry;
+
+import org.eclipse.bpmn2.DocumentRoot;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.util.TransactionUtil;
+
+/**
+ * @author Bob Brodt
+ *
+ */
+public class NamespaceUtil {
+
+ public static Map<String,String> getXMLNSPrefixMap(Resource resource) {
+ if (resource!=null) {
+ EList<EObject> contents = resource.getContents();
+ if (!contents.isEmpty() && contents.get(0) instanceof DocumentRoot) {
+ return ((DocumentRoot)contents.get(0)).getXMLNSPrefixMap();
+ }
+ }
+ return null;
+ }
+
+ public static String getNamespaceForPrefix(Resource resource, String prefix) {
+ Map<String,String> map = getXMLNSPrefixMap(resource);
+ if (map!=null)
+ return map.get(prefix);
+ return null;
+ }
+
+ public static String getPrefixForNamespace(Resource resource, String namespace) {
+ Map<String,String> map = getXMLNSPrefixMap(resource);
+ if (map!=null) {
+ for (Entry<String, String> e : map.entrySet()) {
+ String value = e.getValue();
+ if (value!=null && value.equals(namespace))
+ return e.getKey();
+ }
+ }
+ return null;
+ }
+
+ public static boolean hasNamespace(Resource resource, String namespace) {
+ Map<String,String> map = getXMLNSPrefixMap(resource);
+ if (map!=null) {
+ for (Entry<String, String> e : map.entrySet()) {
+ String value = e.getValue();
+ if (value!=null && value.equals(namespace))
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public static boolean hasPrefix(Resource resource, String prefix) {
+ Map<String,String> map = getXMLNSPrefixMap(resource);
+ if (map!=null) {
+ return map.containsKey(prefix);
+ }
+ return false;
+ }
+
+ public static String addNamespace(Resource resource, String namespace) {
+ if (hasNamespace(resource,namespace))
+ return null;
+ // generate a prefix
+ String prefix = null;
+ Map<String,String> map = getXMLNSPrefixMap(resource);
+ if (map!=null) {
+ prefix = "ns";
+ int index = 1;
+ while (map.containsKey(prefix+index))
+ ++index;
+ prefix = addNamespace(resource, prefix+index, namespace);
+ }
+ return prefix;
+ }
+
+ public static String addNamespace(final Resource resource, final String prefix, final String namespace) {
+ final Map<String,String> map = getXMLNSPrefixMap(resource);
+ if (map!=null) {
+ TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(resource);
+ if (domain != null) {
+ domain.getCommandStack().execute(new RecordingCommand(domain) {
+ @Override
+ protected void doExecute() {
+ map.put(prefix, namespace);
+ }
+ });
+ }
+ return prefix;
+ }
+ return null;
+ }
+
+ /**
+ * Remove the namespace prefix mapping for a given namespace.
+ *
+ * @param object - any EObject in the BPMN2 Resource
+ * @param namespace - the namespace to businessObject removed
+ * @return the namespace prefix if the mapping was successfully removed
+ * or null otherwise
+ */
+ public static String removeNamespace(final Resource resource, final String namespace) {
+ final Map<String,String> map = getXMLNSPrefixMap(resource);
+ if (map!=null) {
+ String prefix = null;
+ for (Entry<String, String> e : map.entrySet()) {
+ String value = e.getValue();
+ if (value!=null && value.equals(namespace)) {
+ prefix = e.getKey();
+ break;
+ }
+ }
+ if (prefix!=null && map.containsKey(prefix)) {
+ TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(resource);
+ if (domain != null) {
+ final String p = prefix;
+ domain.getCommandStack().execute(new RecordingCommand(domain) {
+ @Override
+ protected void doExecute() {
+ map.remove(p);
+ }
+ });
+ }
+ return prefix;
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Remove the namespace prefix mapping for a given prefix.
+ *
+ * @param object - any EObject in the BPMN2 Resource
+ * @param prefix - the namespace prefix to businessObject removed
+ * @return the namespace if the mapping was successfully removed
+ * or null otherwise
+ */
+ public static String removeNamespaceForPrefix(final Resource resource, final String prefix) {
+ final Map<String,String> map = getXMLNSPrefixMap(resource);
+ if (map!=null && map.containsKey(prefix)) {
+ TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(resource);
+ if (domain != null) {
+ String ns = map.get(prefix);
+ domain.getCommandStack().execute(new RecordingCommand(domain) {
+ @Override
+ protected void doExecute() {
+ map.remove(prefix);
+ }
+ });
+ return ns;
+ }
+ }
+ return null;
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/BPMN2BatchValidationConstraint.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/BPMN2BatchValidationConstraint.java
index 9792d6d..b9e7932 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/BPMN2BatchValidationConstraint.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/BPMN2BatchValidationConstraint.java
@@ -335,34 +335,34 @@
if (gw.getGatewayDirection().getValue() != GatewayDirection.DIVERGING.getValue()
&& gw.getGatewayDirection().getValue() != GatewayDirection.CONVERGING.getValue()) {
return ctx.createFailureStatus(
- "Invalid Gateway direction for Exclusing Gateway. It should be 'Converging' or 'Diverging'");
+ "Invalid Gateway direction for Exclusing Gateway. It should businessObject 'Converging' or 'Diverging'");
}
}
if (gw instanceof EventBasedGateway) {
if (gw.getGatewayDirection().getValue() != GatewayDirection.DIVERGING.getValue()) {
return ctx.createFailureStatus(
- "Invalid Gateway direction for EventBased Gateway. It should be 'Diverging'");
+ "Invalid Gateway direction for EventBased Gateway. It should businessObject 'Diverging'");
}
}
if (gw instanceof ParallelGateway) {
if (gw.getGatewayDirection().getValue() != GatewayDirection.DIVERGING.getValue()
&& gw.getGatewayDirection().getValue() != GatewayDirection.CONVERGING.getValue()) {
return ctx.createFailureStatus(
- "Invalid Gateway direction for Parallel Gateway. It should be 'Converging' or 'Diverging'");
+ "Invalid Gateway direction for Parallel Gateway. It should businessObject 'Converging' or 'Diverging'");
}
}
if (gw instanceof InclusiveGateway) {
if (gw.getGatewayDirection().getValue() != GatewayDirection.DIVERGING.getValue()
&& gw.getGatewayDirection().getValue() != GatewayDirection.CONVERGING.getValue()) {
return ctx.createFailureStatus(
- "Invalid Gateway direction for Inclusive Gateway. It should be 'Converging' or 'Diverging'");
+ "Invalid Gateway direction for Inclusive Gateway. It should businessObject 'Converging' or 'Diverging'");
}
}
if (gw instanceof ComplexGateway) {
if (gw.getGatewayDirection().getValue() != GatewayDirection.DIVERGING.getValue()
&& gw.getGatewayDirection().getValue() != GatewayDirection.CONVERGING.getValue()) {
return ctx.createFailureStatus(
- "Invalid Gateway direction for Complex Gateway. It should be 'Converging' or 'Diverging'");
+ "Invalid Gateway direction for Complex Gateway. It should businessObject 'Converging' or 'Diverging'");
}
}
}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/BPMN2ProjectValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/BPMN2ProjectValidator.java
index 72c8a8f..24c0c23 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/BPMN2ProjectValidator.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/BPMN2ProjectValidator.java
@@ -169,7 +169,7 @@
project.getName()+
"' has not been configured with the BPMN2 Project Nature.\n\n"+
"Adding the BPMN2 Project Nature will cause all BPMN2 files in this project"+
- "to be validated automatically whenever the project is built.\n\n"+
+ "to businessObject validated automatically whenever the project is built.\n\n"+
"Do you want to add this Nature to the Project now?";
MessageDialogWithToggle result = MessageDialogWithToggle.open(
MessageDialog.QUESTION,
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/BPMN2ValidationStatusLoader.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/BPMN2ValidationStatusLoader.java
index 2e2178f..1c973f4 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/BPMN2ValidationStatusLoader.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/BPMN2ValidationStatusLoader.java
@@ -60,7 +60,7 @@
IStatus status = convertMarker(marker, markedObject);
// also add an adapter to each affected EObject in the result locus
- // TODO: do we need this? it causes duplicate messages to be created for each marker
+ // TODO: do we need this? it causes duplicate messages to businessObject created for each marker
// better to have the constraint handler create additional error messages as needed.
// if (status instanceof ConstraintStatus) {
// ConstraintStatus cs = (ConstraintStatus) status;
diff --git a/org.eclipse.bpmn2.modeler.runtime.example/src/org/eclipse/bpmn2/modeler/runtime/example/SampleModel/DocumentRoot.java b/org.eclipse.bpmn2.modeler.runtime.example/src/org/eclipse/bpmn2/modeler/runtime/example/SampleModel/DocumentRoot.java
index a5714d4..0604102 100644
--- a/org.eclipse.bpmn2.modeler.runtime.example/src/org/eclipse/bpmn2/modeler/runtime/example/SampleModel/DocumentRoot.java
+++ b/org.eclipse.bpmn2.modeler.runtime.example/src/org/eclipse/bpmn2/modeler/runtime/example/SampleModel/DocumentRoot.java
@@ -29,7 +29,7 @@
* <!-- begin-user-doc -->
* <p>
* If the meaning of the '<em>Sample Custom Task Id</em>' attribute isn't clear,
- * there really should be more of a description here...
+ * there really should businessObject more of a description here...
* </p>
* <!-- end-user-doc -->
* @return the value of the '<em>Sample Custom Task Id</em>' attribute.
diff --git a/org.eclipse.bpmn2.modeler.runtime.example/src/org/eclipse/bpmn2/modeler/runtime/example/SampleModel/impl/SampleModelPackageImpl.java b/org.eclipse.bpmn2.modeler.runtime.example/src/org/eclipse/bpmn2/modeler/runtime/example/SampleModel/impl/SampleModelPackageImpl.java
index c83d480..77da44f 100644
--- a/org.eclipse.bpmn2.modeler.runtime.example/src/org/eclipse/bpmn2/modeler/runtime/example/SampleModel/impl/SampleModelPackageImpl.java
+++ b/org.eclipse.bpmn2.modeler.runtime.example/src/org/eclipse/bpmn2/modeler/runtime/example/SampleModel/impl/SampleModelPackageImpl.java
@@ -96,7 +96,7 @@
// Initialize created meta-data
theSampleModelPackage.initializePackageContents();
- // Mark meta-data to indicate it can't be changed
+ // Mark meta-data to indicate it can't businessObject changed
theSampleModelPackage.freeze();
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/customeditor/EditBeanDialog.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/customeditor/EditBeanDialog.java
index 3718057..6094f8e 100644
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/customeditor/EditBeanDialog.java
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/customeditor/EditBeanDialog.java
@@ -1,73 +1,73 @@
-/*
- * Copyright 2005 JBoss Inc
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.customeditor;
-
-import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.Activator;
-import org.eclipse.bpmn2.modeler.ui.util.PropertyUtil;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.ErrorDialog;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.graphics.Point;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * Dialog for editing a JavaBean.
- */
-public abstract class EditBeanDialog<T> extends Dialog {
-
- private String title;
- private T value;
-
- protected EditBeanDialog(Shell parentShell, String title) {
- super(parentShell);
- this.title = title;
- setShellStyle(getShellStyle() | SWT.RESIZE);
- }
-
- protected void configureShell(Shell newShell) {
- super.configureShell(newShell);
- newShell.setText(title);
- }
-
- public T getValue() {
- return value;
- }
-
- protected void okPressed() {
- try {
- value = updateValue(value);
- super.okPressed();
- } catch (IllegalArgumentException e) {
- showError(e.getMessage());
- // value could not be set, ignoring ok
- }
- }
-
- protected abstract T updateValue(T value);
-
- public void setValue(T value) {
- this.value = value;
- }
-
- protected void showError(String error) {
- MessageDialog.openError(getShell(), "Error", error);
- }
-}
+/*
+ * Copyright 2005 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.customeditor;
+
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.Activator;
+import org.eclipse.bpmn2.modeler.ui.util.PropertyUtil;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.ErrorDialog;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * Dialog for editing a JavaBean.
+ */
+public abstract class EditBeanDialog<T> extends Dialog {
+
+ private String title;
+ private T value;
+
+ protected EditBeanDialog(Shell parentShell, String title) {
+ super(parentShell);
+ this.title = title;
+ setShellStyle(getShellStyle() | SWT.RESIZE);
+ }
+
+ protected void configureShell(Shell newShell) {
+ super.configureShell(newShell);
+ newShell.setText(title);
+ }
+
+ public T getValue() {
+ return value;
+ }
+
+ protected void okPressed() {
+ try {
+ value = updateValue(value);
+ super.okPressed();
+ } catch (IllegalArgumentException e) {
+ showError(e.getMessage());
+ // value could not businessObject set, ignoring ok
+ }
+ }
+
+ protected abstract T updateValue(T value);
+
+ public void setValue(T value) {
+ this.value = value;
+ }
+
+ protected void showError(String error) {
+ MessageDialog.openError(getShell(), "Error", error);
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/drools/process/core/impl/ParameterDefinitionImpl.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/drools/process/core/impl/ParameterDefinitionImpl.java
index e39b89e..8e06f58 100644
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/drools/process/core/impl/ParameterDefinitionImpl.java
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/drools/process/core/impl/ParameterDefinitionImpl.java
@@ -1,64 +1,64 @@
-/*
- * Copyright 2010 JBoss Inc
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.drools.process.core.impl;
-
-import java.io.Serializable;
-
-import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.drools.process.core.ParameterDefinition;
-import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.drools.process.core.datatype.DataType;
-
-public class ParameterDefinitionImpl implements ParameterDefinition, Serializable {
-
- private static final long serialVersionUID = 510l;
-
- private String name;
- private DataType type;
-
- public ParameterDefinitionImpl() {
- }
-
- public ParameterDefinitionImpl(String name, DataType type) {
- setName(name);
- setType(type);
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- if (name == null) {
- throw new IllegalArgumentException("Name cannot be null");
- }
- this.name = name;
- }
-
- public DataType getType() {
- return type;
- }
-
- public void setType(DataType type) {
- if (type == null) {
- throw new IllegalArgumentException("Data type cannot be null");
- }
- this.type = type;
- }
-
- public String toString() {
- return name;
- }
-}
+/*
+ * Copyright 2010 JBoss Inc
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.drools.process.core.impl;
+
+import java.io.Serializable;
+
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.drools.process.core.ParameterDefinition;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.drools.process.core.datatype.DataType;
+
+public class ParameterDefinitionImpl implements ParameterDefinition, Serializable {
+
+ private static final long serialVersionUID = 510l;
+
+ private String name;
+ private DataType type;
+
+ public ParameterDefinitionImpl() {
+ }
+
+ public ParameterDefinitionImpl(String name, DataType type) {
+ setName(name);
+ setType(type);
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ if (name == null) {
+ throw new IllegalArgumentException("Name cannot businessObject null");
+ }
+ this.name = name;
+ }
+
+ public DataType getType() {
+ return type;
+ }
+
+ public void setType(DataType type) {
+ if (type == null) {
+ throw new IllegalArgumentException("Data type cannot businessObject null");
+ }
+ this.type = type;
+ }
+
+ public String toString() {
+ return name;
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/model/DocumentRoot.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/model/DocumentRoot.java
index 8b70b88..1840a4b 100644
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/model/DocumentRoot.java
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/model/DocumentRoot.java
@@ -1,333 +1,333 @@
-/**
- * <copyright>
- * </copyright>
- *
- * $Id$
- */
-package org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model;
-
-import java.math.BigInteger;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Document Root</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getGlobal <em>Global</em>}</li>
- * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getImportType <em>Import Type</em>}</li>
- * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getOnEntryScript <em>On Entry Script</em>}</li>
- * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getOnExitScript <em>On Exit Script</em>}</li>
- * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getPackageName <em>Package Name</em>}</li>
- * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getPriority <em>Priority</em>}</li>
- * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getRuleFlowGroup <em>Rule Flow Group</em>}</li>
- * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getTaskName <em>Task Name</em>}</li>
- * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getVersion <em>Version</em>}</li>
- * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#isWaitForCompletion <em>Wait For Completion</em>}</li>
- * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#isIndependent <em>Independent</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getDocumentRoot()
- * @model extendedMetaData="name='' kind='mixed' namespace='##targetNamespace'"
- * @generated
- */
-public interface DocumentRoot extends org.eclipse.bpmn2.DocumentRoot {
- /**
- * Returns the value of the '<em><b>Global</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Global</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Global</em>' containment reference.
- * @see #setGlobal(GlobalType)
- * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getDocumentRoot_Global()
- * @model containment="true" upper="-2" transient="true" volatile="true" derived="true"
- * extendedMetaData="kind='element' name='global' namespace='##targetNamespace'"
- * @generated
- */
- GlobalType getGlobal();
-
- /**
- * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getGlobal <em>Global</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Global</em>' containment reference.
- * @see #getGlobal()
- * @generated
- */
- void setGlobal(GlobalType value);
-
- /**
- * Returns the value of the '<em><b>Import Type</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Import Type</em>' containment reference isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Import Type</em>' containment reference.
- * @see #setImportType(ImportType)
- * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getDocumentRoot_ImportType()
- * @model containment="true" upper="-2" transient="true" volatile="true" derived="true"
- * extendedMetaData="kind='element' name='import' namespace='##targetNamespace'"
- * @generated
- */
- ImportType getImportType();
-
- /**
- * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getImportType <em>Import Type</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Import Type</em>' containment reference.
- * @see #getImportType()
- * @generated
- */
- void setImportType(ImportType value);
-
- /**
- * Returns the value of the '<em><b>On Entry Script</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>On Entry Script</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>On Entry Script</em>' containment reference.
- * @see #setOnEntryScript(OnEntryScriptType)
- * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getDocumentRoot_OnEntryScript()
- * @model containment="true" upper="-2" transient="true" volatile="true" derived="true"
- * extendedMetaData="kind='element' name='onEntry-script' namespace='##targetNamespace'"
- * @generated
- */
- OnEntryScriptType getOnEntryScript();
-
- /**
- * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getOnEntryScript <em>On Entry Script</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>On Entry Script</em>' containment reference.
- * @see #getOnEntryScript()
- * @generated
- */
- void setOnEntryScript(OnEntryScriptType value);
-
- /**
- * Returns the value of the '<em><b>On Exit Script</b></em>' containment reference.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>On Exit Script</em>' containment reference list isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>On Exit Script</em>' containment reference.
- * @see #setOnExitScript(OnExitScriptType)
- * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getDocumentRoot_OnExitScript()
- * @model containment="true" upper="-2" transient="true" volatile="true" derived="true"
- * extendedMetaData="kind='element' name='onExit-script' namespace='##targetNamespace'"
- * @generated
- */
- OnExitScriptType getOnExitScript();
-
- /**
- * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getOnExitScript <em>On Exit Script</em>}' containment reference.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>On Exit Script</em>' containment reference.
- * @see #getOnExitScript()
- * @generated
- */
- void setOnExitScript(OnExitScriptType value);
-
- /**
- * Returns the value of the '<em><b>Package Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Package Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Package Name</em>' attribute.
- * @see #setPackageName(String)
- * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getDocumentRoot_PackageName()
- * @model dataType="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.PackageNameType"
- * extendedMetaData="kind='attribute' name='packageName' namespace='##targetNamespace'"
- * @generated
- */
- String getPackageName();
-
- /**
- * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getPackageName <em>Package Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Package Name</em>' attribute.
- * @see #getPackageName()
- * @generated
- */
- void setPackageName(String value);
-
- /**
- * Returns the value of the '<em><b>Priority</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Priority</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Priority</em>' attribute.
- * @see #setPriority(BigInteger)
- * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getDocumentRoot_Priority()
- * @model dataType="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.PriorityType"
- * extendedMetaData="kind='attribute' name='priority' namespace='##targetNamespace'"
- * @generated
- */
- BigInteger getPriority();
-
- /**
- * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getPriority <em>Priority</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Priority</em>' attribute.
- * @see #getPriority()
- * @generated
- */
- void setPriority(BigInteger value);
-
- /**
- * Returns the value of the '<em><b>Rule Flow Group</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Rule Flow Group</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Rule Flow Group</em>' attribute.
- * @see #setRuleFlowGroup(String)
- * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getDocumentRoot_RuleFlowGroup()
- * @model dataType="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.RuleFlowGroupType"
- * extendedMetaData="kind='attribute' name='ruleFlowGroup' namespace='##targetNamespace'"
- * @generated
- */
- String getRuleFlowGroup();
-
- /**
- * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getRuleFlowGroup <em>Rule Flow Group</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Rule Flow Group</em>' attribute.
- * @see #getRuleFlowGroup()
- * @generated
- */
- void setRuleFlowGroup(String value);
-
- /**
- * Returns the value of the '<em><b>Task Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Task Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Task Name</em>' attribute.
- * @see #setTaskName(String)
- * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getDocumentRoot_TaskName()
- * @model dataType="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.TaskNameType"
- * extendedMetaData="kind='attribute' name='taskName' namespace='##targetNamespace'"
- * @generated
- */
- String getTaskName();
-
- /**
- * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getTaskName <em>Task Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Task Name</em>' attribute.
- * @see #getTaskName()
- * @generated
- */
- void setTaskName(String value);
-
- /**
- * Returns the value of the '<em><b>Version</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Version</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Version</em>' attribute.
- * @see #setVersion(BigInteger)
- * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getDocumentRoot_Version()
- * @model dataType="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.VersionType"
- * extendedMetaData="kind='attribute' name='version' namespace='##targetNamespace'"
- * @generated
- */
- BigInteger getVersion();
-
- /**
- * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getVersion <em>Version</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Version</em>' attribute.
- * @see #getVersion()
- * @generated
- */
- void setVersion(BigInteger value);
-
- /**
- * Returns the value of the '<em><b>Wait For Completion</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Wait For Completion</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Wait For Completion</em>' attribute.
- * @see #setWaitForCompletion(boolean)
- * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getDocumentRoot_WaitForCompletion()
- * @model extendedMetaData="kind='attribute' name='waitForCompletion' namespace='##targetNamespace'"
- * @generated
- */
- boolean isWaitForCompletion();
-
- /**
- * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#isWaitForCompletion <em>Wait For Completion</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Wait For Completion</em>' attribute.
- * @see #isWaitForCompletion()
- * @generated
- */
- void setWaitForCompletion(boolean value);
-
- /**
- * Returns the value of the '<em><b>Independent</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Independent</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Independent</em>' attribute.
- * @see #setIndependent(boolean)
- * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getDocumentRoot_Independent()
- * @model extendedMetaData="kind='attribute' name='independent' namespace='##targetNamespace'"
- * @generated
- */
- boolean isIndependent();
-
- /**
- * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#isIndependent <em>Independent</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Independent</em>' attribute.
- * @see #isIndependent()
- * @generated
- */
- void setIndependent(boolean value);
-
-} // DocumentRoot
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model;
+
+import java.math.BigInteger;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Document Root</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getGlobal <em>Global</em>}</li>
+ * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getImportType <em>Import Type</em>}</li>
+ * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getOnEntryScript <em>On Entry Script</em>}</li>
+ * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getOnExitScript <em>On Exit Script</em>}</li>
+ * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getPackageName <em>Package Name</em>}</li>
+ * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getPriority <em>Priority</em>}</li>
+ * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getRuleFlowGroup <em>Rule Flow Group</em>}</li>
+ * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getTaskName <em>Task Name</em>}</li>
+ * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getVersion <em>Version</em>}</li>
+ * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#isWaitForCompletion <em>Wait For Completion</em>}</li>
+ * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#isIndependent <em>Independent</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getDocumentRoot()
+ * @model extendedMetaData="name='' kind='mixed' namespace='##targetNamespace'"
+ * @generated
+ */
+public interface DocumentRoot extends org.eclipse.bpmn2.DocumentRoot {
+ /**
+ * Returns the value of the '<em><b>Global</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Global</em>' containment reference isn't clear,
+ * there really should businessObject more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Global</em>' containment reference.
+ * @see #setGlobal(GlobalType)
+ * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getDocumentRoot_Global()
+ * @model containment="true" upper="-2" transient="true" volatile="true" derived="true"
+ * extendedMetaData="kind='element' name='global' namespace='##targetNamespace'"
+ * @generated
+ */
+ GlobalType getGlobal();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getGlobal <em>Global</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Global</em>' containment reference.
+ * @see #getGlobal()
+ * @generated
+ */
+ void setGlobal(GlobalType value);
+
+ /**
+ * Returns the value of the '<em><b>Import Type</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Import Type</em>' containment reference isn't clear,
+ * there really should businessObject more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Import Type</em>' containment reference.
+ * @see #setImportType(ImportType)
+ * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getDocumentRoot_ImportType()
+ * @model containment="true" upper="-2" transient="true" volatile="true" derived="true"
+ * extendedMetaData="kind='element' name='import' namespace='##targetNamespace'"
+ * @generated
+ */
+ ImportType getImportType();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getImportType <em>Import Type</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Import Type</em>' containment reference.
+ * @see #getImportType()
+ * @generated
+ */
+ void setImportType(ImportType value);
+
+ /**
+ * Returns the value of the '<em><b>On Entry Script</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>On Entry Script</em>' containment reference list isn't clear,
+ * there really should businessObject more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>On Entry Script</em>' containment reference.
+ * @see #setOnEntryScript(OnEntryScriptType)
+ * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getDocumentRoot_OnEntryScript()
+ * @model containment="true" upper="-2" transient="true" volatile="true" derived="true"
+ * extendedMetaData="kind='element' name='onEntry-script' namespace='##targetNamespace'"
+ * @generated
+ */
+ OnEntryScriptType getOnEntryScript();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getOnEntryScript <em>On Entry Script</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>On Entry Script</em>' containment reference.
+ * @see #getOnEntryScript()
+ * @generated
+ */
+ void setOnEntryScript(OnEntryScriptType value);
+
+ /**
+ * Returns the value of the '<em><b>On Exit Script</b></em>' containment reference.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>On Exit Script</em>' containment reference list isn't clear,
+ * there really should businessObject more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>On Exit Script</em>' containment reference.
+ * @see #setOnExitScript(OnExitScriptType)
+ * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getDocumentRoot_OnExitScript()
+ * @model containment="true" upper="-2" transient="true" volatile="true" derived="true"
+ * extendedMetaData="kind='element' name='onExit-script' namespace='##targetNamespace'"
+ * @generated
+ */
+ OnExitScriptType getOnExitScript();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getOnExitScript <em>On Exit Script</em>}' containment reference.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>On Exit Script</em>' containment reference.
+ * @see #getOnExitScript()
+ * @generated
+ */
+ void setOnExitScript(OnExitScriptType value);
+
+ /**
+ * Returns the value of the '<em><b>Package Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Package Name</em>' attribute isn't clear,
+ * there really should businessObject more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Package Name</em>' attribute.
+ * @see #setPackageName(String)
+ * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getDocumentRoot_PackageName()
+ * @model dataType="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.PackageNameType"
+ * extendedMetaData="kind='attribute' name='packageName' namespace='##targetNamespace'"
+ * @generated
+ */
+ String getPackageName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getPackageName <em>Package Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Package Name</em>' attribute.
+ * @see #getPackageName()
+ * @generated
+ */
+ void setPackageName(String value);
+
+ /**
+ * Returns the value of the '<em><b>Priority</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Priority</em>' attribute isn't clear,
+ * there really should businessObject more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Priority</em>' attribute.
+ * @see #setPriority(BigInteger)
+ * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getDocumentRoot_Priority()
+ * @model dataType="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.PriorityType"
+ * extendedMetaData="kind='attribute' name='priority' namespace='##targetNamespace'"
+ * @generated
+ */
+ BigInteger getPriority();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getPriority <em>Priority</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Priority</em>' attribute.
+ * @see #getPriority()
+ * @generated
+ */
+ void setPriority(BigInteger value);
+
+ /**
+ * Returns the value of the '<em><b>Rule Flow Group</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Rule Flow Group</em>' attribute isn't clear,
+ * there really should businessObject more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Rule Flow Group</em>' attribute.
+ * @see #setRuleFlowGroup(String)
+ * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getDocumentRoot_RuleFlowGroup()
+ * @model dataType="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.RuleFlowGroupType"
+ * extendedMetaData="kind='attribute' name='ruleFlowGroup' namespace='##targetNamespace'"
+ * @generated
+ */
+ String getRuleFlowGroup();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getRuleFlowGroup <em>Rule Flow Group</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Rule Flow Group</em>' attribute.
+ * @see #getRuleFlowGroup()
+ * @generated
+ */
+ void setRuleFlowGroup(String value);
+
+ /**
+ * Returns the value of the '<em><b>Task Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Task Name</em>' attribute isn't clear,
+ * there really should businessObject more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Task Name</em>' attribute.
+ * @see #setTaskName(String)
+ * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getDocumentRoot_TaskName()
+ * @model dataType="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.TaskNameType"
+ * extendedMetaData="kind='attribute' name='taskName' namespace='##targetNamespace'"
+ * @generated
+ */
+ String getTaskName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getTaskName <em>Task Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Task Name</em>' attribute.
+ * @see #getTaskName()
+ * @generated
+ */
+ void setTaskName(String value);
+
+ /**
+ * Returns the value of the '<em><b>Version</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Version</em>' attribute isn't clear,
+ * there really should businessObject more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Version</em>' attribute.
+ * @see #setVersion(BigInteger)
+ * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getDocumentRoot_Version()
+ * @model dataType="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.VersionType"
+ * extendedMetaData="kind='attribute' name='version' namespace='##targetNamespace'"
+ * @generated
+ */
+ BigInteger getVersion();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#getVersion <em>Version</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Version</em>' attribute.
+ * @see #getVersion()
+ * @generated
+ */
+ void setVersion(BigInteger value);
+
+ /**
+ * Returns the value of the '<em><b>Wait For Completion</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Wait For Completion</em>' attribute isn't clear,
+ * there really should businessObject more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Wait For Completion</em>' attribute.
+ * @see #setWaitForCompletion(boolean)
+ * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getDocumentRoot_WaitForCompletion()
+ * @model extendedMetaData="kind='attribute' name='waitForCompletion' namespace='##targetNamespace'"
+ * @generated
+ */
+ boolean isWaitForCompletion();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#isWaitForCompletion <em>Wait For Completion</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Wait For Completion</em>' attribute.
+ * @see #isWaitForCompletion()
+ * @generated
+ */
+ void setWaitForCompletion(boolean value);
+
+ /**
+ * Returns the value of the '<em><b>Independent</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Independent</em>' attribute isn't clear,
+ * there really should businessObject more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Independent</em>' attribute.
+ * @see #setIndependent(boolean)
+ * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getDocumentRoot_Independent()
+ * @model extendedMetaData="kind='attribute' name='independent' namespace='##targetNamespace'"
+ * @generated
+ */
+ boolean isIndependent();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot#isIndependent <em>Independent</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Independent</em>' attribute.
+ * @see #isIndependent()
+ * @generated
+ */
+ void setIndependent(boolean value);
+
+} // DocumentRoot
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/model/GlobalType.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/model/GlobalType.java
index 703999b..4ea8c8b 100644
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/model/GlobalType.java
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/model/GlobalType.java
@@ -1,83 +1,83 @@
-/**
- * <copyright>
- * </copyright>
- *
- * $Id$
- */
-package org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model;
-
-import org.eclipse.emf.ecore.EObject;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Global Type</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.GlobalType#getIdentifier <em>Identifier</em>}</li>
- * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.GlobalType#getType <em>Type</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getGlobalType()
- * @model extendedMetaData="name='global_._type' kind='element' namespace='##targetNamespace'"
- * @generated
- */
-public interface GlobalType extends EObject {
- /**
- * Returns the value of the '<em><b>Identifier</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Identifier</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Identifier</em>' attribute.
- * @see #setIdentifier(String)
- * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getGlobalType_Identifier()
- * @model required="true"
- * extendedMetaData="kind='attribute' name='identifier' namespace='##targetNamespace'"
- * @generated
- */
- String getIdentifier();
-
- /**
- * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.GlobalType#getIdentifier <em>Identifier</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Identifier</em>' attribute.
- * @see #getIdentifier()
- * @generated
- */
- void setIdentifier(String value);
-
- /**
- * Returns the value of the '<em><b>Type</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Type</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Type</em>' attribute.
- * @see #setType(String)
- * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getGlobalType_Type()
- * @model required="true"
- * extendedMetaData="kind='attribute' name='type' namespace='##targetNamespace'"
- * @generated
- */
- String getType();
-
- /**
- * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.GlobalType#getType <em>Type</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Type</em>' attribute.
- * @see #getType()
- * @generated
- */
- void setType(String value);
-
-} // GlobalType
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Global Type</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.GlobalType#getIdentifier <em>Identifier</em>}</li>
+ * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.GlobalType#getType <em>Type</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getGlobalType()
+ * @model extendedMetaData="name='global_._type' kind='element' namespace='##targetNamespace'"
+ * @generated
+ */
+public interface GlobalType extends EObject {
+ /**
+ * Returns the value of the '<em><b>Identifier</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Identifier</em>' attribute isn't clear,
+ * there really should businessObject more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Identifier</em>' attribute.
+ * @see #setIdentifier(String)
+ * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getGlobalType_Identifier()
+ * @model required="true"
+ * extendedMetaData="kind='attribute' name='identifier' namespace='##targetNamespace'"
+ * @generated
+ */
+ String getIdentifier();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.GlobalType#getIdentifier <em>Identifier</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Identifier</em>' attribute.
+ * @see #getIdentifier()
+ * @generated
+ */
+ void setIdentifier(String value);
+
+ /**
+ * Returns the value of the '<em><b>Type</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Type</em>' attribute isn't clear,
+ * there really should businessObject more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Type</em>' attribute.
+ * @see #setType(String)
+ * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getGlobalType_Type()
+ * @model required="true"
+ * extendedMetaData="kind='attribute' name='type' namespace='##targetNamespace'"
+ * @generated
+ */
+ String getType();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.GlobalType#getType <em>Type</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Type</em>' attribute.
+ * @see #getType()
+ * @generated
+ */
+ void setType(String value);
+
+} // GlobalType
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/model/ImportType.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/model/ImportType.java
index 3f2dd30..e6a417d 100644
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/model/ImportType.java
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/model/ImportType.java
@@ -1,55 +1,55 @@
-/**
- * <copyright>
- * </copyright>
- *
- * $Id$
- */
-package org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model;
-
-import org.eclipse.emf.ecore.EObject;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>Import Type</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ImportType#getName <em>Name</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getImportType()
- * @model extendedMetaData="name='import_._type' kind='element' namespace='##targetNamespace'"
- * @generated
- */
-public interface ImportType extends EObject {
- /**
- * Returns the value of the '<em><b>Name</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Name</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Name</em>' attribute.
- * @see #setName(String)
- * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getImportType_Name()
- * @model required="true"
- * extendedMetaData="kind='attribute' name='name'"
- * @generated
- */
- String getName();
-
- /**
- * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ImportType#getName <em>Name</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Name</em>' attribute.
- * @see #getName()
- * @generated
- */
- void setName(String value);
-
-} // ImportType
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>Import Type</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ImportType#getName <em>Name</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getImportType()
+ * @model extendedMetaData="name='import_._type' kind='element' namespace='##targetNamespace'"
+ * @generated
+ */
+public interface ImportType extends EObject {
+ /**
+ * Returns the value of the '<em><b>Name</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Name</em>' attribute isn't clear,
+ * there really should businessObject more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Name</em>' attribute.
+ * @see #setName(String)
+ * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getImportType_Name()
+ * @model required="true"
+ * extendedMetaData="kind='attribute' name='name'"
+ * @generated
+ */
+ String getName();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ImportType#getName <em>Name</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Name</em>' attribute.
+ * @see #getName()
+ * @generated
+ */
+ void setName(String value);
+
+} // ImportType
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/model/OnEntryScriptType.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/model/OnEntryScriptType.java
index e784aad..725611b 100644
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/model/OnEntryScriptType.java
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/model/OnEntryScriptType.java
@@ -1,83 +1,83 @@
-/**
- * <copyright>
- * </copyright>
- *
- * $Id$
- */
-package org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model;
-
-import org.eclipse.emf.ecore.EObject;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>On Entry Script Type</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.OnEntryScriptType#getScript <em>Script</em>}</li>
- * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.OnEntryScriptType#getScriptFormat <em>Script Format</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getOnEntryScriptType()
- * @model extendedMetaData="name='onEntry-script_._type' kind='elementOnly' namespace='##targetNamespace'"
- * @generated
- */
-public interface OnEntryScriptType extends EObject {
- /**
- * Returns the value of the '<em><b>Script</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Script</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Script</em>' attribute.
- * @see #setScript(String)
- * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getOnEntryScriptType_Script()
- * @model required="true"
- * extendedMetaData="kind='element' name='script' namespace='##targetNamespace'"
- * @generated
- */
- String getScript();
-
- /**
- * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.OnEntryScriptType#getScript <em>Script</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Script</em>' attribute.
- * @see #getScript()
- * @generated
- */
- void setScript(String value);
-
- /**
- * Returns the value of the '<em><b>Script Format</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Script Format</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Script Format</em>' attribute.
- * @see #setScriptFormat(String)
- * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getOnEntryScriptType_ScriptFormat()
- * @model required="true"
- * extendedMetaData="kind='attribute' name='scriptFormat' namespace='##targetNamespace'"
- * @generated
- */
- String getScriptFormat();
-
- /**
- * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.OnEntryScriptType#getScriptFormat <em>Script Format</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Script Format</em>' attribute.
- * @see #getScriptFormat()
- * @generated
- */
- void setScriptFormat(String value);
-
-} // OnEntryScriptType
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>On Entry Script Type</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.OnEntryScriptType#getScript <em>Script</em>}</li>
+ * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.OnEntryScriptType#getScriptFormat <em>Script Format</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getOnEntryScriptType()
+ * @model extendedMetaData="name='onEntry-script_._type' kind='elementOnly' namespace='##targetNamespace'"
+ * @generated
+ */
+public interface OnEntryScriptType extends EObject {
+ /**
+ * Returns the value of the '<em><b>Script</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Script</em>' attribute isn't clear,
+ * there really should businessObject more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Script</em>' attribute.
+ * @see #setScript(String)
+ * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getOnEntryScriptType_Script()
+ * @model required="true"
+ * extendedMetaData="kind='element' name='script' namespace='##targetNamespace'"
+ * @generated
+ */
+ String getScript();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.OnEntryScriptType#getScript <em>Script</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Script</em>' attribute.
+ * @see #getScript()
+ * @generated
+ */
+ void setScript(String value);
+
+ /**
+ * Returns the value of the '<em><b>Script Format</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Script Format</em>' attribute isn't clear,
+ * there really should businessObject more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Script Format</em>' attribute.
+ * @see #setScriptFormat(String)
+ * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getOnEntryScriptType_ScriptFormat()
+ * @model required="true"
+ * extendedMetaData="kind='attribute' name='scriptFormat' namespace='##targetNamespace'"
+ * @generated
+ */
+ String getScriptFormat();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.OnEntryScriptType#getScriptFormat <em>Script Format</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Script Format</em>' attribute.
+ * @see #getScriptFormat()
+ * @generated
+ */
+ void setScriptFormat(String value);
+
+} // OnEntryScriptType
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/model/OnExitScriptType.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/model/OnExitScriptType.java
index 17f7efa..a4728a4 100644
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/model/OnExitScriptType.java
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/model/OnExitScriptType.java
@@ -1,83 +1,83 @@
-/**
- * <copyright>
- * </copyright>
- *
- * $Id$
- */
-package org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model;
-
-import org.eclipse.emf.ecore.EObject;
-
-/**
- * <!-- begin-user-doc -->
- * A representation of the model object '<em><b>On Exit Script Type</b></em>'.
- * <!-- end-user-doc -->
- *
- * <p>
- * The following features are supported:
- * <ul>
- * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.OnExitScriptType#getScript <em>Script</em>}</li>
- * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.OnExitScriptType#getScriptFormat <em>Script Format</em>}</li>
- * </ul>
- * </p>
- *
- * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getOnExitScriptType()
- * @model extendedMetaData="name='onExit-script_._type' kind='elementOnly' namespace='##targetNamespace'"
- * @generated
- */
-public interface OnExitScriptType extends EObject {
- /**
- * Returns the value of the '<em><b>Script</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Script</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Script</em>' attribute.
- * @see #setScript(String)
- * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getOnExitScriptType_Script()
- * @model required="true"
- * extendedMetaData="kind='element' name='script' namespace='##targetNamespace'"
- * @generated
- */
- String getScript();
-
- /**
- * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.OnExitScriptType#getScript <em>Script</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Script</em>' attribute.
- * @see #getScript()
- * @generated
- */
- void setScript(String value);
-
- /**
- * Returns the value of the '<em><b>Script Format</b></em>' attribute.
- * <!-- begin-user-doc -->
- * <p>
- * If the meaning of the '<em>Script Format</em>' attribute isn't clear,
- * there really should be more of a description here...
- * </p>
- * <!-- end-user-doc -->
- * @return the value of the '<em>Script Format</em>' attribute.
- * @see #setScriptFormat(String)
- * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getOnExitScriptType_ScriptFormat()
- * @model required="true"
- * extendedMetaData="kind='attribute' name='scriptFormat' namespace='##targetNamespace'"
- * @generated
- */
- String getScriptFormat();
-
- /**
- * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.OnExitScriptType#getScriptFormat <em>Script Format</em>}' attribute.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @param value the new value of the '<em>Script Format</em>' attribute.
- * @see #getScriptFormat()
- * @generated
- */
- void setScriptFormat(String value);
-
-} // OnExitScriptType
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model;
+
+import org.eclipse.emf.ecore.EObject;
+
+/**
+ * <!-- begin-user-doc -->
+ * A representation of the model object '<em><b>On Exit Script Type</b></em>'.
+ * <!-- end-user-doc -->
+ *
+ * <p>
+ * The following features are supported:
+ * <ul>
+ * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.OnExitScriptType#getScript <em>Script</em>}</li>
+ * <li>{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.OnExitScriptType#getScriptFormat <em>Script Format</em>}</li>
+ * </ul>
+ * </p>
+ *
+ * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getOnExitScriptType()
+ * @model extendedMetaData="name='onExit-script_._type' kind='elementOnly' namespace='##targetNamespace'"
+ * @generated
+ */
+public interface OnExitScriptType extends EObject {
+ /**
+ * Returns the value of the '<em><b>Script</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Script</em>' attribute isn't clear,
+ * there really should businessObject more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Script</em>' attribute.
+ * @see #setScript(String)
+ * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getOnExitScriptType_Script()
+ * @model required="true"
+ * extendedMetaData="kind='element' name='script' namespace='##targetNamespace'"
+ * @generated
+ */
+ String getScript();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.OnExitScriptType#getScript <em>Script</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Script</em>' attribute.
+ * @see #getScript()
+ * @generated
+ */
+ void setScript(String value);
+
+ /**
+ * Returns the value of the '<em><b>Script Format</b></em>' attribute.
+ * <!-- begin-user-doc -->
+ * <p>
+ * If the meaning of the '<em>Script Format</em>' attribute isn't clear,
+ * there really should businessObject more of a description here...
+ * </p>
+ * <!-- end-user-doc -->
+ * @return the value of the '<em>Script Format</em>' attribute.
+ * @see #setScriptFormat(String)
+ * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#getOnExitScriptType_ScriptFormat()
+ * @model required="true"
+ * extendedMetaData="kind='attribute' name='scriptFormat' namespace='##targetNamespace'"
+ * @generated
+ */
+ String getScriptFormat();
+
+ /**
+ * Sets the value of the '{@link org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.OnExitScriptType#getScriptFormat <em>Script Format</em>}' attribute.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @param value the new value of the '<em>Script Format</em>' attribute.
+ * @see #getScriptFormat()
+ * @generated
+ */
+ void setScriptFormat(String value);
+
+} // OnExitScriptType
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/model/impl/ModelPackageImpl.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/model/impl/ModelPackageImpl.java
index 705f011..d9ff8eb 100644
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/model/impl/ModelPackageImpl.java
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/model/impl/ModelPackageImpl.java
@@ -1,807 +1,807 @@
-/**
- * <copyright>
- * </copyright>
- *
- * $Id$
- */
-package org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.impl;
-
-import java.math.BigInteger;
-
-import org.eclipse.bpmn2.Bpmn2Package;
-import org.eclipse.bpmn2.di.BpmnDiPackage;
-import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot;
-import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.GlobalType;
-import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ImportType;
-import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelFactory;
-import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage;
-import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.OnEntryScriptType;
-import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.OnExitScriptType;
-import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.util.ModelValidator;
-import org.eclipse.dd.dc.DcPackage;
-import org.eclipse.dd.di.DiPackage;
-import org.eclipse.emf.ecore.EAttribute;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EDataType;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.EValidator;
-import org.eclipse.emf.ecore.impl.EPackageImpl;
-
-/**
- * <!-- begin-user-doc -->
- * An implementation of the model <b>Package</b>.
- * <!-- end-user-doc -->
- * @generated
- */
-public class ModelPackageImpl extends EPackageImpl implements ModelPackage {
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass documentRootEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass globalTypeEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass importTypeEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass onEntryScriptTypeEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EClass onExitScriptTypeEClass = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EDataType packageNameTypeEDataType = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EDataType priorityTypeEDataType = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EDataType ruleFlowGroupTypeEDataType = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EDataType taskNameTypeEDataType = null;
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private EDataType versionTypeEDataType = null;
-
- /**
- * Creates an instance of the model <b>Package</b>, registered with
- * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
- * package URI value.
- * <p>Note: the correct way to create the package is via the static
- * factory method {@link #init init()}, which also performs
- * initialization of the package, or returns the registered package,
- * if one already exists.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.ecore.EPackage.Registry
- * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#eNS_URI
- * @see #init()
- * @generated
- */
- private ModelPackageImpl() {
- super(eNS_URI, ModelFactory.eINSTANCE);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private static boolean isInited = false;
-
- /**
- * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
- *
- * <p>This method is used to initialize {@link ModelPackage#eINSTANCE} when that field is accessed.
- * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see #eNS_URI
- * @see #createPackageContents()
- * @see #initializePackageContents()
- * @generated
- */
- public static ModelPackage init() {
- if (isInited) return (ModelPackage)EPackage.Registry.INSTANCE.getEPackage(ModelPackage.eNS_URI);
-
- // Obtain or create and register package
- ModelPackageImpl theModelPackage = (ModelPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof ModelPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new ModelPackageImpl());
-
- isInited = true;
-
- // Initialize simple dependencies
- Bpmn2Package.eINSTANCE.eClass();
- BpmnDiPackage.eINSTANCE.eClass();
- DiPackage.eINSTANCE.eClass();
- DcPackage.eINSTANCE.eClass();
-
- // Create package meta-data objects
- theModelPackage.createPackageContents();
-
- // Initialize created meta-data
- theModelPackage.initializePackageContents();
-
- // Register package validator
- EValidator.Registry.INSTANCE.put
- (theModelPackage,
- new EValidator.Descriptor() {
- public EValidator getEValidator() {
- return ModelValidator.INSTANCE;
- }
- });
-
- // Mark meta-data to indicate it can't be changed
- theModelPackage.freeze();
-
-
- // Update the registry and return the package
- EPackage.Registry.INSTANCE.put(ModelPackage.eNS_URI, theModelPackage);
- return theModelPackage;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EClass getDocumentRoot() {
- return documentRootEClass;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EReference getDocumentRoot_Global() {
- return (EReference)documentRootEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EReference getDocumentRoot_ImportType() {
- return (EReference)documentRootEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EReference getDocumentRoot_OnEntryScript() {
- return (EReference)documentRootEClass.getEStructuralFeatures().get(2);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EReference getDocumentRoot_OnExitScript() {
- return (EReference)documentRootEClass.getEStructuralFeatures().get(3);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EAttribute getDocumentRoot_PackageName() {
- return (EAttribute)documentRootEClass.getEStructuralFeatures().get(4);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EAttribute getDocumentRoot_Priority() {
- return (EAttribute)documentRootEClass.getEStructuralFeatures().get(5);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EAttribute getDocumentRoot_RuleFlowGroup() {
- return (EAttribute)documentRootEClass.getEStructuralFeatures().get(6);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EAttribute getDocumentRoot_TaskName() {
- return (EAttribute)documentRootEClass.getEStructuralFeatures().get(7);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EAttribute getDocumentRoot_Version() {
- return (EAttribute)documentRootEClass.getEStructuralFeatures().get(8);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EAttribute getDocumentRoot_WaitForCompletion() {
- return (EAttribute)documentRootEClass.getEStructuralFeatures().get(9);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EAttribute getDocumentRoot_Independent() {
- return (EAttribute)documentRootEClass.getEStructuralFeatures().get(10);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EClass getGlobalType() {
- return globalTypeEClass;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EAttribute getGlobalType_Identifier() {
- return (EAttribute)globalTypeEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EAttribute getGlobalType_Type() {
- return (EAttribute)globalTypeEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EClass getImportType() {
- return importTypeEClass;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EAttribute getImportType_Name() {
- return (EAttribute)importTypeEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EClass getOnEntryScriptType() {
- return onEntryScriptTypeEClass;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EAttribute getOnEntryScriptType_Script() {
- return (EAttribute)onEntryScriptTypeEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EAttribute getOnEntryScriptType_ScriptFormat() {
- return (EAttribute)onEntryScriptTypeEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EClass getOnExitScriptType() {
- return onExitScriptTypeEClass;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EAttribute getOnExitScriptType_Script() {
- return (EAttribute)onExitScriptTypeEClass.getEStructuralFeatures().get(0);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EAttribute getOnExitScriptType_ScriptFormat() {
- return (EAttribute)onExitScriptTypeEClass.getEStructuralFeatures().get(1);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EDataType getPackageNameType() {
- return packageNameTypeEDataType;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EDataType getPriorityType() {
- return priorityTypeEDataType;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EDataType getRuleFlowGroupType() {
- return ruleFlowGroupTypeEDataType;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EDataType getTaskNameType() {
- return taskNameTypeEDataType;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public EDataType getVersionType() {
- return versionTypeEDataType;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public ModelFactory getModelFactory() {
- return (ModelFactory)getEFactoryInstance();
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private boolean isCreated = false;
-
- /**
- * Creates the meta-model objects for the package. This method is
- * guarded to have no affect on any invocation but its first.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void createPackageContents() {
- if (isCreated) return;
- isCreated = true;
-
- // Create classes and their features
- documentRootEClass = createEClass(DOCUMENT_ROOT);
- createEReference(documentRootEClass, DOCUMENT_ROOT__GLOBAL);
- createEReference(documentRootEClass, DOCUMENT_ROOT__IMPORT_TYPE);
- createEReference(documentRootEClass, DOCUMENT_ROOT__ON_ENTRY_SCRIPT);
- createEReference(documentRootEClass, DOCUMENT_ROOT__ON_EXIT_SCRIPT);
- createEAttribute(documentRootEClass, DOCUMENT_ROOT__PACKAGE_NAME);
- createEAttribute(documentRootEClass, DOCUMENT_ROOT__PRIORITY);
- createEAttribute(documentRootEClass, DOCUMENT_ROOT__RULE_FLOW_GROUP);
- createEAttribute(documentRootEClass, DOCUMENT_ROOT__TASK_NAME);
- createEAttribute(documentRootEClass, DOCUMENT_ROOT__VERSION);
- createEAttribute(documentRootEClass, DOCUMENT_ROOT__WAIT_FOR_COMPLETION);
- createEAttribute(documentRootEClass, DOCUMENT_ROOT__INDEPENDENT);
-
- globalTypeEClass = createEClass(GLOBAL_TYPE);
- createEAttribute(globalTypeEClass, GLOBAL_TYPE__IDENTIFIER);
- createEAttribute(globalTypeEClass, GLOBAL_TYPE__TYPE);
-
- importTypeEClass = createEClass(IMPORT_TYPE);
- createEAttribute(importTypeEClass, IMPORT_TYPE__NAME);
-
- onEntryScriptTypeEClass = createEClass(ON_ENTRY_SCRIPT_TYPE);
- createEAttribute(onEntryScriptTypeEClass, ON_ENTRY_SCRIPT_TYPE__SCRIPT);
- createEAttribute(onEntryScriptTypeEClass, ON_ENTRY_SCRIPT_TYPE__SCRIPT_FORMAT);
-
- onExitScriptTypeEClass = createEClass(ON_EXIT_SCRIPT_TYPE);
- createEAttribute(onExitScriptTypeEClass, ON_EXIT_SCRIPT_TYPE__SCRIPT);
- createEAttribute(onExitScriptTypeEClass, ON_EXIT_SCRIPT_TYPE__SCRIPT_FORMAT);
-
- // Create data types
- packageNameTypeEDataType = createEDataType(PACKAGE_NAME_TYPE);
- priorityTypeEDataType = createEDataType(PRIORITY_TYPE);
- ruleFlowGroupTypeEDataType = createEDataType(RULE_FLOW_GROUP_TYPE);
- taskNameTypeEDataType = createEDataType(TASK_NAME_TYPE);
- versionTypeEDataType = createEDataType(VERSION_TYPE);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private boolean isInitialized = false;
-
- /**
- * Complete the initialization of the package and its meta-model. This
- * method is guarded to have no affect on any invocation but its first.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public void initializePackageContents() {
- if (isInitialized) return;
- isInitialized = true;
-
- // Initialize package
- setName(eNAME);
- setNsPrefix(eNS_PREFIX);
- setNsURI(eNS_URI);
-
- // Obtain other dependent packages
- Bpmn2Package theBpmn2Package = (Bpmn2Package)EPackage.Registry.INSTANCE.getEPackage(Bpmn2Package.eNS_URI);
-
- // Create type parameters
-
- // Set bounds for type parameters
-
- // Add supertypes to classes
- documentRootEClass.getESuperTypes().add(theBpmn2Package.getDocumentRoot());
-
- // Initialize classes and features; add operations and parameters
- initEClass(documentRootEClass, DocumentRoot.class, "DocumentRoot", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEReference(getDocumentRoot_Global(), this.getGlobalType(), null, "global", null, 0, -2, null, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
- initEReference(getDocumentRoot_ImportType(), this.getImportType(), null, "importType", null, 0, -2, null, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
- initEReference(getDocumentRoot_OnEntryScript(), this.getOnEntryScriptType(), null, "onEntryScript", null, 0, -2, null, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
- initEReference(getDocumentRoot_OnExitScript(), this.getOnExitScriptType(), null, "onExitScript", null, 0, -2, null, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
- initEAttribute(getDocumentRoot_PackageName(), this.getPackageNameType(), "packageName", null, 0, 1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getDocumentRoot_Priority(), this.getPriorityType(), "priority", null, 0, 1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getDocumentRoot_RuleFlowGroup(), this.getRuleFlowGroupType(), "ruleFlowGroup", null, 0, 1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getDocumentRoot_TaskName(), this.getTaskNameType(), "taskName", null, 0, 1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getDocumentRoot_Version(), this.getVersionType(), "version", null, 0, 1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getDocumentRoot_WaitForCompletion(), ecorePackage.getEBoolean(), "waitForCompletion", null, 0, 1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getDocumentRoot_Independent(), ecorePackage.getEBoolean(), "independent", null, 0, 1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
-
- initEClass(globalTypeEClass, GlobalType.class, "GlobalType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getGlobalType_Identifier(), ecorePackage.getEString(), "identifier", null, 1, 1, GlobalType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getGlobalType_Type(), ecorePackage.getEString(), "type", null, 1, 1, GlobalType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
-
- initEClass(importTypeEClass, ImportType.class, "ImportType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getImportType_Name(), ecorePackage.getEString(), "name", null, 1, 1, ImportType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
-
- initEClass(onEntryScriptTypeEClass, OnEntryScriptType.class, "OnEntryScriptType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getOnEntryScriptType_Script(), ecorePackage.getEString(), "script", null, 1, 1, OnEntryScriptType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getOnEntryScriptType_ScriptFormat(), ecorePackage.getEString(), "scriptFormat", null, 1, 1, OnEntryScriptType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
-
- initEClass(onExitScriptTypeEClass, OnExitScriptType.class, "OnExitScriptType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
- initEAttribute(getOnExitScriptType_Script(), ecorePackage.getEString(), "script", null, 1, 1, OnExitScriptType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
- initEAttribute(getOnExitScriptType_ScriptFormat(), ecorePackage.getEString(), "scriptFormat", null, 1, 1, OnExitScriptType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
-
- // Initialize data types
- initEDataType(packageNameTypeEDataType, String.class, "PackageNameType", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
- initEDataType(priorityTypeEDataType, BigInteger.class, "PriorityType", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
- initEDataType(ruleFlowGroupTypeEDataType, String.class, "RuleFlowGroupType", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
- initEDataType(taskNameTypeEDataType, String.class, "TaskNameType", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
- initEDataType(versionTypeEDataType, BigInteger.class, "VersionType", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
-
- // Create resource
- createResource(eNS_URI);
-
- // Create annotations
- // http:///org/eclipse/emf/ecore/util/ExtendedMetaData
- createExtendedMetaDataAnnotations();
- }
-
- /**
- * Initializes the annotations for <b>http:///org/eclipse/emf/ecore/util/ExtendedMetaData</b>.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected void createExtendedMetaDataAnnotations() {
- String source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData";
- addAnnotation
- (documentRootEClass,
- source,
- new String[] {
- "name", "",
- "kind", "mixed",
- "namespace", "##targetNamespace"
- });
- addAnnotation
- (getDocumentRoot_Global(),
- source,
- new String[] {
- "kind", "element",
- "name", "global",
- "namespace", "##targetNamespace"
- });
- addAnnotation
- (getDocumentRoot_ImportType(),
- source,
- new String[] {
- "kind", "element",
- "name", "import",
- "namespace", "##targetNamespace"
- });
- addAnnotation
- (getDocumentRoot_OnEntryScript(),
- source,
- new String[] {
- "kind", "element",
- "name", "onEntry-script",
- "namespace", "##targetNamespace"
- });
- addAnnotation
- (getDocumentRoot_OnExitScript(),
- source,
- new String[] {
- "kind", "element",
- "name", "onExit-script",
- "namespace", "##targetNamespace"
- });
- addAnnotation
- (getDocumentRoot_PackageName(),
- source,
- new String[] {
- "kind", "attribute",
- "name", "packageName",
- "namespace", "##targetNamespace"
- });
- addAnnotation
- (getDocumentRoot_Priority(),
- source,
- new String[] {
- "kind", "attribute",
- "name", "priority",
- "namespace", "##targetNamespace"
- });
- addAnnotation
- (getDocumentRoot_RuleFlowGroup(),
- source,
- new String[] {
- "kind", "attribute",
- "name", "ruleFlowGroup",
- "namespace", "##targetNamespace"
- });
- addAnnotation
- (getDocumentRoot_TaskName(),
- source,
- new String[] {
- "kind", "attribute",
- "name", "taskName",
- "namespace", "##targetNamespace"
- });
- addAnnotation
- (getDocumentRoot_Version(),
- source,
- new String[] {
- "kind", "attribute",
- "name", "version",
- "namespace", "##targetNamespace"
- });
- addAnnotation
- (getDocumentRoot_WaitForCompletion(),
- source,
- new String[] {
- "kind", "attribute",
- "name", "waitForCompletion",
- "namespace", "##targetNamespace"
- });
- addAnnotation
- (getDocumentRoot_Independent(),
- source,
- new String[] {
- "kind", "attribute",
- "name", "independent",
- "namespace", "##targetNamespace"
- });
- addAnnotation
- (globalTypeEClass,
- source,
- new String[] {
- "name", "global_._type",
- "kind", "element",
- "namespace", "##targetNamespace"
- });
- addAnnotation
- (getGlobalType_Identifier(),
- source,
- new String[] {
- "kind", "attribute",
- "name", "identifier",
- "namespace", "##targetNamespace"
- });
- addAnnotation
- (getGlobalType_Type(),
- source,
- new String[] {
- "kind", "attribute",
- "name", "type",
- "namespace", "##targetNamespace"
- });
- addAnnotation
- (importTypeEClass,
- source,
- new String[] {
- "name", "import_._type",
- "kind", "element",
- "namespace", "##targetNamespace"
- });
- addAnnotation
- (getImportType_Name(),
- source,
- new String[] {
- "kind", "attribute",
- "name", "name"
- });
- addAnnotation
- (onEntryScriptTypeEClass,
- source,
- new String[] {
- "name", "onEntry-script_._type",
- "kind", "elementOnly",
- "namespace", "##targetNamespace"
- });
- addAnnotation
- (getOnEntryScriptType_Script(),
- source,
- new String[] {
- "kind", "element",
- "name", "script",
- "namespace", "##targetNamespace"
- });
- addAnnotation
- (getOnEntryScriptType_ScriptFormat(),
- source,
- new String[] {
- "kind", "attribute",
- "name", "scriptFormat",
- "namespace", "##targetNamespace"
- });
- addAnnotation
- (onExitScriptTypeEClass,
- source,
- new String[] {
- "name", "onExit-script_._type",
- "kind", "elementOnly",
- "namespace", "##targetNamespace"
- });
- addAnnotation
- (getOnExitScriptType_Script(),
- source,
- new String[] {
- "kind", "element",
- "name", "script",
- "namespace", "##targetNamespace"
- });
- addAnnotation
- (getOnExitScriptType_ScriptFormat(),
- source,
- new String[] {
- "kind", "attribute",
- "name", "scriptFormat",
- "namespace", "##targetNamespace"
- });
- addAnnotation
- (packageNameTypeEDataType,
- source,
- new String[] {
- "name", "packageName_._type",
- "baseType", "http://www.eclipse.org/emf/2003/XMLType#string"
- });
- addAnnotation
- (priorityTypeEDataType,
- source,
- new String[] {
- "name", "priority_._type",
- "baseType", "http://www.eclipse.org/emf/2003/XMLType#integer",
- "minInclusive", "1"
- });
- addAnnotation
- (ruleFlowGroupTypeEDataType,
- source,
- new String[] {
- "name", "ruleFlowGroup_._type",
- "baseType", "http://www.eclipse.org/emf/2003/XMLType#string"
- });
- addAnnotation
- (taskNameTypeEDataType,
- source,
- new String[] {
- "name", "taskName_._type",
- "baseType", "http://www.eclipse.org/emf/2003/XMLType#string"
- });
- addAnnotation
- (versionTypeEDataType,
- source,
- new String[] {
- "name", "version_._type",
- "baseType", "http://www.eclipse.org/emf/2003/XMLType#integer",
- "minInclusive", "0"
- });
- }
-
-} //ModelPackageImpl
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.impl;
+
+import java.math.BigInteger;
+
+import org.eclipse.bpmn2.Bpmn2Package;
+import org.eclipse.bpmn2.di.BpmnDiPackage;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.GlobalType;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ImportType;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelFactory;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.OnEntryScriptType;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.OnExitScriptType;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.util.ModelValidator;
+import org.eclipse.dd.dc.DcPackage;
+import org.eclipse.dd.di.DiPackage;
+import org.eclipse.emf.ecore.EAttribute;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EDataType;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.EReference;
+import org.eclipse.emf.ecore.EValidator;
+import org.eclipse.emf.ecore.impl.EPackageImpl;
+
+/**
+ * <!-- begin-user-doc -->
+ * An implementation of the model <b>Package</b>.
+ * <!-- end-user-doc -->
+ * @generated
+ */
+public class ModelPackageImpl extends EPackageImpl implements ModelPackage {
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass documentRootEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass globalTypeEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass importTypeEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass onEntryScriptTypeEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EClass onExitScriptTypeEClass = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EDataType packageNameTypeEDataType = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EDataType priorityTypeEDataType = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EDataType ruleFlowGroupTypeEDataType = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EDataType taskNameTypeEDataType = null;
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private EDataType versionTypeEDataType = null;
+
+ /**
+ * Creates an instance of the model <b>Package</b>, registered with
+ * {@link org.eclipse.emf.ecore.EPackage.Registry EPackage.Registry} by the package
+ * package URI value.
+ * <p>Note: the correct way to create the package is via the static
+ * factory method {@link #init init()}, which also performs
+ * initialization of the package, or returns the registered package,
+ * if one already exists.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.ecore.EPackage.Registry
+ * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage#eNS_URI
+ * @see #init()
+ * @generated
+ */
+ private ModelPackageImpl() {
+ super(eNS_URI, ModelFactory.eINSTANCE);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static boolean isInited = false;
+
+ /**
+ * Creates, registers, and initializes the <b>Package</b> for this model, and for any others upon which it depends.
+ *
+ * <p>This method is used to initialize {@link ModelPackage#eINSTANCE} when that field is accessed.
+ * Clients should not invoke it directly. Instead, they should simply access that field to obtain the package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see #eNS_URI
+ * @see #createPackageContents()
+ * @see #initializePackageContents()
+ * @generated
+ */
+ public static ModelPackage init() {
+ if (isInited) return (ModelPackage)EPackage.Registry.INSTANCE.getEPackage(ModelPackage.eNS_URI);
+
+ // Obtain or create and register package
+ ModelPackageImpl theModelPackage = (ModelPackageImpl)(EPackage.Registry.INSTANCE.get(eNS_URI) instanceof ModelPackageImpl ? EPackage.Registry.INSTANCE.get(eNS_URI) : new ModelPackageImpl());
+
+ isInited = true;
+
+ // Initialize simple dependencies
+ Bpmn2Package.eINSTANCE.eClass();
+ BpmnDiPackage.eINSTANCE.eClass();
+ DiPackage.eINSTANCE.eClass();
+ DcPackage.eINSTANCE.eClass();
+
+ // Create package meta-data objects
+ theModelPackage.createPackageContents();
+
+ // Initialize created meta-data
+ theModelPackage.initializePackageContents();
+
+ // Register package validator
+ EValidator.Registry.INSTANCE.put
+ (theModelPackage,
+ new EValidator.Descriptor() {
+ public EValidator getEValidator() {
+ return ModelValidator.INSTANCE;
+ }
+ });
+
+ // Mark meta-data to indicate it can't businessObject changed
+ theModelPackage.freeze();
+
+
+ // Update the registry and return the package
+ EPackage.Registry.INSTANCE.put(ModelPackage.eNS_URI, theModelPackage);
+ return theModelPackage;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getDocumentRoot() {
+ return documentRootEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getDocumentRoot_Global() {
+ return (EReference)documentRootEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getDocumentRoot_ImportType() {
+ return (EReference)documentRootEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getDocumentRoot_OnEntryScript() {
+ return (EReference)documentRootEClass.getEStructuralFeatures().get(2);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EReference getDocumentRoot_OnExitScript() {
+ return (EReference)documentRootEClass.getEStructuralFeatures().get(3);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getDocumentRoot_PackageName() {
+ return (EAttribute)documentRootEClass.getEStructuralFeatures().get(4);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getDocumentRoot_Priority() {
+ return (EAttribute)documentRootEClass.getEStructuralFeatures().get(5);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getDocumentRoot_RuleFlowGroup() {
+ return (EAttribute)documentRootEClass.getEStructuralFeatures().get(6);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getDocumentRoot_TaskName() {
+ return (EAttribute)documentRootEClass.getEStructuralFeatures().get(7);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getDocumentRoot_Version() {
+ return (EAttribute)documentRootEClass.getEStructuralFeatures().get(8);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getDocumentRoot_WaitForCompletion() {
+ return (EAttribute)documentRootEClass.getEStructuralFeatures().get(9);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getDocumentRoot_Independent() {
+ return (EAttribute)documentRootEClass.getEStructuralFeatures().get(10);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getGlobalType() {
+ return globalTypeEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getGlobalType_Identifier() {
+ return (EAttribute)globalTypeEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getGlobalType_Type() {
+ return (EAttribute)globalTypeEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getImportType() {
+ return importTypeEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getImportType_Name() {
+ return (EAttribute)importTypeEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getOnEntryScriptType() {
+ return onEntryScriptTypeEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getOnEntryScriptType_Script() {
+ return (EAttribute)onEntryScriptTypeEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getOnEntryScriptType_ScriptFormat() {
+ return (EAttribute)onEntryScriptTypeEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EClass getOnExitScriptType() {
+ return onExitScriptTypeEClass;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getOnExitScriptType_Script() {
+ return (EAttribute)onExitScriptTypeEClass.getEStructuralFeatures().get(0);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EAttribute getOnExitScriptType_ScriptFormat() {
+ return (EAttribute)onExitScriptTypeEClass.getEStructuralFeatures().get(1);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EDataType getPackageNameType() {
+ return packageNameTypeEDataType;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EDataType getPriorityType() {
+ return priorityTypeEDataType;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EDataType getRuleFlowGroupType() {
+ return ruleFlowGroupTypeEDataType;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EDataType getTaskNameType() {
+ return taskNameTypeEDataType;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public EDataType getVersionType() {
+ return versionTypeEDataType;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ModelFactory getModelFactory() {
+ return (ModelFactory)getEFactoryInstance();
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isCreated = false;
+
+ /**
+ * Creates the meta-model objects for the package. This method is
+ * guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void createPackageContents() {
+ if (isCreated) return;
+ isCreated = true;
+
+ // Create classes and their features
+ documentRootEClass = createEClass(DOCUMENT_ROOT);
+ createEReference(documentRootEClass, DOCUMENT_ROOT__GLOBAL);
+ createEReference(documentRootEClass, DOCUMENT_ROOT__IMPORT_TYPE);
+ createEReference(documentRootEClass, DOCUMENT_ROOT__ON_ENTRY_SCRIPT);
+ createEReference(documentRootEClass, DOCUMENT_ROOT__ON_EXIT_SCRIPT);
+ createEAttribute(documentRootEClass, DOCUMENT_ROOT__PACKAGE_NAME);
+ createEAttribute(documentRootEClass, DOCUMENT_ROOT__PRIORITY);
+ createEAttribute(documentRootEClass, DOCUMENT_ROOT__RULE_FLOW_GROUP);
+ createEAttribute(documentRootEClass, DOCUMENT_ROOT__TASK_NAME);
+ createEAttribute(documentRootEClass, DOCUMENT_ROOT__VERSION);
+ createEAttribute(documentRootEClass, DOCUMENT_ROOT__WAIT_FOR_COMPLETION);
+ createEAttribute(documentRootEClass, DOCUMENT_ROOT__INDEPENDENT);
+
+ globalTypeEClass = createEClass(GLOBAL_TYPE);
+ createEAttribute(globalTypeEClass, GLOBAL_TYPE__IDENTIFIER);
+ createEAttribute(globalTypeEClass, GLOBAL_TYPE__TYPE);
+
+ importTypeEClass = createEClass(IMPORT_TYPE);
+ createEAttribute(importTypeEClass, IMPORT_TYPE__NAME);
+
+ onEntryScriptTypeEClass = createEClass(ON_ENTRY_SCRIPT_TYPE);
+ createEAttribute(onEntryScriptTypeEClass, ON_ENTRY_SCRIPT_TYPE__SCRIPT);
+ createEAttribute(onEntryScriptTypeEClass, ON_ENTRY_SCRIPT_TYPE__SCRIPT_FORMAT);
+
+ onExitScriptTypeEClass = createEClass(ON_EXIT_SCRIPT_TYPE);
+ createEAttribute(onExitScriptTypeEClass, ON_EXIT_SCRIPT_TYPE__SCRIPT);
+ createEAttribute(onExitScriptTypeEClass, ON_EXIT_SCRIPT_TYPE__SCRIPT_FORMAT);
+
+ // Create data types
+ packageNameTypeEDataType = createEDataType(PACKAGE_NAME_TYPE);
+ priorityTypeEDataType = createEDataType(PRIORITY_TYPE);
+ ruleFlowGroupTypeEDataType = createEDataType(RULE_FLOW_GROUP_TYPE);
+ taskNameTypeEDataType = createEDataType(TASK_NAME_TYPE);
+ versionTypeEDataType = createEDataType(VERSION_TYPE);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private boolean isInitialized = false;
+
+ /**
+ * Complete the initialization of the package and its meta-model. This
+ * method is guarded to have no affect on any invocation but its first.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public void initializePackageContents() {
+ if (isInitialized) return;
+ isInitialized = true;
+
+ // Initialize package
+ setName(eNAME);
+ setNsPrefix(eNS_PREFIX);
+ setNsURI(eNS_URI);
+
+ // Obtain other dependent packages
+ Bpmn2Package theBpmn2Package = (Bpmn2Package)EPackage.Registry.INSTANCE.getEPackage(Bpmn2Package.eNS_URI);
+
+ // Create type parameters
+
+ // Set bounds for type parameters
+
+ // Add supertypes to classes
+ documentRootEClass.getESuperTypes().add(theBpmn2Package.getDocumentRoot());
+
+ // Initialize classes and features; add operations and parameters
+ initEClass(documentRootEClass, DocumentRoot.class, "DocumentRoot", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEReference(getDocumentRoot_Global(), this.getGlobalType(), null, "global", null, 0, -2, null, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
+ initEReference(getDocumentRoot_ImportType(), this.getImportType(), null, "importType", null, 0, -2, null, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
+ initEReference(getDocumentRoot_OnEntryScript(), this.getOnEntryScriptType(), null, "onEntryScript", null, 0, -2, null, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
+ initEReference(getDocumentRoot_OnExitScript(), this.getOnExitScriptType(), null, "onExitScript", null, 0, -2, null, IS_TRANSIENT, IS_VOLATILE, IS_CHANGEABLE, IS_COMPOSITE, !IS_RESOLVE_PROXIES, !IS_UNSETTABLE, IS_UNIQUE, IS_DERIVED, IS_ORDERED);
+ initEAttribute(getDocumentRoot_PackageName(), this.getPackageNameType(), "packageName", null, 0, 1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getDocumentRoot_Priority(), this.getPriorityType(), "priority", null, 0, 1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getDocumentRoot_RuleFlowGroup(), this.getRuleFlowGroupType(), "ruleFlowGroup", null, 0, 1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getDocumentRoot_TaskName(), this.getTaskNameType(), "taskName", null, 0, 1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getDocumentRoot_Version(), this.getVersionType(), "version", null, 0, 1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getDocumentRoot_WaitForCompletion(), ecorePackage.getEBoolean(), "waitForCompletion", null, 0, 1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getDocumentRoot_Independent(), ecorePackage.getEBoolean(), "independent", null, 0, 1, null, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(globalTypeEClass, GlobalType.class, "GlobalType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getGlobalType_Identifier(), ecorePackage.getEString(), "identifier", null, 1, 1, GlobalType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getGlobalType_Type(), ecorePackage.getEString(), "type", null, 1, 1, GlobalType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(importTypeEClass, ImportType.class, "ImportType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getImportType_Name(), ecorePackage.getEString(), "name", null, 1, 1, ImportType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(onEntryScriptTypeEClass, OnEntryScriptType.class, "OnEntryScriptType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getOnEntryScriptType_Script(), ecorePackage.getEString(), "script", null, 1, 1, OnEntryScriptType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getOnEntryScriptType_ScriptFormat(), ecorePackage.getEString(), "scriptFormat", null, 1, 1, OnEntryScriptType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ initEClass(onExitScriptTypeEClass, OnExitScriptType.class, "OnExitScriptType", !IS_ABSTRACT, !IS_INTERFACE, IS_GENERATED_INSTANCE_CLASS);
+ initEAttribute(getOnExitScriptType_Script(), ecorePackage.getEString(), "script", null, 1, 1, OnExitScriptType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+ initEAttribute(getOnExitScriptType_ScriptFormat(), ecorePackage.getEString(), "scriptFormat", null, 1, 1, OnExitScriptType.class, !IS_TRANSIENT, !IS_VOLATILE, IS_CHANGEABLE, !IS_UNSETTABLE, !IS_ID, IS_UNIQUE, !IS_DERIVED, IS_ORDERED);
+
+ // Initialize data types
+ initEDataType(packageNameTypeEDataType, String.class, "PackageNameType", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
+ initEDataType(priorityTypeEDataType, BigInteger.class, "PriorityType", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
+ initEDataType(ruleFlowGroupTypeEDataType, String.class, "RuleFlowGroupType", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
+ initEDataType(taskNameTypeEDataType, String.class, "TaskNameType", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
+ initEDataType(versionTypeEDataType, BigInteger.class, "VersionType", IS_SERIALIZABLE, !IS_GENERATED_INSTANCE_CLASS);
+
+ // Create resource
+ createResource(eNS_URI);
+
+ // Create annotations
+ // http:///org/eclipse/emf/ecore/util/ExtendedMetaData
+ createExtendedMetaDataAnnotations();
+ }
+
+ /**
+ * Initializes the annotations for <b>http:///org/eclipse/emf/ecore/util/ExtendedMetaData</b>.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected void createExtendedMetaDataAnnotations() {
+ String source = "http:///org/eclipse/emf/ecore/util/ExtendedMetaData";
+ addAnnotation
+ (documentRootEClass,
+ source,
+ new String[] {
+ "name", "",
+ "kind", "mixed",
+ "namespace", "##targetNamespace"
+ });
+ addAnnotation
+ (getDocumentRoot_Global(),
+ source,
+ new String[] {
+ "kind", "element",
+ "name", "global",
+ "namespace", "##targetNamespace"
+ });
+ addAnnotation
+ (getDocumentRoot_ImportType(),
+ source,
+ new String[] {
+ "kind", "element",
+ "name", "import",
+ "namespace", "##targetNamespace"
+ });
+ addAnnotation
+ (getDocumentRoot_OnEntryScript(),
+ source,
+ new String[] {
+ "kind", "element",
+ "name", "onEntry-script",
+ "namespace", "##targetNamespace"
+ });
+ addAnnotation
+ (getDocumentRoot_OnExitScript(),
+ source,
+ new String[] {
+ "kind", "element",
+ "name", "onExit-script",
+ "namespace", "##targetNamespace"
+ });
+ addAnnotation
+ (getDocumentRoot_PackageName(),
+ source,
+ new String[] {
+ "kind", "attribute",
+ "name", "packageName",
+ "namespace", "##targetNamespace"
+ });
+ addAnnotation
+ (getDocumentRoot_Priority(),
+ source,
+ new String[] {
+ "kind", "attribute",
+ "name", "priority",
+ "namespace", "##targetNamespace"
+ });
+ addAnnotation
+ (getDocumentRoot_RuleFlowGroup(),
+ source,
+ new String[] {
+ "kind", "attribute",
+ "name", "ruleFlowGroup",
+ "namespace", "##targetNamespace"
+ });
+ addAnnotation
+ (getDocumentRoot_TaskName(),
+ source,
+ new String[] {
+ "kind", "attribute",
+ "name", "taskName",
+ "namespace", "##targetNamespace"
+ });
+ addAnnotation
+ (getDocumentRoot_Version(),
+ source,
+ new String[] {
+ "kind", "attribute",
+ "name", "version",
+ "namespace", "##targetNamespace"
+ });
+ addAnnotation
+ (getDocumentRoot_WaitForCompletion(),
+ source,
+ new String[] {
+ "kind", "attribute",
+ "name", "waitForCompletion",
+ "namespace", "##targetNamespace"
+ });
+ addAnnotation
+ (getDocumentRoot_Independent(),
+ source,
+ new String[] {
+ "kind", "attribute",
+ "name", "independent",
+ "namespace", "##targetNamespace"
+ });
+ addAnnotation
+ (globalTypeEClass,
+ source,
+ new String[] {
+ "name", "global_._type",
+ "kind", "element",
+ "namespace", "##targetNamespace"
+ });
+ addAnnotation
+ (getGlobalType_Identifier(),
+ source,
+ new String[] {
+ "kind", "attribute",
+ "name", "identifier",
+ "namespace", "##targetNamespace"
+ });
+ addAnnotation
+ (getGlobalType_Type(),
+ source,
+ new String[] {
+ "kind", "attribute",
+ "name", "type",
+ "namespace", "##targetNamespace"
+ });
+ addAnnotation
+ (importTypeEClass,
+ source,
+ new String[] {
+ "name", "import_._type",
+ "kind", "element",
+ "namespace", "##targetNamespace"
+ });
+ addAnnotation
+ (getImportType_Name(),
+ source,
+ new String[] {
+ "kind", "attribute",
+ "name", "name"
+ });
+ addAnnotation
+ (onEntryScriptTypeEClass,
+ source,
+ new String[] {
+ "name", "onEntry-script_._type",
+ "kind", "elementOnly",
+ "namespace", "##targetNamespace"
+ });
+ addAnnotation
+ (getOnEntryScriptType_Script(),
+ source,
+ new String[] {
+ "kind", "element",
+ "name", "script",
+ "namespace", "##targetNamespace"
+ });
+ addAnnotation
+ (getOnEntryScriptType_ScriptFormat(),
+ source,
+ new String[] {
+ "kind", "attribute",
+ "name", "scriptFormat",
+ "namespace", "##targetNamespace"
+ });
+ addAnnotation
+ (onExitScriptTypeEClass,
+ source,
+ new String[] {
+ "name", "onExit-script_._type",
+ "kind", "elementOnly",
+ "namespace", "##targetNamespace"
+ });
+ addAnnotation
+ (getOnExitScriptType_Script(),
+ source,
+ new String[] {
+ "kind", "element",
+ "name", "script",
+ "namespace", "##targetNamespace"
+ });
+ addAnnotation
+ (getOnExitScriptType_ScriptFormat(),
+ source,
+ new String[] {
+ "kind", "attribute",
+ "name", "scriptFormat",
+ "namespace", "##targetNamespace"
+ });
+ addAnnotation
+ (packageNameTypeEDataType,
+ source,
+ new String[] {
+ "name", "packageName_._type",
+ "baseType", "http://www.eclipse.org/emf/2003/XMLType#string"
+ });
+ addAnnotation
+ (priorityTypeEDataType,
+ source,
+ new String[] {
+ "name", "priority_._type",
+ "baseType", "http://www.eclipse.org/emf/2003/XMLType#integer",
+ "minInclusive", "1"
+ });
+ addAnnotation
+ (ruleFlowGroupTypeEDataType,
+ source,
+ new String[] {
+ "name", "ruleFlowGroup_._type",
+ "baseType", "http://www.eclipse.org/emf/2003/XMLType#string"
+ });
+ addAnnotation
+ (taskNameTypeEDataType,
+ source,
+ new String[] {
+ "name", "taskName_._type",
+ "baseType", "http://www.eclipse.org/emf/2003/XMLType#string"
+ });
+ addAnnotation
+ (versionTypeEDataType,
+ source,
+ new String[] {
+ "name", "version_._type",
+ "baseType", "http://www.eclipse.org/emf/2003/XMLType#integer",
+ "minInclusive", "0"
+ });
+ }
+
+} //ModelPackageImpl
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/model/util/ModelResourceImpl.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/model/util/ModelResourceImpl.java
index b5b1c6d..8a54b9a 100644
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/model/util/ModelResourceImpl.java
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/model/util/ModelResourceImpl.java
@@ -125,7 +125,7 @@
/**
* We need extend the standard SAXXMLHandler to hook into the handling of attribute references
- * which may be either simple ID Strings or QNames. We'll search through all of the objects'
+ * which may businessObject either simple ID Strings or QNames. We'll search through all of the objects'
* IDs first to find the one we're looking for. If not, we'll try a QName search.
*/
protected static class ModelXmlHandler extends Bpmn2ModelerXmlHandler {
@@ -164,7 +164,7 @@
// ugly hack for https://bugs.eclipse.org/bugs/show_bug.cgi?id=355686
// Remove the "type" attribute from the feature parentMap if there is one.
// The XSI type will have already been used to construct the EObject,
- // so any "type" in the feature parentMap will be a duplicate which will
+ // so any "type" in the feature parentMap will businessObject a duplicate which will
// cause problems during parsing.
// See also getXSIType()
EObject childObject = objects.peekEObject();
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/model/util/ModelValidator.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/model/util/ModelValidator.java
index 33eceea..0fd3f57 100644
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/model/util/ModelValidator.java
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/model/util/ModelValidator.java
@@ -1,279 +1,279 @@
-/**
- * <copyright>
- * </copyright>
- *
- * $Id$
- */
-package org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.util;
-
-import java.math.BigInteger;
-import java.util.Map;
-
-import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.*;
-import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot;
-import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.GlobalType;
-import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ImportType;
-import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage;
-import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.OnEntryScriptType;
-import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.OnExitScriptType;
-import org.eclipse.emf.common.util.DiagnosticChain;
-import org.eclipse.emf.common.util.ResourceLocator;
-import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.util.EObjectValidator;
-import org.eclipse.emf.ecore.xml.type.util.XMLTypeValidator;
-
-/**
- * <!-- begin-user-doc -->
- * The <b>Validator</b> for the model.
- * <!-- end-user-doc -->
- * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage
- * @generated
- */
-public class ModelValidator extends EObjectValidator {
- /**
- * The cached model package
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public static final ModelValidator INSTANCE = new ModelValidator();
-
- /**
- * A constant for the {@link org.eclipse.emf.common.util.Diagnostic#getSource() source} of diagnostic {@link org.eclipse.emf.common.util.Diagnostic#getCode() codes} from this package.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @see org.eclipse.emf.common.util.Diagnostic#getSource()
- * @see org.eclipse.emf.common.util.Diagnostic#getCode()
- * @generated
- */
- public static final String DIAGNOSTIC_SOURCE = "org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model";
-
- /**
- * A constant with a fixed name that can be used as the base value for additional hand written constants.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- private static final int GENERATED_DIAGNOSTIC_CODE_COUNT = 0;
-
- /**
- * A constant with a fixed name that can be used as the base value for additional hand written constants in a derived class.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected static final int DIAGNOSTIC_CODE_COUNT = GENERATED_DIAGNOSTIC_CODE_COUNT;
-
- /**
- * The cached base package validator.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- protected XMLTypeValidator xmlTypeValidator;
-
- /**
- * Creates an instance of the switch.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public ModelValidator() {
- super();
- xmlTypeValidator = XMLTypeValidator.INSTANCE;
- }
-
- /**
- * Returns the package of this validator switch.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected EPackage getEPackage() {
- return ModelPackage.eINSTANCE;
- }
-
- /**
- * Calls <code>validateXXX</code> for the corresponding classifier of the model.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- protected boolean validate(int classifierID, Object value, DiagnosticChain diagnostics, Map<Object, Object> context) {
- switch (classifierID) {
- case ModelPackage.DOCUMENT_ROOT:
- return validateDocumentRoot((DocumentRoot)value, diagnostics, context);
- case ModelPackage.GLOBAL_TYPE:
- return validateGlobalType((GlobalType)value, diagnostics, context);
- case ModelPackage.IMPORT_TYPE:
- return validateImportType((ImportType)value, diagnostics, context);
- case ModelPackage.ON_ENTRY_SCRIPT_TYPE:
- return validateOnEntryScriptType((OnEntryScriptType)value, diagnostics, context);
- case ModelPackage.ON_EXIT_SCRIPT_TYPE:
- return validateOnExitScriptType((OnExitScriptType)value, diagnostics, context);
- case ModelPackage.PACKAGE_NAME_TYPE:
- return validatePackageNameType((String)value, diagnostics, context);
- case ModelPackage.PRIORITY_TYPE:
- return validatePriorityType((BigInteger)value, diagnostics, context);
- case ModelPackage.RULE_FLOW_GROUP_TYPE:
- return validateRuleFlowGroupType((String)value, diagnostics, context);
- case ModelPackage.TASK_NAME_TYPE:
- return validateTaskNameType((String)value, diagnostics, context);
- case ModelPackage.VERSION_TYPE:
- return validateVersionType((BigInteger)value, diagnostics, context);
- default:
- return true;
- }
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public boolean validateDocumentRoot(DocumentRoot documentRoot, DiagnosticChain diagnostics, Map<Object, Object> context) {
- return validate_EveryDefaultConstraint(documentRoot, diagnostics, context);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public boolean validateGlobalType(GlobalType globalType, DiagnosticChain diagnostics, Map<Object, Object> context) {
- return validate_EveryDefaultConstraint(globalType, diagnostics, context);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public boolean validateImportType(ImportType importType, DiagnosticChain diagnostics, Map<Object, Object> context) {
- return validate_EveryDefaultConstraint(importType, diagnostics, context);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public boolean validateOnEntryScriptType(OnEntryScriptType onEntryScriptType, DiagnosticChain diagnostics, Map<Object, Object> context) {
- return validate_EveryDefaultConstraint(onEntryScriptType, diagnostics, context);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public boolean validateOnExitScriptType(OnExitScriptType onExitScriptType, DiagnosticChain diagnostics, Map<Object, Object> context) {
- return validate_EveryDefaultConstraint(onExitScriptType, diagnostics, context);
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public boolean validatePackageNameType(String packageNameType, DiagnosticChain diagnostics, Map<Object, Object> context) {
- return true;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public boolean validatePriorityType(BigInteger priorityType, DiagnosticChain diagnostics, Map<Object, Object> context) {
- boolean result = validatePriorityType_Min(priorityType, diagnostics, context);
- return result;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @see #validatePriorityType_Min
- */
- public static final BigInteger PRIORITY_TYPE__MIN__VALUE = new BigInteger("1");
-
- /**
- * Validates the Min constraint of '<em>Priority Type</em>'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public boolean validatePriorityType_Min(BigInteger priorityType, DiagnosticChain diagnostics, Map<Object, Object> context) {
- boolean result = priorityType.compareTo(PRIORITY_TYPE__MIN__VALUE) >= 0;
- if (!result && diagnostics != null)
- reportMinViolation(ModelPackage.Literals.PRIORITY_TYPE, priorityType, PRIORITY_TYPE__MIN__VALUE, true, diagnostics, context);
- return result;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public boolean validateRuleFlowGroupType(String ruleFlowGroupType, DiagnosticChain diagnostics, Map<Object, Object> context) {
- return true;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public boolean validateTaskNameType(String taskNameType, DiagnosticChain diagnostics, Map<Object, Object> context) {
- return true;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public boolean validateVersionType(BigInteger versionType, DiagnosticChain diagnostics, Map<Object, Object> context) {
- boolean result = validateVersionType_Min(versionType, diagnostics, context);
- return result;
- }
-
- /**
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- * @see #validateVersionType_Min
- */
- public static final BigInteger VERSION_TYPE__MIN__VALUE = new BigInteger("0");
-
- /**
- * Validates the Min constraint of '<em>Version Type</em>'.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- public boolean validateVersionType_Min(BigInteger versionType, DiagnosticChain diagnostics, Map<Object, Object> context) {
- boolean result = versionType.compareTo(VERSION_TYPE__MIN__VALUE) >= 0;
- if (!result && diagnostics != null)
- reportMinViolation(ModelPackage.Literals.VERSION_TYPE, versionType, VERSION_TYPE__MIN__VALUE, true, diagnostics, context);
- return result;
- }
-
- /**
- * Returns the resource locator that will be used to fetch messages for this validator's diagnostics.
- * <!-- begin-user-doc -->
- * <!-- end-user-doc -->
- * @generated
- */
- @Override
- public ResourceLocator getResourceLocator() {
- // TODO
- // Specialize this to return a resource locator for messages specific to this validator.
- // Ensure that you remove @generated or mark it @generated NOT
- return super.getResourceLocator();
- }
-
-} //ModelValidator
+/**
+ * <copyright>
+ * </copyright>
+ *
+ * $Id$
+ */
+package org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.util;
+
+import java.math.BigInteger;
+import java.util.Map;
+
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.*;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.DocumentRoot;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.GlobalType;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ImportType;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.OnEntryScriptType;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.OnExitScriptType;
+import org.eclipse.emf.common.util.DiagnosticChain;
+import org.eclipse.emf.common.util.ResourceLocator;
+import org.eclipse.emf.ecore.EPackage;
+import org.eclipse.emf.ecore.util.EObjectValidator;
+import org.eclipse.emf.ecore.xml.type.util.XMLTypeValidator;
+
+/**
+ * <!-- begin-user-doc -->
+ * The <b>Validator</b> for the model.
+ * <!-- end-user-doc -->
+ * @see org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ModelPackage
+ * @generated
+ */
+public class ModelValidator extends EObjectValidator {
+ /**
+ * The cached model package
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public static final ModelValidator INSTANCE = new ModelValidator();
+
+ /**
+ * A constant for the {@link org.eclipse.emf.common.util.Diagnostic#getSource() source} of diagnostic {@link org.eclipse.emf.common.util.Diagnostic#getCode() codes} from this package.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @see org.eclipse.emf.common.util.Diagnostic#getSource()
+ * @see org.eclipse.emf.common.util.Diagnostic#getCode()
+ * @generated
+ */
+ public static final String DIAGNOSTIC_SOURCE = "org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model";
+
+ /**
+ * A constant with a fixed name that can businessObject used as the base value for additional hand written constants.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ private static final int GENERATED_DIAGNOSTIC_CODE_COUNT = 0;
+
+ /**
+ * A constant with a fixed name that can businessObject used as the base value for additional hand written constants in a derived class.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected static final int DIAGNOSTIC_CODE_COUNT = GENERATED_DIAGNOSTIC_CODE_COUNT;
+
+ /**
+ * The cached base package validator.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ protected XMLTypeValidator xmlTypeValidator;
+
+ /**
+ * Creates an instance of the switch.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public ModelValidator() {
+ super();
+ xmlTypeValidator = XMLTypeValidator.INSTANCE;
+ }
+
+ /**
+ * Returns the package of this validator switch.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected EPackage getEPackage() {
+ return ModelPackage.eINSTANCE;
+ }
+
+ /**
+ * Calls <code>validateXXX</code> for the corresponding classifier of the model.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ protected boolean validate(int classifierID, Object value, DiagnosticChain diagnostics, Map<Object, Object> context) {
+ switch (classifierID) {
+ case ModelPackage.DOCUMENT_ROOT:
+ return validateDocumentRoot((DocumentRoot)value, diagnostics, context);
+ case ModelPackage.GLOBAL_TYPE:
+ return validateGlobalType((GlobalType)value, diagnostics, context);
+ case ModelPackage.IMPORT_TYPE:
+ return validateImportType((ImportType)value, diagnostics, context);
+ case ModelPackage.ON_ENTRY_SCRIPT_TYPE:
+ return validateOnEntryScriptType((OnEntryScriptType)value, diagnostics, context);
+ case ModelPackage.ON_EXIT_SCRIPT_TYPE:
+ return validateOnExitScriptType((OnExitScriptType)value, diagnostics, context);
+ case ModelPackage.PACKAGE_NAME_TYPE:
+ return validatePackageNameType((String)value, diagnostics, context);
+ case ModelPackage.PRIORITY_TYPE:
+ return validatePriorityType((BigInteger)value, diagnostics, context);
+ case ModelPackage.RULE_FLOW_GROUP_TYPE:
+ return validateRuleFlowGroupType((String)value, diagnostics, context);
+ case ModelPackage.TASK_NAME_TYPE:
+ return validateTaskNameType((String)value, diagnostics, context);
+ case ModelPackage.VERSION_TYPE:
+ return validateVersionType((BigInteger)value, diagnostics, context);
+ default:
+ return true;
+ }
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public boolean validateDocumentRoot(DocumentRoot documentRoot, DiagnosticChain diagnostics, Map<Object, Object> context) {
+ return validate_EveryDefaultConstraint(documentRoot, diagnostics, context);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public boolean validateGlobalType(GlobalType globalType, DiagnosticChain diagnostics, Map<Object, Object> context) {
+ return validate_EveryDefaultConstraint(globalType, diagnostics, context);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public boolean validateImportType(ImportType importType, DiagnosticChain diagnostics, Map<Object, Object> context) {
+ return validate_EveryDefaultConstraint(importType, diagnostics, context);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public boolean validateOnEntryScriptType(OnEntryScriptType onEntryScriptType, DiagnosticChain diagnostics, Map<Object, Object> context) {
+ return validate_EveryDefaultConstraint(onEntryScriptType, diagnostics, context);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public boolean validateOnExitScriptType(OnExitScriptType onExitScriptType, DiagnosticChain diagnostics, Map<Object, Object> context) {
+ return validate_EveryDefaultConstraint(onExitScriptType, diagnostics, context);
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public boolean validatePackageNameType(String packageNameType, DiagnosticChain diagnostics, Map<Object, Object> context) {
+ return true;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public boolean validatePriorityType(BigInteger priorityType, DiagnosticChain diagnostics, Map<Object, Object> context) {
+ boolean result = validatePriorityType_Min(priorityType, diagnostics, context);
+ return result;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @see #validatePriorityType_Min
+ */
+ public static final BigInteger PRIORITY_TYPE__MIN__VALUE = new BigInteger("1");
+
+ /**
+ * Validates the Min constraint of '<em>Priority Type</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public boolean validatePriorityType_Min(BigInteger priorityType, DiagnosticChain diagnostics, Map<Object, Object> context) {
+ boolean result = priorityType.compareTo(PRIORITY_TYPE__MIN__VALUE) >= 0;
+ if (!result && diagnostics != null)
+ reportMinViolation(ModelPackage.Literals.PRIORITY_TYPE, priorityType, PRIORITY_TYPE__MIN__VALUE, true, diagnostics, context);
+ return result;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public boolean validateRuleFlowGroupType(String ruleFlowGroupType, DiagnosticChain diagnostics, Map<Object, Object> context) {
+ return true;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public boolean validateTaskNameType(String taskNameType, DiagnosticChain diagnostics, Map<Object, Object> context) {
+ return true;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public boolean validateVersionType(BigInteger versionType, DiagnosticChain diagnostics, Map<Object, Object> context) {
+ boolean result = validateVersionType_Min(versionType, diagnostics, context);
+ return result;
+ }
+
+ /**
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ * @see #validateVersionType_Min
+ */
+ public static final BigInteger VERSION_TYPE__MIN__VALUE = new BigInteger("0");
+
+ /**
+ * Validates the Min constraint of '<em>Version Type</em>'.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ public boolean validateVersionType_Min(BigInteger versionType, DiagnosticChain diagnostics, Map<Object, Object> context) {
+ boolean result = versionType.compareTo(VERSION_TYPE__MIN__VALUE) >= 0;
+ if (!result && diagnostics != null)
+ reportMinViolation(ModelPackage.Literals.VERSION_TYPE, versionType, VERSION_TYPE__MIN__VALUE, true, diagnostics, context);
+ return result;
+ }
+
+ /**
+ * Returns the resource locator that will businessObject used to fetch messages for this validator's diagnostics.
+ * <!-- begin-user-doc -->
+ * <!-- end-user-doc -->
+ * @generated
+ */
+ @Override
+ public ResourceLocator getResourceLocator() {
+ // TODO
+ // Specialize this to return a resource locator for messages specific to this validator.
+ // Ensure that you remove @generated or mark it @generated NOT
+ return super.getResourceLocator();
+ }
+
+} //ModelValidator
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/JbpmImportObjectEditor.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/JbpmImportObjectEditor.java
index 37acce3..20d6c98 100644
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/JbpmImportObjectEditor.java
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/JbpmImportObjectEditor.java
@@ -1,38 +1,38 @@
-package org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.property;
-
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.dialogs.TextAndButtonObjectEditor;
-import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ImportType;
-import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.util.JbpmModelUtil;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.transaction.RecordingCommand;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-public class JbpmImportObjectEditor extends TextAndButtonObjectEditor {
-
- public JbpmImportObjectEditor(AbstractDetailComposite parent, EObject object, EStructuralFeature feature) {
- super(parent, object, feature);
- }
-
- @Override
- public Control createControl(Composite composite, String label, int style) {
- super.createControl(composite, label, style);
- // the Text field should be editable
- text.setEditable(true);
- // and change the "Edit" button to a "Browse" to make it clear that
- // an XML type can be selected from the imports
- button.setText("Browse Types...");
- return text;
- }
-
- @Override
- protected void buttonClicked() {
- String name = JbpmModelUtil.showImportDialog(object);
- ImportType imp = JbpmModelUtil.addImport(name, object);
- if (imp!=null)
- setText(imp.getName());
- }
-}
+package org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.property;
+
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
+import org.eclipse.bpmn2.modeler.core.merrimac.dialogs.TextAndButtonObjectEditor;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.ImportType;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.util.JbpmModelUtil;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.transaction.RecordingCommand;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+public class JbpmImportObjectEditor extends TextAndButtonObjectEditor {
+
+ public JbpmImportObjectEditor(AbstractDetailComposite parent, EObject object, EStructuralFeature feature) {
+ super(parent, object, feature);
+ }
+
+ @Override
+ public Control createControl(Composite composite, String label, int style) {
+ super.createControl(composite, label, style);
+ // the Text field should businessObject editable
+ text.setEditable(true);
+ // and change the "Edit" button to a "Browse" to make it clear that
+ // an XML type can businessObject selected from the imports
+ button.setText("Browse Types...");
+ return text;
+ }
+
+ @Override
+ protected void buttonClicked() {
+ String name = JbpmModelUtil.showImportDialog(object);
+ ImportType imp = JbpmModelUtil.addImport(name, object);
+ if (imp!=null)
+ setText(imp.getName());
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/util/JbpmModelUtil.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/util/JbpmModelUtil.java
index 9bf5bff..50a037d 100644
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/util/JbpmModelUtil.java
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/util/JbpmModelUtil.java
@@ -40,7 +40,7 @@
* will also create a corresponding ItemDefinition for the newly imported java type.
*
* @param object - a context EObject used to search for the Process in which the new
- * ImportType will be created.
+ * ImportType will businessObject created.
* @return an ImportType object if it was created, null if the user canceled the import dialog.
*/
public static String showImportDialog(EObject object) {
@@ -130,11 +130,11 @@
// ModelUtil.addExtensionAttributeValue(itemDef, feature, ref);
// Nope, don't need this! The ItemDefinition needs to stick around, otherwise the data types
// for process variables and globals would disappear. Besides, jBPM allows data types
- // (a.k.a. ItemDefinitions) to be defined as sort of "forward references" without actual
+ // (a.k.a. ItemDefinitions) to businessObject defined as sort of "forward references" without actual
// knowledge of the physicial structure of the data type - these get resolved (somehow,
// through FM maybe?) at runtime.
// As a side note: if a type is unknown (i.e. there is no "import") then the structure
- // will be unknown in java scripts (FormalExpressions).
+ // will businessObject unknown in java scripts (FormalExpressions).
// add the ItemDefinition to the root elements
definitions.getRootElements().add(itemDef);
@@ -210,7 +210,7 @@
/**
* This method returns a string representation for a "data type". This is intended to
- * be used to interpret the various objects in the map returned by collectAllDataTypes().
+ * businessObject used to interpret the various objects in the map returned by collectAllDataTypes().
*
* @param value - one of the Object values in the map returned by collectAllDataTypes().
* @return a string representation of the data type
@@ -237,7 +237,7 @@
/**
* This method returns an ItemDefinition object for a "data type". This is intended to
- * be used to interpret the various objects in the map returned by collectAllDataTypes().
+ * businessObject used to interpret the various objects in the map returned by collectAllDataTypes().
*
* NOTE: This method will create an ItemDefinition if it does not already exist.
*
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/CallActivityConstraint.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/CallActivityConstraint.java
index 369988f..93579e4 100644
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/CallActivityConstraint.java
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/CallActivityConstraint.java
@@ -39,7 +39,7 @@
foundCalledElementProcess = true; // TODO: remove this
if (!foundCalledElementProcess) {
ctx.createFailureStatus("No existing process with id=" + ca.getCalledElementRef()
- + " could be found.");
+ + " could businessObject found.");
}
}
}
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/GatewayConstraint.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/GatewayConstraint.java
index 2381519..d84f3f3 100644
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/GatewayConstraint.java
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/GatewayConstraint.java
@@ -41,7 +41,7 @@
Integer i = new Integer(entry.getValue());
if (i < 0) {
ctx.addResult(sf);
- ctx.createFailureStatus("Probability value must be positive.");
+ ctx.createFailureStatus("Probability value must businessObject positive.");
} else {
sum += i;
}
@@ -57,7 +57,7 @@
}
}
if (sum != 100) {
- ctx.createFailureStatus("The sum of probability values of all outgoing Sequence Flows must be equal 100.");
+ ctx.createFailureStatus("The sum of probability values of all outgoing Sequence Flows must businessObject equal 100.");
}
}
}
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/TaskConstraint.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/TaskConstraint.java
index 4819666..e53ec6c 100644
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/TaskConstraint.java
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/TaskConstraint.java
@@ -39,7 +39,7 @@
if (entry.getName() != null && entry.getName().equals("costpertimeunit")) {
Float f = new Float(entry.getValue());
if (f.floatValue() < 0) {
- ctx.createFailureStatus("Cost per Time Unit value must be positive");
+ ctx.createFailureStatus("Cost per Time Unit value must businessObject positive");
}
}
if (entry.getName() != null && entry.getName().equals("distributiontype")) {
@@ -49,7 +49,7 @@
if (entry.getName() != null && entry.getName().equals("duration")) {
Float f = new Float(entry.getValue());
if (f.floatValue() < 0) {
- ctx.createFailureStatus("Duration value must be positive");
+ ctx.createFailureStatus("Duration value must businessObject positive");
}
foundDuration = true;
}
@@ -59,13 +59,13 @@
if (entry.getName() != null && entry.getName().equals("workinghours")) {
Float f = new Float(entry.getValue());
if (f.floatValue() < 0) {
- ctx.createFailureStatus("Working Hours value must be positive");
+ ctx.createFailureStatus("Working Hours value must businessObject positive");
}
}
if (entry.getName() != null && entry.getName().equals("range")) {
Float f = new Float(entry.getValue());
if (f.floatValue() < 0) {
- ctx.createFailureStatus("Range value must be positive");
+ ctx.createFailureStatus("Range value must businessObject positive");
}
foundRange = true;
}
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/UserTaskConstraint.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/UserTaskConstraint.java
index 250e66a..4b16fa8 100644
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/UserTaskConstraint.java
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/UserTaskConstraint.java
@@ -62,7 +62,7 @@
if (entry.getName() != null && entry.getName().equals("staffavailability")) {
Float f = new Float(entry.getValue());
if (f.floatValue() < 0) {
- ctx.createFailureStatus("Staff Availability value must be positive");
+ ctx.createFailureStatus("Staff Availability value must businessObject positive");
}
foundStaffAvailability = true;
}
diff --git a/org.eclipse.bpmn2.modeler.ui/plugin.xml b/org.eclipse.bpmn2.modeler.ui/plugin.xml
index b8614cd..f94e22e 100644
--- a/org.eclipse.bpmn2.modeler.ui/plugin.xml
+++ b/org.eclipse.bpmn2.modeler.ui/plugin.xml
@@ -217,7 +217,8 @@
<propertyTab
id="org.eclipse.bpmn2.modeler.messageFlow.tab"
- class="org.eclipse.bpmn2.modeler.ui.property.connectors.MessageFlowPropertySection"
+ class="default"
+ features="messageRef"
type="org.eclipse.bpmn2.MessageFlow"
afterTab="org.eclipse.bpmn2.modeler.description.tab"
label="Message Flow">
@@ -225,7 +226,8 @@
<propertyTab
id="org.eclipse.bpmn2.modeler.message.tab"
- class="org.eclipse.bpmn2.modeler.ui.property.data.MessagePropertySection"
+ class="default"
+ features="itemRef"
type="org.eclipse.bpmn2.Message"
afterTab="org.eclipse.bpmn2.modeler.description.tab"
label="Message">
@@ -233,23 +235,17 @@
<propertyTab
id="org.eclipse.bpmn2.modeler.assocation.tab"
- class="org.eclipse.bpmn2.modeler.ui.property.connectors.AssociationPropertySection"
+ class="default"
+ features="associationDirection"
type="org.eclipse.bpmn2.Association"
afterTab="org.eclipse.bpmn2.modeler.description.tab"
label="Assocation">
</propertyTab>
<propertyTab
- id="org.eclipse.bpmn2.modeler.conversationLink.tab"
- class="org.eclipse.bpmn2.modeler.ui.property.connectors.ConversationLinkPropertySection"
- type="org.eclipse.bpmn2.ConversationLink"
- afterTab="org.eclipse.bpmn2.modeler.description.tab"
- label="Conversation Link">
- </propertyTab>
-
- <propertyTab
id="org.eclipse.bpmn2.modeler.conversation.tab"
- class="org.eclipse.bpmn2.modeler.ui.property.connectors.ConversationPropertySection"
+ class="default"
+ features="correlationKeys"
type="org.eclipse.bpmn2.Conversation"
afterTab="org.eclipse.bpmn2.modeler.description.tab"
label="Conversation">
@@ -262,6 +258,14 @@
afterTab="org.eclipse.bpmn2.modeler.description.tab"
label="Event">
</propertyTab>
+
+ <propertyTab
+ afterTab="org.eclipse.bpmn2.modeler.task.tab"
+ class="org.eclipse.bpmn2.modeler.ui.property.artifact.TextAnnotationPropertySection"
+ id="org.eclipse.bpmn2.modeler.textAnnotation.tab"
+ type="org.eclipse.bpmn2.TextAnnotation"
+ label="Text Annotation">
+ </propertyTab>
<propertyTab
id="org.eclipse.bpmn2.modeler.task.tab"
@@ -270,14 +274,6 @@
afterTab="org.eclipse.bpmn2.modeler.description.tab"
label="Task">
</propertyTab>
-
- <propertyTab
- afterTab="org.eclipse.bpmn2.modeler.task.tab"
- class="org.eclipse.bpmn2.modeler.ui.property.artifact.TextAnnotationPropertySection"
- id="org.eclipse.bpmn2.modeler.textAnnotation.tab"
- label="Text Annotation"
- type="org.eclipse.bpmn2.TextAnnotation">
- </propertyTab>
<propertyTab
id="org.eclipse.bpmn2.modeler.scriptTask.tab"
@@ -289,7 +285,8 @@
<propertyTab
id="org.eclipse.bpmn2.modeler.serviceTask.tab"
- class="org.eclipse.bpmn2.modeler.ui.property.tasks.ServiceTaskPropertySection"
+ class="default"
+ features="implementation operationRef"
type="org.eclipse.bpmn2.ServiceTask"
afterTab="org.eclipse.bpmn2.modeler.task.tab"
label="Service Task">
@@ -297,7 +294,8 @@
<propertyTab
id="org.eclipse.bpmn2.modeler.userTask.tab"
- class="org.eclipse.bpmn2.modeler.ui.property.tasks.UserTaskPropertySection"
+ class="default"
+ features="implementation renderings"
type="org.eclipse.bpmn2.UserTask"
afterTab="org.eclipse.bpmn2.modeler.task.tab"
label="User Task">
@@ -305,7 +303,8 @@
<propertyTab
id="org.eclipse.bpmn2.modeler.sendTask.tab"
- class="org.eclipse.bpmn2.modeler.ui.property.tasks.SendTaskPropertySection"
+ class="default"
+ features="implementation messageRef operationRef"
type="org.eclipse.bpmn2.SendTask"
afterTab="org.eclipse.bpmn2.modeler.task.tab"
label="Send Task">
@@ -313,7 +312,8 @@
<propertyTab
id="org.eclipse.bpmn2.modeler.receiveTask.tab"
- class="org.eclipse.bpmn2.modeler.ui.property.tasks.ReceiveTaskPropertySection"
+ class="default"
+ features="implementation instantiate messageRef operationRef"
type="org.eclipse.bpmn2.ReceiveTask"
afterTab="org.eclipse.bpmn2.modeler.description.tab"
label="Receive Task">
@@ -321,7 +321,8 @@
<propertyTab
id="org.eclipse.bpmn2.modeler.businessRuleTask.tab"
- class="org.eclipse.bpmn2.modeler.ui.property.tasks.BusinessRuleTaskPropertySection"
+ class="default"
+ features="anyAttribute implementation"
type="org.eclipse.bpmn2.BusinessRuleTask"
afterTab="org.eclipse.bpmn2.modeler.description.tab"
label="Business Rule Task">
@@ -329,7 +330,8 @@
<propertyTab
id="org.eclipse.bpmn2.modeler.choreographyTask.tab"
- class="org.eclipse.bpmn2.modeler.ui.property.tasks.ChoreographyTaskPropertySection"
+ class="default"
+ features="loopType initiatingParticipantRef correlationKeys messageFlowRef"
type="org.eclipse.bpmn2.ChoreographyTask"
afterTab="org.eclipse.bpmn2.modeler.description.tab"
label="Choreography Task">
@@ -337,7 +339,7 @@
<propertyTab
id="org.eclipse.bpmn2.modeler.callActivity.tab"
- class="org.eclipse.bpmn2.modeler.ui.property.tasks.CallActivityPropertySection"
+ class="org.eclipse.bpmn2.modeler.ui.property.tasks.ActivityPropertySection"
type="org.eclipse.bpmn2.CallActivity"
afterTab="org.eclipse.bpmn2.modeler.description.tab"
label="Call Activity">
@@ -345,7 +347,7 @@
<propertyTab
id="org.eclipse.bpmn2.modeler.callChoreography.tab"
- class="org.eclipse.bpmn2.modeler.ui.property.tasks.CallChoreographyPropertySection"
+ class="org.eclipse.bpmn2.modeler.ui.property.tasks.ActivityPropertySection"
type="org.eclipse.bpmn2.CallChoreography"
afterTab="org.eclipse.bpmn2.modeler.description.tab"
label="Call Choreography">
@@ -353,7 +355,7 @@
<propertyTab
id="org.eclipse.bpmn2.modeler.subProcess.tab"
- class="org.eclipse.bpmn2.modeler.ui.property.tasks.SubProcessPropertySection"
+ class="org.eclipse.bpmn2.modeler.ui.property.tasks.ActivityPropertySection"
type="org.eclipse.bpmn2.SubProcess"
afterTab="org.eclipse.bpmn2.modeler.description.tab"
label="Sub Process">
@@ -361,7 +363,8 @@
<propertyTab
id="org.eclipse.bpmn2.modeler.subChoreography.tab"
- class="org.eclipse.bpmn2.modeler.ui.property.tasks.SubChoreographyPropertySection"
+ class="default"
+ features="anyAttribute loopType participantRefs initiatingParticipantRef correlationKeys artifacts"
type="org.eclipse.bpmn2.SubChoreography"
afterTab="org.eclipse.bpmn2.modeler.description.tab"
label="Sub Choreography">
@@ -373,33 +376,18 @@
afterTab="org.eclipse.bpmn2.modeler.task.tab"
label="I/O Parameters">
</propertyTab>
-<!--
- <propertyTab
- id="org.eclipse.bpmn2.modeler.activity.input.tab"
- class="org.eclipse.bpmn2.modeler.ui.property.tasks.ActivityInputPropertySection"
- type="org.eclipse.bpmn2.Activity"
- afterTab="org.eclipse.bpmn2.modeler.task.tab"
- label="Inputs/Assignments">
- </propertyTab>
<propertyTab
- id="org.eclipse.bpmn2.modeler.activity.output.tab"
- class="org.eclipse.bpmn2.modeler.ui.property.tasks.ActivityOutputPropertySection"
- type="org.eclipse.bpmn2.Activity"
- afterTab="org.eclipse.bpmn2.modeler.task.tab"
- label="Outputs/Assignments">
- </propertyTab>
--->
- <propertyTab
- id="org.eclipse.bpmn2.modeler.gateway.tab"
- class="org.eclipse.bpmn2.modeler.ui.property.artifact.GroupPropertySection"
+ id="org.eclipse.bpmn2.modeler.group.tab"
+ class="default"
+ features="anyAttribute categoryValueRef"
type="org.eclipse.bpmn2.Group"
afterTab="org.eclipse.bpmn2.modeler.description.tab"
label="Group">
</propertyTab>
<propertyTab
- id="org.eclipse.bpmn2.modeler.group.tab"
+ id="org.eclipse.bpmn2.modeler.gateway.tab"
class="org.eclipse.bpmn2.modeler.ui.property.gateways.GatewayPropertySection"
type="org.eclipse.bpmn2.Gateway"
afterTab="org.eclipse.bpmn2.modeler.description.tab"
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/Activator.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/Activator.java
index d03d521..22b0793 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/Activator.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/Activator.java
@@ -129,8 +129,8 @@
}
/**
- * Return the dialog settings for a given object. The object may be a string
- * or any other java object. In that case, the object's class name will be used
+ * Return the dialog settings for a given object. The object may businessObject a string
+ * or any other java object. In that case, the object's class name will businessObject used
* to retrieve that section name.
*
* @param object
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/FaultAdapter.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/FaultAdapter.java
index fe9ac16..1a8d005 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/FaultAdapter.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/FaultAdapter.java
@@ -1,63 +1,63 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.adapters;
-
-import org.eclipse.bpmn2.modeler.core.adapters.AbstractStatefulAdapter;
-import org.eclipse.bpmn2.modeler.ui.Activator;
-import org.eclipse.bpmn2.modeler.ui.IConstants;
-import org.eclipse.bpmn2.modeler.ui.Messages;
-import org.eclipse.jface.fieldassist.IContentProposal;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.wst.wsdl.Fault;
-
-public class FaultAdapter extends AbstractStatefulAdapter implements ILabeledElement, IContentProposal {
-
- /* ILabeledElement */
-
- // TODO: need a unique icon for WSDL faults
-
- public Image getSmallImage(Object object) {
- return Activator.getDefault().getImage(IConstants.ICON_THROW_16);
- }
-
- public Image getLargeImage(Object object) {
- return Activator.getDefault().getImage(IConstants.ICON_THROW_32);
- }
-
- public String getTypeLabel(Object object) {
- return Messages.FaultAdapter_Fault_1;
- }
- public String getLabel(Object object) {
- String name = getTarget(object, Fault.class).getName();
- if (name != null) {
- return name;
- }
- return getTypeLabel(object);
- }
-
- public String getContent() {
- return getLabel ( getTarget() );
- }
-
- public int getCursorPosition() {
- // TODO Why -1?
- return -1;
- }
-
- public String getDescription() {
- // TODO Temporary returns null, then should be updated
- return null;
- }
-
- public String getLabel() {
- return getLabel ( getTarget() ) + " - " + getLabel ( getTarget() );
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpmn2.modeler.ui.adapters;
+
+import org.eclipse.bpmn2.modeler.core.adapters.AbstractStatefulAdapter;
+import org.eclipse.bpmn2.modeler.ui.Activator;
+import org.eclipse.bpmn2.modeler.ui.IConstants;
+import org.eclipse.bpmn2.modeler.ui.Messages;
+import org.eclipse.jface.fieldassist.IContentProposal;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.wst.wsdl.Fault;
+
+public class FaultAdapter extends AbstractStatefulAdapter implements ILabeledElement, IContentProposal {
+
+ /* ILabeledElement */
+
+ // TODO: need a unique icon for WSDL faults
+
+ public Image getSmallImage(Object object) {
+ return Activator.getDefault().getImage(IConstants.ICON_THROW_16);
+ }
+
+ public Image getLargeImage(Object object) {
+ return Activator.getDefault().getImage(IConstants.ICON_THROW_32);
+ }
+
+ public String getTypeLabel(Object object) {
+ return Messages.FaultAdapter_Fault_1;
+ }
+ public String getLabel(Object object) {
+ String name = getTarget(object, Fault.class).getName();
+ if (name != null) {
+ return name;
+ }
+ return getTypeLabel(object);
+ }
+
+ public String getContent() {
+ return getLabel ( getTarget() );
+ }
+
+ public int getCursorPosition() {
+ // TODO Why -1?
+ return -1;
+ }
+
+ public String getDescription() {
+ // TODO Temporary returns null, then should businessObject updated
+ return null;
+ }
+
+ public String getLabel() {
+ return getLabel ( getTarget() ) + " - " + getLabel ( getTarget() );
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/INamedElement.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/INamedElement.java
index b55ce34..a7fc80f 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/INamedElement.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/INamedElement.java
@@ -19,13 +19,13 @@
public interface INamedElement {
/**
* Return the name of the given parameter. The name may
- * be null.
+ * businessObject null.
*/
public String getName(Object modelObject);
/**
* Set the name of the parameter to the given string.
- * The string may be null;
+ * The string may businessObject null;
*/
public void setName(Object modelObject, String name);
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/properties/DataAssociationPropertiesAdapter.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/properties/DataAssociationPropertiesAdapter.java
index 64c520a..18b0994 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/properties/DataAssociationPropertiesAdapter.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/properties/DataAssociationPropertiesAdapter.java
@@ -124,7 +124,7 @@
// what kind of object should we create? Property or DataStore?
if (eClass==null) {
if (ModelUtil.findNearestAncestor(association, new Class[] {Process.class, Event.class}) != null)
- // nearest ancestor is a Process or Event, so new object will be a Property
+ // nearest ancestor is a Process or Event, so new object will businessObject a Property
eClass = Bpmn2Package.eINSTANCE.getProperty();
else if(ModelUtil.findNearestAncestor(association, new Class[] {DocumentRoot.class}) != null)
eClass = Bpmn2Package.eINSTANCE.getDataStore();
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/properties/ParticipantPropertiesAdapter.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/properties/ParticipantPropertiesAdapter.java
index 654b3d6..235c2a3 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/properties/ParticipantPropertiesAdapter.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/adapters/properties/ParticipantPropertiesAdapter.java
@@ -74,12 +74,12 @@
// participant.setProcessRef(process);
// NOTE: this is needed because it fires the InsertionAdapter, which adds the new Process
- // to Definitions.rootElements, otherwise the Process would be a dangling object
+ // to Definitions.rootElements, otherwise the Process would businessObject a dangling object
// process.setName(participant.getName()+" Process");
// add the Participant to the first Choreography or Collaboration we find.
// TODO: when (and if) multipage editor allows additional Choreography or
- // Collaboration diagrams to be created, this will be the specific diagram
+ // Collaboration diagrams to businessObject created, this will businessObject the specific diagram
// that is being rendered on the current page.
List<RootElement> rootElements = definitions.getRootElements();
for (RootElement element : rootElements) {
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/diagram/BPMNFeatureProvider.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/diagram/BPMNFeatureProvider.java
index 5423f24..c56673a 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/diagram/BPMNFeatureProvider.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/diagram/BPMNFeatureProvider.java
@@ -127,7 +127,7 @@
import org.eclipse.graphiti.ui.features.DefaultFeatureProvider;
/**
- * Determines what kinds of business objects can be added to a diagram.
+ * Determines what kinds of business objects can businessObject added to a diagram.
*
* @author imeikas
*
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/diagram/BpmnToolBehaviourFeature.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/diagram/BpmnToolBehaviourFeature.java
index c8fcd3f..a01395a 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/diagram/BpmnToolBehaviourFeature.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/diagram/BpmnToolBehaviourFeature.java
@@ -316,7 +316,7 @@
}
// 1. set the generic context buttons
- // Participant bands can only be removed from the choreograpy task
+ // Participant bands can only businessObject removed from the choreograpy task
int genericButtons = CONTEXT_BUTTON_DELETE;
if (ChoreographyUtil.isChoreographyParticipantBand(pe)) {
genericButtons |= CONTEXT_BUTTON_REMOVE;
@@ -432,7 +432,7 @@
public IDecorator[] getDecorators(PictogramElement pe) {
List<IDecorator> decorators = new ArrayList<IDecorator>();
- // labels should not be decorated
+ // labels should not businessObject decorated
String labelProperty = Graphiti.getPeService().getPropertyValue(pe, GraphicsUtil.LABEL_PROPERTY);
if (!Boolean.parseBoolean(labelProperty)) {
IFeatureProvider featureProvider = getFeatureProvider();
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2EditingDomainListener.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2EditingDomainListener.java
index 9f35932..987c241 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2EditingDomainListener.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2EditingDomainListener.java
@@ -1,82 +1,82 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Bob Brodt
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.editor;
-
-import org.eclipse.core.resources.IMarker;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.emf.common.util.BasicDiagnostic;
-import org.eclipse.emf.transaction.ExceptionHandler;
-import org.eclipse.emf.transaction.TransactionalCommandStack;
-import org.eclipse.emf.transaction.TransactionalEditingDomainEvent;
-import org.eclipse.emf.transaction.TransactionalEditingDomainListenerImpl;
-
-public class BPMN2EditingDomainListener extends TransactionalEditingDomainListenerImpl implements ExceptionHandler {
-
- protected BPMN2Editor bpmn2Editor;
- protected BasicDiagnostic diagnostics;
-
- public BPMN2EditingDomainListener(BPMN2Editor bpmn2Editor) {
- super();
- this.bpmn2Editor = bpmn2Editor;
- TransactionalCommandStack stack = (TransactionalCommandStack) bpmn2Editor.getEditingDomain().getCommandStack();
- stack.setExceptionHandler(this);
- }
-
- @Override
- public void transactionStarting(TransactionalEditingDomainEvent event) {
- diagnostics = null;
- }
-
- /**
- * this will be called in case of rollback
- */
- @Override
- public void transactionClosed(TransactionalEditingDomainEvent event) {
- super.transactionClosed(event);
- }
-
- @Override
- public void handleException(Exception e) {
- String source = null;
- int code = 0;
- String message = e.getMessage();
- Object[] data = null;
- StackTraceElement trace[] = e.getStackTrace();
- if (trace!=null && trace.length>0) {
- source = trace[0].getMethodName();
- }
- if (diagnostics==null) {
- diagnostics = new BasicDiagnostic(source,code,message,data);
- }
- else
- diagnostics.add(new BasicDiagnostic(source,code,message,data));
- }
-
- public BasicDiagnostic getDiagnostics() {
- return diagnostics;
- }
-
- public IMarker createMarker(IResource resource, int severity, String msg) {
- try {
- IMarker m = resource.createMarker(IMarker.PROBLEM);
- m.setAttribute(IMarker.MESSAGE, msg);
- m.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH);
- m.setAttribute(IMarker.SEVERITY, severity);
- return m;
- } catch (CoreException e) {
- throw new RuntimeException(e);
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Bob Brodt
+ ******************************************************************************/
+package org.eclipse.bpmn2.modeler.ui.editor;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.emf.common.util.BasicDiagnostic;
+import org.eclipse.emf.transaction.ExceptionHandler;
+import org.eclipse.emf.transaction.TransactionalCommandStack;
+import org.eclipse.emf.transaction.TransactionalEditingDomainEvent;
+import org.eclipse.emf.transaction.TransactionalEditingDomainListenerImpl;
+
+public class BPMN2EditingDomainListener extends TransactionalEditingDomainListenerImpl implements ExceptionHandler {
+
+ protected BPMN2Editor bpmn2Editor;
+ protected BasicDiagnostic diagnostics;
+
+ public BPMN2EditingDomainListener(BPMN2Editor bpmn2Editor) {
+ super();
+ this.bpmn2Editor = bpmn2Editor;
+ TransactionalCommandStack stack = (TransactionalCommandStack) bpmn2Editor.getEditingDomain().getCommandStack();
+ stack.setExceptionHandler(this);
+ }
+
+ @Override
+ public void transactionStarting(TransactionalEditingDomainEvent event) {
+ diagnostics = null;
+ }
+
+ /**
+ * this will businessObject called in case of rollback
+ */
+ @Override
+ public void transactionClosed(TransactionalEditingDomainEvent event) {
+ super.transactionClosed(event);
+ }
+
+ @Override
+ public void handleException(Exception e) {
+ String source = null;
+ int code = 0;
+ String message = e.getMessage();
+ Object[] data = null;
+ StackTraceElement trace[] = e.getStackTrace();
+ if (trace!=null && trace.length>0) {
+ source = trace[0].getMethodName();
+ }
+ if (diagnostics==null) {
+ diagnostics = new BasicDiagnostic(source,code,message,data);
+ }
+ else
+ diagnostics.add(new BasicDiagnostic(source,code,message,data));
+ }
+
+ public BasicDiagnostic getDiagnostics() {
+ return diagnostics;
+ }
+
+ public IMarker createMarker(IResource resource, int severity, String msg) {
+ try {
+ IMarker m = resource.createMarker(IMarker.PROBLEM);
+ m.setAttribute(IMarker.MESSAGE, msg);
+ m.setAttribute(IMarker.PRIORITY, IMarker.PRIORITY_HIGH);
+ m.setAttribute(IMarker.SEVERITY, severity);
+ return m;
+ } catch (CoreException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2Editor.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2Editor.java
index 639f1ac..9703739 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2Editor.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2Editor.java
@@ -13,13 +13,65 @@
package org.eclipse.bpmn2.modeler.ui.editor;
import java.io.IOException;
-import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.LinkedHashSet;
-import java.util.Set;
+import org.eclipse.bpmn2.Activity;
+import org.eclipse.bpmn2.Assignment;
import org.eclipse.bpmn2.BaseElement;
+import org.eclipse.bpmn2.BoundaryEvent;
+import org.eclipse.bpmn2.CallActivity;
+import org.eclipse.bpmn2.CallChoreography;
+import org.eclipse.bpmn2.CatchEvent;
+import org.eclipse.bpmn2.Category;
+import org.eclipse.bpmn2.CompensateEventDefinition;
+import org.eclipse.bpmn2.ConditionalEventDefinition;
+import org.eclipse.bpmn2.DataInput;
+import org.eclipse.bpmn2.DataObject;
+import org.eclipse.bpmn2.DataObjectReference;
+import org.eclipse.bpmn2.DataOutput;
+import org.eclipse.bpmn2.DataStore;
+import org.eclipse.bpmn2.DataStoreReference;
+import org.eclipse.bpmn2.EndEvent;
+import org.eclipse.bpmn2.ErrorEventDefinition;
+import org.eclipse.bpmn2.EscalationEventDefinition;
+import org.eclipse.bpmn2.Event;
+import org.eclipse.bpmn2.Expression;
+import org.eclipse.bpmn2.FormalExpression;
+import org.eclipse.bpmn2.Gateway;
+import org.eclipse.bpmn2.GlobalBusinessRuleTask;
+import org.eclipse.bpmn2.GlobalManualTask;
+import org.eclipse.bpmn2.GlobalScriptTask;
+import org.eclipse.bpmn2.GlobalTask;
+import org.eclipse.bpmn2.GlobalUserTask;
+import org.eclipse.bpmn2.HumanPerformer;
+import org.eclipse.bpmn2.Import;
+import org.eclipse.bpmn2.InputOutputSpecification;
+import org.eclipse.bpmn2.Interface;
+import org.eclipse.bpmn2.ItemDefinition;
+import org.eclipse.bpmn2.LinkEventDefinition;
+import org.eclipse.bpmn2.ManualTask;
+import org.eclipse.bpmn2.Message;
+import org.eclipse.bpmn2.MessageEventDefinition;
+import org.eclipse.bpmn2.MessageFlow;
+import org.eclipse.bpmn2.MultiInstanceLoopCharacteristics;
+import org.eclipse.bpmn2.Performer;
+import org.eclipse.bpmn2.PotentialOwner;
+import org.eclipse.bpmn2.Process;
+import org.eclipse.bpmn2.Property;
+import org.eclipse.bpmn2.ResourceAssignmentExpression;
+import org.eclipse.bpmn2.ResourceParameterBinding;
+import org.eclipse.bpmn2.ResourceRole;
+import org.eclipse.bpmn2.ScriptTask;
+import org.eclipse.bpmn2.SequenceFlow;
+import org.eclipse.bpmn2.SignalEventDefinition;
+import org.eclipse.bpmn2.StandardLoopCharacteristics;
+import org.eclipse.bpmn2.StartEvent;
+import org.eclipse.bpmn2.SubProcess;
+import org.eclipse.bpmn2.Task;
+import org.eclipse.bpmn2.TextAnnotation;
+import org.eclipse.bpmn2.ThrowEvent;
+import org.eclipse.bpmn2.TimerEventDefinition;
import org.eclipse.bpmn2.di.BPMNDiagram;
import org.eclipse.bpmn2.modeler.core.Bpmn2TabbedPropertySheetPage;
import org.eclipse.bpmn2.modeler.core.ModelHandler;
@@ -42,6 +94,49 @@
import org.eclipse.bpmn2.modeler.core.validation.BPMN2ProjectValidator;
import org.eclipse.bpmn2.modeler.core.validation.BPMN2ValidationStatusLoader;
import org.eclipse.bpmn2.modeler.ui.Activator;
+import org.eclipse.bpmn2.modeler.ui.property.artifact.CategoryDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.artifact.TextAnnotationDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.connectors.MessageFlowDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.connectors.SequenceFlowDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.data.ConditionalEventDefinitionDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.data.DataAssignmentDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.data.DataObjectPropertySection.DataObjectDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.data.DataObjectReferencePropertySection.DataObjectReferenceDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.data.DataStorePropertySection.DataStoreDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.data.DataStoreReferencePropertySection.DataStoreReferenceDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.data.ExpressionDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.data.InterfaceDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.data.ItemAwareElementDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.data.MessageDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.data.MessageListComposite;
+import org.eclipse.bpmn2.modeler.ui.property.data.ResourceAssignmentExpressionDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.data.ResourceParameterBindingDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.data.ResourceRoleDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.diagrams.DefinitionsPropertyComposite.ImportDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.diagrams.ItemDefinitionDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.diagrams.ItemDefinitionListComposite;
+import org.eclipse.bpmn2.modeler.ui.property.diagrams.ProcessDiagramPropertyComposite;
+import org.eclipse.bpmn2.modeler.ui.property.diagrams.PropertyListComposite;
+import org.eclipse.bpmn2.modeler.ui.property.diagrams.ResourceRoleListComposite;
+import org.eclipse.bpmn2.modeler.ui.property.events.BoundaryEventDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.events.CatchEventDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.events.CommonEventDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.events.CommonEventPropertySection.EventDefinitionDialogComposite;
+import org.eclipse.bpmn2.modeler.ui.property.events.EndEventDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.events.StartEventDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.events.ThrowEventDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.events.TimerEventDefinitionDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.gateways.GatewayDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.tasks.ActivityDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.tasks.ActivityInputDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.tasks.ActivityOutputDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.tasks.DataAssociationDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.tasks.IoParametersDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.tasks.ManualTaskDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.tasks.MultiInstanceLoopCharacteristicsDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.tasks.ScriptTaskDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.tasks.StandardLoopCharacteristicsDetailComposite;
+import org.eclipse.bpmn2.modeler.ui.property.tasks.TaskDetailComposite;
import org.eclipse.bpmn2.modeler.ui.wizards.BPMN2DiagramCreator;
import org.eclipse.bpmn2.modeler.ui.wizards.Bpmn2DiagramEditorInput;
import org.eclipse.bpmn2.util.Bpmn2ResourceImpl;
@@ -70,10 +165,6 @@
import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.TransactionalEditingDomain.Lifecycle;
import org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl;
-import org.eclipse.emf.validation.model.EvaluationMode;
-import org.eclipse.emf.validation.service.IBatchValidator;
-import org.eclipse.emf.validation.service.ModelValidationService;
-import org.eclipse.emf.validation.service.ValidationEvent;
import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
import org.eclipse.graphiti.features.IFeatureProvider;
import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
@@ -86,7 +177,6 @@
import org.eclipse.graphiti.ui.editor.DiagramEditor;
import org.eclipse.graphiti.ui.editor.DiagramEditorInput;
import org.eclipse.graphiti.ui.internal.editor.GFPaletteRoot;
-import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.util.IPropertyChangeListener;
import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.jface.viewers.ISelection;
@@ -97,8 +187,6 @@
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.IFileEditorInput;
import org.eclipse.ui.IPartListener2;
-import org.eclipse.ui.IViewPart;
-import org.eclipse.ui.IViewReference;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchListener;
import org.eclipse.ui.IWorkbenchPage;
@@ -110,12 +198,8 @@
import org.eclipse.ui.ide.IGotoMarker;
import org.eclipse.ui.ide.ResourceUtil;
import org.eclipse.ui.part.FileEditorInput;
-import org.eclipse.ui.part.IPage;
-import org.eclipse.ui.progress.IProgressService;
import org.eclipse.ui.views.properties.IPropertySheetPage;
-import org.eclipse.ui.views.properties.PropertySheet;
import org.eclipse.ui.views.properties.tabbed.ITabDescriptorProvider;
-import org.eclipse.wst.validation.ValidationState;
/**
*
@@ -128,6 +212,72 @@
PropertiesCompositeFactory.register(EObject.class, DefaultDetailComposite.class);
PropertiesCompositeFactory.register(EObject.class, DefaultListComposite.class);
PropertiesCompositeFactory.register(EObject.class, DefaultDialogComposite.class);
+ PropertiesCompositeFactory.register(Message.class, MessageDetailComposite.class);
+ PropertiesCompositeFactory.register(Message.class, MessageListComposite.class);
+ PropertiesCompositeFactory.register(MessageFlow.class, MessageFlowDetailComposite.class);
+ PropertiesCompositeFactory.register(Property.class, ItemAwareElementDetailComposite.class);
+ PropertiesCompositeFactory.register(CallActivity.class, ActivityDetailComposite.class);
+ PropertiesCompositeFactory.register(GlobalTask.class, ActivityDetailComposite.class);
+ PropertiesCompositeFactory.register(GlobalBusinessRuleTask.class, ActivityDetailComposite.class);
+ PropertiesCompositeFactory.register(GlobalManualTask.class, ActivityDetailComposite.class);
+ PropertiesCompositeFactory.register(GlobalScriptTask.class, ActivityDetailComposite.class);
+ PropertiesCompositeFactory.register(GlobalUserTask.class, ActivityDetailComposite.class);
+ PropertiesCompositeFactory.register(Import.class, ImportDetailComposite.class);
+ PropertiesCompositeFactory.register(Category.class, CategoryDetailComposite.class);
+ PropertiesCompositeFactory.register(TextAnnotation.class, TextAnnotationDetailComposite.class);
+ PropertiesCompositeFactory.register(SequenceFlow.class, SequenceFlowDetailComposite.class);
+ PropertiesCompositeFactory.register(DataObject.class, DataObjectDetailComposite.class);
+ PropertiesCompositeFactory.register(DataObjectReference.class, DataObjectDetailComposite.class);
+ PropertiesCompositeFactory.register(Assignment.class, DataAssignmentDetailComposite.class);
+ PropertiesCompositeFactory.register(Expression.class, ExpressionDetailComposite.class);
+ PropertiesCompositeFactory.register(FormalExpression.class, ExpressionDetailComposite.class);
+ PropertiesCompositeFactory.register(ResourceAssignmentExpression.class, ResourceAssignmentExpressionDetailComposite.class);
+ PropertiesCompositeFactory.register(ResourceParameterBinding.class, ResourceParameterBindingDetailComposite.class);
+ PropertiesCompositeFactory.register(PotentialOwner.class, ResourceRoleDetailComposite.class);
+ PropertiesCompositeFactory.register(HumanPerformer.class, ResourceRoleDetailComposite.class);
+ PropertiesCompositeFactory.register(Performer.class, ResourceRoleDetailComposite.class);
+ PropertiesCompositeFactory.register(DataObjectReference.class, DataObjectReferenceDetailComposite.class);
+ PropertiesCompositeFactory.register(DataStore.class, DataStoreDetailComposite.class);
+ PropertiesCompositeFactory.register(DataStoreReference.class, DataStoreReferenceDetailComposite.class);
+ PropertiesCompositeFactory.register(Interface.class, InterfaceDetailComposite.class);
+ PropertiesCompositeFactory.register(ItemDefinition.class, ItemDefinitionDetailComposite.class);
+ PropertiesCompositeFactory.register(ItemDefinition.class, ItemDefinitionListComposite.class);
+ PropertiesCompositeFactory.register(Property.class, PropertyListComposite.class);
+ PropertiesCompositeFactory.register(ResourceRole.class, ResourceRoleListComposite.class);
+ PropertiesCompositeFactory.register(Event.class, CommonEventDetailComposite.class);
+ PropertiesCompositeFactory.register(StartEvent.class, StartEventDetailComposite.class);
+ PropertiesCompositeFactory.register(EndEvent.class, EndEventDetailComposite.class);
+ PropertiesCompositeFactory.register(CatchEvent.class, CatchEventDetailComposite.class);
+ PropertiesCompositeFactory.register(ThrowEvent.class, ThrowEventDetailComposite.class);
+ PropertiesCompositeFactory.register(BoundaryEvent.class, BoundaryEventDetailComposite.class);
+ PropertiesCompositeFactory.register(TimerEventDefinition.class, TimerEventDefinitionDetailComposite.class);
+ PropertiesCompositeFactory.register(ConditionalEventDefinition.class, ConditionalEventDefinitionDetailComposite.class);
+ PropertiesCompositeFactory.register(CompensateEventDefinition.class, EventDefinitionDialogComposite.class);
+ PropertiesCompositeFactory.register(ConditionalEventDefinition.class, EventDefinitionDialogComposite.class);
+ PropertiesCompositeFactory.register(ErrorEventDefinition.class, EventDefinitionDialogComposite.class);
+ PropertiesCompositeFactory.register(EscalationEventDefinition.class, EventDefinitionDialogComposite.class);
+ PropertiesCompositeFactory.register(LinkEventDefinition.class, EventDefinitionDialogComposite.class);
+ PropertiesCompositeFactory.register(MessageEventDefinition.class, EventDefinitionDialogComposite.class);
+ PropertiesCompositeFactory.register(SignalEventDefinition.class, EventDefinitionDialogComposite.class);
+ PropertiesCompositeFactory.register(TimerEventDefinition.class, EventDefinitionDialogComposite.class);
+ PropertiesCompositeFactory.register(Process.class, ProcessDiagramPropertyComposite.class);
+ PropertiesCompositeFactory.register(EndEvent.class, EndEventDetailComposite.class);
+ PropertiesCompositeFactory.register(StartEvent.class, StartEventDetailComposite.class);
+ PropertiesCompositeFactory.register(ThrowEvent.class, ThrowEventDetailComposite.class);
+ PropertiesCompositeFactory.register(StandardLoopCharacteristics.class, StandardLoopCharacteristicsDetailComposite.class);
+ PropertiesCompositeFactory.register(MultiInstanceLoopCharacteristics.class, MultiInstanceLoopCharacteristicsDetailComposite.class);
+ PropertiesCompositeFactory.register(Gateway.class, GatewayDetailComposite.class);
+ PropertiesCompositeFactory.register(Activity.class, ActivityInputDetailComposite.class);
+ PropertiesCompositeFactory.register(InputOutputSpecification.class, ActivityInputDetailComposite.class);
+ PropertiesCompositeFactory.register(Activity.class, ActivityOutputDetailComposite.class);
+ PropertiesCompositeFactory.register(CallChoreography.class, ActivityDetailComposite.class);
+ PropertiesCompositeFactory.register(InputOutputSpecification.class, IoParametersDetailComposite.class);
+ PropertiesCompositeFactory.register(DataInput.class, DataAssociationDetailComposite.class);
+ PropertiesCompositeFactory.register(DataOutput.class, DataAssociationDetailComposite.class);
+ PropertiesCompositeFactory.register(ManualTask.class, ManualTaskDetailComposite.class);
+ PropertiesCompositeFactory.register(ScriptTask.class, ScriptTaskDetailComposite.class);
+ PropertiesCompositeFactory.register(SubProcess.class, ActivityDetailComposite.class);
+ PropertiesCompositeFactory.register(Task.class, TaskDetailComposite.class);
}
public static final String EDITOR_ID = "org.eclipse.bpmn2.modeler.ui.bpmn2editor";
@@ -202,8 +352,8 @@
setActiveEditor(this);
// allow the runtime extension to construct custom tasks and whatever else it needs
- // custom tasks should be added to the current target runtime's custom tasks list
- // where they will be picked up by the toolpalette refresh.
+ // custom tasks should businessObject added to the current target runtime's custom tasks list
+ // where they will businessObject picked up by the toolpalette refresh.
getTargetRuntime().getRuntimeExtension().initialize();
super.init(site, input);
@@ -356,7 +506,7 @@
di.generateFromDI();
// this needs to happen AFTER the diagram has been imported because we need
- // to be able to determine the diagram type from the file's contents in order
+ // to businessObject able to determine the diagram type from the file's contents in order
// to build the right tool palette for the target runtime and model enablements.
GFPaletteRoot pr = (GFPaletteRoot)getPaletteRoot();
pr.updatePaletteEntries();
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2MultiPageEditor.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2MultiPageEditor.java
index 317ca6e..c0c7f92 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2MultiPageEditor.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2MultiPageEditor.java
@@ -60,15 +60,15 @@
* point in plugin.xml (see comments there).
*
* This is still in the experimental phase and currently only supports a single diagram
- * per .bpmn file. An optional second page, which displays the XML source, can be created
+ * per .bpmn file. An optional second page, which displays the XML source, can businessObject created
* from the context menu. The source view is not yet synchronized to the design view and
* can only show the XML as of the last "Save" i.e. the current state of the file on disk,
- * not the in-memory model. Design/Source view synchronization will be implemented in a
- * future version, but direct editing of the XML will not be supported - it will remain
+ * not the in-memory model. Design/Source view synchronization will businessObject implemented in a
+ * future version, but direct editing of the XML will not businessObject supported - it will remain
* "view only".
*
* Future versions will support multiple diagrams per .bpmn file with the ability to add
- * and remove pages containing different diagram types. It should be possible for the user
+ * and remove pages containing different diagram types. It should businessObject possible for the user
* to create a single file that contains a mix of Process, Collaboration and Choreography
* diagrams. Whether or not these types of files are actually deployable and/or executable
* is another story ;)
@@ -263,11 +263,11 @@
defaultTabHeight = tabFolder.getTabHeight();
setPageText(pageIndex,"Design");
- // TODO: it should be possible to create additional instances of the BPMN2Editor
+ // TODO: it should businessObject possible to create additional instances of the BPMN2Editor
// that use the same IEditorInput as the original, but work within different
// BPMNPlane objects within the same model.
- // Likewise, it should be possible to remove a page, which causes the associated
- // BPMNPlane to be removed from the model. The last page may not be removed because
+ // Likewise, it should businessObject possible to remove a page, which causes the associated
+ // BPMNPlane to businessObject removed from the model. The last page may not businessObject removed because
// this would invalidate the bpmn file.
// ++pageIndex;
// DesignEditor designEditor2 = new DesignEditor();
@@ -317,7 +317,7 @@
}
public void removeSourceViewer() {
- // there will only be one source page and it will always be the last page in the tab folder
+ // there will only businessObject one source page and it will always businessObject the last page in the tab folder
if (sourceViewer!=null) {
int pageIndex = tabFolder.getItemCount() - 1;
if (pageIndex>0)
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/AbstractAppendNodeNodeFeature.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/AbstractAppendNodeNodeFeature.java
index feafae6..7270699 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/AbstractAppendNodeNodeFeature.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/AbstractAppendNodeNodeFeature.java
@@ -135,7 +135,7 @@
ModelHandler mh = ModelHandler.getInstance(getDiagram());
// Let user select the new type of object to append. The selection will
- // be from a list of subtypes of <code>T</code> as defined by the various
+ // businessObject from a list of subtypes of <code>T</code> as defined by the various
// AbstractAppendNodeNodeFeature specializations; for example the class
// AppendActivityFeature will construct a popup list of all Activity subclasses
// e.g. Task, ScriptTask, SubProcess, etc.
@@ -223,7 +223,7 @@
ContainerShape containerShape = oldShape.getContainer();
if (containerShape!=getDiagram()) {
// we are adding a new shape to a control (e.g a SubProcess)
- // so we need to adjust the location to be relative to the
+ // so we need to adjust the location to businessObject relative to the
// control instead of the diagram
loc = layoutService.getLocationRelativeToDiagram(containerShape);
xOffset = loc.getX();
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/AbstractRotateContainerFeature.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/AbstractRotateContainerFeature.java
index 0d05862..9a859b2 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/AbstractRotateContainerFeature.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/AbstractRotateContainerFeature.java
@@ -1,159 +1,159 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Bob Brodt
- ******************************************************************************/
-
-package org.eclipse.bpmn2.modeler.ui.features;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.bpmn2.ChoreographyTask;
-import org.eclipse.bpmn2.Lane;
-import org.eclipse.bpmn2.Participant;
-import org.eclipse.bpmn2.SequenceFlow;
-import org.eclipse.bpmn2.di.BPMNDiagram;
-import org.eclipse.bpmn2.modeler.core.di.DIUtils;
-import org.eclipse.bpmn2.modeler.core.utils.BusinessObjectUtil;
-import org.eclipse.bpmn2.modeler.core.utils.FeatureSupport;
-import org.eclipse.bpmn2.modeler.ui.ImageProvider;
-import org.eclipse.bpmn2.modeler.ui.features.choreography.ChoreographyUtil;
-import org.eclipse.graphiti.datatypes.ILocation;
-import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.features.context.IContext;
-import org.eclipse.graphiti.features.context.ICustomContext;
-import org.eclipse.graphiti.features.custom.AbstractCustomFeature;
-import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
-import org.eclipse.graphiti.mm.algorithms.styles.Point;
-import org.eclipse.graphiti.mm.pictograms.Anchor;
-import org.eclipse.graphiti.mm.pictograms.Connection;
-import org.eclipse.graphiti.mm.pictograms.ContainerShape;
-import org.eclipse.graphiti.mm.pictograms.FreeFormConnection;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.graphiti.services.Graphiti;
-import org.eclipse.graphiti.services.IGaService;
-/**
- * @author Bob Brodt
- *
- */
-public abstract class AbstractRotateContainerFeature extends AbstractCustomFeature {
-
- /**
- * @param fp
- */
- public AbstractRotateContainerFeature(IFeatureProvider fp) {
- super(fp);
- }
-
-
- @Override
- public boolean isAvailable(IContext context) {
- return true;
- }
-
- @Override
- public String getImageId() {
- return ImageProvider.IMG_16_ROTATE;
- }
-
- @Override
- public boolean canExecute(ICustomContext context) {
- PictogramElement[] pes = context.getPictogramElements();
- if (pes != null && pes.length == 1) {
- PictogramElement pe = pes[0];
- Object bo = getBusinessObjectForPictogramElement(pe);
- if (pe instanceof ContainerShape && (bo instanceof Participant || bo instanceof Lane)) {
- Object parent = getBusinessObjectForPictogramElement(((ContainerShape)pe).getContainer());
- if (parent instanceof BPMNDiagram) {
- // only the top-level Lane or Pool can be rotated - all other
- // child Lanes must have the same orientation as their ancestor.
- return true;
- }
- }
- }
- return false;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.graphiti.features.custom.ICustomFeature#execute(org.eclipse.graphiti.features.context.ICustomContext)
- */
- @Override
- public void execute(ICustomContext context) {
- PictogramElement[] pes = context.getPictogramElements();
- if (pes != null && pes.length == 1 && pes[0] instanceof ContainerShape) {
- ContainerShape container = (ContainerShape)pes[0];
- boolean horz = FeatureSupport.isHorizontal(container);
- changeOrientation(container, !horz);
- FeatureSupport.redraw(container);
- }
- }
-
- private void changeOrientation(ContainerShape container, boolean horz) {
-
- // Recursively change the orientation of Lanes and "Pools" (Participants).
- // Note that this does not apply to Participant bands contained in a ChoreographTask.
- if (ChoreographyUtil.isChoreographyParticipantBand(container))
- return;
-
- IGaService gaService = Graphiti.getGaService();
- GraphicsAlgorithm ga = container.getGraphicsAlgorithm();
- int x = ga.getX();
- int y = ga.getY();
- int width = ga.getWidth();
- int height = ga.getHeight();
-
- if (FeatureSupport.isParticipant(container) || FeatureSupport.isLane(container)) {
- gaService.setLocationAndSize(ga, x, y, height, width);
- FeatureSupport.setHorizontal(container, horz);
- }
- else {
- // Activities and other child figures only change location, not size
- // so simply swap x and y as a first cut.
- // TODO: replace this with auto layout algorithm, TBD later
- gaService.setLocationAndSize(ga, y, x, width, height);
-
- // TODO: also swap x and y of connection bendpoints: connection bendpoint
- // coordinates are relative to the diagram not the control figure
- // (i.e. the Lane in this case)
- ILocation loc = Graphiti.getLayoutService().getLocationRelativeToDiagram(container.getContainer());
- for (Anchor a : container.getAnchors()) {
- for (Connection c : a.getIncomingConnections()) {
- if (c instanceof FreeFormConnection) {
- FreeFormConnection fc = (FreeFormConnection)c;
- boolean update = false;
- for (Point p : fc.getBendpoints()) {
- int py = p.getX() - loc.getX() + loc.getY();
- int px = p.getY() - loc.getY() + loc.getX();
- p.setX(px);
- p.setY(py);
- update = true;
- }
- if (update)
- DIUtils.updateDIEdge(c);
- }
- }
- }
-
- layoutPictogramElement(container);
- }
-
- DIUtils.updateDIShape(container);
-
- for (PictogramElement pe : container.getChildren()) {
- if (pe instanceof ContainerShape) {
- changeOrientation((ContainerShape) pe, horz);
- if (BusinessObjectUtil.getBusinessObjectForPictogramElement(pe) instanceof ChoreographyTask)
- ChoreographyUtil.moveChoreographyMessageLinks((ContainerShape) pe);
- }
- }
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Bob Brodt
+ ******************************************************************************/
+
+package org.eclipse.bpmn2.modeler.ui.features;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.bpmn2.ChoreographyTask;
+import org.eclipse.bpmn2.Lane;
+import org.eclipse.bpmn2.Participant;
+import org.eclipse.bpmn2.SequenceFlow;
+import org.eclipse.bpmn2.di.BPMNDiagram;
+import org.eclipse.bpmn2.modeler.core.di.DIUtils;
+import org.eclipse.bpmn2.modeler.core.utils.BusinessObjectUtil;
+import org.eclipse.bpmn2.modeler.core.utils.FeatureSupport;
+import org.eclipse.bpmn2.modeler.ui.ImageProvider;
+import org.eclipse.bpmn2.modeler.ui.features.choreography.ChoreographyUtil;
+import org.eclipse.graphiti.datatypes.ILocation;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IContext;
+import org.eclipse.graphiti.features.context.ICustomContext;
+import org.eclipse.graphiti.features.custom.AbstractCustomFeature;
+import org.eclipse.graphiti.mm.algorithms.GraphicsAlgorithm;
+import org.eclipse.graphiti.mm.algorithms.styles.Point;
+import org.eclipse.graphiti.mm.pictograms.Anchor;
+import org.eclipse.graphiti.mm.pictograms.Connection;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.FreeFormConnection;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.services.Graphiti;
+import org.eclipse.graphiti.services.IGaService;
+/**
+ * @author Bob Brodt
+ *
+ */
+public abstract class AbstractRotateContainerFeature extends AbstractCustomFeature {
+
+ /**
+ * @param fp
+ */
+ public AbstractRotateContainerFeature(IFeatureProvider fp) {
+ super(fp);
+ }
+
+
+ @Override
+ public boolean isAvailable(IContext context) {
+ return true;
+ }
+
+ @Override
+ public String getImageId() {
+ return ImageProvider.IMG_16_ROTATE;
+ }
+
+ @Override
+ public boolean canExecute(ICustomContext context) {
+ PictogramElement[] pes = context.getPictogramElements();
+ if (pes != null && pes.length == 1) {
+ PictogramElement pe = pes[0];
+ Object bo = getBusinessObjectForPictogramElement(pe);
+ if (pe instanceof ContainerShape && (bo instanceof Participant || bo instanceof Lane)) {
+ Object parent = getBusinessObjectForPictogramElement(((ContainerShape)pe).getContainer());
+ if (parent instanceof BPMNDiagram) {
+ // only the top-level Lane or Pool can businessObject rotated - all other
+ // child Lanes must have the same orientation as their ancestor.
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.graphiti.features.custom.ICustomFeature#execute(org.eclipse.graphiti.features.context.ICustomContext)
+ */
+ @Override
+ public void execute(ICustomContext context) {
+ PictogramElement[] pes = context.getPictogramElements();
+ if (pes != null && pes.length == 1 && pes[0] instanceof ContainerShape) {
+ ContainerShape container = (ContainerShape)pes[0];
+ boolean horz = FeatureSupport.isHorizontal(container);
+ changeOrientation(container, !horz);
+ FeatureSupport.redraw(container);
+ }
+ }
+
+ private void changeOrientation(ContainerShape container, boolean horz) {
+
+ // Recursively change the orientation of Lanes and "Pools" (Participants).
+ // Note that this does not apply to Participant bands contained in a ChoreographTask.
+ if (ChoreographyUtil.isChoreographyParticipantBand(container))
+ return;
+
+ IGaService gaService = Graphiti.getGaService();
+ GraphicsAlgorithm ga = container.getGraphicsAlgorithm();
+ int x = ga.getX();
+ int y = ga.getY();
+ int width = ga.getWidth();
+ int height = ga.getHeight();
+
+ if (FeatureSupport.isParticipant(container) || FeatureSupport.isLane(container)) {
+ gaService.setLocationAndSize(ga, x, y, height, width);
+ FeatureSupport.setHorizontal(container, horz);
+ }
+ else {
+ // Activities and other child figures only change location, not size
+ // so simply swap x and y as a first cut.
+ // TODO: replace this with auto layout algorithm, TBD later
+ gaService.setLocationAndSize(ga, y, x, width, height);
+
+ // TODO: also swap x and y of connection bendpoints: connection bendpoint
+ // coordinates are relative to the diagram not the control figure
+ // (i.e. the Lane in this case)
+ ILocation loc = Graphiti.getLayoutService().getLocationRelativeToDiagram(container.getContainer());
+ for (Anchor a : container.getAnchors()) {
+ for (Connection c : a.getIncomingConnections()) {
+ if (c instanceof FreeFormConnection) {
+ FreeFormConnection fc = (FreeFormConnection)c;
+ boolean update = false;
+ for (Point p : fc.getBendpoints()) {
+ int py = p.getX() - loc.getX() + loc.getY();
+ int px = p.getY() - loc.getY() + loc.getX();
+ p.setX(px);
+ p.setY(py);
+ update = true;
+ }
+ if (update)
+ DIUtils.updateDIEdge(c);
+ }
+ }
+ }
+
+ layoutPictogramElement(container);
+ }
+
+ DIUtils.updateDIShape(container);
+
+ for (PictogramElement pe : container.getChildren()) {
+ if (pe instanceof ContainerShape) {
+ changeOrientation((ContainerShape) pe, horz);
+ if (BusinessObjectUtil.getBusinessObjectForPictogramElement(pe) instanceof ChoreographyTask)
+ ChoreographyUtil.moveChoreographyMessageLinks((ContainerShape) pe);
+ }
+ }
+ }
+
+}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/activity/subprocess/CallActivityFeatureContainer.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/activity/subprocess/CallActivityFeatureContainer.java
index 285e51d..bc9a5b7 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/activity/subprocess/CallActivityFeatureContainer.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/activity/subprocess/CallActivityFeatureContainer.java
@@ -137,8 +137,8 @@
public static class CreateCallActivityFeature extends AbstractCreateExpandableFlowNodeFeature<CallActivity> {
// NOTE: Even though the Call Activity is an expandable figure, the contents for its "innards"
- // are (usually) defined somewhere else, so it doesn't make much sense to be able to expand it in the
- // same sense that a SubProcess would be expanded and rendered. When the "expand" button is clicked
+ // are (usually) defined somewhere else, so it doesn't make much sense to businessObject able to expand it in the
+ // same sense that a SubProcess would businessObject expanded and rendered. When the "expand" button is clicked
// we should probably locate the process where this thing is defined (if possible) and open an
// editor to display its contents.
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/activity/subprocess/CollapseFlowNodeFeature.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/activity/subprocess/CollapseFlowNodeFeature.java
index 124a8cf..3aa80fe 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/activity/subprocess/CollapseFlowNodeFeature.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/activity/subprocess/CollapseFlowNodeFeature.java
@@ -93,7 +93,7 @@
if (bpmnShape.isIsExpanded()) {
// SubProcess is collapsed - resize to standard modelObject size
- // NOTE: children tasks will be set not-visible in LayoutExpandableActivityFeature
+ // NOTE: children tasks will businessObject set not-visible in LayoutExpandableActivityFeature
bpmnShape.setIsExpanded(false);
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/activity/subprocess/ExpandFlowNodeFeature.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/activity/subprocess/ExpandFlowNodeFeature.java
index 870fb3c..2a4c6a6 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/activity/subprocess/ExpandFlowNodeFeature.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/activity/subprocess/ExpandFlowNodeFeature.java
@@ -90,7 +90,7 @@
if (!bpmnShape.isIsExpanded()) {
// SubProcess is collapsed - resize to minimum size such that all children are visible
- // NOTE: children tasks will be set visible in LayoutExpandableActivityFeature
+ // NOTE: children tasks will businessObject set visible in LayoutExpandableActivityFeature
bpmnShape.setIsExpanded(true);
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/activity/task/CustomTaskFeatureContainer.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/activity/task/CustomTaskFeatureContainer.java
index a54ae51..cc8d7e1 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/activity/task/CustomTaskFeatureContainer.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/activity/task/CustomTaskFeatureContainer.java
@@ -1,268 +1,268 @@
-package org.eclipse.bpmn2.modeler.ui.features.activity.task;
-
-import org.eclipse.bpmn2.Bpmn2Package;
-import org.eclipse.bpmn2.Task;
-import org.eclipse.bpmn2.impl.TaskImpl;
-import org.eclipse.bpmn2.modeler.core.features.activity.task.AbstractCreateTaskFeature;
-import org.eclipse.bpmn2.modeler.core.features.activity.task.AddTaskFeature;
-import org.eclipse.bpmn2.modeler.core.features.activity.task.ICustomTaskFeature;
-import org.eclipse.bpmn2.modeler.core.runtime.CustomTaskDescriptor;
-import org.eclipse.bpmn2.modeler.core.runtime.TargetRuntime;
-import org.eclipse.bpmn2.modeler.ui.diagram.BPMNFeatureProvider;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.graphiti.features.IAddFeature;
-import org.eclipse.graphiti.features.ICreateFeature;
-import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.features.context.IAddContext;
-import org.eclipse.graphiti.features.context.IAreaContext;
-import org.eclipse.graphiti.features.context.IContext;
-import org.eclipse.graphiti.features.context.ICreateContext;
-import org.eclipse.graphiti.features.context.ICustomContext;
-import org.eclipse.graphiti.features.context.IDoubleClickContext;
-import org.eclipse.graphiti.features.context.IPictogramElementContext;
-import org.eclipse.graphiti.features.context.impl.AddContext;
-import org.eclipse.graphiti.features.custom.ICustomFeature;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.graphiti.services.Graphiti;
-
-public class CustomTaskFeatureContainer extends TaskFeatureContainer implements ICustomTaskFeature {
-
- protected String id;
- protected CustomTaskDescriptor customTaskDescriptor;
-
- /* (non-Javadoc)
- * Determine if the context applies to this modelObject and return the Task object. Return null otherwise.
- * @param context - the Graphiti context.
- *
- * @see org.eclipse.bpmn2.modeler.core.features.BaseElementFeatureContainer#getApplyObject(org.eclipse.graphiti.features.context.IContext)
- */
- @Override
- public Object getApplyObject(IContext context) {
- Object id = getId(context);
- if (id==null || !this.id.equals(id)) {
- return null;
- }
-
- return super.getApplyObject(context);
- }
-
- @Override
- public boolean canApplyTo(Object o) {
- boolean b1 = o instanceof TaskImpl;
- boolean b2 = o.getClass().isAssignableFrom(TaskImpl.class);
- return b1 || b2;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.core.features.activity.task.ICustomTaskFeature#setId(java.lang.String)
- */
- @Override
- public void setId(String id) {
- this.id = id;
- }
-
- /**
- * Set this modelObject's ID in the given Graphiti context.
- *
- * @param context - if this is a IPictogramElementContext, set the property
- * in the contained PictogramElement's list of properties;
- * otherwise set the Context's property
- * @param id - ID of this Custom Task
- */
- public static void setId(IContext context, String id) {
-
- if (context instanceof IPictogramElementContext) {
- PictogramElement pe = ((IPictogramElementContext)context).getPictogramElement();
- Graphiti.getPeService().setPropertyValue(pe,CUSTOM_TASK_ID,id);
- }
- else {
- context.putProperty(CUSTOM_TASK_ID, id);
- }
- }
-
- /**
- * Returns the modelObject ID string from the given Graphiti context.
- *
- * @param context
- * @return - ID string for this modelObject.
- */
- public static String getId(IContext context) {
- Object id = null;
-
- /**
- * IAddContext can also mean that a file is dragged,
- * therefore we have to check if we are really dragging a customTask
- */
- if (context instanceof IAddContext &&
- ((IAddContext)context).getNewObject() instanceof EObject ) {
- EObject object = (EObject) ((IAddContext)context).getNewObject();
- TargetRuntime rt = TargetRuntime.getCurrentRuntime();
- for (CustomTaskDescriptor ct : rt.getCustomTasks()) {
- id = ct.getFeatureContainer().getId(object);
- if (id!=null) {
- context.putProperty(CUSTOM_TASK_ID, id);
- return (String)id;
- }
- }
- }
-
- if (context instanceof IPictogramElementContext) {
- PictogramElement pe = ((IPictogramElementContext)context).getPictogramElement();
- id = Graphiti.getPeService().getPropertyValue(pe,CUSTOM_TASK_ID);
- }
- else {
- id = context.getProperty(CUSTOM_TASK_ID);
- }
- return (String)id;
- }
-
- public String getId(EObject object) {
- return null;
- }
-
- /**
- * Set this modelObject's ID string. The ID is defined in the plugin's
- * extension point contribution to org.eclipse.bpmn2.modeler.rutime.
- * This will register the Custom Task with the BPMN Feature Provider.
- *
- * @param fp - Feature Provider (must be a BPMNFeatureProvider)
- * @param id - the modelObject ID string.
- * @throws Exception
- * Custom Task ID can not be null
- * The Feature Provider is invalid (not a BPMNFeatureProvider)
- * Attempt to add a Custom Feature with a duplicate ID {id}
- */
- public void setId(IFeatureProvider fp, String id) throws Exception {
-
- // "id" is a required parameter in the extension point.
- if (id==null || id.isEmpty()) {
- throw new Exception("Custom Task ID can not be null");
- }
- this.id = id;
-
- if (fp instanceof BPMNFeatureProvider) {
- // register this custom modelObject ID with the BPMNFeatureProvider;
- // this will allow the feature provider to find the correct feature control class
- // for this custom modelObject, instead of the generic "Task" feature control
- BPMNFeatureProvider bfp = (BPMNFeatureProvider)fp;
- try {
- bfp.addFeatureContainer(this);
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- else
- throw new Exception("The Feature Provider is invalid (not a BPMNFeatureProvider)");
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.ui.features.activity.task.ICustomTaskFeatureContainer#getId()
- */
- @Override
- public String getId() {
- return id;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.ui.features.activity.task.ICustomTaskFeatureContainer#setCustomTaskDescriptor(org.eclipse.bpmn2.modeler.core.preferences.TargetRuntime.CustomTaskDescriptor)
- */
- @Override
- public void setCustomTaskDescriptor(CustomTaskDescriptor customTaskDescriptor) {
- this.customTaskDescriptor = customTaskDescriptor;
- }
-
- @Override
- public ICreateFeature getCreateFeature(IFeatureProvider fp) {
- return new CreateCustomTaskFeature(fp);
- }
-
- @Override
- public IAddFeature getAddFeature(IFeatureProvider fp) {
- return new AddCustomTaskFeature(fp);
- }
-
- /**
- * @author bbrodt
- *
- * Base class for Custom Task Feature construction. Custom Tasks contributed to
- * the editor MUST subclass this!
- *
- * The Task creation process copies the modelObject ID string into the Graphiti create
- * context during the construction phase, then migrates that ID into the created
- * PictogramElement. This is necessary because the ID must be associated with the
- * PE in to allow our BPMNFeatureProvider to correctly identify the Custom Task.
- */
- public class CreateCustomTaskFeature extends AbstractCreateTaskFeature<Task> {
-
- public CreateCustomTaskFeature(IFeatureProvider fp, String name, String description) {
- super(fp, name, description);
- }
-
- public CreateCustomTaskFeature(IFeatureProvider fp) {
- super(fp, customTaskDescriptor.getName(), customTaskDescriptor.getDescription());
- }
-
- @Override
- protected PictogramElement addGraphicalRepresentation(IAreaContext context, Object newObject) {
-
- // create a new AddContext and copy our ID into it.
- IAddContext addContext = new AddContext(context, newObject);
- setId(addContext, getId());
-
- // create the PE and copy our ID into its properties.
- PictogramElement pe = getFeatureProvider().addIfPossible(addContext);
- Graphiti.getPeService().setPropertyValue(pe,CUSTOM_TASK_ID,id);
-
- return pe;
- }
-
- @Override
- public boolean canCreate(ICreateContext context) {
- // copy our ID into the CreateContext - this is where it all starts!
- setId(context, id);
- return super.canCreate(context);
- }
-
- @Override
- public Task createBusinessObject(ICreateContext context) {
- EObject target = Graphiti.getLinkService().getBusinessObjectForLinkedPictogramElement(context.getTargetContainer());
- Task task = (Task)customTaskDescriptor.createObject(target);
- putBusinessObject(context, task);
- return task;
- }
-
- @Override
- protected String getStencilImageId() {
- // TODO Auto-generated method stub
- return null;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.core.features.AbstractCreateFlowElementFeature#getFlowElementClass()
- */
- @Override
- public EClass getBusinessObjectClass() {
- return Bpmn2Package.eINSTANCE.getTask();
- }
-
- }
-
- public class AddCustomTaskFeature extends AddTaskFeature<Task> {
-
- /**
- * @param fp
- */
- public AddCustomTaskFeature(IFeatureProvider fp) {
- super(fp);
- }
-
- @Override
- public PictogramElement add(IAddContext context) {
- PictogramElement pe = super.add(context);
- // make sure everyone knows that this PE is a custom task
- Graphiti.getPeService().setPropertyValue(pe,CUSTOM_TASK_ID,getId());
- return pe;
- }
- }
-}
+package org.eclipse.bpmn2.modeler.ui.features.activity.task;
+
+import org.eclipse.bpmn2.Bpmn2Package;
+import org.eclipse.bpmn2.Task;
+import org.eclipse.bpmn2.impl.TaskImpl;
+import org.eclipse.bpmn2.modeler.core.features.activity.task.AbstractCreateTaskFeature;
+import org.eclipse.bpmn2.modeler.core.features.activity.task.AddTaskFeature;
+import org.eclipse.bpmn2.modeler.core.features.activity.task.ICustomTaskFeature;
+import org.eclipse.bpmn2.modeler.core.runtime.CustomTaskDescriptor;
+import org.eclipse.bpmn2.modeler.core.runtime.TargetRuntime;
+import org.eclipse.bpmn2.modeler.ui.diagram.BPMNFeatureProvider;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.graphiti.features.IAddFeature;
+import org.eclipse.graphiti.features.ICreateFeature;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.IAddContext;
+import org.eclipse.graphiti.features.context.IAreaContext;
+import org.eclipse.graphiti.features.context.IContext;
+import org.eclipse.graphiti.features.context.ICreateContext;
+import org.eclipse.graphiti.features.context.ICustomContext;
+import org.eclipse.graphiti.features.context.IDoubleClickContext;
+import org.eclipse.graphiti.features.context.IPictogramElementContext;
+import org.eclipse.graphiti.features.context.impl.AddContext;
+import org.eclipse.graphiti.features.custom.ICustomFeature;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.services.Graphiti;
+
+public class CustomTaskFeatureContainer extends TaskFeatureContainer implements ICustomTaskFeature {
+
+ protected String id;
+ protected CustomTaskDescriptor customTaskDescriptor;
+
+ /* (non-Javadoc)
+ * Determine if the context applies to this modelObject and return the Task object. Return null otherwise.
+ * @param context - the Graphiti context.
+ *
+ * @see org.eclipse.bpmn2.modeler.core.features.BaseElementFeatureContainer#getApplyObject(org.eclipse.graphiti.features.context.IContext)
+ */
+ @Override
+ public Object getApplyObject(IContext context) {
+ Object id = getId(context);
+ if (id==null || !this.id.equals(id)) {
+ return null;
+ }
+
+ return super.getApplyObject(context);
+ }
+
+ @Override
+ public boolean canApplyTo(Object o) {
+ boolean b1 = o instanceof TaskImpl;
+ boolean b2 = o.getClass().isAssignableFrom(TaskImpl.class);
+ return b1 || b2;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.features.activity.task.ICustomTaskFeature#setId(java.lang.String)
+ */
+ @Override
+ public void setId(String id) {
+ this.id = id;
+ }
+
+ /**
+ * Set this modelObject's ID in the given Graphiti context.
+ *
+ * @param context - if this is a IPictogramElementContext, set the property
+ * in the contained PictogramElement's list of properties;
+ * otherwise set the Context's property
+ * @param id - ID of this Custom Task
+ */
+ public static void setId(IContext context, String id) {
+
+ if (context instanceof IPictogramElementContext) {
+ PictogramElement pe = ((IPictogramElementContext)context).getPictogramElement();
+ Graphiti.getPeService().setPropertyValue(pe,CUSTOM_TASK_ID,id);
+ }
+ else {
+ context.putProperty(CUSTOM_TASK_ID, id);
+ }
+ }
+
+ /**
+ * Returns the modelObject ID string from the given Graphiti context.
+ *
+ * @param context
+ * @return - ID string for this modelObject.
+ */
+ public static String getId(IContext context) {
+ Object id = null;
+
+ /**
+ * IAddContext can also mean that a file is dragged,
+ * therefore we have to check if we are really dragging a customTask
+ */
+ if (context instanceof IAddContext &&
+ ((IAddContext)context).getNewObject() instanceof EObject ) {
+ EObject object = (EObject) ((IAddContext)context).getNewObject();
+ TargetRuntime rt = TargetRuntime.getCurrentRuntime();
+ for (CustomTaskDescriptor ct : rt.getCustomTasks()) {
+ id = ct.getFeatureContainer().getId(object);
+ if (id!=null) {
+ context.putProperty(CUSTOM_TASK_ID, id);
+ return (String)id;
+ }
+ }
+ }
+
+ if (context instanceof IPictogramElementContext) {
+ PictogramElement pe = ((IPictogramElementContext)context).getPictogramElement();
+ id = Graphiti.getPeService().getPropertyValue(pe,CUSTOM_TASK_ID);
+ }
+ else {
+ id = context.getProperty(CUSTOM_TASK_ID);
+ }
+ return (String)id;
+ }
+
+ public String getId(EObject object) {
+ return null;
+ }
+
+ /**
+ * Set this modelObject's ID string. The ID is defined in the plugin's
+ * extension point contribution to org.eclipse.bpmn2.modeler.rutime.
+ * This will register the Custom Task with the BPMN Feature Provider.
+ *
+ * @param fp - Feature Provider (must businessObject a BPMNFeatureProvider)
+ * @param id - the modelObject ID string.
+ * @throws Exception
+ * Custom Task ID can not businessObject null
+ * The Feature Provider is invalid (not a BPMNFeatureProvider)
+ * Attempt to add a Custom Feature with a duplicate ID {id}
+ */
+ public void setId(IFeatureProvider fp, String id) throws Exception {
+
+ // "id" is a required parameter in the extension point.
+ if (id==null || id.isEmpty()) {
+ throw new Exception("Custom Task ID can not businessObject null");
+ }
+ this.id = id;
+
+ if (fp instanceof BPMNFeatureProvider) {
+ // register this custom modelObject ID with the BPMNFeatureProvider;
+ // this will allow the feature provider to find the correct feature control class
+ // for this custom modelObject, instead of the generic "Task" feature control
+ BPMNFeatureProvider bfp = (BPMNFeatureProvider)fp;
+ try {
+ bfp.addFeatureContainer(this);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ else
+ throw new Exception("The Feature Provider is invalid (not a BPMNFeatureProvider)");
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.ui.features.activity.task.ICustomTaskFeatureContainer#getId()
+ */
+ @Override
+ public String getId() {
+ return id;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.ui.features.activity.task.ICustomTaskFeatureContainer#setCustomTaskDescriptor(org.eclipse.bpmn2.modeler.core.preferences.TargetRuntime.CustomTaskDescriptor)
+ */
+ @Override
+ public void setCustomTaskDescriptor(CustomTaskDescriptor customTaskDescriptor) {
+ this.customTaskDescriptor = customTaskDescriptor;
+ }
+
+ @Override
+ public ICreateFeature getCreateFeature(IFeatureProvider fp) {
+ return new CreateCustomTaskFeature(fp);
+ }
+
+ @Override
+ public IAddFeature getAddFeature(IFeatureProvider fp) {
+ return new AddCustomTaskFeature(fp);
+ }
+
+ /**
+ * @author bbrodt
+ *
+ * Base class for Custom Task Feature construction. Custom Tasks contributed to
+ * the editor MUST subclass this!
+ *
+ * The Task creation process copies the modelObject ID string into the Graphiti create
+ * context during the construction phase, then migrates that ID into the created
+ * PictogramElement. This is necessary because the ID must businessObject associated with the
+ * PE in to allow our BPMNFeatureProvider to correctly identify the Custom Task.
+ */
+ public class CreateCustomTaskFeature extends AbstractCreateTaskFeature<Task> {
+
+ public CreateCustomTaskFeature(IFeatureProvider fp, String name, String description) {
+ super(fp, name, description);
+ }
+
+ public CreateCustomTaskFeature(IFeatureProvider fp) {
+ super(fp, customTaskDescriptor.getName(), customTaskDescriptor.getDescription());
+ }
+
+ @Override
+ protected PictogramElement addGraphicalRepresentation(IAreaContext context, Object newObject) {
+
+ // create a new AddContext and copy our ID into it.
+ IAddContext addContext = new AddContext(context, newObject);
+ setId(addContext, getId());
+
+ // create the PE and copy our ID into its properties.
+ PictogramElement pe = getFeatureProvider().addIfPossible(addContext);
+ Graphiti.getPeService().setPropertyValue(pe,CUSTOM_TASK_ID,id);
+
+ return pe;
+ }
+
+ @Override
+ public boolean canCreate(ICreateContext context) {
+ // copy our ID into the CreateContext - this is where it all starts!
+ setId(context, id);
+ return super.canCreate(context);
+ }
+
+ @Override
+ public Task createBusinessObject(ICreateContext context) {
+ EObject target = Graphiti.getLinkService().getBusinessObjectForLinkedPictogramElement(context.getTargetContainer());
+ Task task = (Task)customTaskDescriptor.createObject(target);
+ putBusinessObject(context, task);
+ return task;
+ }
+
+ @Override
+ protected String getStencilImageId() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.features.AbstractCreateFlowElementFeature#getFlowElementClass()
+ */
+ @Override
+ public EClass getBusinessObjectClass() {
+ return Bpmn2Package.eINSTANCE.getTask();
+ }
+
+ }
+
+ public class AddCustomTaskFeature extends AddTaskFeature<Task> {
+
+ /**
+ * @param fp
+ */
+ public AddCustomTaskFeature(IFeatureProvider fp) {
+ super(fp);
+ }
+
+ @Override
+ public PictogramElement add(IAddContext context) {
+ PictogramElement pe = super.add(context);
+ // make sure everyone knows that this PE is a custom task
+ Graphiti.getPeService().setPropertyValue(pe,CUSTOM_TASK_ID,getId());
+ return pe;
+ }
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/choreography/AddChoreographyParticipantFeature.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/choreography/AddChoreographyParticipantFeature.java
index 3c54151..0cadc00 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/choreography/AddChoreographyParticipantFeature.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/choreography/AddChoreographyParticipantFeature.java
@@ -160,7 +160,7 @@
Process process = (Process) PropertyUtil.createObject(task.eResource(), Bpmn2Package.eINSTANCE.getProcess());
// NOTE: this is needed because it fires the InsertionAdapter, which adds the new Process
- // to Definitions.rootElements, otherwise the Process would be a dangling object
+ // to Definitions.rootElements, otherwise the Process would businessObject a dangling object
process.setName(participant.getName()+" Process");
participant.setProcessRef(process);
*/
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/choreography/RemoveChoreographyParticipantFeature.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/choreography/RemoveChoreographyParticipantFeature.java
index 430c1c0..254c2eb 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/choreography/RemoveChoreographyParticipantFeature.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/choreography/RemoveChoreographyParticipantFeature.java
@@ -37,7 +37,7 @@
@Override
public boolean canRemove(IRemoveContext context) {
- // participant bands in a ChoreographyTask CAN be "removed" (from the modelObject's
+ // participant bands in a ChoreographyTask CAN businessObject "removed" (from the modelObject's
// participantRef list) but not "deleted" (from the model)
if (ChoreographyUtil.isChoreographyParticipantBand(context.getPictogramElement())) {
return true;
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/data/DataInputFeatureContainer.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/data/DataInputFeatureContainer.java
index c99dbf0..8ac0586 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/data/DataInputFeatureContainer.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/data/DataInputFeatureContainer.java
@@ -1,86 +1,86 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Innar Made
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.features.data;
-
-import org.eclipse.bpmn2.BaseElement;
-import org.eclipse.bpmn2.Bpmn2Package;
-import org.eclipse.bpmn2.DataInput;
-import org.eclipse.bpmn2.modeler.core.ModelHandler;
-import org.eclipse.bpmn2.modeler.core.features.data.AbstractCreateDataInputOutputFeature;
-import org.eclipse.bpmn2.modeler.core.features.data.AddDataFeature;
-import org.eclipse.bpmn2.modeler.core.model.Bpmn2ModelerFactory;
-import org.eclipse.bpmn2.modeler.core.utils.GraphicsUtil;
-import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
-import org.eclipse.bpmn2.modeler.core.utils.StyleUtil;
-import org.eclipse.bpmn2.modeler.ui.ImageProvider;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.graphiti.features.IAddFeature;
-import org.eclipse.graphiti.features.ICreateFeature;
-import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.features.context.ICreateContext;
-import org.eclipse.graphiti.mm.algorithms.Polygon;
-
-public class DataInputFeatureContainer extends AbstractDataFeatureContainer {
-
- @Override
- public boolean canApplyTo(Object o) {
- return super.canApplyTo(o) && o instanceof DataInput;
- }
-
- @Override
- public ICreateFeature getCreateFeature(IFeatureProvider fp) {
- return new CreateDataInputFeature(fp);
- }
-
- @Override
- public IAddFeature getAddFeature(IFeatureProvider fp) {
- return new AddDataFeature<DataInput>(fp) {
- @Override
- protected boolean isSupportCollectionMarkers() {
- return false;
- }
-
- @Override
- protected void decorate(Polygon p) {
- Polygon arrow = GraphicsUtil.createDataArrow(p);
- arrow.setFilled(false);
- arrow.setForeground(manageColor(StyleUtil.CLASS_FOREGROUND));
- }
-
- @Override
- public String getName(DataInput t) {
- return t.getName();
- }
- };
- }
-
- public static class CreateDataInputFeature extends AbstractCreateDataInputOutputFeature<DataInput> {
-
- public CreateDataInputFeature(IFeatureProvider fp) {
- super(fp, "Data Input", "Declaration that a particular kind of data will be used as input");
- }
-
- @Override
- public String getStencilImageId() {
- return ImageProvider.IMG_16_DATA_INPUT;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.core.features.AbstractBpmn2CreateFeature#getBusinessObjectClass()
- */
- @Override
- public EClass getBusinessObjectClass() {
- return Bpmn2Package.eINSTANCE.getDataInput();
- }
- }
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Innar Made
+ ******************************************************************************/
+package org.eclipse.bpmn2.modeler.ui.features.data;
+
+import org.eclipse.bpmn2.BaseElement;
+import org.eclipse.bpmn2.Bpmn2Package;
+import org.eclipse.bpmn2.DataInput;
+import org.eclipse.bpmn2.modeler.core.ModelHandler;
+import org.eclipse.bpmn2.modeler.core.features.data.AbstractCreateDataInputOutputFeature;
+import org.eclipse.bpmn2.modeler.core.features.data.AddDataFeature;
+import org.eclipse.bpmn2.modeler.core.model.Bpmn2ModelerFactory;
+import org.eclipse.bpmn2.modeler.core.utils.GraphicsUtil;
+import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
+import org.eclipse.bpmn2.modeler.core.utils.StyleUtil;
+import org.eclipse.bpmn2.modeler.ui.ImageProvider;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.graphiti.features.IAddFeature;
+import org.eclipse.graphiti.features.ICreateFeature;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.ICreateContext;
+import org.eclipse.graphiti.mm.algorithms.Polygon;
+
+public class DataInputFeatureContainer extends AbstractDataFeatureContainer {
+
+ @Override
+ public boolean canApplyTo(Object o) {
+ return super.canApplyTo(o) && o instanceof DataInput;
+ }
+
+ @Override
+ public ICreateFeature getCreateFeature(IFeatureProvider fp) {
+ return new CreateDataInputFeature(fp);
+ }
+
+ @Override
+ public IAddFeature getAddFeature(IFeatureProvider fp) {
+ return new AddDataFeature<DataInput>(fp) {
+ @Override
+ protected boolean isSupportCollectionMarkers() {
+ return false;
+ }
+
+ @Override
+ protected void decorate(Polygon p) {
+ Polygon arrow = GraphicsUtil.createDataArrow(p);
+ arrow.setFilled(false);
+ arrow.setForeground(manageColor(StyleUtil.CLASS_FOREGROUND));
+ }
+
+ @Override
+ public String getName(DataInput t) {
+ return t.getName();
+ }
+ };
+ }
+
+ public static class CreateDataInputFeature extends AbstractCreateDataInputOutputFeature<DataInput> {
+
+ public CreateDataInputFeature(IFeatureProvider fp) {
+ super(fp, "Data Input", "Declaration that a particular kind of data will businessObject used as input");
+ }
+
+ @Override
+ public String getStencilImageId() {
+ return ImageProvider.IMG_16_DATA_INPUT;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.features.AbstractBpmn2CreateFeature#getBusinessObjectClass()
+ */
+ @Override
+ public EClass getBusinessObjectClass() {
+ return Bpmn2Package.eINSTANCE.getDataInput();
+ }
+ }
}
\ No newline at end of file
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/data/DataObjectFeatureContainer.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/data/DataObjectFeatureContainer.java
index 21e709b..7e7a343 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/data/DataObjectFeatureContainer.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/data/DataObjectFeatureContainer.java
@@ -1,237 +1,237 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Innar Made
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.features.data;
-
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.bpmn2.BaseElement;
-import org.eclipse.bpmn2.Bpmn2Package;
-import org.eclipse.bpmn2.DataObject;
-import org.eclipse.bpmn2.DataObjectReference;
-import org.eclipse.bpmn2.FlowElement;
-import org.eclipse.bpmn2.modeler.core.ModelHandler;
-import org.eclipse.bpmn2.modeler.core.features.AbstractCreateFlowElementFeature;
-import org.eclipse.bpmn2.modeler.core.features.MultiUpdateFeature;
-import org.eclipse.bpmn2.modeler.core.features.UpdateBaseElementNameFeature;
-import org.eclipse.bpmn2.modeler.core.features.data.AddDataFeature;
-import org.eclipse.bpmn2.modeler.core.features.data.Properties;
-import org.eclipse.bpmn2.modeler.core.model.Bpmn2ModelerFactory;
-import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
-import org.eclipse.bpmn2.modeler.ui.Activator;
-import org.eclipse.bpmn2.modeler.ui.ImageProvider;
-import org.eclipse.emf.common.util.TreeIterator;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.graphiti.features.IAddFeature;
-import org.eclipse.graphiti.features.ICreateFeature;
-import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.features.IReason;
-import org.eclipse.graphiti.features.IUpdateFeature;
-import org.eclipse.graphiti.features.context.ICreateContext;
-import org.eclipse.graphiti.features.context.IUpdateContext;
-import org.eclipse.graphiti.features.impl.AbstractUpdateFeature;
-import org.eclipse.graphiti.features.impl.Reason;
-import org.eclipse.graphiti.mm.algorithms.Polyline;
-import org.eclipse.graphiti.mm.pictograms.ContainerShape;
-import org.eclipse.graphiti.mm.pictograms.Shape;
-import org.eclipse.graphiti.services.Graphiti;
-import org.eclipse.graphiti.services.IPeService;
-import org.eclipse.graphiti.ui.internal.util.ui.PopupMenu;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Display;
-
-public class DataObjectFeatureContainer extends AbstractDataFeatureContainer {
-
- @Override
- public boolean canApplyTo(Object o) {
- return super.canApplyTo(o) && o instanceof DataObject;
- }
-
- @Override
- public ICreateFeature getCreateFeature(IFeatureProvider fp) {
- return new CreateDataObjectFeature(fp);
- }
-
- @Override
- public IAddFeature getAddFeature(IFeatureProvider fp) {
- return new AddDataFeature<DataObject>(fp) {
-
- @Override
- public String getName(DataObject t) {
- return t.getName();
- }
-
- };
- }
-
- @Override
- public IUpdateFeature getUpdateFeature(IFeatureProvider fp) {
- MultiUpdateFeature multiUpdate = new MultiUpdateFeature(fp);
- multiUpdate.addUpdateFeature(new UpdateMarkersFeature(fp));
- multiUpdate.addUpdateFeature(new UpdateBaseElementNameFeature(fp));
- return multiUpdate;
- }
-
- private class UpdateMarkersFeature extends AbstractUpdateFeature {
-
- public UpdateMarkersFeature(IFeatureProvider fp) {
- super(fp);
- }
-
- @Override
- public boolean canUpdate(IUpdateContext context) {
- Object o = getBusinessObjectForPictogramElement(context.getPictogramElement());
- return o != null && o instanceof BaseElement && canApplyTo(o);
- }
-
- @Override
- public IReason updateNeeded(IUpdateContext context) {
- IPeService peService = Graphiti.getPeService();
- ContainerShape container = (ContainerShape) context.getPictogramElement();
- DataObject data = (DataObject) getBusinessObjectForPictogramElement(container);
- boolean isCollection = Boolean.parseBoolean(peService.getPropertyValue(container,
- Properties.COLLECTION_PROPERTY));
- return data.isIsCollection() != isCollection ? Reason.createTrueReason() : Reason.createFalseReason();
- }
-
- @Override
- public boolean update(IUpdateContext context) {
- IPeService peService = Graphiti.getPeService();
- ContainerShape container = (ContainerShape) context.getPictogramElement();
- DataObject data = (DataObject) getBusinessObjectForPictogramElement(container);
-
- boolean drawCollectionMarker = data.isIsCollection();
-
- Iterator<Shape> iterator = peService.getAllContainedShapes(container).iterator();
- while (iterator.hasNext()) {
- Shape shape = iterator.next();
- String prop = peService.getPropertyValue(shape, Properties.HIDEABLE_PROPERTY);
- if (prop != null && new Boolean(prop)) {
- Polyline line = (Polyline) shape.getGraphicsAlgorithm();
- line.setLineVisible(drawCollectionMarker);
- }
- }
-
- peService.setPropertyValue(container, Properties.COLLECTION_PROPERTY,
- Boolean.toString(data.isIsCollection()));
- return true;
- }
- }
-
- public static class CreateDataObjectFeature extends AbstractCreateFlowElementFeature<FlowElement> {
-
- private static ILabelProvider labelProvider = new ILabelProvider() {
-
- public void removeListener(ILabelProviderListener listener) {
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- public void dispose() {
-
- }
-
- public void addListener(ILabelProviderListener listener) {
-
- }
-
- public String getText(Object element) {
- if (((DataObject) element).getId() == null)
- return ((DataObject) element).getName();
- return "Reference existing \"" + ((DataObject) element).getName() + "\"";
- }
-
- public Image getImage(Object element) {
- return null;
- }
-
- };
-
- public CreateDataObjectFeature(IFeatureProvider fp) {
- super(fp, "Data Object",
- "Provides information about what activities require to be performed or what they produce");
- }
-
- @Override
- public String getStencilImageId() {
- return ImageProvider.IMG_16_DATA_OBJECT;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.core.features.AbstractCreateFlowElementFeature#getFlowElementClass()
- */
- @Override
- public EClass getBusinessObjectClass() {
- return Bpmn2Package.eINSTANCE.getDataObject();
- }
-
- @Override
- public FlowElement createBusinessObject(ICreateContext context) {
- FlowElement bo = null;
- try {
- DataObjectReference dataObjectReference = null;
- DataObject dataObject = null;
- ModelHandler mh = ModelHandler.getInstance(getDiagram());
- dataObjectReference = Bpmn2ModelerFactory.create(DataObjectReference.class);
- dataObject = Bpmn2ModelerFactory.create(DataObject.class);
- dataObject.setName("Create a new Data Object");
- Object container = getBusinessObjectForPictogramElement(context.getTargetContainer());
-
- List<DataObject> dataObjectList = new ArrayList<DataObject>();
- dataObjectList.add(dataObject);
- TreeIterator<EObject> iter = mh.getDefinitions().eAllContents();
- while (iter.hasNext()) {
- EObject obj = iter.next();
- if (obj instanceof DataObject)
- dataObjectList.add((DataObject) obj);
- }
-
- DataObject result = dataObject;
- if (dataObjectList.size() > 1) {
- PopupMenu popupMenu = new PopupMenu(dataObjectList, labelProvider);
- boolean b = popupMenu.show(Display.getCurrent().getActiveShell());
- if (b) {
- result = (DataObject) popupMenu.getResult();
- }
- }
- if (result == dataObject) { // the new one
- mh.addFlowElement(container,dataObject);
- ModelUtil.setID(dataObject);
- dataObject.setIsCollection(false);
- dataObject.setName(ModelUtil.toDisplayName(dataObject.getId()));
- dataObjectReference.setName(dataObject.getName());
- bo = dataObject;
- } else {
- mh.addFlowElement(container,dataObjectReference);
- ModelUtil.setID(dataObjectReference);
- dataObjectReference.setName(result.getName() + " Ref");
- dataObjectReference.setDataObjectRef(result);
- dataObject = result;
- bo = dataObjectReference;
- }
- putBusinessObject(context, bo);
-
- } catch (IOException e) {
- Activator.showErrorWithLogging(e);
- }
- return bo;
- }
- }
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Innar Made
+ ******************************************************************************/
+package org.eclipse.bpmn2.modeler.ui.features.data;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.bpmn2.BaseElement;
+import org.eclipse.bpmn2.Bpmn2Package;
+import org.eclipse.bpmn2.DataObject;
+import org.eclipse.bpmn2.DataObjectReference;
+import org.eclipse.bpmn2.FlowElement;
+import org.eclipse.bpmn2.modeler.core.ModelHandler;
+import org.eclipse.bpmn2.modeler.core.features.AbstractCreateFlowElementFeature;
+import org.eclipse.bpmn2.modeler.core.features.MultiUpdateFeature;
+import org.eclipse.bpmn2.modeler.core.features.UpdateBaseElementNameFeature;
+import org.eclipse.bpmn2.modeler.core.features.data.AddDataFeature;
+import org.eclipse.bpmn2.modeler.core.features.data.Properties;
+import org.eclipse.bpmn2.modeler.core.model.Bpmn2ModelerFactory;
+import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
+import org.eclipse.bpmn2.modeler.ui.Activator;
+import org.eclipse.bpmn2.modeler.ui.ImageProvider;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.graphiti.features.IAddFeature;
+import org.eclipse.graphiti.features.ICreateFeature;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.IReason;
+import org.eclipse.graphiti.features.IUpdateFeature;
+import org.eclipse.graphiti.features.context.ICreateContext;
+import org.eclipse.graphiti.features.context.IUpdateContext;
+import org.eclipse.graphiti.features.impl.AbstractUpdateFeature;
+import org.eclipse.graphiti.features.impl.Reason;
+import org.eclipse.graphiti.mm.algorithms.Polyline;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+import org.eclipse.graphiti.services.Graphiti;
+import org.eclipse.graphiti.services.IPeService;
+import org.eclipse.graphiti.ui.internal.util.ui.PopupMenu;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ILabelProviderListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.Display;
+
+public class DataObjectFeatureContainer extends AbstractDataFeatureContainer {
+
+ @Override
+ public boolean canApplyTo(Object o) {
+ return super.canApplyTo(o) && o instanceof DataObject;
+ }
+
+ @Override
+ public ICreateFeature getCreateFeature(IFeatureProvider fp) {
+ return new CreateDataObjectFeature(fp);
+ }
+
+ @Override
+ public IAddFeature getAddFeature(IFeatureProvider fp) {
+ return new AddDataFeature<DataObject>(fp) {
+
+ @Override
+ public String getName(DataObject t) {
+ return t.getName();
+ }
+
+ };
+ }
+
+ @Override
+ public IUpdateFeature getUpdateFeature(IFeatureProvider fp) {
+ MultiUpdateFeature multiUpdate = new MultiUpdateFeature(fp);
+ multiUpdate.addUpdateFeature(new UpdateMarkersFeature(fp));
+ multiUpdate.addUpdateFeature(new UpdateBaseElementNameFeature(fp));
+ return multiUpdate;
+ }
+
+ private class UpdateMarkersFeature extends AbstractUpdateFeature {
+
+ public UpdateMarkersFeature(IFeatureProvider fp) {
+ super(fp);
+ }
+
+ @Override
+ public boolean canUpdate(IUpdateContext context) {
+ Object o = getBusinessObjectForPictogramElement(context.getPictogramElement());
+ return o != null && o instanceof BaseElement && canApplyTo(o);
+ }
+
+ @Override
+ public IReason updateNeeded(IUpdateContext context) {
+ IPeService peService = Graphiti.getPeService();
+ ContainerShape container = (ContainerShape) context.getPictogramElement();
+ DataObject data = (DataObject) getBusinessObjectForPictogramElement(container);
+ boolean isCollection = Boolean.parseBoolean(peService.getPropertyValue(container,
+ Properties.COLLECTION_PROPERTY));
+ return data.isIsCollection() != isCollection ? Reason.createTrueReason() : Reason.createFalseReason();
+ }
+
+ @Override
+ public boolean update(IUpdateContext context) {
+ IPeService peService = Graphiti.getPeService();
+ ContainerShape container = (ContainerShape) context.getPictogramElement();
+ DataObject data = (DataObject) getBusinessObjectForPictogramElement(container);
+
+ boolean drawCollectionMarker = data.isIsCollection();
+
+ Iterator<Shape> iterator = peService.getAllContainedShapes(container).iterator();
+ while (iterator.hasNext()) {
+ Shape shape = iterator.next();
+ String prop = peService.getPropertyValue(shape, Properties.HIDEABLE_PROPERTY);
+ if (prop != null && new Boolean(prop)) {
+ Polyline line = (Polyline) shape.getGraphicsAlgorithm();
+ line.setLineVisible(drawCollectionMarker);
+ }
+ }
+
+ peService.setPropertyValue(container, Properties.COLLECTION_PROPERTY,
+ Boolean.toString(data.isIsCollection()));
+ return true;
+ }
+ }
+
+ public static class CreateDataObjectFeature extends AbstractCreateFlowElementFeature<FlowElement> {
+
+ private static ILabelProvider labelProvider = new ILabelProvider() {
+
+ public void removeListener(ILabelProviderListener listener) {
+ }
+
+ public boolean isLabelProperty(Object element, String property) {
+ return false;
+ }
+
+ public void dispose() {
+
+ }
+
+ public void addListener(ILabelProviderListener listener) {
+
+ }
+
+ public String getText(Object element) {
+ if (((DataObject) element).getId() == null)
+ return ((DataObject) element).getName();
+ return "Reference existing \"" + ((DataObject) element).getName() + "\"";
+ }
+
+ public Image getImage(Object element) {
+ return null;
+ }
+
+ };
+
+ public CreateDataObjectFeature(IFeatureProvider fp) {
+ super(fp, "Data Object",
+ "Provides information about what activities require to businessObject performed or what they produce");
+ }
+
+ @Override
+ public String getStencilImageId() {
+ return ImageProvider.IMG_16_DATA_OBJECT;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.features.AbstractCreateFlowElementFeature#getFlowElementClass()
+ */
+ @Override
+ public EClass getBusinessObjectClass() {
+ return Bpmn2Package.eINSTANCE.getDataObject();
+ }
+
+ @Override
+ public FlowElement createBusinessObject(ICreateContext context) {
+ FlowElement bo = null;
+ try {
+ DataObjectReference dataObjectReference = null;
+ DataObject dataObject = null;
+ ModelHandler mh = ModelHandler.getInstance(getDiagram());
+ dataObjectReference = Bpmn2ModelerFactory.create(DataObjectReference.class);
+ dataObject = Bpmn2ModelerFactory.create(DataObject.class);
+ dataObject.setName("Create a new Data Object");
+ Object container = getBusinessObjectForPictogramElement(context.getTargetContainer());
+
+ List<DataObject> dataObjectList = new ArrayList<DataObject>();
+ dataObjectList.add(dataObject);
+ TreeIterator<EObject> iter = mh.getDefinitions().eAllContents();
+ while (iter.hasNext()) {
+ EObject obj = iter.next();
+ if (obj instanceof DataObject)
+ dataObjectList.add((DataObject) obj);
+ }
+
+ DataObject result = dataObject;
+ if (dataObjectList.size() > 1) {
+ PopupMenu popupMenu = new PopupMenu(dataObjectList, labelProvider);
+ boolean b = popupMenu.show(Display.getCurrent().getActiveShell());
+ if (b) {
+ result = (DataObject) popupMenu.getResult();
+ }
+ }
+ if (result == dataObject) { // the new one
+ mh.addFlowElement(container,dataObject);
+ ModelUtil.setID(dataObject);
+ dataObject.setIsCollection(false);
+ dataObject.setName(ModelUtil.toDisplayName(dataObject.getId()));
+ dataObjectReference.setName(dataObject.getName());
+ bo = dataObject;
+ } else {
+ mh.addFlowElement(container,dataObjectReference);
+ ModelUtil.setID(dataObjectReference);
+ dataObjectReference.setName(result.getName() + " Ref");
+ dataObjectReference.setDataObjectRef(result);
+ dataObject = result;
+ bo = dataObjectReference;
+ }
+ putBusinessObject(context, bo);
+
+ } catch (IOException e) {
+ Activator.showErrorWithLogging(e);
+ }
+ return bo;
+ }
+ }
}
\ No newline at end of file
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/data/DataObjectReferenceFeatureContainer.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/data/DataObjectReferenceFeatureContainer.java
index 14ddbd8..10be8fb 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/data/DataObjectReferenceFeatureContainer.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/data/DataObjectReferenceFeatureContainer.java
@@ -1,77 +1,77 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Innar Made
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.features.data;
-
-import org.eclipse.bpmn2.Bpmn2Package;
-import org.eclipse.bpmn2.DataObjectReference;
-import org.eclipse.bpmn2.modeler.core.features.AbstractCreateFlowElementFeature;
-import org.eclipse.bpmn2.modeler.core.features.UpdateBaseElementNameFeature;
-import org.eclipse.bpmn2.modeler.core.features.data.AddDataFeature;
-import org.eclipse.bpmn2.modeler.core.model.Bpmn2ModelerFactory;
-import org.eclipse.bpmn2.modeler.ui.ImageProvider;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.graphiti.features.IAddFeature;
-import org.eclipse.graphiti.features.ICreateFeature;
-import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.features.IUpdateFeature;
-import org.eclipse.graphiti.features.context.ICreateContext;
-
-public class DataObjectReferenceFeatureContainer extends AbstractDataFeatureContainer {
-
- @Override
- public boolean canApplyTo(Object o) {
- return super.canApplyTo(o) && o instanceof DataObjectReference;
- }
-
- @Override
- public ICreateFeature getCreateFeature(IFeatureProvider fp) {
- return new CreateDataObjectReferenceFeature(fp);
- }
-
- @Override
- public IAddFeature getAddFeature(IFeatureProvider fp) {
- return new AddDataFeature<DataObjectReference>(fp) {
-
- @Override
- public String getName(DataObjectReference t) {
- return t.getName();
- }
- };
- }
-
- @Override
- public IUpdateFeature getUpdateFeature(IFeatureProvider fp) {
- return new UpdateBaseElementNameFeature(fp);
- }
-
- public static class CreateDataObjectReferenceFeature extends AbstractCreateFlowElementFeature<DataObjectReference> {
-
- public CreateDataObjectReferenceFeature(IFeatureProvider fp) {
- super(fp, "Data Object Ref",
- "Provides ref information about what activities require to be performed or what they produce");
- }
-
- @Override
- public String getStencilImageId() {
- return ImageProvider.IMG_16_DATA_OBJECT;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.core.features.AbstractCreateFlowElementFeature#getFlowElementClass()
- */
- @Override
- public EClass getBusinessObjectClass() {
- return Bpmn2Package.eINSTANCE.getDataObjectReference();
- }
- }
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Innar Made
+ ******************************************************************************/
+package org.eclipse.bpmn2.modeler.ui.features.data;
+
+import org.eclipse.bpmn2.Bpmn2Package;
+import org.eclipse.bpmn2.DataObjectReference;
+import org.eclipse.bpmn2.modeler.core.features.AbstractCreateFlowElementFeature;
+import org.eclipse.bpmn2.modeler.core.features.UpdateBaseElementNameFeature;
+import org.eclipse.bpmn2.modeler.core.features.data.AddDataFeature;
+import org.eclipse.bpmn2.modeler.core.model.Bpmn2ModelerFactory;
+import org.eclipse.bpmn2.modeler.ui.ImageProvider;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.graphiti.features.IAddFeature;
+import org.eclipse.graphiti.features.ICreateFeature;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.IUpdateFeature;
+import org.eclipse.graphiti.features.context.ICreateContext;
+
+public class DataObjectReferenceFeatureContainer extends AbstractDataFeatureContainer {
+
+ @Override
+ public boolean canApplyTo(Object o) {
+ return super.canApplyTo(o) && o instanceof DataObjectReference;
+ }
+
+ @Override
+ public ICreateFeature getCreateFeature(IFeatureProvider fp) {
+ return new CreateDataObjectReferenceFeature(fp);
+ }
+
+ @Override
+ public IAddFeature getAddFeature(IFeatureProvider fp) {
+ return new AddDataFeature<DataObjectReference>(fp) {
+
+ @Override
+ public String getName(DataObjectReference t) {
+ return t.getName();
+ }
+ };
+ }
+
+ @Override
+ public IUpdateFeature getUpdateFeature(IFeatureProvider fp) {
+ return new UpdateBaseElementNameFeature(fp);
+ }
+
+ public static class CreateDataObjectReferenceFeature extends AbstractCreateFlowElementFeature<DataObjectReference> {
+
+ public CreateDataObjectReferenceFeature(IFeatureProvider fp) {
+ super(fp, "Data Object Ref",
+ "Provides ref information about what activities require to businessObject performed or what they produce");
+ }
+
+ @Override
+ public String getStencilImageId() {
+ return ImageProvider.IMG_16_DATA_OBJECT;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.features.AbstractCreateFlowElementFeature#getFlowElementClass()
+ */
+ @Override
+ public EClass getBusinessObjectClass() {
+ return Bpmn2Package.eINSTANCE.getDataObjectReference();
+ }
+ }
}
\ No newline at end of file
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/data/DataOutputFeatureContainer.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/data/DataOutputFeatureContainer.java
index b821458..96626b3 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/data/DataOutputFeatureContainer.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/data/DataOutputFeatureContainer.java
@@ -1,91 +1,91 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Innar Made
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.features.data;
-
-import java.io.IOException;
-
-import org.eclipse.bpmn2.BaseElement;
-import org.eclipse.bpmn2.Bpmn2Package;
-import org.eclipse.bpmn2.DataOutput;
-import org.eclipse.bpmn2.ItemAwareElement;
-import org.eclipse.bpmn2.modeler.core.ModelHandler;
-import org.eclipse.bpmn2.modeler.core.ModelHandlerLocator;
-import org.eclipse.bpmn2.modeler.core.features.data.AbstractCreateDataInputOutputFeature;
-import org.eclipse.bpmn2.modeler.core.features.data.AddDataFeature;
-import org.eclipse.bpmn2.modeler.core.model.Bpmn2ModelerFactory;
-import org.eclipse.bpmn2.modeler.core.utils.GraphicsUtil;
-import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
-import org.eclipse.bpmn2.modeler.core.utils.StyleUtil;
-import org.eclipse.bpmn2.modeler.ui.ImageProvider;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.graphiti.features.IAddFeature;
-import org.eclipse.graphiti.features.ICreateFeature;
-import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.features.context.ICreateContext;
-import org.eclipse.graphiti.mm.algorithms.Polygon;
-
-public class DataOutputFeatureContainer extends AbstractDataFeatureContainer {
-
- @Override
- public boolean canApplyTo(Object o) {
- return super.canApplyTo(o) && o instanceof DataOutput;
- }
-
- @Override
- public ICreateFeature getCreateFeature(IFeatureProvider fp) {
- return new CreateDataOutputFeature(fp);
- }
-
- @Override
- public IAddFeature getAddFeature(IFeatureProvider fp) {
- return new AddDataFeature<DataOutput>(fp) {
- @Override
- protected boolean isSupportCollectionMarkers() {
- return false;
- }
-
- @Override
- protected void decorate(Polygon p) {
- Polygon arrow = GraphicsUtil.createDataArrow(p);
- arrow.setFilled(true);
- arrow.setBackground(manageColor(StyleUtil.CLASS_FOREGROUND));
- arrow.setForeground(manageColor(StyleUtil.CLASS_FOREGROUND));
- }
-
- @Override
- public String getName(DataOutput t) {
- return t.getName();
- }
- };
- }
-
- public static class CreateDataOutputFeature extends AbstractCreateDataInputOutputFeature<DataOutput> {
-
- public CreateDataOutputFeature(IFeatureProvider fp) {
- super(fp, "Data Output", "Declaration that a particular kind of data can be produced as output");
- }
-
- @Override
- public String getStencilImageId() {
- return ImageProvider.IMG_16_DATA_OUTPUT;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.core.features.AbstractBpmn2CreateFeature#getBusinessObjectClass()
- */
- @Override
- public EClass getBusinessObjectClass() {
- return Bpmn2Package.eINSTANCE.getDataOutput();
- }
- }
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Innar Made
+ ******************************************************************************/
+package org.eclipse.bpmn2.modeler.ui.features.data;
+
+import java.io.IOException;
+
+import org.eclipse.bpmn2.BaseElement;
+import org.eclipse.bpmn2.Bpmn2Package;
+import org.eclipse.bpmn2.DataOutput;
+import org.eclipse.bpmn2.ItemAwareElement;
+import org.eclipse.bpmn2.modeler.core.ModelHandler;
+import org.eclipse.bpmn2.modeler.core.ModelHandlerLocator;
+import org.eclipse.bpmn2.modeler.core.features.data.AbstractCreateDataInputOutputFeature;
+import org.eclipse.bpmn2.modeler.core.features.data.AddDataFeature;
+import org.eclipse.bpmn2.modeler.core.model.Bpmn2ModelerFactory;
+import org.eclipse.bpmn2.modeler.core.utils.GraphicsUtil;
+import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
+import org.eclipse.bpmn2.modeler.core.utils.StyleUtil;
+import org.eclipse.bpmn2.modeler.ui.ImageProvider;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.graphiti.features.IAddFeature;
+import org.eclipse.graphiti.features.ICreateFeature;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.ICreateContext;
+import org.eclipse.graphiti.mm.algorithms.Polygon;
+
+public class DataOutputFeatureContainer extends AbstractDataFeatureContainer {
+
+ @Override
+ public boolean canApplyTo(Object o) {
+ return super.canApplyTo(o) && o instanceof DataOutput;
+ }
+
+ @Override
+ public ICreateFeature getCreateFeature(IFeatureProvider fp) {
+ return new CreateDataOutputFeature(fp);
+ }
+
+ @Override
+ public IAddFeature getAddFeature(IFeatureProvider fp) {
+ return new AddDataFeature<DataOutput>(fp) {
+ @Override
+ protected boolean isSupportCollectionMarkers() {
+ return false;
+ }
+
+ @Override
+ protected void decorate(Polygon p) {
+ Polygon arrow = GraphicsUtil.createDataArrow(p);
+ arrow.setFilled(true);
+ arrow.setBackground(manageColor(StyleUtil.CLASS_FOREGROUND));
+ arrow.setForeground(manageColor(StyleUtil.CLASS_FOREGROUND));
+ }
+
+ @Override
+ public String getName(DataOutput t) {
+ return t.getName();
+ }
+ };
+ }
+
+ public static class CreateDataOutputFeature extends AbstractCreateDataInputOutputFeature<DataOutput> {
+
+ public CreateDataOutputFeature(IFeatureProvider fp) {
+ super(fp, "Data Output", "Declaration that a particular kind of data can businessObject produced as output");
+ }
+
+ @Override
+ public String getStencilImageId() {
+ return ImageProvider.IMG_16_DATA_OUTPUT;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.features.AbstractBpmn2CreateFeature#getBusinessObjectClass()
+ */
+ @Override
+ public EClass getBusinessObjectClass() {
+ return Bpmn2Package.eINSTANCE.getDataOutput();
+ }
+ }
}
\ No newline at end of file
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/data/DataStoreReferenceFeatureContainer.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/data/DataStoreReferenceFeatureContainer.java
index 984689b..335bf0d 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/data/DataStoreReferenceFeatureContainer.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/data/DataStoreReferenceFeatureContainer.java
@@ -229,7 +229,7 @@
"Data Store",
"Reference to a Data Store instance."
+ " Data Stores provide a mechanism for Activities to persist data beyond the lifetime of the Process."
- + " The same Data Store instance can be visualized through a Data Store Reference in one or more"
+ + " The same Data Store instance can businessObject visualized through a Data Store Reference in one or more"
+ " places in the Process.");
}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/event/definitions/TimerEventDefinitionContainer.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/event/definitions/TimerEventDefinitionContainer.java
index cb36bca..cfe96fb 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/event/definitions/TimerEventDefinitionContainer.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/event/definitions/TimerEventDefinitionContainer.java
@@ -1,127 +1,127 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Innar Made
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.features.event.definitions;
-
-import org.eclipse.bpmn2.BaseElement;
-import org.eclipse.bpmn2.Bpmn2Package;
-import org.eclipse.bpmn2.Event;
-import org.eclipse.bpmn2.EventDefinition;
-import org.eclipse.bpmn2.TerminateEventDefinition;
-import org.eclipse.bpmn2.ThrowEvent;
-import org.eclipse.bpmn2.TimerEventDefinition;
-import org.eclipse.bpmn2.modeler.core.features.event.definitions.AbstractEventDefinitionFeatureContainer;
-import org.eclipse.bpmn2.modeler.core.features.event.definitions.CreateEventDefinition;
-import org.eclipse.bpmn2.modeler.core.features.event.definitions.DecorationAlgorithm;
-import org.eclipse.bpmn2.modeler.core.model.Bpmn2ModelerFactory;
-import org.eclipse.bpmn2.modeler.core.utils.BusinessObjectUtil;
-import org.eclipse.bpmn2.modeler.core.utils.GraphicsUtil;
-import org.eclipse.bpmn2.modeler.core.utils.StyleUtil;
-import org.eclipse.bpmn2.modeler.core.utils.StyleUtil.FillStyle;
-import org.eclipse.bpmn2.modeler.ui.ImageProvider;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.graphiti.features.ICreateFeature;
-import org.eclipse.graphiti.features.IFeatureProvider;
-import org.eclipse.graphiti.features.context.ICreateContext;
-import org.eclipse.graphiti.mm.algorithms.Image;
-import org.eclipse.graphiti.mm.pictograms.ContainerShape;
-import org.eclipse.graphiti.mm.pictograms.Diagram;
-import org.eclipse.graphiti.mm.pictograms.Shape;
-import org.eclipse.graphiti.services.Graphiti;
-import org.eclipse.graphiti.services.IGaService;
-import org.eclipse.graphiti.util.IColorConstant;
-
-public class TimerEventDefinitionContainer extends AbstractEventDefinitionFeatureContainer {
-
- @Override
- public boolean canApplyTo(Object o) {
- return super.canApplyTo(o) && o instanceof TimerEventDefinition;
- }
-
- @Override
- public ICreateFeature getCreateFeature(IFeatureProvider fp) {
- return new CreateTimerEventDefinition(fp);
- }
-
- @Override
- protected Shape drawForStart(DecorationAlgorithm algorithm, ContainerShape shape) {
- return draw(shape);
- }
-
- @Override
- protected Shape drawForEnd(DecorationAlgorithm algorithm, ContainerShape shape) {
- return draw(shape);
- }
-
- @Override
- protected Shape drawForThrow(DecorationAlgorithm decorationAlgorithm, ContainerShape shape) {
- return null; // NOT ALLOWED ACCORDING TO SPEC
- }
-
- @Override
- public Shape drawForCatch(DecorationAlgorithm decorationAlgorithm, ContainerShape shape) {
- return draw(shape);
- }
-
- @Override
- protected Shape drawForBoundary(DecorationAlgorithm algorithm, ContainerShape shape) {
- return draw(shape);
- }
-
- private Shape draw(ContainerShape shape) {
- BaseElement be = BusinessObjectUtil.getFirstElementOfType(shape, BaseElement.class, true);
- Shape timerShape = Graphiti.getPeService().createShape(shape, false);
- Image image = GraphicsUtil.createEventImage(timerShape, ImageProvider.IMG_20_TIMER);
-
- // TODO: can't change foreground color of an Image?
-// Diagram diagram = StyleUtil.findDiagram(image);
-// IGaService gaService = Graphiti.getGaService();
-// image.setForeground(gaService.manageColor(diagram, IColorConstant.GREEN));
-// StyleUtil.setFillStyle(image, FillStyle.FILL_STYLE_NONE);
-// StyleUtil.applyStyle(image, be);
- return timerShape;
- }
-
- public static class CreateTimerEventDefinition extends CreateEventDefinition<TimerEventDefinition> {
-
- public CreateTimerEventDefinition(IFeatureProvider fp) {
- super(fp, "Timer Definition", "Adds time condition to event");
- }
-
- @Override
- public boolean canCreate(ICreateContext context) {
- if (!super.canCreate(context)) {
- return false;
- }
-
- Event e = (Event) getBusinessObjectForPictogramElement(context.getTargetContainer());
- if (e instanceof ThrowEvent) {
- return false;
- }
-
- return true;
- }
-
- @Override
- protected String getStencilImageId() {
- return ImageProvider.IMG_16_TIMER;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.core.features.AbstractBpmn2CreateFeature#getBusinessObjectClass()
- */
- @Override
- public EClass getBusinessObjectClass() {
- return Bpmn2Package.eINSTANCE.getTimerEventDefinition();
- }
- }
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Innar Made
+ ******************************************************************************/
+package org.eclipse.bpmn2.modeler.ui.features.event.definitions;
+
+import org.eclipse.bpmn2.BaseElement;
+import org.eclipse.bpmn2.Bpmn2Package;
+import org.eclipse.bpmn2.Event;
+import org.eclipse.bpmn2.EventDefinition;
+import org.eclipse.bpmn2.TerminateEventDefinition;
+import org.eclipse.bpmn2.ThrowEvent;
+import org.eclipse.bpmn2.TimerEventDefinition;
+import org.eclipse.bpmn2.modeler.core.features.event.definitions.AbstractEventDefinitionFeatureContainer;
+import org.eclipse.bpmn2.modeler.core.features.event.definitions.CreateEventDefinition;
+import org.eclipse.bpmn2.modeler.core.features.event.definitions.DecorationAlgorithm;
+import org.eclipse.bpmn2.modeler.core.model.Bpmn2ModelerFactory;
+import org.eclipse.bpmn2.modeler.core.utils.BusinessObjectUtil;
+import org.eclipse.bpmn2.modeler.core.utils.GraphicsUtil;
+import org.eclipse.bpmn2.modeler.core.utils.StyleUtil;
+import org.eclipse.bpmn2.modeler.core.utils.StyleUtil.FillStyle;
+import org.eclipse.bpmn2.modeler.ui.ImageProvider;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.graphiti.features.ICreateFeature;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.features.context.ICreateContext;
+import org.eclipse.graphiti.mm.algorithms.Image;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+import org.eclipse.graphiti.mm.pictograms.Shape;
+import org.eclipse.graphiti.services.Graphiti;
+import org.eclipse.graphiti.services.IGaService;
+import org.eclipse.graphiti.util.IColorConstant;
+
+public class TimerEventDefinitionContainer extends AbstractEventDefinitionFeatureContainer {
+
+ @Override
+ public boolean canApplyTo(Object o) {
+ return super.canApplyTo(o) && o instanceof TimerEventDefinition;
+ }
+
+ @Override
+ public ICreateFeature getCreateFeature(IFeatureProvider fp) {
+ return new CreateTimerEventDefinition(fp);
+ }
+
+ @Override
+ protected Shape drawForStart(DecorationAlgorithm algorithm, ContainerShape shape) {
+ return draw(shape);
+ }
+
+ @Override
+ protected Shape drawForEnd(DecorationAlgorithm algorithm, ContainerShape shape) {
+ return draw(shape);
+ }
+
+ @Override
+ protected Shape drawForThrow(DecorationAlgorithm decorationAlgorithm, ContainerShape shape) {
+ return null; // NOT ALLOWED ACCORDING TO SPEC
+ }
+
+ @Override
+ public Shape drawForCatch(DecorationAlgorithm decorationAlgorithm, ContainerShape shape) {
+ return draw(shape);
+ }
+
+ @Override
+ protected Shape drawForBoundary(DecorationAlgorithm algorithm, ContainerShape shape) {
+ return draw(shape);
+ }
+
+ private Shape draw(ContainerShape shape) {
+ BaseElement be = BusinessObjectUtil.getFirstElementOfType(shape, BaseElement.class, true);
+ Shape timerShape = Graphiti.getPeService().createShape(shape, false);
+ Image image = GraphicsUtil.createEventImage(timerShape, ImageProvider.IMG_20_TIMER);
+
+ // TODO: can't change foreground color of an Image?
+// Diagram diagram = StyleUtil.findDiagram(image);
+// IGaService gaService = Graphiti.getGaService();
+// image.setForeground(gaService.manageColor(diagram, IColorConstant.GREEN));
+// StyleUtil.setFillStyle(image, FillStyle.FILL_STYLE_NONE);
+// StyleUtil.applyStyle(image, businessObject);
+ return timerShape;
+ }
+
+ public static class CreateTimerEventDefinition extends CreateEventDefinition<TimerEventDefinition> {
+
+ public CreateTimerEventDefinition(IFeatureProvider fp) {
+ super(fp, "Timer Definition", "Adds time condition to event");
+ }
+
+ @Override
+ public boolean canCreate(ICreateContext context) {
+ if (!super.canCreate(context)) {
+ return false;
+ }
+
+ Event e = (Event) getBusinessObjectForPictogramElement(context.getTargetContainer());
+ if (e instanceof ThrowEvent) {
+ return false;
+ }
+
+ return true;
+ }
+
+ @Override
+ protected String getStencilImageId() {
+ return ImageProvider.IMG_16_TIMER;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.features.AbstractBpmn2CreateFeature#getBusinessObjectClass()
+ */
+ @Override
+ public EClass getBusinessObjectClass() {
+ return Bpmn2Package.eINSTANCE.getTimerEventDefinition();
+ }
+ }
}
\ No newline at end of file
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/flow/SequenceFlowFeatureContainer.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/flow/SequenceFlowFeatureContainer.java
index 5e4c986..9add9b6 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/flow/SequenceFlowFeatureContainer.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/flow/SequenceFlowFeatureContainer.java
@@ -143,7 +143,7 @@
public CreateSequenceFlowFeature(IFeatureProvider fp) {
super(fp, "Sequence Flow",
- "A Sequence Flow is used to show the order that Activities will be performed in a Process");
+ "A Sequence Flow is used to show the order that Activities will businessObject performed in a Process");
}
@Override
@@ -304,7 +304,7 @@
@Override
public IReason updateNeeded(IUpdateContext context) {
// NOTE: if this method returns "true" the very first time it's called by the refresh
- // framework, the connection line will be drawn as a red dotted line, so make sure
+ // framework, the connection line will businessObject drawn as a red dotted line, so make sure
// all properties have been correctly set to their initial values in the AddFeature!
// see https://issues.jboss.org/browse/JBPM-3102
IPeService peService = Graphiti.getPeService();
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/participant/DeleteParticipantFeature.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/participant/DeleteParticipantFeature.java
index abfe208..d5fffca 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/participant/DeleteParticipantFeature.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/features/participant/DeleteParticipantFeature.java
@@ -50,8 +50,8 @@
@Override
public boolean canDelete(IDeleteContext context) {
- // Participant bands in a ChoreographyTask only be "deleted" (from the model)
- // if there are no other references to the participant; but they can be "removed"
+ // Participant bands in a ChoreographyTask only businessObject "deleted" (from the model)
+ // if there are no other references to the participant; but they can businessObject "removed"
// (from the ChoreographyTask's participantRef list) at any time.
// @see RemoveChoreographyParticipantFeature
PictogramElement pe = context.getPictogramElement();
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/preferences/Bpmn2HomePreferencePage.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/preferences/Bpmn2HomePreferencePage.java
index 16fc0df..fd49856 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/preferences/Bpmn2HomePreferencePage.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/preferences/Bpmn2HomePreferencePage.java
@@ -32,7 +32,7 @@
* This page is used to modify preferences only. They
* are stored in the preference store that belongs to
* the main plug-in class. That way, preferences can
- * be accessed directly via the preference store.
+ * businessObject accessed directly via the preference store.
*/
public class Bpmn2HomePreferencePage
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/preferences/WSILPreferencePage.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/preferences/WSILPreferencePage.java
index 2f5db1f..f426606 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/preferences/WSILPreferencePage.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/preferences/WSILPreferencePage.java
@@ -1,849 +1,849 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.preferences;
-
-
-import java.io.File;
-import java.io.IOException;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.bpel.wsil.model.inspection.Inspection;
-import org.eclipse.bpel.wsil.model.inspection.InspectionFactory;
-import org.eclipse.bpel.wsil.model.inspection.InspectionPackage;
-import org.eclipse.bpel.wsil.model.inspection.Link;
-import org.eclipse.bpel.wsil.model.inspection.TypeOfAbstract;
-import org.eclipse.bpel.wsil.model.inspection.WSILDocument;
-import org.eclipse.bpmn2.modeler.core.merrimac.providers.ColumnTableProvider;
-import org.eclipse.bpmn2.modeler.core.merrimac.providers.TableCursor;
-import org.eclipse.bpmn2.modeler.core.model.Bpmn2ModelerResourceSetImpl;
-import org.eclipse.bpmn2.modeler.core.preferences.Bpmn2Preferences;
-import org.eclipse.bpmn2.modeler.ui.Activator;
-import org.eclipse.bpmn2.modeler.ui.Messages;
-import org.eclipse.bpmn2.modeler.ui.property.providers.WSILContentProvider;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.util.EContentAdapter;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.preference.PreferencePage;
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jface.viewers.ICellModifier;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.jface.viewers.TextCellEditor;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
-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.FileDialog;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Table;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.IWorkbenchPreferencePage;
-
-
-/**
- *
- * @author Michal Chmielewski (michal.chmielewski@oracle.com)
- * @date May 2, 2007
- *
- */
-
-
-@SuppressWarnings({"nls","boxing","unchecked"})
-
-public class WSILPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
-
- Bpmn2ModelerResourceSetImpl resourceSet = new Bpmn2ModelerResourceSetImpl();
-
- Text wsilURL;
-
- Table linkTable;
- ColumnTableProvider tableProvider;
-
- TableViewer linkTableViewer;
-
- TableCursor tableCursor;
-
- Link fLinkSelection;
-
- WSILDocument fWsilDocument;
-
- Button addButton;
- Button removeButton;
- Button moveUpButton;
- Button moveDownButton;
- Button openInBrowserButton;
-
- private static String WSIL = "wsil";
-
- // Track the modification of any parameter in the WSIL model.
- // we don't use commands and stacks here.
- EContentAdapter fContentAdapter = new EContentAdapter() {
-
- /**
- * @see org.eclipse.emf.ecore.util.EContentAdapter#notifyChanged(org.eclipse.emf.common.notify.Notification)
- */
-
- @Override
- public void notifyChanged(Notification arg0) {
-
- super.notifyChanged(arg0);
- int eventId = arg0.getEventType();
- if (eventId == Notification.ADD || eventId == Notification.SET ||
- eventId == Notification.MOVE || eventId == Notification.REMOVE ) {
-
- linkTableViewer.refresh();
- updateButtons();
- }
- }
- };
-
-
-
- @Override
- protected Control createContents (Composite parent) {
-
- Composite result = new Composite(parent, SWT.NONE);
-
- GridLayout layout = new GridLayout( );
- layout.numColumns = 3;
- layout.verticalSpacing = 15;
- layout.makeColumnsEqualWidth = false;
-
- result.setLayout(layout);
- GridData data = new GridData(GridData.FILL_BOTH);
- // result.setLayoutData(data);
-
- // WSIL directory
- Label wsilLabel = new Label(result, SWT.NONE);
- wsilLabel.setText(Messages.WSILPreferencePage_WSIL_1);
- wsilLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
-
- wsilURL = new Text(result, SWT.BORDER);
- wsilURL.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
- wsilURL.addFocusListener( new FocusListener () {
-
-
- public void focusGained(FocusEvent e) {
- wsilURL.setData("lastValue",wsilURL.getText());
- }
-
- public void focusLost(FocusEvent e) {
- String url = wsilURL.getText();
-
- // no change.
- if (url.equals(wsilURL.getData("lastValue"))) {
- return ;
- }
- attemptLoad( url );
- }
-
- });
-
- Button browse = new Button(result, SWT.NONE);
- browse.setText(Messages.WSILPreferencePage_WSIL_2);
- data = new GridData(SWT.RIGHT);
- data.widthHint = 100;
-
- browse.setLayoutData(data);
- browse.addSelectionListener(new SelectionAdapter() {
-
- @Override
- public void widgetSelected(SelectionEvent e) {
- FileDialog fd = new FileDialog(getShell(), SWT.OPEN);
- fd.setFilterExtensions(new String[]{"*."+WSIL});
- String fileName = fd.open();
- if ((fileName != null) && (fileName.length() > 0)) {
- // parse to file url
- File file = new File(fileName);
- String uri = file.toURI().toString();
- wsilURL.setText( uri );
- attemptLoad(uri);
-
- }
- }
- }
- );
-
-
- // 2nd row of the 3 cell grid
-
- Label txt = new Label ( result, SWT.NO_BACKGROUND | SWT.WRAP );
-
- txt.setText( Messages.WSILPreferencePage_WSIL_Description );
- data = new GridData( GridData.GRAB_HORIZONTAL );
- data.horizontalSpan = 3;
- txt.setLayoutData(data);
-
- //
- //
-
- // create table
- linkTable = new Table(result, SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.BORDER );
-
- data = new GridData(GridData.FILL_BOTH);
- data.horizontalSpan = 2;
-
- linkTable.setLayoutData(data);
-
- // set up table
- linkTable.setLinesVisible(true);
- linkTable.setHeaderVisible(true);
-
- tableProvider = new ColumnTableProvider();
- tableProvider.add(new IndexColumn());
- tableProvider.add(new AbstractColumn());
- tableProvider.add(new LocationColumn());
- // columnProvider.add(new NamespaceColumn());
-
- linkTableViewer = new TableViewer(linkTable);
- tableProvider.createTableLayout(linkTable);
- linkTableViewer.setLabelProvider(tableProvider);
- linkTableViewer.setCellModifier(tableProvider);
-
- WSILContentProvider wsilContentProvider = new WSILContentProvider();
- wsilContentProvider.setMode( WSILContentProvider.FLATTEN );
-
- linkTableViewer.setContentProvider( wsilContentProvider );
-
- linkTableViewer.addFilter(new ViewerFilter() {
- @Override
- public boolean select(Viewer viewer, Object parentElement, Object element) {
- return element instanceof Link;
- }
- });
-
- linkTableViewer.setColumnProperties(tableProvider.getColumnProperties());
- linkTableViewer.setCellEditors(tableProvider.createCellEditors(linkTable));
-
-
- tableCursor = TableCursor.create(linkTable, linkTableViewer);
-
- ///
-
-
- layout = new GridLayout();
- layout.numColumns = 1;
- layout.verticalSpacing = 5;
-
- Composite buttonList = new Composite ( result , SWT.NONE );
- buttonList.setLayout(layout);
-
- data = new GridData( GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_CENTER );
- buttonList.setLayoutData( data );
-
- addButton = new Button(buttonList, SWT.NONE);
- addButton.setText(Messages.WSILPreferencePage_WSIL_Add);
- data = new GridData( GridData.FILL_HORIZONTAL );
-
- addButton.setLayoutData(data);
- addButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
-
- Link link = InspectionFactory.eINSTANCE.createLink();
-
- link.setLocation(Messages.WSILPreferencePage_WSIL_EnterLocation);
- link.setReferencedNamespace( InspectionPackage.eNS_URI );
-
- TypeOfAbstract toa = InspectionFactory.eINSTANCE.createTypeOfAbstract();
- toa.setValue(Messages.WSILPreferencePage_WSIL_EnterDescription);
- link.getAbstract().add( toa );
-
- // modify the document
- EList links = fWsilDocument.getInspection().getLinks();
- links.add ( link );
-
- // notifications of modifications are sent back to us via the EContentAdapter
- // on the WSIL Document resource.
- }
- });
-
-
- removeButton = new Button(buttonList, SWT.NONE);
- removeButton.setText(Messages.WSILPreferencePage_WSIL_Remove);
- data = new GridData( GridData.FILL_HORIZONTAL );
-
- removeButton.setLayoutData(data);
-
- removeButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (fLinkSelection == null) {
- return ;
- }
- // modify the document
- EList links = fWsilDocument.getInspection().getLinks();
- links.remove(fLinkSelection);
- }
- });
-
-
-
- moveUpButton = new Button(buttonList, SWT.NONE);
- moveUpButton.setText(Messages.WSILPreferencePage_WSIL_MoveUp);
- data = new GridData( GridData.FILL_HORIZONTAL );
-
- moveUpButton.setLayoutData(data);
-
- moveUpButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (fLinkSelection == null) {
- return ;
- }
- // modify the document
- EList links = fWsilDocument.getInspection().getLinks();
- int idx = links.indexOf(fLinkSelection);
- if (idx < 0) {
- return ;
- }
- links.move(idx,idx-1);
- }
- });
-
-
- moveDownButton = new Button(buttonList, SWT.NONE);
- moveDownButton.setText(Messages.WSILPreferencePage_WSIL_MoveDown);
- data = new GridData( GridData.FILL_HORIZONTAL );
-
- moveDownButton.setLayoutData(data);
-
- moveDownButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (fLinkSelection == null) {
- return ;
- }
- // modify the document
- EList links = fWsilDocument.getInspection().getLinks();
- int idx = links.indexOf(fLinkSelection);
- if (idx < 0) {
- return ;
- }
- links.move(idx, idx+1);
- }
- });
-
- openInBrowserButton = new Button(buttonList, SWT.NONE);
- openInBrowserButton.setText(Messages.WSILPreferencePage_WSIL_OpenInBrowser);
- data = new GridData( GridData.FILL_HORIZONTAL );
-
- openInBrowserButton.setLayoutData(data);
-
- openInBrowserButton.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- if (fLinkSelection == null) {
- return ;
- }
-
- // TODO:
- }
- });
-
-
-
- linkTableViewer.addPostSelectionChangedListener( new ISelectionChangedListener () {
-
-
- public void selectionChanged (SelectionChangedEvent event) {
- ISelection selection = event.getSelection();
- if (selection instanceof IStructuredSelection) {
- IStructuredSelection ss = (IStructuredSelection) selection;
- Object obj = ss.getFirstElement();
- fLinkSelection = obj instanceof Link ? (Link) obj : null;
- }
- updateButtons();
- }
-
- });
-
- updateButtons();
-
- initializeValues();
-
-// PlatformUI.getWorkbench().getHelpSystem().setHelp(
-// parent, IHelpContextIds.PREFERENCES_PAGE);
-
- return result;
- }
-
-
- /**
- * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
- */
- public void init(IWorkbench workbench) {
-
- }
-
- @Override
- protected void performDefaults() {
- super.performDefaults();
- initializeDefaults();
- }
-
- /**
- * @see org.eclipse.jface.preference.PreferencePage#performOk()
- */
- @Override
- public boolean performOk() {
- storeValues();
- return true;
- }
-
- @Override
- protected void performApply() {
- performOk();
- }
-
- /**
- * Initializes states of the controls using default values in the preference store.
- */
- private void initializeDefaults() {
-
- }
-
- /**
- * Initializes states of the controls from the preference store.
- */
- private void initializeValues() {
- IPreferenceStore store = Activator.getDefault().getPreferenceStore();
-
- wsilURL.setText(store.getString(Bpmn2Preferences.PREF_WSIL_URL));
-
- attemptLoad (wsilURL.getText() );
- }
-
-
-
- /**
- * Stores the values of the controls back to the preference store.
- */
- private void storeValues() {
- IPreferenceStore store = Activator.getDefault().getPreferenceStore();
-
- store.setValue(Bpmn2Preferences.PREF_WSIL_URL, wsilURL.getText());
-
- if (fWsilDocument != null) {
-
- Resource resource = fWsilDocument.eResource();
-
- try {
- resource.save(null);
- } catch (IOException e) {
- Activator.logError(e);
- }
- }
- }
-
-
- void updateButtons ( ) {
-
- List linkList = (fWsilDocument == null ? Collections.EMPTY_LIST : fWsilDocument.getInspection().getLinks());
-
- int idx = linkList.indexOf(fLinkSelection);
- // -1 if not found ...
- moveUpButton.setEnabled(idx > 0);
- moveDownButton.setEnabled(idx >= 0 && idx < linkList.size() - 1);
- removeButton.setEnabled( fLinkSelection != null );
- openInBrowserButton.setEnabled( fLinkSelection != null );
- addButton.setEnabled( fWsilDocument != null );
- }
-
-
-
- /**
- * @see org.eclipse.jface.dialogs.DialogPage#dispose()
- */
- @Override
- public void dispose() {
-
- Iterator it = resourceSet.getResources().iterator();
- while (it.hasNext()) {
- Resource r = (Resource) it.next();
- r.eAdapters().clear();
- }
- // TODO Auto-generated method stub
- super.dispose();
- }
-
-
- void attemptLoad ( String url ) {
-
- url = url.trim();
-
- if (url.length() < 1) {
- return ;
- }
- if(!url.endsWith(WSIL)){
- setMessage(Messages.WSILPreferencePage_WSIL_NameLimit, ERROR);
- return;
- }
-
- if (fWsilDocument != null) {
- fWsilDocument.eResource().eAdapters().remove( fContentAdapter );
- fWsilDocument = null;
- }
-
- org.eclipse.emf.common.util.URI uri = org.eclipse.emf.common.util.URI.createURI(url);
-
- Resource resource = null;
- try {
-
- resource = resourceSet.getResource(uri, true, WSIL);
-
- List contents = resource.getContents();
-
- if (contents.size() > 0) {
- if (contents.get(0) instanceof WSILDocument ) {
- fWsilDocument = (WSILDocument ) contents.get(0);
- }
- }
- setMessage(null);
-
- } catch (Exception e) {
- setMessage(Messages.WSILPreferencePage_WSIL_DocumentNotLoaded, ERROR);
- Activator.logError(e);
- }
-
- linkTableViewer.setInput( fWsilDocument );
-
- // Track the modification of any parameter in the WSIL model.
- // we don't use commands and stacks here.
- if (fWsilDocument != null) {
- fWsilDocument.eResource().eAdapters().add( fContentAdapter );
- }
- updateButtons();
- }
-
-
-
- /**
- * @author Michal Chmielewski (michal.chmielewski@oracle.com)
- * @date May 4, 2007
- *
- */
- public class AbstractColumn extends ColumnTableProvider.Column implements
- ILabelProvider, ICellModifier {
-
- /**
- * @see org.eclipse.bpmn2.modeler.core.merrimac.providers.ui.details.providers.ColumnTableProvider.Column#getHeaderText()
- */
- @Override
- public String getHeaderText() {
- return Messages.WSILPreferencePage_WSIL_Abstract;
- }
-
- /**
- * @see org.eclipse.bpmn2.modeler.core.merrimac.providers.ui.details.providers.ColumnTableProvider.Column#getProperty()
- */
- @Override
- public String getProperty() {
- return "abstract"; //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.bpmn2.modeler.core.merrimac.providers.ui.details.providers.ColumnTableProvider.Column#getInitialWeight()
- */
- @Override
- public int getInitialWeight() {
- return 50;
- }
-
-
- /**
- * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
- */
- public String getText (Object element) {
- if (element instanceof Link) {
- Link link = (Link) element;
- List abs = link.getAbstract();
- // TODO: Do this based on language ?
- if (abs.size() > 0) {
- TypeOfAbstract absType = (TypeOfAbstract) abs.get(0);
- return absType.getValue();
- }
- }
- return "";
- }
-
- /**
- * @see org.eclipse.bpmn2.modeler.core.merrimac.providers.ui.details.providers.ColumnTableProvider.Column#createCellEditor(org.eclipse.swt.widgets.Composite)
- */
- @Override
- public CellEditor createCellEditor (Composite parent) {
- return new TextCellEditor(parent, SWT.NO_BACKGROUND );
- }
-
- /**
- * @see org.eclipse.jface.viewers.ICellModifier#canModify(java.lang.Object, java.lang.String)
- */
- public boolean canModify(Object element, String property) {
- return true;
- }
-
- /**
- * @see org.eclipse.jface.viewers.ICellModifier#getValue(java.lang.Object, java.lang.String)
- */
- public Object getValue(Object element, String property) {
- return getText(element);
- }
-
- /**
- * @see org.eclipse.jface.viewers.ICellModifier#modify(java.lang.Object, java.lang.String, java.lang.Object)
- */
- public void modify(Object element, String property, Object value) {
- if (element instanceof Link) {
- Link link = (Link) element;
- List abs = link.getAbstract();
- // TODO: Do this based on language ?
- if (abs.size() > 0) {
- TypeOfAbstract absType = (TypeOfAbstract) abs.get(0);
-
- // noop, do not needlessly modify
- if (value.equals(absType.getValue())) {
- return ;
- }
-
- absType.setValue( (String) value);
- }
- }
- }
- }
-
-
-
- /**
- * @author Michal Chmielewski (michal.chmielewski@oracle.com)
- * @date May 4, 2007
- *
- */
- public class LocationColumn extends ColumnTableProvider.Column
- implements ILabelProvider, ICellModifier {
-
- /**
- * @see org.eclipse.bpmn2.modeler.core.merrimac.providers.ui.details.providers.ColumnTableProvider.Column#getHeaderText()
- */
- @Override
- public String getHeaderText() {
- return Messages.WSILPreferencePage_WSIL_Location;
- }
-
- /**
- * @see org.eclipse.bpmn2.modeler.core.merrimac.providers.ui.details.providers.ColumnTableProvider.Column#getProperty()
- */
- @Override
- public String getProperty() {
- return "location"; //$NON-NLS-1$
- }
-
-
- /** (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.core.merrimac.providers.ui.details.providers.ColumnTableProvider.Column#getInitialWeight()
- */
- @Override
- public int getInitialWeight() {
- return 50;
- }
-
- /**
- * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
- */
- public String getText (Object element) {
- if (element instanceof Link) {
- Link link = (Link) element;
- return link.getLocation();
- }
- return "";
- }
-
- /**
- * @see org.eclipse.bpmn2.modeler.core.merrimac.providers.ui.details.providers.ColumnTableProvider.Column#createCellEditor(org.eclipse.swt.widgets.Composite)
- */
- @Override
- public CellEditor createCellEditor (Composite parent) {
- return new TextCellEditor(parent, SWT.NO_BACKGROUND );
- }
-
- /**
- * @see org.eclipse.jface.viewers.ICellModifier#canModify(java.lang.Object, java.lang.String)
- */
- public boolean canModify(Object element, String property) {
- return true;
- }
-
- /**
- * @see org.eclipse.jface.viewers.ICellModifier#getValue(java.lang.Object, java.lang.String)
- */
- public Object getValue(Object element, String property) {
- return getText(element);
- }
-
- /**
- * @see org.eclipse.jface.viewers.ICellModifier#modify(java.lang.Object, java.lang.String, java.lang.Object)
- */
- public void modify (Object element, String property, Object value) {
-
- if (element instanceof Link) {
- Link link = (Link) element;
-
- //noop, do not needlessly modify
- if (value.equals(link.getLocation())) {
- return ;
- }
-
- org.eclipse.emf.common.util.URI linkURI = null;
- try {
-
- linkURI = org.eclipse.emf.common.util.URI.createURI( (String) value );
- if (linkURI.isRelative()) {
- // path is relative to me ...
- URI parentURI = link.eResource().getURI();
- linkURI = linkURI.resolve(parentURI);
- }
-
- // so far, so good !
- // VZ: so why not use linkURI? To be reviewed later!
- link.setLocation( (String) value);
-
- // all goes well
- setMessage(null);
-
- } catch (java.lang.IllegalArgumentException ex) {
-
- setMessage(ex.getLocalizedMessage(), ERROR);
-
- }
-
-
- }
- }
-
- }
-
- /**
- * @author Michal Chmielewski (michal.chmielewski@oracle.com)
- * @date May 4, 2007
- */
- public class NamespaceColumn extends ColumnTableProvider.Column implements
- ILabelProvider {
-
- /**
- * @see org.eclipse.bpmn2.modeler.core.merrimac.providers.ui.details.providers.ColumnTableProvider.Column#getHeaderText()
- */
-
- @Override
- public String getHeaderText() {
- return Messages.WSILPreferencePage_WSIL_Namespace;
- }
-
-
- /**
- * @see org.eclipse.bpmn2.modeler.core.merrimac.providers.ui.details.providers.ColumnTableProvider.Column#getProperty()
- */
- @Override
- public String getProperty() {
- return "namespace"; //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.bpmn2.modeler.core.merrimac.providers.ui.details.providers.ColumnTableProvider.Column#getInitialWeight()
- */
- @Override
- public int getInitialWeight() {
- return 30;
- }
-
- /**
- * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
- */
- public String getText (Object element) {
-
- if (element instanceof Link) {
- Link link = (Link) element;
- // TODO: do we need to support namespace templates in modelEnablement?
-// return NamespaceUtils.convertUriToNamespace( link.getReferencedNamespace() );
- return link.getReferencedNamespace();
- }
- return "";
- }
-
- }
-
-
- /**
- * @author Michal Chmielewski (michal.chmielewski@oracle.com)
- * @date May 4, 2007
- */
- public class IndexColumn extends ColumnTableProvider.Column implements
- ILabelProvider {
-
- /**
- * @see org.eclipse.bpmn2.modeler.core.merrimac.providers.ui.details.providers.ColumnTableProvider.Column#getHeaderText()
- */
-
- @Override
- public String getHeaderText() {
- return Messages.WSILPreferencePage_WSIL_Index;
- }
-
-
- /**
- * @see org.eclipse.bpmn2.modeler.core.merrimac.providers.ui.details.providers.ColumnTableProvider.Column#getProperty()
- */
- @Override
- public String getProperty() {
- return "index"; //$NON-NLS-1$
- }
-
- /**
- * @see org.eclipse.bpmn2.modeler.core.merrimac.providers.ui.details.providers.ColumnTableProvider.Column#getInitialWeight()
- */
- @Override
- public int getInitialWeight() {
- return 5;
- }
-
- /**
- * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
- */
- public String getText (Object element) {
-
- if (element instanceof Link) {
- Link link = (Link) element;
- Inspection insp = (Inspection) link.eContainer();
- return Integer.toString( insp.getLinks().indexOf(link) + 1 );
- }
-
- return "";
- }
- }
-
-
-}
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpmn2.modeler.ui.preferences;
+
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.List;
+
+import org.eclipse.bpel.wsil.model.inspection.Inspection;
+import org.eclipse.bpel.wsil.model.inspection.InspectionFactory;
+import org.eclipse.bpel.wsil.model.inspection.InspectionPackage;
+import org.eclipse.bpel.wsil.model.inspection.Link;
+import org.eclipse.bpel.wsil.model.inspection.TypeOfAbstract;
+import org.eclipse.bpel.wsil.model.inspection.WSILDocument;
+import org.eclipse.bpmn2.modeler.core.merrimac.providers.ColumnTableProvider;
+import org.eclipse.bpmn2.modeler.core.merrimac.providers.TableCursor;
+import org.eclipse.bpmn2.modeler.core.model.Bpmn2ModelerResourceSetImpl;
+import org.eclipse.bpmn2.modeler.core.preferences.Bpmn2Preferences;
+import org.eclipse.bpmn2.modeler.ui.Activator;
+import org.eclipse.bpmn2.modeler.ui.Messages;
+import org.eclipse.bpmn2.modeler.ui.property.providers.WSILContentProvider;
+import org.eclipse.emf.common.notify.Notification;
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.util.EContentAdapter;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.viewers.CellEditor;
+import org.eclipse.jface.viewers.ICellModifier;
+import org.eclipse.jface.viewers.ILabelProvider;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TableViewer;
+import org.eclipse.jface.viewers.TextCellEditor;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
+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.FileDialog;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Table;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPreferencePage;
+
+
+/**
+ *
+ * @author Michal Chmielewski (michal.chmielewski@oracle.com)
+ * @date May 2, 2007
+ *
+ */
+
+
+@SuppressWarnings({"nls","boxing","unchecked"})
+
+public class WSILPreferencePage extends PreferencePage implements IWorkbenchPreferencePage {
+
+ Bpmn2ModelerResourceSetImpl resourceSet = new Bpmn2ModelerResourceSetImpl();
+
+ Text wsilURL;
+
+ Table linkTable;
+ ColumnTableProvider tableProvider;
+
+ TableViewer linkTableViewer;
+
+ TableCursor tableCursor;
+
+ Link fLinkSelection;
+
+ WSILDocument fWsilDocument;
+
+ Button addButton;
+ Button removeButton;
+ Button moveUpButton;
+ Button moveDownButton;
+ Button openInBrowserButton;
+
+ private static String WSIL = "wsil";
+
+ // Track the modification of any parameter in the WSIL model.
+ // we don't use commands and stacks here.
+ EContentAdapter fContentAdapter = new EContentAdapter() {
+
+ /**
+ * @see org.eclipse.emf.ecore.util.EContentAdapter#notifyChanged(org.eclipse.emf.common.notify.Notification)
+ */
+
+ @Override
+ public void notifyChanged(Notification arg0) {
+
+ super.notifyChanged(arg0);
+ int eventId = arg0.getEventType();
+ if (eventId == Notification.ADD || eventId == Notification.SET ||
+ eventId == Notification.MOVE || eventId == Notification.REMOVE ) {
+
+ linkTableViewer.refresh();
+ updateButtons();
+ }
+ }
+ };
+
+
+
+ @Override
+ protected Control createContents (Composite parent) {
+
+ Composite result = new Composite(parent, SWT.NONE);
+
+ GridLayout layout = new GridLayout( );
+ layout.numColumns = 3;
+ layout.verticalSpacing = 15;
+ layout.makeColumnsEqualWidth = false;
+
+ result.setLayout(layout);
+ GridData data = new GridData(GridData.FILL_BOTH);
+ // result.setLayoutData(data);
+
+ // WSIL directory
+ Label wsilLabel = new Label(result, SWT.NONE);
+ wsilLabel.setText(Messages.WSILPreferencePage_WSIL_1);
+ wsilLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
+
+ wsilURL = new Text(result, SWT.BORDER);
+ wsilURL.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ wsilURL.addFocusListener( new FocusListener () {
+
+
+ public void focusGained(FocusEvent e) {
+ wsilURL.setData("lastValue",wsilURL.getText());
+ }
+
+ public void focusLost(FocusEvent e) {
+ String url = wsilURL.getText();
+
+ // no change.
+ if (url.equals(wsilURL.getData("lastValue"))) {
+ return ;
+ }
+ attemptLoad( url );
+ }
+
+ });
+
+ Button browse = new Button(result, SWT.NONE);
+ browse.setText(Messages.WSILPreferencePage_WSIL_2);
+ data = new GridData(SWT.RIGHT);
+ data.widthHint = 100;
+
+ browse.setLayoutData(data);
+ browse.addSelectionListener(new SelectionAdapter() {
+
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ FileDialog fd = new FileDialog(getShell(), SWT.OPEN);
+ fd.setFilterExtensions(new String[]{"*."+WSIL});
+ String fileName = fd.open();
+ if ((fileName != null) && (fileName.length() > 0)) {
+ // parse to file url
+ File file = new File(fileName);
+ String uri = file.toURI().toString();
+ wsilURL.setText( uri );
+ attemptLoad(uri);
+
+ }
+ }
+ }
+ );
+
+
+ // 2nd row of the 3 cell grid
+
+ Label txt = new Label ( result, SWT.NO_BACKGROUND | SWT.WRAP );
+
+ txt.setText( Messages.WSILPreferencePage_WSIL_Description );
+ data = new GridData( GridData.GRAB_HORIZONTAL );
+ data.horizontalSpan = 3;
+ txt.setLayoutData(data);
+
+ //
+ //
+
+ // create table
+ linkTable = new Table(result, SWT.FULL_SELECTION | SWT.V_SCROLL | SWT.BORDER );
+
+ data = new GridData(GridData.FILL_BOTH);
+ data.horizontalSpan = 2;
+
+ linkTable.setLayoutData(data);
+
+ // set up table
+ linkTable.setLinesVisible(true);
+ linkTable.setHeaderVisible(true);
+
+ tableProvider = new ColumnTableProvider();
+ tableProvider.add(new IndexColumn());
+ tableProvider.add(new AbstractColumn());
+ tableProvider.add(new LocationColumn());
+ // columnProvider.add(new NamespaceColumn());
+
+ linkTableViewer = new TableViewer(linkTable);
+ tableProvider.createTableLayout(linkTable);
+ linkTableViewer.setLabelProvider(tableProvider);
+ linkTableViewer.setCellModifier(tableProvider);
+
+ WSILContentProvider wsilContentProvider = new WSILContentProvider();
+ wsilContentProvider.setMode( WSILContentProvider.FLATTEN );
+
+ linkTableViewer.setContentProvider( wsilContentProvider );
+
+ linkTableViewer.addFilter(new ViewerFilter() {
+ @Override
+ public boolean select(Viewer viewer, Object parentElement, Object element) {
+ return element instanceof Link;
+ }
+ });
+
+ linkTableViewer.setColumnProperties(tableProvider.getColumnProperties());
+ linkTableViewer.setCellEditors(tableProvider.createCellEditors(linkTable));
+
+
+ tableCursor = TableCursor.create(linkTable, linkTableViewer);
+
+ ///
+
+
+ layout = new GridLayout();
+ layout.numColumns = 1;
+ layout.verticalSpacing = 5;
+
+ Composite buttonList = new Composite ( result , SWT.NONE );
+ buttonList.setLayout(layout);
+
+ data = new GridData( GridData.VERTICAL_ALIGN_BEGINNING | GridData.HORIZONTAL_ALIGN_CENTER );
+ buttonList.setLayoutData( data );
+
+ addButton = new Button(buttonList, SWT.NONE);
+ addButton.setText(Messages.WSILPreferencePage_WSIL_Add);
+ data = new GridData( GridData.FILL_HORIZONTAL );
+
+ addButton.setLayoutData(data);
+ addButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+
+ Link link = InspectionFactory.eINSTANCE.createLink();
+
+ link.setLocation(Messages.WSILPreferencePage_WSIL_EnterLocation);
+ link.setReferencedNamespace( InspectionPackage.eNS_URI );
+
+ TypeOfAbstract toa = InspectionFactory.eINSTANCE.createTypeOfAbstract();
+ toa.setValue(Messages.WSILPreferencePage_WSIL_EnterDescription);
+ link.getAbstract().add( toa );
+
+ // modify the document
+ EList links = fWsilDocument.getInspection().getLinks();
+ links.add ( link );
+
+ // notifications of modifications are sent back to us via the EContentAdapter
+ // on the WSIL Document resource.
+ }
+ });
+
+
+ removeButton = new Button(buttonList, SWT.NONE);
+ removeButton.setText(Messages.WSILPreferencePage_WSIL_Remove);
+ data = new GridData( GridData.FILL_HORIZONTAL );
+
+ removeButton.setLayoutData(data);
+
+ removeButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (fLinkSelection == null) {
+ return ;
+ }
+ // modify the document
+ EList links = fWsilDocument.getInspection().getLinks();
+ links.remove(fLinkSelection);
+ }
+ });
+
+
+
+ moveUpButton = new Button(buttonList, SWT.NONE);
+ moveUpButton.setText(Messages.WSILPreferencePage_WSIL_MoveUp);
+ data = new GridData( GridData.FILL_HORIZONTAL );
+
+ moveUpButton.setLayoutData(data);
+
+ moveUpButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (fLinkSelection == null) {
+ return ;
+ }
+ // modify the document
+ EList links = fWsilDocument.getInspection().getLinks();
+ int idx = links.indexOf(fLinkSelection);
+ if (idx < 0) {
+ return ;
+ }
+ links.move(idx,idx-1);
+ }
+ });
+
+
+ moveDownButton = new Button(buttonList, SWT.NONE);
+ moveDownButton.setText(Messages.WSILPreferencePage_WSIL_MoveDown);
+ data = new GridData( GridData.FILL_HORIZONTAL );
+
+ moveDownButton.setLayoutData(data);
+
+ moveDownButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (fLinkSelection == null) {
+ return ;
+ }
+ // modify the document
+ EList links = fWsilDocument.getInspection().getLinks();
+ int idx = links.indexOf(fLinkSelection);
+ if (idx < 0) {
+ return ;
+ }
+ links.move(idx, idx+1);
+ }
+ });
+
+ openInBrowserButton = new Button(buttonList, SWT.NONE);
+ openInBrowserButton.setText(Messages.WSILPreferencePage_WSIL_OpenInBrowser);
+ data = new GridData( GridData.FILL_HORIZONTAL );
+
+ openInBrowserButton.setLayoutData(data);
+
+ openInBrowserButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (fLinkSelection == null) {
+ return ;
+ }
+
+ // TODO:
+ }
+ });
+
+
+
+ linkTableViewer.addPostSelectionChangedListener( new ISelectionChangedListener () {
+
+
+ public void selectionChanged (SelectionChangedEvent event) {
+ ISelection selection = event.getSelection();
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection ss = (IStructuredSelection) selection;
+ Object obj = ss.getFirstElement();
+ fLinkSelection = obj instanceof Link ? (Link) obj : null;
+ }
+ updateButtons();
+ }
+
+ });
+
+ updateButtons();
+
+ initializeValues();
+
+// PlatformUI.getWorkbench().getHelpSystem().setHelp(
+// parent, IHelpContextIds.PREFERENCES_PAGE);
+
+ return result;
+ }
+
+
+ /**
+ * @see org.eclipse.ui.IWorkbenchPreferencePage#init(org.eclipse.ui.IWorkbench)
+ */
+ public void init(IWorkbench workbench) {
+
+ }
+
+ @Override
+ protected void performDefaults() {
+ super.performDefaults();
+ initializeDefaults();
+ }
+
+ /**
+ * @see org.eclipse.jface.preference.PreferencePage#performOk()
+ */
+ @Override
+ public boolean performOk() {
+ storeValues();
+ return true;
+ }
+
+ @Override
+ protected void performApply() {
+ performOk();
+ }
+
+ /**
+ * Initializes states of the controls using default values in the preference store.
+ */
+ private void initializeDefaults() {
+
+ }
+
+ /**
+ * Initializes states of the controls from the preference store.
+ */
+ private void initializeValues() {
+ IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+
+ wsilURL.setText(store.getString(Bpmn2Preferences.PREF_WSIL_URL));
+
+ attemptLoad (wsilURL.getText() );
+ }
+
+
+
+ /**
+ * Stores the values of the controls back to the preference store.
+ */
+ private void storeValues() {
+ IPreferenceStore store = Activator.getDefault().getPreferenceStore();
+
+ store.setValue(Bpmn2Preferences.PREF_WSIL_URL, wsilURL.getText());
+
+ if (fWsilDocument != null) {
+
+ Resource resource = fWsilDocument.eResource();
+
+ try {
+ resource.save(null);
+ } catch (IOException e) {
+ Activator.logError(e);
+ }
+ }
+ }
+
+
+ void updateButtons ( ) {
+
+ List linkList = (fWsilDocument == null ? Collections.EMPTY_LIST : fWsilDocument.getInspection().getLinks());
+
+ int idx = linkList.indexOf(fLinkSelection);
+ // -1 if not found ...
+ moveUpButton.setEnabled(idx > 0);
+ moveDownButton.setEnabled(idx >= 0 && idx < linkList.size() - 1);
+ removeButton.setEnabled( fLinkSelection != null );
+ openInBrowserButton.setEnabled( fLinkSelection != null );
+ addButton.setEnabled( fWsilDocument != null );
+ }
+
+
+
+ /**
+ * @see org.eclipse.jface.dialogs.DialogPage#dispose()
+ */
+ @Override
+ public void dispose() {
+
+ Iterator it = resourceSet.getResources().iterator();
+ while (it.hasNext()) {
+ Resource r = (Resource) it.next();
+ r.eAdapters().clear();
+ }
+ // TODO Auto-generated method stub
+ super.dispose();
+ }
+
+
+ void attemptLoad ( String url ) {
+
+ url = url.trim();
+
+ if (url.length() < 1) {
+ return ;
+ }
+ if(!url.endsWith(WSIL)){
+ setMessage(Messages.WSILPreferencePage_WSIL_NameLimit, ERROR);
+ return;
+ }
+
+ if (fWsilDocument != null) {
+ fWsilDocument.eResource().eAdapters().remove( fContentAdapter );
+ fWsilDocument = null;
+ }
+
+ org.eclipse.emf.common.util.URI uri = org.eclipse.emf.common.util.URI.createURI(url);
+
+ Resource resource = null;
+ try {
+
+ resource = resourceSet.getResource(uri, true, WSIL);
+
+ List contents = resource.getContents();
+
+ if (contents.size() > 0) {
+ if (contents.get(0) instanceof WSILDocument ) {
+ fWsilDocument = (WSILDocument ) contents.get(0);
+ }
+ }
+ setMessage(null);
+
+ } catch (Exception e) {
+ setMessage(Messages.WSILPreferencePage_WSIL_DocumentNotLoaded, ERROR);
+ Activator.logError(e);
+ }
+
+ linkTableViewer.setInput( fWsilDocument );
+
+ // Track the modification of any parameter in the WSIL model.
+ // we don't use commands and stacks here.
+ if (fWsilDocument != null) {
+ fWsilDocument.eResource().eAdapters().add( fContentAdapter );
+ }
+ updateButtons();
+ }
+
+
+
+ /**
+ * @author Michal Chmielewski (michal.chmielewski@oracle.com)
+ * @date May 4, 2007
+ *
+ */
+ public class AbstractColumn extends ColumnTableProvider.Column implements
+ ILabelProvider, ICellModifier {
+
+ /**
+ * @see org.eclipse.bpmn2.modeler.core.merrimac.providers.ui.details.providers.ColumnTableProvider.Column#getHeaderText()
+ */
+ @Override
+ public String getHeaderText() {
+ return Messages.WSILPreferencePage_WSIL_Abstract;
+ }
+
+ /**
+ * @see org.eclipse.bpmn2.modeler.core.merrimac.providers.ui.details.providers.ColumnTableProvider.Column#getProperty()
+ */
+ @Override
+ public String getProperty() {
+ return "abstract"; //$NON-NLS-1$
+ }
+
+ /**
+ * @see org.eclipse.bpmn2.modeler.core.merrimac.providers.ui.details.providers.ColumnTableProvider.Column#getInitialWeight()
+ */
+ @Override
+ public int getInitialWeight() {
+ return 50;
+ }
+
+
+ /**
+ * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
+ */
+ public String getText (Object element) {
+ if (element instanceof Link) {
+ Link link = (Link) element;
+ List abs = link.getAbstract();
+ // TODO: Do this based on language ?
+ if (abs.size() > 0) {
+ TypeOfAbstract absType = (TypeOfAbstract) abs.get(0);
+ return absType.getValue();
+ }
+ }
+ return "";
+ }
+
+ /**
+ * @see org.eclipse.bpmn2.modeler.core.merrimac.providers.ui.details.providers.ColumnTableProvider.Column#createCellEditor(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public CellEditor createCellEditor (Composite parent) {
+ return new TextCellEditor(parent, SWT.NO_BACKGROUND );
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.ICellModifier#canModify(java.lang.Object, java.lang.String)
+ */
+ public boolean canModify(Object element, String property) {
+ return true;
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.ICellModifier#getValue(java.lang.Object, java.lang.String)
+ */
+ public Object getValue(Object element, String property) {
+ return getText(element);
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.ICellModifier#modify(java.lang.Object, java.lang.String, java.lang.Object)
+ */
+ public void modify(Object element, String property, Object value) {
+ if (element instanceof Link) {
+ Link link = (Link) element;
+ List abs = link.getAbstract();
+ // TODO: Do this based on language ?
+ if (abs.size() > 0) {
+ TypeOfAbstract absType = (TypeOfAbstract) abs.get(0);
+
+ // noop, do not needlessly modify
+ if (value.equals(absType.getValue())) {
+ return ;
+ }
+
+ absType.setValue( (String) value);
+ }
+ }
+ }
+ }
+
+
+
+ /**
+ * @author Michal Chmielewski (michal.chmielewski@oracle.com)
+ * @date May 4, 2007
+ *
+ */
+ public class LocationColumn extends ColumnTableProvider.Column
+ implements ILabelProvider, ICellModifier {
+
+ /**
+ * @see org.eclipse.bpmn2.modeler.core.merrimac.providers.ui.details.providers.ColumnTableProvider.Column#getHeaderText()
+ */
+ @Override
+ public String getHeaderText() {
+ return Messages.WSILPreferencePage_WSIL_Location;
+ }
+
+ /**
+ * @see org.eclipse.bpmn2.modeler.core.merrimac.providers.ui.details.providers.ColumnTableProvider.Column#getProperty()
+ */
+ @Override
+ public String getProperty() {
+ return "location"; //$NON-NLS-1$
+ }
+
+
+ /** (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.merrimac.providers.ui.details.providers.ColumnTableProvider.Column#getInitialWeight()
+ */
+ @Override
+ public int getInitialWeight() {
+ return 50;
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
+ */
+ public String getText (Object element) {
+ if (element instanceof Link) {
+ Link link = (Link) element;
+ return link.getLocation();
+ }
+ return "";
+ }
+
+ /**
+ * @see org.eclipse.bpmn2.modeler.core.merrimac.providers.ui.details.providers.ColumnTableProvider.Column#createCellEditor(org.eclipse.swt.widgets.Composite)
+ */
+ @Override
+ public CellEditor createCellEditor (Composite parent) {
+ return new TextCellEditor(parent, SWT.NO_BACKGROUND );
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.ICellModifier#canModify(java.lang.Object, java.lang.String)
+ */
+ public boolean canModify(Object element, String property) {
+ return true;
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.ICellModifier#getValue(java.lang.Object, java.lang.String)
+ */
+ public Object getValue(Object element, String property) {
+ return getText(element);
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.ICellModifier#modify(java.lang.Object, java.lang.String, java.lang.Object)
+ */
+ public void modify (Object element, String property, Object value) {
+
+ if (element instanceof Link) {
+ Link link = (Link) element;
+
+ //noop, do not needlessly modify
+ if (value.equals(link.getLocation())) {
+ return ;
+ }
+
+ org.eclipse.emf.common.util.URI linkURI = null;
+ try {
+
+ linkURI = org.eclipse.emf.common.util.URI.createURI( (String) value );
+ if (linkURI.isRelative()) {
+ // path is relative to me ...
+ URI parentURI = link.eResource().getURI();
+ linkURI = linkURI.resolve(parentURI);
+ }
+
+ // so far, so good !
+ // VZ: so why not use linkURI? To businessObject reviewed later!
+ link.setLocation( (String) value);
+
+ // all goes well
+ setMessage(null);
+
+ } catch (java.lang.IllegalArgumentException ex) {
+
+ setMessage(ex.getLocalizedMessage(), ERROR);
+
+ }
+
+
+ }
+ }
+
+ }
+
+ /**
+ * @author Michal Chmielewski (michal.chmielewski@oracle.com)
+ * @date May 4, 2007
+ */
+ public class NamespaceColumn extends ColumnTableProvider.Column implements
+ ILabelProvider {
+
+ /**
+ * @see org.eclipse.bpmn2.modeler.core.merrimac.providers.ui.details.providers.ColumnTableProvider.Column#getHeaderText()
+ */
+
+ @Override
+ public String getHeaderText() {
+ return Messages.WSILPreferencePage_WSIL_Namespace;
+ }
+
+
+ /**
+ * @see org.eclipse.bpmn2.modeler.core.merrimac.providers.ui.details.providers.ColumnTableProvider.Column#getProperty()
+ */
+ @Override
+ public String getProperty() {
+ return "namespace"; //$NON-NLS-1$
+ }
+
+ /**
+ * @see org.eclipse.bpmn2.modeler.core.merrimac.providers.ui.details.providers.ColumnTableProvider.Column#getInitialWeight()
+ */
+ @Override
+ public int getInitialWeight() {
+ return 30;
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
+ */
+ public String getText (Object element) {
+
+ if (element instanceof Link) {
+ Link link = (Link) element;
+ // TODO: do we need to support namespace templates in modelEnablement?
+// return NamespaceUtils.convertUriToNamespace( link.getReferencedNamespace() );
+ return link.getReferencedNamespace();
+ }
+ return "";
+ }
+
+ }
+
+
+ /**
+ * @author Michal Chmielewski (michal.chmielewski@oracle.com)
+ * @date May 4, 2007
+ */
+ public class IndexColumn extends ColumnTableProvider.Column implements
+ ILabelProvider {
+
+ /**
+ * @see org.eclipse.bpmn2.modeler.core.merrimac.providers.ui.details.providers.ColumnTableProvider.Column#getHeaderText()
+ */
+
+ @Override
+ public String getHeaderText() {
+ return Messages.WSILPreferencePage_WSIL_Index;
+ }
+
+
+ /**
+ * @see org.eclipse.bpmn2.modeler.core.merrimac.providers.ui.details.providers.ColumnTableProvider.Column#getProperty()
+ */
+ @Override
+ public String getProperty() {
+ return "index"; //$NON-NLS-1$
+ }
+
+ /**
+ * @see org.eclipse.bpmn2.modeler.core.merrimac.providers.ui.details.providers.ColumnTableProvider.Column#getInitialWeight()
+ */
+ @Override
+ public int getInitialWeight() {
+ return 5;
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.ILabelProvider#getText(java.lang.Object)
+ */
+ public String getText (Object element) {
+
+ if (element instanceof Link) {
+ Link link = (Link) element;
+ Inspection insp = (Inspection) link.eContainer();
+ return Integer.toString( insp.getLinks().indexOf(link) + 1 );
+ }
+
+ return "";
+ }
+ }
+
+
+}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/artifact/CategoryDetailComposite.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/artifact/CategoryDetailComposite.java
index 54ba13b..72747e9 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/artifact/CategoryDetailComposite.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/artifact/CategoryDetailComposite.java
@@ -15,11 +15,11 @@
package org.eclipse.bpmn2.modeler.ui.property.artifact;
import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.ui.property.tasks.ActivityDetailComposite;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.DefaultDetailComposite;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.swt.widgets.Composite;
-public class CategoryDetailComposite extends ActivityDetailComposite {
+public class CategoryDetailComposite extends DefaultDetailComposite {
public CategoryDetailComposite(Composite parent, int style) {
super(parent, style);
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/artifact/GroupDetailComposite.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/artifact/GroupDetailComposite.java
deleted file mode 100644
index 95467fd..0000000
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/artifact/GroupDetailComposite.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Bob Brodt
- ******************************************************************************/
-
-
-package org.eclipse.bpmn2.modeler.ui.property.artifact;
-
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.ui.property.tasks.ActivityDetailComposite;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.swt.widgets.Composite;
-
-public class GroupDetailComposite extends ActivityDetailComposite {
-
- public GroupDetailComposite(Composite parent, int style) {
- super(parent, style);
- }
-
- /**
- * @param section
- */
- public GroupDetailComposite(AbstractBpmn2PropertySection section) {
- super(section);
- }
-
- @Override
- public AbstractPropertiesProvider getPropertiesProvider(EObject object) {
- if (propertiesProvider==null) {
- propertiesProvider = new AbstractPropertiesProvider(object) {
- String[] properties = new String[] {
- "anyAttribute",
- "categoryValueRef",
- };
-
- @Override
- public String[] getProperties() {
- return properties;
- }
- };
- }
- return propertiesProvider;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/artifact/GroupPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/artifact/GroupPropertySection.java
deleted file mode 100644
index 57b5498..0000000
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/artifact/GroupPropertySection.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Bob Brodt
- ******************************************************************************/
-
-package org.eclipse.bpmn2.modeler.ui.property.artifact;
-
-import org.eclipse.bpmn2.Bpmn2Package;
-import org.eclipse.bpmn2.Group;
-import org.eclipse.bpmn2.modeler.core.adapters.AdapterUtil;
-import org.eclipse.bpmn2.modeler.core.adapters.ExtendedPropertiesAdapter;
-import org.eclipse.bpmn2.modeler.core.adapters.FeatureDescriptor;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
-
-/**
- * @author Bob Brodt
- *
- */
-public class GroupPropertySection extends AbstractBpmn2PropertySection implements ITabbedPropertyConstants {
- static {
- PropertiesCompositeFactory.register(Group.class, GroupDetailComposite.class);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
- */
- @Override
- protected AbstractDetailComposite createSectionRoot() {
- return new GroupDetailComposite(this);
- }
-
- @Override
- public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
- return new GroupDetailComposite(parent,style);
- }
-
- @Override
- protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
- EObject be = super.getBusinessObjectForPictogramElement(pe);
- if (be instanceof Group) {
- ExtendedPropertiesAdapter adapter = (ExtendedPropertiesAdapter) AdapterUtil.adapt(
- (Group)be, ExtendedPropertiesAdapter.class);
- EStructuralFeature ref = Bpmn2Package.eINSTANCE.getGroup_CategoryValueRef();
- adapter.setProperty(ref, ExtendedPropertiesAdapter.UI_CAN_EDIT, Boolean.TRUE);
- adapter.setProperty(ref, ExtendedPropertiesAdapter.UI_CAN_CREATE_NEW, Boolean.TRUE);
- adapter.setProperty(ref, ExtendedPropertiesAdapter.UI_CAN_SET_NULL, Boolean.TRUE);
-
- return be;
- }
- return null;
- }
-}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/artifact/TextAnnotationPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/artifact/TextAnnotationPropertySection.java
index 8ae1ff1..feaee51 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/artifact/TextAnnotationPropertySection.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/artifact/TextAnnotationPropertySection.java
@@ -15,9 +15,6 @@
*
*/
public class TextAnnotationPropertySection extends AbstractBpmn2PropertySection implements ITabbedPropertyConstants{
- static {
- PropertiesCompositeFactory.register(TextAnnotation.class, TextAnnotationDetailComposite.class);
- }
@Override
protected AbstractDetailComposite createSectionRoot() {
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/AssocationDetailComposite.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/AssocationDetailComposite.java
deleted file mode 100644
index 416cbac..0000000
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/AssocationDetailComposite.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Innar Made
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.property.connectors;
-
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.DefaultDetailComposite;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.swt.widgets.Composite;
-
-public class AssocationDetailComposite extends DefaultDetailComposite {
-
- public AssocationDetailComposite(Composite parent, int style) {
- super(parent, style);
- }
-
- /**
- * @param section
- */
- public AssocationDetailComposite(AbstractBpmn2PropertySection section) {
- super(section);
- }
-
- @Override
- public AbstractPropertiesProvider getPropertiesProvider(EObject object) {
- if (propertiesProvider==null) {
- propertiesProvider = new AbstractPropertiesProvider(object) {
- String[] properties = new String[] {
- "associationDirection"
- };
-
- @Override
- public String[] getProperties() {
- return properties;
- }
- };
- }
- return propertiesProvider;
- }
-}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/AssociationPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/AssociationPropertySection.java
deleted file mode 100644
index 3d4a807..0000000
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/AssociationPropertySection.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Innar Made
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.property.connectors;
-
-import org.eclipse.bpmn2.Association;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.swt.widgets.Composite;
-
-public class AssociationPropertySection extends AbstractBpmn2PropertySection {
- static {
- PropertiesCompositeFactory.register(Association.class, AssocationDetailComposite.class);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
- */
- @Override
- protected AbstractDetailComposite createSectionRoot() {
- return new AssocationDetailComposite(this);
- }
-
- @Override
- public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
- return new AssocationDetailComposite(parent,style);
- }
-
- @Override
- protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
- EObject be = super.getBusinessObjectForPictogramElement(pe);
- if (be instanceof Association)
- return be;
- return null;
- }
-}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/ConversationDetailComposite.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/ConversationDetailComposite.java
deleted file mode 100644
index 7f7ec9f..0000000
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/ConversationDetailComposite.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Innar Made
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.property.connectors;
-
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.DefaultDetailComposite;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.swt.widgets.Composite;
-
-public class ConversationDetailComposite extends DefaultDetailComposite {
-
- private AbstractPropertiesProvider propertiesProvider;
-
- public ConversationDetailComposite(Composite parent, int style) {
- super(parent, style);
- }
-
- /**
- * @param section
- */
- public ConversationDetailComposite(AbstractBpmn2PropertySection section) {
- super(section);
- }
-
- @Override
- public AbstractPropertiesProvider getPropertiesProvider(EObject object) {
- if (propertiesProvider==null) {
- propertiesProvider = new AbstractPropertiesProvider(object) {
- String[] properties = new String[] {
- "correlationKeys"
- };
-
- @Override
- public String[] getProperties() {
- return properties;
- }
- };
- }
- return propertiesProvider;
- }
-}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/ConversationLinkDetailComposite.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/ConversationLinkDetailComposite.java
deleted file mode 100644
index a75e0b3..0000000
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/ConversationLinkDetailComposite.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Innar Made
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.property.connectors;
-
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.DefaultDetailComposite;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.swt.widgets.Composite;
-
-public class ConversationLinkDetailComposite extends DefaultDetailComposite {
-
- // NOTE: This has no additional attributes or other features
-
- public ConversationLinkDetailComposite(Composite parent, int style) {
- super(parent, style);
- }
-
- /**
- * @param section
- */
- public ConversationLinkDetailComposite(AbstractBpmn2PropertySection section) {
- super(section);
- }
-
- @Override
- public void createBindings(EObject be) {
- getToolkit().createLabel(this, "Nothing to see here...move along!");
- }
-}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/ConversationLinkPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/ConversationLinkPropertySection.java
deleted file mode 100644
index f44444f..0000000
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/ConversationLinkPropertySection.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Innar Made
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.property.connectors;
-
-import org.eclipse.bpmn2.ConversationLink;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
-
-public class ConversationLinkPropertySection extends AbstractBpmn2PropertySection implements ITabbedPropertyConstants {
- static {
- PropertiesCompositeFactory.register(ConversationLink.class, ConversationLinkDetailComposite.class);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
- */
- @Override
- protected AbstractDetailComposite createSectionRoot() {
- return new ConversationLinkDetailComposite(this);
- }
-
- @Override
- public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
- return new ConversationLinkDetailComposite(parent,style);
- }
-
- @Override
- protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
- EObject be = super.getBusinessObjectForPictogramElement(pe);
- if (be instanceof ConversationLink)
- return be;
- return null;
- }
-}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/ConversationPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/ConversationPropertySection.java
deleted file mode 100644
index 98f7060..0000000
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/ConversationPropertySection.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Innar Made
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.property.connectors;
-
-import org.eclipse.bpmn2.Conversation;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
-
-public class ConversationPropertySection extends AbstractBpmn2PropertySection implements ITabbedPropertyConstants {
- static {
- PropertiesCompositeFactory.register(Conversation.class, ConversationDetailComposite.class);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
- */
- @Override
- protected AbstractDetailComposite createSectionRoot() {
- return new ConversationDetailComposite(this);
- }
-
- @Override
- public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
- return new ConversationDetailComposite(parent,style);
- }
-
- @Override
- protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
- EObject be = super.getBusinessObjectForPictogramElement(pe);
- if (be instanceof Conversation)
- return be;
- return null;
- }
-}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/MessageFlowDetailComposite.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/MessageFlowDetailComposite.java
index fcc6909..04b44af 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/MessageFlowDetailComposite.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/MessageFlowDetailComposite.java
@@ -1,53 +1,52 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Innar Made
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.property.connectors;
-
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.DefaultDetailComposite;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.swt.widgets.Composite;
-
-public class MessageFlowDetailComposite extends DefaultDetailComposite {
-
- private AbstractPropertiesProvider propertiesProvider;
-
- public MessageFlowDetailComposite(Composite parent, int style) {
- super(parent, style);
- }
-
- /**
- * @param section
- */
- public MessageFlowDetailComposite(AbstractBpmn2PropertySection section) {
- super(section);
- }
-
- @Override
- public AbstractPropertiesProvider getPropertiesProvider(EObject object) {
- if (propertiesProvider==null) {
- propertiesProvider = new AbstractPropertiesProvider(object) {
- String[] properties = new String[] {
- "messageRef",
- "sourceRef",
- "targetRef"
- };
-
- @Override
- public String[] getProperties() {
- return properties;
- }
- };
- }
- return propertiesProvider;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Innar Made
+ ******************************************************************************/
+package org.eclipse.bpmn2.modeler.ui.property.connectors;
+
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.DefaultDetailComposite;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.swt.widgets.Composite;
+
+public class MessageFlowDetailComposite extends DefaultDetailComposite {
+
+ private AbstractPropertiesProvider propertiesProvider;
+
+ public MessageFlowDetailComposite(Composite parent, int style) {
+ super(parent, style);
+ }
+
+ /**
+ * @param section
+ */
+ public MessageFlowDetailComposite(AbstractBpmn2PropertySection section) {
+ super(section);
+ }
+
+ @Override
+ public AbstractPropertiesProvider getPropertiesProvider(EObject object) {
+ if (propertiesProvider==null) {
+ propertiesProvider = new AbstractPropertiesProvider(object) {
+ String[] properties = new String[] {
+ "name",
+ "messageRef",
+ };
+
+ @Override
+ public String[] getProperties() {
+ return properties;
+ }
+ };
+ }
+ return propertiesProvider;
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/MessageFlowPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/MessageFlowPropertySection.java
deleted file mode 100644
index b74f9dc..0000000
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/MessageFlowPropertySection.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Innar Made
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.property.connectors;
-
-import org.eclipse.bpmn2.MessageFlow;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
-
-public class MessageFlowPropertySection extends AbstractBpmn2PropertySection implements ITabbedPropertyConstants {
- static {
- PropertiesCompositeFactory.register(MessageFlow.class, MessageFlowDetailComposite.class);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
- */
- @Override
- protected AbstractDetailComposite createSectionRoot() {
- return new MessageFlowDetailComposite(this);
- }
-
- @Override
- public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
- return new MessageFlowDetailComposite(parent,style);
- }
-
- @Override
- protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
- EObject be = super.getBusinessObjectForPictogramElement(pe);
- if (be instanceof MessageFlow)
- return be;
- return null;
- }
-}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/SequenceFlowPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/SequenceFlowPropertySection.java
index 80a97d5..e9bfd84 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/SequenceFlowPropertySection.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/SequenceFlowPropertySection.java
@@ -1,49 +1,45 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Innar Made
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.property.connectors;
-
-import org.eclipse.bpmn2.SequenceFlow;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.swt.widgets.Composite;
-
-public class SequenceFlowPropertySection extends AbstractBpmn2PropertySection {
-
- static {
- PropertiesCompositeFactory.register(SequenceFlow.class, SequenceFlowDetailComposite.class);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
- */
- @Override
- protected AbstractDetailComposite createSectionRoot() {
- return new SequenceFlowDetailComposite(this);
- }
-
- @Override
- public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
- return new SequenceFlowDetailComposite(parent,style);
- }
-
- @Override
- protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
- EObject be = super.getBusinessObjectForPictogramElement(pe);
- if (be instanceof SequenceFlow)
- return be;
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Innar Made
+ ******************************************************************************/
+package org.eclipse.bpmn2.modeler.ui.property.connectors;
+
+import org.eclipse.bpmn2.SequenceFlow;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.swt.widgets.Composite;
+
+public class SequenceFlowPropertySection extends AbstractBpmn2PropertySection {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
+ */
+ @Override
+ protected AbstractDetailComposite createSectionRoot() {
+ return new SequenceFlowDetailComposite(this);
+ }
+
+ @Override
+ public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
+ return new SequenceFlowDetailComposite(parent,style);
+ }
+
+ @Override
+ protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
+ EObject be = super.getBusinessObjectForPictogramElement(pe);
+ if (be instanceof SequenceFlow)
+ return be;
+ return null;
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/DataObjectPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/DataObjectPropertySection.java
index f3074e3..a3a18cb 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/DataObjectPropertySection.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/DataObjectPropertySection.java
@@ -38,7 +38,7 @@
/**
* @author Bob Brodt
* From section 10.3.1 of the BPMN 2.0 specification:
- * "The Data Object class is an item-aware parameter. Data Object elements MUST be contained within Process or Sub-
+ * "The Data Object class is an item-aware parameter. Data Object elements MUST businessObject contained within Process or Sub-
* Process elements. Data Object elements are visually displayed on a Process diagram. Data Object References are
* a way to reuse Data Objects in the same diagram. They can specify different states of the same Data Object at
* different points in a Process. Data Object Reference cannot specify item definitions, and Data Objects cannot
@@ -47,19 +47,6 @@
* Object Reference State> ]."
*/
public class DataObjectPropertySection extends AbstractBpmn2PropertySection {
-
- static {
- PropertiesCompositeFactory.register(DataObject.class, DataObjectDetailComposite.class);
- PropertiesCompositeFactory.register(DataObjectReference.class, DataObjectDetailComposite.class);
- PropertiesCompositeFactory.register(Assignment.class, DataAssignmentDetailComposite.class);
- PropertiesCompositeFactory.register(Expression.class, ExpressionDetailComposite.class);
- PropertiesCompositeFactory.register(FormalExpression.class, ExpressionDetailComposite.class);
- PropertiesCompositeFactory.register(ResourceAssignmentExpression.class, ResourceAssignmentExpressionDetailComposite.class);
- PropertiesCompositeFactory.register(ResourceParameterBinding.class, ResourceParameterBindingDetailComposite.class);
- PropertiesCompositeFactory.register(PotentialOwner.class, ResourceRoleDetailComposite.class);
- PropertiesCompositeFactory.register(HumanPerformer.class, ResourceRoleDetailComposite.class);
- PropertiesCompositeFactory.register(Performer.class, ResourceRoleDetailComposite.class);
- }
/* (non-Javadoc)
* @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/DataObjectReferencePropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/DataObjectReferencePropertySection.java
index adc364f..fa1662a 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/DataObjectReferencePropertySection.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/DataObjectReferencePropertySection.java
@@ -29,9 +29,6 @@
*
*/
public class DataObjectReferencePropertySection extends AbstractBpmn2PropertySection {
- static {
- PropertiesCompositeFactory.register(DataObjectReference.class, DataObjectReferenceDetailComposite.class);
- }
/* (non-Javadoc)
* @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/DataStorePropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/DataStorePropertySection.java
index 15281a7..b31e003 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/DataStorePropertySection.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/DataStorePropertySection.java
@@ -32,11 +32,6 @@
*
*/
public class DataStorePropertySection extends AbstractBpmn2PropertySection {
-
- static {
- // register the DataStoreDetailComposite for rendering DataStore objects
- PropertiesCompositeFactory.register(DataStore.class, DataStoreDetailComposite.class);
- }
/* (non-Javadoc)
* @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/DataStoreReferencePropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/DataStoreReferencePropertySection.java
index c77f66e..219f9c9 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/DataStoreReferencePropertySection.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/DataStoreReferencePropertySection.java
@@ -28,9 +28,6 @@
*
*/
public class DataStoreReferencePropertySection extends AbstractBpmn2PropertySection {
- static {
- PropertiesCompositeFactory.register(DataStoreReference.class, DataStoreReferenceDetailComposite.class);
- }
/* (non-Javadoc)
* @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/InterfacePropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/InterfacePropertySection.java
index cbcc520..80e8d6f 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/InterfacePropertySection.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/InterfacePropertySection.java
@@ -40,10 +40,6 @@
public class InterfacePropertySection extends DefaultPropertySection {
- static {
- PropertiesCompositeFactory.register(Interface.class, InterfaceDetailComposite.class);
- }
-
@Override
protected AbstractDetailComposite createSectionRoot() {
return new InterfaceSectionRoot(this);
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/MessagePropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/MessagePropertySection.java
deleted file mode 100644
index 30a23dd..0000000
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/MessagePropertySection.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Innar Made
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.property.data;
-
-import org.eclipse.bpmn2.Message;
-import org.eclipse.bpmn2.Property;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
-
-public class MessagePropertySection extends AbstractBpmn2PropertySection implements ITabbedPropertyConstants {
- static {
- PropertiesCompositeFactory.register(Message.class, MessageDetailComposite.class);
- PropertiesCompositeFactory.register(Message.class, MessageListComposite.class);
- PropertiesCompositeFactory.register(Property.class, ItemAwareElementDetailComposite.class);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
- */
- @Override
- protected AbstractDetailComposite createSectionRoot() {
- return new MessageDetailComposite(this);
- }
-
- @Override
- public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
- return new MessageDetailComposite(parent,style);
- }
-
- @Override
- protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
- EObject be = super.getBusinessObjectForPictogramElement(pe);
- if (be instanceof Message)
- return be;
- return null;
- }
-}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/diagrams/DataItemsPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/diagrams/DataItemsPropertySection.java
index 2e84662..861e2cc 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/diagrams/DataItemsPropertySection.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/diagrams/DataItemsPropertySection.java
@@ -1,51 +1,44 @@
-package org.eclipse.bpmn2.modeler.ui.property.diagrams;
-
-import java.io.IOException;
-import java.util.Collection;
-
-import org.eclipse.bpmn2.ItemDefinition;
-import org.eclipse.bpmn2.Property;
-import org.eclipse.bpmn2.ResourceRole;
-import org.eclipse.bpmn2.di.BPMNDiagram;
-import org.eclipse.bpmn2.modeler.core.ModelHandlerLocator;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.DefaultPropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
-import org.eclipse.bpmn2.modeler.ui.Activator;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-
-public class DataItemsPropertySection extends DefaultPropertySection {
-
- static {
- PropertiesCompositeFactory.register(ItemDefinition.class, ItemDefinitionDetailComposite.class);
- PropertiesCompositeFactory.register(ItemDefinition.class, ItemDefinitionListComposite.class);
- PropertiesCompositeFactory.register(Property.class, PropertyListComposite.class);
- PropertiesCompositeFactory.register(ResourceRole.class, ResourceRoleListComposite.class);
- }
-
- public DataItemsPropertySection() {
- }
-
- @Override
- protected AbstractDetailComposite createSectionRoot() {
- return new DataItemsDetailComposite(this);
- }
-
- @Override
- protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
- EObject be = super.getBusinessObjectForPictogramElement(pe);
- if (be instanceof BPMNDiagram) {
-// EList<EObject> contents = be.eResource().getContents();
-// if (!contents.isEmpty() && contents.get(0) instanceof DocumentRoot) {
-// return contents.get(0);
-// }
- try {
- return ModelHandlerLocator.getModelHandler(be.eResource()).getDefinitions();
- } catch (IOException e) {
- Activator.showErrorWithLogging(e);
- }
- }
- return null;
- }
-}
+package org.eclipse.bpmn2.modeler.ui.property.diagrams;
+
+import java.io.IOException;
+import java.util.Collection;
+
+import org.eclipse.bpmn2.ItemDefinition;
+import org.eclipse.bpmn2.Property;
+import org.eclipse.bpmn2.ResourceRole;
+import org.eclipse.bpmn2.di.BPMNDiagram;
+import org.eclipse.bpmn2.modeler.core.ModelHandlerLocator;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.DefaultPropertySection;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
+import org.eclipse.bpmn2.modeler.ui.Activator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+
+public class DataItemsPropertySection extends DefaultPropertySection {
+
+ public DataItemsPropertySection() {
+ }
+
+ @Override
+ protected AbstractDetailComposite createSectionRoot() {
+ return new DataItemsDetailComposite(this);
+ }
+
+ @Override
+ protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
+ EObject be = super.getBusinessObjectForPictogramElement(pe);
+ if (be instanceof BPMNDiagram) {
+// EList<EObject> contents = businessObject.eResource().getContents();
+// if (!contents.isEmpty() && contents.get(0) instanceof DocumentRoot) {
+// return contents.get(0);
+// }
+ try {
+ return ModelHandlerLocator.getModelHandler(be.eResource()).getDefinitions();
+ } catch (IOException e) {
+ Activator.showErrorWithLogging(e);
+ }
+ }
+ return null;
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/diagrams/DefinitionsPropertyComposite.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/diagrams/DefinitionsPropertyComposite.java
index 522b1d3..ec9747d 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/diagrams/DefinitionsPropertyComposite.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/diagrams/DefinitionsPropertyComposite.java
@@ -181,7 +181,7 @@
@Override
protected boolean updateObject(final Object result) {
// we can't just change the key because the map that contains it
- // needs to be updated, so remove old key, then add new.
+ // needs to businessObject updated, so remove old key, then add new.
if (result instanceof String && !((String)result).isEmpty() ) {
final Map.Entry<String, String> entry = (Map.Entry<String, String>)object;
final String oldKey = entry.getKey();
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/diagrams/DefinitionsPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/diagrams/DefinitionsPropertySection.java
index 72a45c6..0133c4d 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/diagrams/DefinitionsPropertySection.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/diagrams/DefinitionsPropertySection.java
@@ -18,11 +18,6 @@
import org.eclipse.swt.widgets.Composite;
public class DefinitionsPropertySection extends AbstractBpmn2PropertySection {
-
- static {
- PropertiesCompositeFactory.register(Import.class, ImportDetailComposite.class);
- PropertiesCompositeFactory.register(Category.class, CategoryDetailComposite.class);
- }
/* (non-Javadoc)
* @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/diagrams/ItemDefinitionDetailComposite.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/diagrams/ItemDefinitionDetailComposite.java
index f41415f..3387af7 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/diagrams/ItemDefinitionDetailComposite.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/diagrams/ItemDefinitionDetailComposite.java
@@ -37,7 +37,7 @@
"itemKind",
"isCollection",
"structureRef",
- // this thing is transient so it won't be serialized; no point in allowing user to set it
+ // this thing is transient so it won't businessObject serialized; no point in allowing user to set it
// "import"
};
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/diagrams/ProcessDiagramPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/diagrams/ProcessDiagramPropertySection.java
index f436623..a9cf040 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/diagrams/ProcessDiagramPropertySection.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/diagrams/ProcessDiagramPropertySection.java
@@ -1,48 +1,45 @@
-package org.eclipse.bpmn2.modeler.ui.property.diagrams;
-
-import org.eclipse.bpmn2.BaseElement;
-import org.eclipse.bpmn2.Participant;
-import org.eclipse.bpmn2.Process;
-import org.eclipse.bpmn2.di.BPMNDiagram;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.swt.widgets.Composite;
-
-public class ProcessDiagramPropertySection extends AbstractBpmn2PropertySection {
- static {
- PropertiesCompositeFactory.register(Process.class, ProcessDiagramPropertyComposite.class);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#
- * createSectionRoot()
- */
- @Override
- protected AbstractDetailComposite createSectionRoot() {
- return new ProcessDiagramPropertyComposite(this);
- }
-
- @Override
- public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
- return new ProcessDiagramPropertyComposite(parent,style);
- }
-
- @Override
- protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
- EObject bo = super.getBusinessObjectForPictogramElement(pe);
- if (bo instanceof Participant) {
- return ((Participant) bo).getProcessRef();
- } else if (bo instanceof BPMNDiagram) {
- BaseElement be = ((BPMNDiagram)bo).getPlane().getBpmnElement();
- if (be instanceof Process)
- return be;
- }
-
- return null;
- }
-}
+package org.eclipse.bpmn2.modeler.ui.property.diagrams;
+
+import org.eclipse.bpmn2.BaseElement;
+import org.eclipse.bpmn2.Participant;
+import org.eclipse.bpmn2.Process;
+import org.eclipse.bpmn2.di.BPMNDiagram;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.swt.widgets.Composite;
+
+public class ProcessDiagramPropertySection extends AbstractBpmn2PropertySection {
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#
+ * createSectionRoot()
+ */
+ @Override
+ protected AbstractDetailComposite createSectionRoot() {
+ return new ProcessDiagramPropertyComposite(this);
+ }
+
+ @Override
+ public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
+ return new ProcessDiagramPropertyComposite(parent,style);
+ }
+
+ @Override
+ protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
+ EObject bo = super.getBusinessObjectForPictogramElement(pe);
+ if (bo instanceof Participant) {
+ return ((Participant) bo).getProcessRef();
+ } else if (bo instanceof BPMNDiagram) {
+ BaseElement be = ((BPMNDiagram)bo).getPlane().getBpmnElement();
+ if (be instanceof Process)
+ return be;
+ }
+
+ return null;
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/dialogs/FileSelectionGroup.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/dialogs/FileSelectionGroup.java
index 43c731c..6881ee6 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/dialogs/FileSelectionGroup.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/dialogs/FileSelectionGroup.java
@@ -1,221 +1,221 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.property.dialogs;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.jface.viewers.DoubleClickEvent;
-import org.eclipse.jface.viewers.IDoubleClickListener;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.ui.model.WorkbenchContentProvider;
-import org.eclipse.ui.model.WorkbenchLabelProvider;
-import org.eclipse.ui.part.DrillDownComposite;
-
-public class FileSelectionGroup extends Composite {
-
- // The listener to notify of events
- private Listener listener;
-
- private String message;
-
- // Last selection made by user
- private IResource selectedResource;
-
- // handle on parts
- private TreeViewer treeViewer;
-
- // Filters
- private ViewerFileFilter viewerFileFilter;
- // private ViewerFileFilterMatcher viewerFileFilterMatcher
- private String filterPatterns;
- // sizing constants
- private static final int SIZING_SELECTION_PANE_HEIGHT = 175;
- private static final int SIZING_SELECTION_PANE_WIDTH = 200;
- /**
- * Creates a new instance of the widget.
- */
- public FileSelectionGroup(
- Composite parent,
- Listener listener,
- String message) {
- this(parent, listener, message, null);
- }
- public FileSelectionGroup(
- Composite parent,
- Listener listener,
- String message,
- String filterPatterns) {
- super(parent, SWT.NONE);
-
- this.filterPatterns = filterPatterns;
- this.listener = listener;
- this.message = message;
- this.setFont(parent.getFont());
-
- createViewerFileFilter();
- createContents();
- }
- public void setFileFilter(String filter) {
- filterPatterns = filter;
- createViewerFileFilter();
- treeViewer.setFilters(new ViewerFilter[] {viewerFileFilter});
- treeViewer.setInput(ResourcesPlugin.getWorkspace());
- }
- /**
- * Creates ViewerFileFilter using array of objects.
- */
- public void createViewerFileFilter() {
- if (filterPatterns != null) {
- viewerFileFilter = new ViewerFileFilter(filterPatterns);
- }
- }
- /**
- * Creates the contents of the composite.
- */
- public void createContents() {
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- setLayout(layout);
- setLayoutData(new GridData(GridData.FILL_BOTH));
-
- Label label = new Label(this, SWT.WRAP);
- label.setText(message != null ? message : ""); //$NON-NLS-1$
- label.setFont(this.getFont());
-
- createTreeViewer();
- }
- /**
- * Returns a new drill down viewer for this dialog.
- */
- protected void createTreeViewer() {
-
- // Create drill down.
- DrillDownComposite drillDown = new DrillDownComposite(this, SWT.BORDER);
- GridData spec =
- new GridData(
- GridData.VERTICAL_ALIGN_FILL
- | GridData.HORIZONTAL_ALIGN_FILL
- | GridData.GRAB_HORIZONTAL
- | GridData.GRAB_VERTICAL);
- spec.widthHint = SIZING_SELECTION_PANE_WIDTH;
- spec.heightHint = SIZING_SELECTION_PANE_HEIGHT;
- drillDown.setLayoutData(spec);
-
- // Create tree viewer inside drill down.
- treeViewer = new TreeViewer(drillDown, SWT.NONE);
- drillDown.setChildTree(treeViewer);
- treeViewer.setContentProvider(new WorkbenchContentProvider());
- treeViewer.setLabelProvider(new WorkbenchLabelProvider());
- treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection selection = (IStructuredSelection) event.getSelection();
- resourceSelectionChanged((IResource) selection.getFirstElement());
- // allow null
- }
- });
- treeViewer.addDoubleClickListener(new IDoubleClickListener() {
- public void doubleClick(DoubleClickEvent event) {
- ISelection selection = event.getSelection();
- if (selection instanceof IStructuredSelection) {
- Object item = ((IStructuredSelection) selection).getFirstElement();
- if (treeViewer.getExpandedState(item))
- treeViewer.collapseToLevel(item, 1);
- else
- treeViewer.expandToLevel(item, 1);
- }
- }
- });
-
- if (viewerFileFilter != null)
- treeViewer.addFilter(viewerFileFilter);
- // This has to be done after the viewer has been laid out
- treeViewer.setInput(ResourcesPlugin.getWorkspace());
- }
- /**
- * Returns the "full path" (i.e. first segment is project name) of the currently selected file.
- */
- public IPath getResourceFullPath() {
- if (selectedResource == null) return null;
- return selectedResource.getFullPath();
- }
-
-
- public IResource getSelectedResource () {
- return selectedResource;
- }
-
-
- /**
- * Returns the tree viewer.
- */
- public TreeViewer getTreeViewer() {
- return treeViewer;
- }
- /**
- * The file selection has changed in the
- * tree view. Update the file name field
- * value and notify all listeners.
- */
- public void resourceSelectionChanged(IResource resource) {
- selectedResource = resource;
-
- // fire an event so the parent can update its controls
- if (listener != null) {
- Event changeEvent = new Event();
- changeEvent.type = SWT.Selection;
- changeEvent.widget = this;
- listener.handleEvent(changeEvent);
- }
- }
- /**
- * Gives focus to one of the widgets in the group, as determined by the group.
- */
- public void setInitialFocus() {
- treeViewer.getTree().setFocus();
- }
- /**
- * Sets the selected existing file.
- */
- public void setSelectedResource(IResource resource) {
- // https://issues.jboss.org/browse/JBIDE-8738
- if (resource==null)
- return;
- selectedResource = resource;
-
- //expand to and select the specified file
- List itemsToExpand = new ArrayList();
- IContainer parent = resource.getParent();
- while (parent != null) {
- itemsToExpand.add(0, parent);
- parent = parent.getParent();
- }
- treeViewer.setExpandedElements(itemsToExpand.toArray());
- treeViewer.setSelection(new StructuredSelection(resource), true);
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpmn2.modeler.ui.property.dialogs;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.ui.model.WorkbenchContentProvider;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.eclipse.ui.part.DrillDownComposite;
+
+public class FileSelectionGroup extends Composite {
+
+ // The listener to notify of events
+ private Listener listener;
+
+ private String message;
+
+ // Last selection made by user
+ private IResource selectedResource;
+
+ // handle on parts
+ private TreeViewer treeViewer;
+
+ // Filters
+ private ViewerFileFilter viewerFileFilter;
+ // private ViewerFileFilterMatcher viewerFileFilterMatcher
+ private String filterPatterns;
+ // sizing constants
+ private static final int SIZING_SELECTION_PANE_HEIGHT = 175;
+ private static final int SIZING_SELECTION_PANE_WIDTH = 200;
+ /**
+ * Creates a new instance of the widget.
+ */
+ public FileSelectionGroup(
+ Composite parent,
+ Listener listener,
+ String message) {
+ this(parent, listener, message, null);
+ }
+ public FileSelectionGroup(
+ Composite parent,
+ Listener listener,
+ String message,
+ String filterPatterns) {
+ super(parent, SWT.NONE);
+
+ this.filterPatterns = filterPatterns;
+ this.listener = listener;
+ this.message = message;
+ this.setFont(parent.getFont());
+
+ createViewerFileFilter();
+ createContents();
+ }
+ public void setFileFilter(String filter) {
+ filterPatterns = filter;
+ createViewerFileFilter();
+ treeViewer.setFilters(new ViewerFilter[] {viewerFileFilter});
+ treeViewer.setInput(ResourcesPlugin.getWorkspace());
+ }
+ /**
+ * Creates ViewerFileFilter using array of objects.
+ */
+ public void createViewerFileFilter() {
+ if (filterPatterns != null) {
+ viewerFileFilter = new ViewerFileFilter(filterPatterns);
+ }
+ }
+ /**
+ * Creates the contents of the composite.
+ */
+ public void createContents() {
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ setLayout(layout);
+ setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ Label label = new Label(this, SWT.WRAP);
+ label.setText(message != null ? message : ""); //$NON-NLS-1$
+ label.setFont(this.getFont());
+
+ createTreeViewer();
+ }
+ /**
+ * Returns a new drill down viewer for this dialog.
+ */
+ protected void createTreeViewer() {
+
+ // Create drill down.
+ DrillDownComposite drillDown = new DrillDownComposite(this, SWT.BORDER);
+ GridData spec =
+ new GridData(
+ GridData.VERTICAL_ALIGN_FILL
+ | GridData.HORIZONTAL_ALIGN_FILL
+ | GridData.GRAB_HORIZONTAL
+ | GridData.GRAB_VERTICAL);
+ spec.widthHint = SIZING_SELECTION_PANE_WIDTH;
+ spec.heightHint = SIZING_SELECTION_PANE_HEIGHT;
+ drillDown.setLayoutData(spec);
+
+ // Create tree viewer inside drill down.
+ treeViewer = new TreeViewer(drillDown, SWT.NONE);
+ drillDown.setChildTree(treeViewer);
+ treeViewer.setContentProvider(new WorkbenchContentProvider());
+ treeViewer.setLabelProvider(new WorkbenchLabelProvider());
+ treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ IStructuredSelection selection = (IStructuredSelection) event.getSelection();
+ resourceSelectionChanged((IResource) selection.getFirstElement());
+ // allow null
+ }
+ });
+ treeViewer.addDoubleClickListener(new IDoubleClickListener() {
+ public void doubleClick(DoubleClickEvent event) {
+ ISelection selection = event.getSelection();
+ if (selection instanceof IStructuredSelection) {
+ Object item = ((IStructuredSelection) selection).getFirstElement();
+ if (treeViewer.getExpandedState(item))
+ treeViewer.collapseToLevel(item, 1);
+ else
+ treeViewer.expandToLevel(item, 1);
+ }
+ }
+ });
+
+ if (viewerFileFilter != null)
+ treeViewer.addFilter(viewerFileFilter);
+ // This has to businessObject done after the viewer has been laid out
+ treeViewer.setInput(ResourcesPlugin.getWorkspace());
+ }
+ /**
+ * Returns the "full path" (i.e. first segment is project name) of the currently selected file.
+ */
+ public IPath getResourceFullPath() {
+ if (selectedResource == null) return null;
+ return selectedResource.getFullPath();
+ }
+
+
+ public IResource getSelectedResource () {
+ return selectedResource;
+ }
+
+
+ /**
+ * Returns the tree viewer.
+ */
+ public TreeViewer getTreeViewer() {
+ return treeViewer;
+ }
+ /**
+ * The file selection has changed in the
+ * tree view. Update the file name field
+ * value and notify all listeners.
+ */
+ public void resourceSelectionChanged(IResource resource) {
+ selectedResource = resource;
+
+ // fire an event so the parent can update its controls
+ if (listener != null) {
+ Event changeEvent = new Event();
+ changeEvent.type = SWT.Selection;
+ changeEvent.widget = this;
+ listener.handleEvent(changeEvent);
+ }
+ }
+ /**
+ * Gives focus to one of the widgets in the group, as determined by the group.
+ */
+ public void setInitialFocus() {
+ treeViewer.getTree().setFocus();
+ }
+ /**
+ * Sets the selected existing file.
+ */
+ public void setSelectedResource(IResource resource) {
+ // https://issues.jboss.org/browse/JBIDE-8738
+ if (resource==null)
+ return;
+ selectedResource = resource;
+
+ //expand to and select the specified file
+ List itemsToExpand = new ArrayList();
+ IContainer parent = resource.getParent();
+ while (parent != null) {
+ itemsToExpand.add(0, parent);
+ parent = parent.getParent();
+ }
+ treeViewer.setExpandedElements(itemsToExpand.toArray());
+ treeViewer.setSelection(new StructuredSelection(resource), true);
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/dialogs/NamespacesEditingDialog.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/dialogs/NamespacesEditingDialog.java
index 57ac457..c3aa6de 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/dialogs/NamespacesEditingDialog.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/dialogs/NamespacesEditingDialog.java
@@ -51,7 +51,7 @@
@Override
public String isValid(String newText) {
if (newText==null || newText.isEmpty())
- return "Prefix can not be empty";
+ return "Prefix can not businessObject empty";
if (newText.equals(prefix))
return null;
if (map.containsKey(newText))
@@ -104,7 +104,7 @@
String msg = null;
String ns = namespaceText.getText();
if (ns==null || ns.isEmpty())
- msg = "Namespace can not be empty";
+ msg = "Namespace can not businessObject empty";
try {
URI uri = URI.createURI(ns);
}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/dialogs/SchemaImportDialog.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/dialogs/SchemaImportDialog.java
index e600202..d91a225 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/dialogs/SchemaImportDialog.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/dialogs/SchemaImportDialog.java
@@ -1,1291 +1,1291 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Bob Brodt
- ******************************************************************************/
-
-package org.eclipse.bpmn2.modeler.ui.property.dialogs;
-import java.text.MessageFormat;
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.bpel.wsil.model.inspection.Description;
-import org.eclipse.bpel.wsil.model.inspection.Inspection;
-import org.eclipse.bpel.wsil.model.inspection.Link;
-import org.eclipse.bpel.wsil.model.inspection.Name;
-import org.eclipse.bpel.wsil.model.inspection.Service;
-import org.eclipse.bpel.wsil.model.inspection.TypeOfAbstract;
-import org.eclipse.bpmn2.DocumentRoot;
-import org.eclipse.bpmn2.modeler.core.model.Bpmn2ModelerResourceSetImpl;
-import org.eclipse.bpmn2.modeler.core.preferences.Bpmn2Preferences;
-import org.eclipse.bpmn2.modeler.core.utils.JavaProjectClassLoader;
-import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
-import org.eclipse.bpmn2.modeler.ui.Activator;
-import org.eclipse.bpmn2.modeler.ui.Messages;
-import org.eclipse.bpmn2.modeler.ui.editor.BPMN2Editor;
-import org.eclipse.bpmn2.modeler.ui.property.providers.BPMN2DefinitionsTreeContentProvider;
-import org.eclipse.bpmn2.modeler.ui.property.providers.JavaTreeContentProvider;
-import org.eclipse.bpmn2.modeler.ui.property.providers.ModelLabelProvider;
-import org.eclipse.bpmn2.modeler.ui.property.providers.ModelTreeLabelProvider;
-import org.eclipse.bpmn2.modeler.ui.property.providers.ServiceTreeContentProvider;
-import org.eclipse.bpmn2.modeler.ui.property.providers.TreeNode;
-import org.eclipse.bpmn2.modeler.ui.property.providers.VariableTypeTreeContentProvider;
-import org.eclipse.bpmn2.modeler.ui.property.providers.WSILContentProvider;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.emf.ecore.resource.ResourceSet;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jface.dialogs.Dialog;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.IDialogSettings;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.preference.IPreferenceStore;
-import org.eclipse.jface.resource.JFaceResources;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerComparator;
-import org.eclipse.jface.viewers.ViewerFilter;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.KeyEvent;
-import org.eclipse.swt.events.KeyListener;
-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.Display;
-import org.eclipse.swt.widgets.Event;
-import org.eclipse.swt.widgets.FileDialog;
-import org.eclipse.swt.widgets.Group;
-import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Listener;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.swt.widgets.Tree;
-import org.eclipse.ui.dialogs.SelectionStatusDialog;
-import org.eclipse.ui.part.DrillDownComposite;
-import org.eclipse.wst.wsdl.Definition;
-import org.eclipse.xsd.XSDSchema;
-
-/**
- * Browse for complex/simple types available in the process and choose that
- * simple type.
- *
- */
-
-public class SchemaImportDialog extends SelectionStatusDialog {
-
- // resource type flags for configuring this dialog:
- public final static int ALLOW_XSD = (1 << 0);
- public final static int ALLOW_WSDL = (1 << 1);
- public final static int ALLOW_BPMN2 = (1 << 2);
- public final static int ALLOW_JAVA = (1 << 3);
-
- // Button id for browsing the workspace
- protected final static int BID_BROWSE_WORKSPACE = IDialogConstants.CLIENT_ID + 1;
- // Button id for browsing URLs
- protected final static int BID_BROWSE_URL = IDialogConstants.CLIENT_ID + 2;
- // Button id for browse files
- protected final static int BID_BROWSE_FILE = IDialogConstants.CLIENT_ID + 3;
- // button id for browsing WSIL
- protected static final int BID_BROWSE_WSIL = IDialogConstants.CLIENT_ID + 5;
- // Browse button id
- protected static final int BID_BROWSE = IDialogConstants.CLIENT_ID + 4;
- // Button id for import XML file types
- protected static final int BID_IMPORT_XML = IDialogConstants.CLIENT_ID + 6;
- // Button id for import XSD file types
- protected static final int BID_IMPORT_XSD = IDialogConstants.CLIENT_ID + 7;
- // Button id for import WSDL file types
- protected static final int BID_IMPORT_WSDL = IDialogConstants.CLIENT_ID + 8;
- // Button id for import BPMN 2.0 file types
- protected static final int BID_IMPORT_BPMN2 = IDialogConstants.CLIENT_ID + 9;
-
- ///////////////////////////////////////////////////////////////////////////////
- // TODO: we may want to use JavaUI.createTypeDialog(...) instead of cluttering
- // up this dialog with java types here...
- ///////////////////////////////////////////////////////////////////////////////
- // Button id for import Java types
- protected static final int BID_IMPORT_JAVA = IDialogConstants.CLIENT_ID + 10;
-
- // the current import type
- private int fImportType = BID_IMPORT_XSD;
- // the current import source
- private int fImportSource = BID_BROWSE_WORKSPACE;
- // the import type setting, remembered in the dialog settings
- private static final String IMPORT_TYPE = "ImportType"; //$NON-NLS-1$
- // the import source setting, remembered in the dialog settings
- private static final String IMPORT_SOURCE = "ImportSource"; //$NON-NLS-1$
-
- private static final String EMPTY = ""; //$NON-NLS-1$
-
- private String[] FILTER_EXTENSIONS;
- private String[] FILTER_NAMES;
- private String resourceFilter;
- protected String fResourceKind;
-
- protected BPMN2Editor bpmn2Editor;
- protected EObject modelObject;
- protected int allowedResourceTypes;
-
- protected Tree fTree;
- protected TreeViewer fTreeViewer;
-
- Text fLocation;
- String fLocationText;
- Label fLocationLabel;
- Label fStructureLabel;
-
- private Composite fLocationComposite;
- FileSelectionGroup fResourceComposite;
-
- // Import from WSIL constructs
- private Composite fWSILComposite;
- protected TreeViewer fWSILTreeViewer;
- protected Tree fWSILTree;
- protected Text filterText;
- String fFilter = ""; //$NON-NLS-1$
-
- Button fBrowseButton;
-
- private Group fTypeGroup;
-
- private Group fKindGroup;
- private Composite fKindButtonComposite;
-
- private IDialogSettings fSettings;
-
- private String fStructureTitle;
-
- private ITreeContentProvider fTreeContentProvider;
-
- protected Object fInput;
-
- protected Bpmn2ModelerResourceSetImpl fHackedResourceSet;
-
- long fRunnableStart;
- URI fRunnableLoadURI;
- Job fLoaderJob;
-
- IPreferenceStore fPrefStore = Activator.getDefault().getPreferenceStore();
- String fBasePath = fPrefStore.getString(Bpmn2Preferences.PREF_WSIL_URL);
-
- // The WSIL radio box is turned off if the WSIL document is not set in the
- // modelEnablement.
- Button fBtnWSIL;
- Button fBtnResource;
-
- /**
- * Create a brand new shiny Schema Import Dialog.
- *
- * @param parent
- */
- public SchemaImportDialog(Shell parent, int allowedResourceTypes) {
-
- super(parent);
- setStatusLineAboveButtons(true);
- int shellStyle = getShellStyle();
- setShellStyle(shellStyle | SWT.MAX | SWT.RESIZE);
-
- fSettings = Activator.getDefault().getDialogSettingsFor(this);
-
- try {
- fImportSource = fSettings.getInt(IMPORT_SOURCE);
- fImportType = fSettings.getInt(IMPORT_TYPE);
- } catch (java.lang.NumberFormatException nfe) {
- fImportSource = BID_BROWSE_WORKSPACE;
- fImportType = BID_IMPORT_XSD;
- }
-
- setDialogBoundsSettings(fSettings, getDialogBoundsStrategy());
-
- this.allowedResourceTypes = allowedResourceTypes;
- if ((allowedResourceTypes & ALLOW_XSD) == 0) {
- if (fImportType==BID_IMPORT_XML || fImportType==BID_IMPORT_XSD)
- fImportType = 0;
- }
- if ((allowedResourceTypes & ALLOW_WSDL) == 0) {
- if (fImportType==BID_IMPORT_WSDL)
- fImportType = 0;
- }
- if ((allowedResourceTypes & ALLOW_BPMN2) == 0) {
- if (fImportType==BID_IMPORT_BPMN2)
- fImportType = 0;
- }
- if ((allowedResourceTypes & ALLOW_JAVA) == 0) {
- if (fImportType==BID_IMPORT_JAVA)
- fImportType = 0;
- }
- if (fImportType==0) {
- if ((allowedResourceTypes & ALLOW_XSD) != 0)
- fImportType = BID_IMPORT_XSD;
- if ((allowedResourceTypes & ALLOW_WSDL) != 0)
- fImportType = BID_IMPORT_WSDL;
- if ((allowedResourceTypes & ALLOW_BPMN2) != 0)
- fImportType = BID_IMPORT_BPMN2;
- if ((allowedResourceTypes & ALLOW_JAVA) != 0)
- fImportType = BID_IMPORT_JAVA;
- }
-
- if (fImportType==BID_IMPORT_XML)
- configureAsXMLImport();
- else if (fImportType==BID_IMPORT_XSD)
- configureAsSchemaImport();
- else if (fImportType==BID_IMPORT_WSDL)
- configureAsWSDLImport();
- else if (fImportType==BID_IMPORT_BPMN2)
- configureAsBPMN2Import();
- else if (fImportType==BID_IMPORT_JAVA)
- configureAsJavaImport();
-
- bpmn2Editor = BPMN2Editor.getActiveEditor();
- ResourceSet rs = bpmn2Editor.getResourceSet();
- fHackedResourceSet = ModelUtil.slightlyHackedResourceSet(rs);
- }
-
- public SchemaImportDialog(Shell parent) {
- this(parent, -1);
- }
-
- /**
- *
- * @see Dialog#createDialogArea(Composite)
- *
- * @param parent
- * the parent composite to use
- * @return the composite it created to be used in the dialog area.
- */
-
- @Override
- public Control createDialogArea(Composite parent) {
-
- Composite contents = (Composite) super.createDialogArea(parent);
-
- createImportType(contents);
- createImportLocation(contents);
- createImportStructure(contents);
-
- buttonPressed(fImportSource, true);
- return contents;
- }
-
- @Override
- protected void buttonPressed(int buttonId) {
- switch (buttonId) {
- case BID_BROWSE:
- if (fImportSource == BID_BROWSE_URL) {
- String loc = fLocation.getText();
- if (loc.length() > 0) {
- attemptLoad(loc);
- }
- }
- else {
- FileDialog fileDialog = new FileDialog(getShell());
- fileDialog.setFilterExtensions(FILTER_EXTENSIONS);
- fileDialog.setFilterNames(FILTER_NAMES);
- String path = fileDialog.open();
- if (path == null) {
- return;
- }
- fLocation.setText(path);
- attemptLoad(path);
- }
- break;
-
- case IDialogConstants.CANCEL_ID:
- if (fLoaderJob != null) {
- if (fLoaderJob.getState() == Job.RUNNING) {
- fLoaderJob.cancel();
- }
- }
- break;
- }
-
- super.buttonPressed(buttonId);
- }
-
- protected void buttonPressed(int id, boolean checked) {
-
- if (id==BID_BROWSE_FILE
- || id==BID_BROWSE_WORKSPACE
- || id==BID_BROWSE_URL
- || id==BID_BROWSE_WSIL) {
- if (checked==false) {
- return;
- }
- if (id==BID_BROWSE_WSIL) {
- if (fBasePath==null || fBasePath.isEmpty()) {
- MessageDialog.openInformation(getShell(), "WSIL Browser",
- "In order to browse a WSIL registry, please configure a\n"+
- "WSIL Document URL in the BPMN2 Preferences.");
- Display.getDefault().asyncExec(new Runnable() {
- @Override
- public void run() {
- fBtnWSIL.setSelection(false);
- fBtnResource.setSelection(true);
- buttonPressed(BID_BROWSE_WORKSPACE, true);
- }
- });
- return;
- }
- }
-
- fImportSource = id;
- fSettings.put(IMPORT_SOURCE, fImportSource);
- }
- else if (id==BID_IMPORT_XML
- || id==BID_IMPORT_XSD
- || id==BID_IMPORT_WSDL
- || id==BID_IMPORT_BPMN2
- || id==BID_IMPORT_JAVA) {
- if (checked==false) {
- return;
- }
- if (id==BID_IMPORT_XML) {
- configureAsXMLImport();
- setVisibleControl(fKindButtonComposite,true);
- }
- else if (id==BID_IMPORT_XSD) {
- configureAsSchemaImport();
- setVisibleControl(fKindButtonComposite,true);
- }
- else if (id==BID_IMPORT_WSDL) {
- configureAsWSDLImport();
- setVisibleControl(fKindButtonComposite,true);
- }
- else if (id==BID_IMPORT_BPMN2) {
- configureAsBPMN2Import();
- setVisibleControl(fKindButtonComposite,true);
- }
- else if (id==BID_IMPORT_JAVA) {
- configureAsJavaImport();
- setVisibleControl(fKindButtonComposite,false);
- }
-
- fImportType = id;
- fSettings.put(IMPORT_TYPE, fImportType);
- }
-
- setVisibleControl(fResourceComposite, fImportSource==BID_BROWSE_WORKSPACE && fImportType != BID_IMPORT_JAVA);
- setVisibleControl(fLocationComposite, fImportSource==BID_BROWSE_URL || fImportSource==BID_BROWSE_FILE || fImportType==BID_IMPORT_JAVA);
- setVisibleControl(fWSILComposite, fImportSource==BID_BROWSE_WSIL && fImportType != BID_IMPORT_JAVA);
- if (fImportType==BID_IMPORT_JAVA) {
- setVisibleControl(fKindButtonComposite, false);
- setVisibleControl(fBrowseButton,false);
- fLocationLabel.setText(Messages.SchemaImportDialog_27);
- }
- else {
- setVisibleControl(fKindButtonComposite, true);
- setVisibleControl(fBrowseButton,true);
- fLocationLabel.setText(Messages.SchemaImportDialog_8);
- fBrowseButton.setText(fImportSource==BID_BROWSE_FILE || fImportSource==BID_BROWSE_WSIL ?
- Messages.SchemaImportDialog_9 : Messages.SchemaImportDialog_26);
- }
- fLocation.setText(EMPTY);
- fTypeGroup.getParent().layout(true);
- fKindGroup.getParent().layout(true);
-
- markEmptySelection();
- }
-
- protected void setVisibleControl(Control c, boolean b) {
- Object layoutData = c.getLayoutData();
-
- if (layoutData instanceof GridData) {
- GridData data = (GridData) layoutData;
- data.exclude = !b;
- }
- c.setVisible(b);
- }
-
- /**
- * Create the dialog.
- *
- */
-
- @Override
- public void create() {
- super.create();
- buttonPressed(fImportSource, true);
- }
-
- protected Button createRadioButton(Composite parent, String label, int id,
- boolean checked) {
-
- Button button = new Button(parent, SWT.RADIO);
- button.setText(label);
- button.setFont(JFaceResources.getDialogFont());
- button.setData( Integer.valueOf( id ));
- button.setSelection(checked);
-
- button.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent event) {
- Button b = (Button) event.widget;
- int bid = ((Integer) b.getData()).intValue();
-
- buttonPressed(bid, b.getSelection());
- }
- });
-
- return button;
-
- }
-
- protected void createImportType(Composite parent) {
- fTypeGroup = new Group(parent, SWT.SHADOW_ETCHED_IN);
- fTypeGroup.setText(Messages.SchemaImportDialog_3);
- GridLayout layout = new GridLayout(1, true);
- GridData typeGroupGridData = new GridData();
- typeGroupGridData.grabExcessVerticalSpace = false;
- typeGroupGridData.grabExcessHorizontalSpace = true;
- typeGroupGridData.horizontalAlignment = GridData.FILL;
- typeGroupGridData.verticalAlignment = GridData.FILL;
-
- fTypeGroup.setLayout(layout);
- fTypeGroup.setLayoutData(typeGroupGridData);
-
- Composite container = new Composite(fTypeGroup, SWT.NONE);
-
- layout = new GridLayout();
- layout.makeColumnsEqualWidth = false;
- layout.numColumns = 4;
- container.setLayout(layout);
- GridData data = new GridData();
- data.grabExcessVerticalSpace = false;
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- data.verticalAlignment = GridData.CENTER;
- container.setLayoutData(data);
-
- Button button;
-
-// button = createRadioButton(control, Messages.SchemaImportDialog_20,
-// BID_IMPORT_XML, fImportType == BID_IMPORT_XML);
-// button.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,1,1));
- int buttonCount = 0;
- if ((allowedResourceTypes & ALLOW_XSD) != 0) {
- button = createRadioButton(container, Messages.SchemaImportDialog_21,
- BID_IMPORT_XSD, fImportType == BID_IMPORT_XSD);
- button.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,1,1));
- ++buttonCount;
- }
-
- if ((allowedResourceTypes & ALLOW_WSDL) != 0) {
- button = createRadioButton(container, Messages.SchemaImportDialog_22,
- BID_IMPORT_WSDL, fImportType == BID_IMPORT_WSDL);
- button.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,1,1));
- ++buttonCount;
- }
-
- if ((allowedResourceTypes & ALLOW_BPMN2) != 0) {
- button = createRadioButton(container, Messages.SchemaImportDialog_28,
- BID_IMPORT_BPMN2, fImportType == BID_IMPORT_BPMN2);
- button.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,1,1));
- ++buttonCount;
- }
-
- if ((allowedResourceTypes & ALLOW_JAVA) != 0) {
- button = createRadioButton(container, Messages.SchemaImportDialog_23,
- BID_IMPORT_JAVA, fImportType == BID_IMPORT_JAVA);
- button.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,1,1));
- ++buttonCount;
- }
- if (buttonCount==1) {
- fTypeGroup.setVisible(false);
- typeGroupGridData.exclude = true;
- }
- }
-
- protected void createImportLocation(Composite parent) {
-
- fKindGroup = new Group(parent, SWT.SHADOW_ETCHED_IN);
- fKindGroup.setText(Messages.SchemaImportDialog_4);
- GridLayout layout = new GridLayout(1, true);
- GridData data = new GridData();
- data.grabExcessVerticalSpace = false;
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- data.verticalAlignment = GridData.FILL;
-
- fKindGroup.setLayout(layout);
- fKindGroup.setLayoutData(data);
-
- fKindButtonComposite = new Composite(fKindGroup, SWT.NONE);
-
- layout = new GridLayout();
- layout.makeColumnsEqualWidth = true;
- layout.numColumns = 4;
- fKindButtonComposite.setLayout(layout);
- data = new GridData();
- data.grabExcessVerticalSpace = false;
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- data.verticalAlignment = GridData.CENTER;
- fKindButtonComposite.setLayoutData(data);
-
- fBtnResource = createRadioButton(fKindButtonComposite, Messages.SchemaImportDialog_5,
- BID_BROWSE_WORKSPACE, fImportSource == BID_BROWSE_WORKSPACE);
- createRadioButton(fKindButtonComposite, Messages.SchemaImportDialog_6,
- BID_BROWSE_FILE, fImportSource == BID_BROWSE_FILE);
- createRadioButton(fKindButtonComposite, Messages.SchemaImportDialog_7,
- BID_BROWSE_URL, fImportSource == BID_BROWSE_URL);
-
- // Add WSIL option
- fBtnWSIL = createRadioButton(fKindButtonComposite, Messages.SchemaImportDialog_15,
- BID_BROWSE_WSIL, fImportSource == BID_BROWSE_WSIL);
-
- // Create location variant
- fLocationComposite = new Composite(fKindGroup, SWT.NONE);
-
- layout = new GridLayout();
- layout.numColumns = 3;
- fLocationComposite.setLayout(layout);
- data = new GridData();
- data.grabExcessVerticalSpace = true;
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- data.verticalAlignment = GridData.FILL;
- fLocationComposite.setLayoutData(data);
-
- fLocationLabel = new Label(fLocationComposite, SWT.NONE);
- fLocationLabel.setText(Messages.SchemaImportDialog_8);
-
- fLocation = new Text(fLocationComposite, SWT.BORDER);
- fLocation.setText(EMPTY);
- data = new GridData();
- data.grabExcessVerticalSpace = false;
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- data.verticalAlignment = GridData.FILL;
- fLocation.setLayoutData(data);
-// fLocation.addListener(SWT.FocusOut, new Listener() {
-//
-// public void handleEvent(Event event) {
-// String loc = fLocation.getText();
-// if (loc.length() > 0) {
-// attemptLoad(loc);
-// }
-// }
-// });
- fLocation.addKeyListener(new KeyListener() {
-
- public void keyPressed(KeyEvent event) {
- if (fImportType == BID_IMPORT_JAVA) {
- }
- else if (event.keyCode == SWT.CR) {
- attemptLoad(fLocation.getText());
- event.doit = false;
- }
- }
-
- public void keyReleased(KeyEvent e) {
- if (fImportType == BID_IMPORT_JAVA) {
- String s = fLocation.getText();
- if (s!=null && s.length()>1) {
- if (!s.equals(fLocationText)) {
- fLocationText = s;
- attemptLoad(s);
- }
- }
- }
- }
-
- });
-
- fBrowseButton = createButton(fLocationComposite, BID_BROWSE,
- Messages.SchemaImportDialog_9, false);
-
- // End of location variant
-
- // Start Resource Variant
- fResourceComposite = new FileSelectionGroup(fKindGroup, new Listener() {
- public void handleEvent(Event event) {
- IResource resource = fResourceComposite.getSelectedResource();
- if (resource != null && resource.getType() == IResource.FILE) {
- // only attempt to load a resource which is not a control
- attemptLoad((IFile) resource);
- return;
- }
- markEmptySelection();
- }
- }, Messages.SchemaImportDialog_10, resourceFilter); //$NON-NLS-1$
-
- TreeViewer viewer = fResourceComposite.getTreeViewer();
- viewer.setAutoExpandLevel(2);
-
- // End resource variant
-
- // create WSIL UI widgets
- createWSILStructure(fKindGroup);
-
- }
-
- protected Object createWSILStructure(Composite parent) {
-
- fWSILComposite = new Composite(parent, SWT.NONE);
-
- GridLayout layout = new GridLayout();
- layout.marginWidth = 0;
- fWSILComposite.setLayout(layout);
-
- GridData data = new GridData();
- data.grabExcessVerticalSpace = true;
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- data.verticalAlignment = GridData.FILL;
- data.minimumHeight = 220;
- fWSILComposite.setLayoutData(data);
-
- Label location = new Label(fWSILComposite, SWT.NONE);
- location.setText( Messages.SchemaImportDialog_16 );
-
- data = new GridData();
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = SWT.LEFT;
- location.setLayoutData(data);
-
- filterText = new Text(fWSILComposite, SWT.BORDER);
- data = new GridData(GridData.FILL_HORIZONTAL);
- filterText.setLayoutData(data);
-
- filterText.addKeyListener(new KeyListener() {
-
- public void keyPressed(KeyEvent e) {
-
- }
-
- public void keyReleased(KeyEvent e) {
- // set the value of the filter.
- fFilter = filterText.getText().trim().toLowerCase();
-
- if (fFilter.length() > 0) {
- /* for the time being, only filter 3 levels deep
- * since link references within WSIL are rare at
- * this time. when adoption of WSIL directories
- * take off, this needs to be rehashed */
- fWSILTreeViewer.expandToLevel(3);
- }
- fWSILTreeViewer.refresh();
- e.doit = false;
- }
- });
-
- DrillDownComposite wsilTreeComposite = new DrillDownComposite(fWSILComposite, SWT.BORDER);
-
- layout = new GridLayout();
- layout.marginWidth = 0;
- layout.marginHeight = 0;
- layout.verticalSpacing = 0;
- wsilTreeComposite.setLayout(layout);
-
- data = new GridData();
- data.grabExcessVerticalSpace = true;
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- data.verticalAlignment = GridData.FILL;
- wsilTreeComposite.setLayoutData(data);
-
- // Tree viewer for variable structure ...
- fWSILTree = new Tree(wsilTreeComposite, SWT.NONE );
- data = new GridData();
- data.grabExcessVerticalSpace = true;
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- data.verticalAlignment = GridData.FILL;
- data.minimumHeight = 200;
- fWSILTree.setLayoutData(data);
-
- fWSILTreeViewer = new TreeViewer( fWSILTree );
- fWSILTreeViewer.setContentProvider( new WSILContentProvider() );
- fWSILTreeViewer.setLabelProvider( new ModelLabelProvider() );
-
- Object wsilDoc = attemptLoad(URI.createURI(fBasePath),"wsil");
- fWSILTreeViewer.setInput ( wsilDoc ) ;
- if (wsilDoc == null || wsilDoc instanceof Throwable ) {
-// fBtnWSIL.setEnabled(false);
- // that's always available.
- // delete fImportSource = BID_BROWSE_WORKSPACE; by Grid.Qian
- // because if not, the dialog always display the resource Control
- // regardless last time if user choose the resource button
-
- /*// that's always available.
- fImportSource = BID_BROWSE_WORKSPACE;*/
- }
-
-
- // set default tree expansion to the 2nd level
- fWSILTreeViewer.expandToLevel(2);
- fWSILTreeViewer.addFilter(new TreeFilter());
- fWSILTreeViewer.setComparator(new WSILViewerComparator());
-
- wsilTreeComposite.setChildTree(fWSILTreeViewer);
-
- fWSILTreeViewer
- .addSelectionChangedListener(new ISelectionChangedListener() {
- public void selectionChanged(SelectionChangedEvent event) {
- // TODO Auto-generated method stub
- IStructuredSelection sel = (IStructuredSelection) event.getSelection();
- if (sel.getFirstElement() instanceof Service) {
- Service serv = (Service) sel.getFirstElement();
- Description descr = serv.getDescription().get(0);
- attemptLoad(descr.getLocation());
- } else {
- markEmptySelection();
- }
- }
- });
- // end tree viewer for variable structure
-
- return fWSILComposite;
- }
-
- protected Object createImportStructure(Composite parent) {
-
- fStructureLabel = new Label(parent, SWT.NONE);
- fStructureLabel.setText(fStructureTitle);
-
- // Tree viewer for variable structure ...
- fTree = new Tree(parent, SWT.BORDER);
-
- fTreeViewer = new TreeViewer(fTree);
- fTreeViewer.setContentProvider(fTreeContentProvider);
- fTreeViewer.setLabelProvider(new ModelTreeLabelProvider());
- fTreeViewer.setInput(null);
- fTreeViewer.setAutoExpandLevel(3);
- fTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
- @Override
- public void selectionChanged(SelectionChangedEvent event) {
- IStructuredSelection sel = (IStructuredSelection) event.getSelection();
- if (!sel.isEmpty()) {
- computeResult();
- if (getResult()!=null)
- updateStatus(Status.OK_STATUS);
- else
- updateStatus(new Status(IStatus.ERROR, Activator.getDefault().getID(),0,
- Messages.SchemaImportDialog_31,null));
- } else {
- markEmptySelection();
- }
- }
- });
- // end tree viewer for variable structure
- GridData data = new GridData();
- data.grabExcessVerticalSpace = true;
- data.grabExcessHorizontalSpace = true;
- data.horizontalAlignment = GridData.FILL;
- data.verticalAlignment = GridData.FILL;
- data.minimumHeight = 200;
- fTree.setLayoutData(data);
-
- return fTree;
- }
-
- Object attemptLoad(URI uri, String kind) {
-
- Resource resource = null;
- if ("java".equals(kind)) {
- final String fileName = uri.lastSegment();
- final List<Class> results = new ArrayList<Class>();
- IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
- for (IProject p : projects) {
- try {
- if (p.isOpen() && p.hasNature(JavaCore.NATURE_ID)) {
- final IJavaProject javaProject = JavaCore.create(p);
- JavaProjectClassLoader cl = new JavaProjectClassLoader(javaProject);
- results.addAll(cl.findClasses(fileName));
- }
- } catch (Exception e) {
- e.printStackTrace();
- }
- }
- return results;
- }
- else {
- try {
- resource = fHackedResourceSet.getResource(uri, true, kind);
- } catch (Throwable t) {
- // BPELUIPlugin.log(t);
- return t;
- }
-
- if (resource!=null && resource.getErrors().isEmpty() && resource.isLoaded()) {
- return resource.getContents().get(0);
- }
- }
- return null;
- }
-
- Object attemptLoad ( URI uri ) {
- return attemptLoad (uri, fResourceKind );
- }
-
-
- void attemptLoad ( IFile file ) {
- attemptLoad ( file.getFullPath().toString() );
- }
-
-
- void attemptLoad ( String path ) {
-
- if (fLoaderJob != null) {
- if (fLoaderJob.getState() == Job.RUNNING) {
- fLoaderJob.cancel();
- }
- }
-
- updateStatus ( Status.OK_STATUS );
-
- // empty paths are ignored
- path = path.trim();
- if (path.length() == 0) {
- return ;
- }
-
-
- URI uri = convertToURI ( path );
- if (uri == null) {
- return ;
- }
-
-
- if (uri.isRelative()) {
- // construct absolute path
- String absolutepath = fBasePath.substring(0, fBasePath.lastIndexOf('/')+1) + path;
- uri = URI.createURI(absolutepath);
- }
-
-
- fRunnableLoadURI = uri;
- final String msg = MessageFormat.format(Messages.SchemaImportDialog_17,fRunnableLoadURI);
- fLoaderJob = new Job(msg) {
-
- @Override
- protected IStatus run (IProgressMonitor monitor) {
- monitor.beginTask(msg, 1);
- // Bug 290090 - move this to asyncExec() as below because the method will
- // modify UI parameter, if not, will have a invalid access error.
-
- /* fInput = attemptLoad(fRunnableLoadURI); */
-
- monitor.worked(1);
- if (fBrowseButton != null
- && fBrowseButton.isDisposed() == false) {
- fBrowseButton.getDisplay().asyncExec(new Runnable() {
- public void run() {
- fInput = attemptLoad(fRunnableLoadURI);
- loadDone();
- }
- });
- }
-
- return Status.OK_STATUS;
- }
- };
-
- fLoaderJob.schedule();
- fRunnableStart = System.currentTimeMillis();
-
- updateStatus ( new Status(IStatus.INFO, Activator.getDefault().getID(),0,msg,null));
- }
-
-
-
- @SuppressWarnings("boxing")
- void loadDone () {
-
- long elapsed = System.currentTimeMillis() - fRunnableStart;
-
- if (fInput == null || fInput instanceof Throwable) {
- markEmptySelection();
-
- updateStatus( new Status(IStatus.ERROR,Activator.getDefault().getID(),0,
- MessageFormat.format(Messages.SchemaImportDialog_19,fRunnableLoadURI,elapsed),(Throwable) fInput) );
- fInput = null;
-
- } else {
-
- updateStatus ( new Status(IStatus.INFO, Activator.getDefault().getID(),0,
- MessageFormat.format(Messages.SchemaImportDialog_18,fRunnableLoadURI,elapsed),null)) ;
-
-
- // display a warning if this import does not define a targetNamespace
- String type = null;
- String ns = null;
- String loc = null;
- if (fInput instanceof XSDSchema) {
- XSDSchema schema = (XSDSchema)fInput;
- ns = schema.getTargetNamespace();
- loc = schema.getSchemaLocation();
- type = "XSD Schema";
- }
- else if (fInput instanceof Definition) {
- Definition definition = (Definition)fInput;
- ns = definition.getTargetNamespace();
- loc = definition.getLocation();
- type = "WSDL";
- }
- else if (fInput instanceof org.eclipse.bpmn2.DocumentRoot) {
- DocumentRoot root = (DocumentRoot)fInput;
- org.eclipse.bpmn2.Definitions definitions = root.getDefinitions();
- ns = definitions.getTargetNamespace();
- loc = root.eResource().getURI().toString();
- type = "BPMN2";
- fInput = definitions;
- }
- else if (fInput instanceof List) {
- markEmptySelection();
- }
- if (type!=null) {
- if (ns==null || ns.isEmpty()) {
- updateStatus ( new Status(IStatus.WARNING, Activator.getDefault().getID(),0,
- "This "+type+" does not define a target namespace",null)) ;
- }
- if (loc==null || loc.isEmpty()) {
- updateStatus( new Status(IStatus.ERROR,Activator.getDefault().getID(),0,
- MessageFormat.format(Messages.SchemaImportDialog_19,fRunnableLoadURI,elapsed),null) );
- fInput = null;
- }
- }
-
- fTreeViewer.setInput(fInput);
- fTree.getVerticalBar().setSelection(0);
- }
- }
-
-
-
- void markEmptySelection () {
- updateStatus ( Status.OK_STATUS );
- updateOK(false);
- fTreeViewer.setInput(null);
- }
-
-
- private URI convertToURI (String path ) {
-
- try {
- switch (fImportSource) {
- case BID_BROWSE_FILE :
- return URI.createFileURI( path );
-
- case BID_BROWSE_WORKSPACE :
- return URI.createPlatformResourceURI(path,false);
-
- case BID_BROWSE_WSIL :
- //return URI.createFileURI( path );
- case BID_BROWSE_URL :
- return URI.createURI(path);
-
-
-
- default :
- return null;
- }
-
- } catch (Exception ex) {
- updateStatus ( new Status(IStatus.ERROR,Activator.getDefault().getID(),0,Messages.SchemaImportDialog_13,ex) );
- return null;
- }
- }
-
- /**
- * Update the state of the OK button to the state indicated.
- *
- * @param state
- * false to disable, true to enable.
- */
-
- public void updateOK(boolean state) {
- Button okButton = getOkButton();
- if (okButton != null && !okButton.isDisposed()) {
- okButton.setEnabled(state);
- }
- }
-
- /**
- * @see org.eclipse.ui.dialogs.SelectionStatusDialog#computeResult()
- */
-
- @Override
- protected void computeResult() {
- Object object = fTreeViewer.getInput();
- if (object == null) {
- return;
- }
- if (fImportType == BID_IMPORT_JAVA) {
- IStructuredSelection sel = (IStructuredSelection)fTreeViewer.getSelection();
- if (!sel.isEmpty()) {
- TreeNode treeNode = (TreeNode)sel.getFirstElement();
- if (treeNode.getModelObject() instanceof Class)
- setSelectionResult(new Object[] { treeNode.getModelObject() });
- else
- setSelectionResult(null);
- }
- }
- else {
- setSelectionResult(new Object[] { object });
- }
- }
-
- /**
- * TODO: not implemented - do we need this?
- */
- public void configureAsXMLImport() {
- setTitle(Messages.SchemaImportDialog_1);
- fStructureTitle = Messages.SchemaImportDialog_12;
- if (fStructureLabel!=null)
- fStructureLabel.setText(fStructureTitle);
- fTreeContentProvider = new VariableTypeTreeContentProvider(true, true);
- if (fTreeViewer!=null)
- fTreeViewer.setContentProvider(fTreeContentProvider);
- fResourceKind = "xml";
-
- String[] wsdl_FILTER_EXTENSIONS = {
- "*.xml",
- "*.xsd",
- "*.wsdl",
- "*.*"
- };
- FILTER_EXTENSIONS = wsdl_FILTER_EXTENSIONS;
-
- String[] wsdl_FILTER_NAMES = {
- "XML Files",
- "XML Schema Files",
- "WSDL Definition Files",
- "All"
- };
- FILTER_NAMES = wsdl_FILTER_NAMES;
-
- resourceFilter = ".xml";
- if (fResourceComposite!=null)
- fResourceComposite.setFileFilter(resourceFilter);
- }
-
- /**
- * Configure the dialog as a schema import dialog. Set the title and the
- * structure pane message.
- *
- */
-
- public void configureAsSchemaImport() {
- setTitle(Messages.SchemaImportDialog_2);
- fStructureTitle = Messages.SchemaImportDialog_11;
- if (fStructureLabel!=null)
- fStructureLabel.setText(fStructureTitle);
- fTreeContentProvider = new VariableTypeTreeContentProvider(true, true);
- if (fTreeViewer!=null)
- fTreeViewer.setContentProvider(fTreeContentProvider);
- fResourceKind = "xsd";
-
- String[] wsdl_FILTER_EXTENSIONS = {
- "*.xml",
- "*.xsd",
- "*.wsdl",
- "*.*"
- };
- FILTER_EXTENSIONS = wsdl_FILTER_EXTENSIONS;
-
- String[] wsdl_FILTER_NAMES = {
- "XML Files",
- "XML Schema Files",
- "WSDL Definition Files",
- "All"
- };
- FILTER_NAMES = wsdl_FILTER_NAMES;
-
- resourceFilter = ".xsd";
- if (fResourceComposite!=null)
- fResourceComposite.setFileFilter(resourceFilter);
- }
-
- /**
- * Configure the dialog as a WSDL import dialog. Set the title and the
- * structure pane message.
- *
- */
-
- public void configureAsWSDLImport() {
-
- setTitle(Messages.SchemaImportDialog_0);
- fStructureTitle = Messages.SchemaImportDialog_14;
- if (fStructureLabel!=null)
- fStructureLabel.setText(fStructureTitle);
- fTreeContentProvider = new ServiceTreeContentProvider(true);
- if (fTreeViewer!=null)
- fTreeViewer.setContentProvider(fTreeContentProvider);
- fResourceKind = "wsdl";
-
- String[] wsdl_FILTER_EXTENSIONS = {
- "*.wsdl",
- "*.*"
- };
- FILTER_EXTENSIONS = wsdl_FILTER_EXTENSIONS;
-
- String[] wsdl_FILTER_NAMES = {
- "WSDL Definition Files",
- "All"
- };
- FILTER_NAMES = wsdl_FILTER_NAMES;
-
- resourceFilter = ".wsdl";
- if (fResourceComposite!=null)
- fResourceComposite.setFileFilter(resourceFilter);
- }
-
- public void configureAsBPMN2Import() {
-
- setTitle(Messages.SchemaImportDialog_29);
- fStructureTitle = Messages.SchemaImportDialog_30;
- if (fStructureLabel!=null)
- fStructureLabel.setText(fStructureTitle);
- fTreeContentProvider = new BPMN2DefinitionsTreeContentProvider(true);
- if (fTreeViewer!=null)
- fTreeViewer.setContentProvider(fTreeContentProvider);
- fResourceKind = "";
-
- String[] wsdl_FILTER_EXTENSIONS = {
- "*.bpmn",
- "*.bpmn2",
- "*.*"
- };
- FILTER_EXTENSIONS = wsdl_FILTER_EXTENSIONS;
-
- String[] wsdl_FILTER_NAMES = {
- "BPMN 2.0 Diagram Files",
- "BPMN 2.0 Diagram Files",
- "All"
- };
- FILTER_NAMES = wsdl_FILTER_NAMES;
-
- resourceFilter = ".bpmn";
- if (fResourceComposite!=null)
- fResourceComposite.setFileFilter(resourceFilter);
- }
-
- public void configureAsJavaImport() {
-
- setTitle(Messages.SchemaImportDialog_24);
- fStructureTitle = Messages.SchemaImportDialog_25;
- if (fStructureLabel!=null)
- fStructureLabel.setText(fStructureTitle);
- fTreeContentProvider = new JavaTreeContentProvider(true);
- if (fTreeViewer!=null)
- fTreeViewer.setContentProvider(fTreeContentProvider);
- fResourceKind = "java";
-
- String[] java_FILTER_EXTENSIONS = {
- "*.java",
- "*.class",
- "*.jar",
- "*.*"
- };
- FILTER_EXTENSIONS = java_FILTER_EXTENSIONS;
-
- String[] wsdl_FILTER_NAMES = {
- "Java Source Files",
- "Compiled Java Files",
- "Java Archives",
- "All"
- };
- FILTER_NAMES = wsdl_FILTER_NAMES;
-
- // Resource selection widget not used (yet)
- resourceFilter = ".java";
- if (fResourceComposite!=null)
- fResourceComposite.setFileFilter(resourceFilter);
- }
-
- @Override
- public void setTitle(String title) {
- super.setTitle(title);
- if (getShell()!=null)
- getShell().setText(title);
- }
-
- /**
- *
- * @author Michal Chmielewski (michal.chmielewski@oracle.com)
- * @date May 4, 2007
- *
- */
- public class TreeFilter extends ViewerFilter {
-
- /**
- * (non-Javadoc)
- *
- * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer,
- * java.lang.Object, java.lang.Object)
- */
- @Override
- public boolean select(Viewer viewer, Object parentElement,
- Object element) {
-
- if (fFilter == null || fFilter.length() == 0) {
- return true;
- }
-
- if (element instanceof Service) {
- String text = ""; //$NON-NLS-1$
- Service service = (Service) element;
- if (service.getName().size() > 0) {
- Name name = service.getName().get(0);
- text += name.getValue();
- }
- if (service.getAbstract().size() > 0) {
- TypeOfAbstract abst = service.getAbstract().get(0);
- text += abst.getValue();
- }
- return (text.toLowerCase().indexOf(fFilter) > -1);
- }
-
- return true;
- }
- }
-
- /**
- *
- * @author Michal Chmielewski (michal.chmielewski@oracle.com)
- * @date May 10, 2007
- *
- */
- public class WSILViewerComparator extends ViewerComparator {
-
- /**
- * @see org.eclipse.jface.viewers.ViewerComparator#category(java.lang.Object)
- */
- @Override
- public int category(Object element) {
- if (element instanceof Inspection)
- return 1;
- if (element instanceof Link)
- return 2;
- if (element instanceof Service)
- return 3;
-
- return 0;
- }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Bob Brodt
+ ******************************************************************************/
+
+package org.eclipse.bpmn2.modeler.ui.property.dialogs;
+import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.bpel.wsil.model.inspection.Description;
+import org.eclipse.bpel.wsil.model.inspection.Inspection;
+import org.eclipse.bpel.wsil.model.inspection.Link;
+import org.eclipse.bpel.wsil.model.inspection.Name;
+import org.eclipse.bpel.wsil.model.inspection.Service;
+import org.eclipse.bpel.wsil.model.inspection.TypeOfAbstract;
+import org.eclipse.bpmn2.DocumentRoot;
+import org.eclipse.bpmn2.modeler.core.model.Bpmn2ModelerResourceSetImpl;
+import org.eclipse.bpmn2.modeler.core.preferences.Bpmn2Preferences;
+import org.eclipse.bpmn2.modeler.core.utils.JavaProjectClassLoader;
+import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
+import org.eclipse.bpmn2.modeler.ui.Activator;
+import org.eclipse.bpmn2.modeler.ui.Messages;
+import org.eclipse.bpmn2.modeler.ui.editor.BPMN2Editor;
+import org.eclipse.bpmn2.modeler.ui.property.providers.BPMN2DefinitionsTreeContentProvider;
+import org.eclipse.bpmn2.modeler.ui.property.providers.JavaTreeContentProvider;
+import org.eclipse.bpmn2.modeler.ui.property.providers.ModelLabelProvider;
+import org.eclipse.bpmn2.modeler.ui.property.providers.ModelTreeLabelProvider;
+import org.eclipse.bpmn2.modeler.ui.property.providers.ServiceTreeContentProvider;
+import org.eclipse.bpmn2.modeler.ui.property.providers.TreeNode;
+import org.eclipse.bpmn2.modeler.ui.property.providers.VariableTypeTreeContentProvider;
+import org.eclipse.bpmn2.modeler.ui.property.providers.WSILContentProvider;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.Viewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.jface.viewers.ViewerFilter;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.KeyEvent;
+import org.eclipse.swt.events.KeyListener;
+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.Display;
+import org.eclipse.swt.widgets.Event;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Group;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.Tree;
+import org.eclipse.ui.dialogs.SelectionStatusDialog;
+import org.eclipse.ui.part.DrillDownComposite;
+import org.eclipse.wst.wsdl.Definition;
+import org.eclipse.xsd.XSDSchema;
+
+/**
+ * Browse for complex/simple types available in the process and choose that
+ * simple type.
+ *
+ */
+
+public class SchemaImportDialog extends SelectionStatusDialog {
+
+ // resource type flags for configuring this dialog:
+ public final static int ALLOW_XSD = (1 << 0);
+ public final static int ALLOW_WSDL = (1 << 1);
+ public final static int ALLOW_BPMN2 = (1 << 2);
+ public final static int ALLOW_JAVA = (1 << 3);
+
+ // Button id for browsing the workspace
+ protected final static int BID_BROWSE_WORKSPACE = IDialogConstants.CLIENT_ID + 1;
+ // Button id for browsing URLs
+ protected final static int BID_BROWSE_URL = IDialogConstants.CLIENT_ID + 2;
+ // Button id for browse files
+ protected final static int BID_BROWSE_FILE = IDialogConstants.CLIENT_ID + 3;
+ // button id for browsing WSIL
+ protected static final int BID_BROWSE_WSIL = IDialogConstants.CLIENT_ID + 5;
+ // Browse button id
+ protected static final int BID_BROWSE = IDialogConstants.CLIENT_ID + 4;
+ // Button id for import XML file types
+ protected static final int BID_IMPORT_XML = IDialogConstants.CLIENT_ID + 6;
+ // Button id for import XSD file types
+ protected static final int BID_IMPORT_XSD = IDialogConstants.CLIENT_ID + 7;
+ // Button id for import WSDL file types
+ protected static final int BID_IMPORT_WSDL = IDialogConstants.CLIENT_ID + 8;
+ // Button id for import BPMN 2.0 file types
+ protected static final int BID_IMPORT_BPMN2 = IDialogConstants.CLIENT_ID + 9;
+
+ ///////////////////////////////////////////////////////////////////////////////
+ // TODO: we may want to use JavaUI.createTypeDialog(...) instead of cluttering
+ // up this dialog with java types here...
+ ///////////////////////////////////////////////////////////////////////////////
+ // Button id for import Java types
+ protected static final int BID_IMPORT_JAVA = IDialogConstants.CLIENT_ID + 10;
+
+ // the current import type
+ private int fImportType = BID_IMPORT_XSD;
+ // the current import source
+ private int fImportSource = BID_BROWSE_WORKSPACE;
+ // the import type setting, remembered in the dialog settings
+ private static final String IMPORT_TYPE = "ImportType"; //$NON-NLS-1$
+ // the import source setting, remembered in the dialog settings
+ private static final String IMPORT_SOURCE = "ImportSource"; //$NON-NLS-1$
+
+ private static final String EMPTY = ""; //$NON-NLS-1$
+
+ private String[] FILTER_EXTENSIONS;
+ private String[] FILTER_NAMES;
+ private String resourceFilter;
+ protected String fResourceKind;
+
+ protected BPMN2Editor bpmn2Editor;
+ protected EObject modelObject;
+ protected int allowedResourceTypes;
+
+ protected Tree fTree;
+ protected TreeViewer fTreeViewer;
+
+ Text fLocation;
+ String fLocationText;
+ Label fLocationLabel;
+ Label fStructureLabel;
+
+ private Composite fLocationComposite;
+ FileSelectionGroup fResourceComposite;
+
+ // Import from WSIL constructs
+ private Composite fWSILComposite;
+ protected TreeViewer fWSILTreeViewer;
+ protected Tree fWSILTree;
+ protected Text filterText;
+ String fFilter = ""; //$NON-NLS-1$
+
+ Button fBrowseButton;
+
+ private Group fTypeGroup;
+
+ private Group fKindGroup;
+ private Composite fKindButtonComposite;
+
+ private IDialogSettings fSettings;
+
+ private String fStructureTitle;
+
+ private ITreeContentProvider fTreeContentProvider;
+
+ protected Object fInput;
+
+ protected Bpmn2ModelerResourceSetImpl fHackedResourceSet;
+
+ long fRunnableStart;
+ URI fRunnableLoadURI;
+ Job fLoaderJob;
+
+ IPreferenceStore fPrefStore = Activator.getDefault().getPreferenceStore();
+ String fBasePath = fPrefStore.getString(Bpmn2Preferences.PREF_WSIL_URL);
+
+ // The WSIL radio box is turned off if the WSIL document is not set in the
+ // modelEnablement.
+ Button fBtnWSIL;
+ Button fBtnResource;
+
+ /**
+ * Create a brand new shiny Schema Import Dialog.
+ *
+ * @param parent
+ */
+ public SchemaImportDialog(Shell parent, int allowedResourceTypes) {
+
+ super(parent);
+ setStatusLineAboveButtons(true);
+ int shellStyle = getShellStyle();
+ setShellStyle(shellStyle | SWT.MAX | SWT.RESIZE);
+
+ fSettings = Activator.getDefault().getDialogSettingsFor(this);
+
+ try {
+ fImportSource = fSettings.getInt(IMPORT_SOURCE);
+ fImportType = fSettings.getInt(IMPORT_TYPE);
+ } catch (java.lang.NumberFormatException nfe) {
+ fImportSource = BID_BROWSE_WORKSPACE;
+ fImportType = BID_IMPORT_XSD;
+ }
+
+ setDialogBoundsSettings(fSettings, getDialogBoundsStrategy());
+
+ this.allowedResourceTypes = allowedResourceTypes;
+ if ((allowedResourceTypes & ALLOW_XSD) == 0) {
+ if (fImportType==BID_IMPORT_XML || fImportType==BID_IMPORT_XSD)
+ fImportType = 0;
+ }
+ if ((allowedResourceTypes & ALLOW_WSDL) == 0) {
+ if (fImportType==BID_IMPORT_WSDL)
+ fImportType = 0;
+ }
+ if ((allowedResourceTypes & ALLOW_BPMN2) == 0) {
+ if (fImportType==BID_IMPORT_BPMN2)
+ fImportType = 0;
+ }
+ if ((allowedResourceTypes & ALLOW_JAVA) == 0) {
+ if (fImportType==BID_IMPORT_JAVA)
+ fImportType = 0;
+ }
+ if (fImportType==0) {
+ if ((allowedResourceTypes & ALLOW_XSD) != 0)
+ fImportType = BID_IMPORT_XSD;
+ if ((allowedResourceTypes & ALLOW_WSDL) != 0)
+ fImportType = BID_IMPORT_WSDL;
+ if ((allowedResourceTypes & ALLOW_BPMN2) != 0)
+ fImportType = BID_IMPORT_BPMN2;
+ if ((allowedResourceTypes & ALLOW_JAVA) != 0)
+ fImportType = BID_IMPORT_JAVA;
+ }
+
+ if (fImportType==BID_IMPORT_XML)
+ configureAsXMLImport();
+ else if (fImportType==BID_IMPORT_XSD)
+ configureAsSchemaImport();
+ else if (fImportType==BID_IMPORT_WSDL)
+ configureAsWSDLImport();
+ else if (fImportType==BID_IMPORT_BPMN2)
+ configureAsBPMN2Import();
+ else if (fImportType==BID_IMPORT_JAVA)
+ configureAsJavaImport();
+
+ bpmn2Editor = BPMN2Editor.getActiveEditor();
+ ResourceSet rs = bpmn2Editor.getResourceSet();
+ fHackedResourceSet = ModelUtil.slightlyHackedResourceSet(rs);
+ }
+
+ public SchemaImportDialog(Shell parent) {
+ this(parent, -1);
+ }
+
+ /**
+ *
+ * @see Dialog#createDialogArea(Composite)
+ *
+ * @param parent
+ * the parent composite to use
+ * @return the composite it created to businessObject used in the dialog area.
+ */
+
+ @Override
+ public Control createDialogArea(Composite parent) {
+
+ Composite contents = (Composite) super.createDialogArea(parent);
+
+ createImportType(contents);
+ createImportLocation(contents);
+ createImportStructure(contents);
+
+ buttonPressed(fImportSource, true);
+ return contents;
+ }
+
+ @Override
+ protected void buttonPressed(int buttonId) {
+ switch (buttonId) {
+ case BID_BROWSE:
+ if (fImportSource == BID_BROWSE_URL) {
+ String loc = fLocation.getText();
+ if (loc.length() > 0) {
+ attemptLoad(loc);
+ }
+ }
+ else {
+ FileDialog fileDialog = new FileDialog(getShell());
+ fileDialog.setFilterExtensions(FILTER_EXTENSIONS);
+ fileDialog.setFilterNames(FILTER_NAMES);
+ String path = fileDialog.open();
+ if (path == null) {
+ return;
+ }
+ fLocation.setText(path);
+ attemptLoad(path);
+ }
+ break;
+
+ case IDialogConstants.CANCEL_ID:
+ if (fLoaderJob != null) {
+ if (fLoaderJob.getState() == Job.RUNNING) {
+ fLoaderJob.cancel();
+ }
+ }
+ break;
+ }
+
+ super.buttonPressed(buttonId);
+ }
+
+ protected void buttonPressed(int id, boolean checked) {
+
+ if (id==BID_BROWSE_FILE
+ || id==BID_BROWSE_WORKSPACE
+ || id==BID_BROWSE_URL
+ || id==BID_BROWSE_WSIL) {
+ if (checked==false) {
+ return;
+ }
+ if (id==BID_BROWSE_WSIL) {
+ if (fBasePath==null || fBasePath.isEmpty()) {
+ MessageDialog.openInformation(getShell(), "WSIL Browser",
+ "In order to browse a WSIL registry, please configure a\n"+
+ "WSIL Document URL in the BPMN2 Preferences.");
+ Display.getDefault().asyncExec(new Runnable() {
+ @Override
+ public void run() {
+ fBtnWSIL.setSelection(false);
+ fBtnResource.setSelection(true);
+ buttonPressed(BID_BROWSE_WORKSPACE, true);
+ }
+ });
+ return;
+ }
+ }
+
+ fImportSource = id;
+ fSettings.put(IMPORT_SOURCE, fImportSource);
+ }
+ else if (id==BID_IMPORT_XML
+ || id==BID_IMPORT_XSD
+ || id==BID_IMPORT_WSDL
+ || id==BID_IMPORT_BPMN2
+ || id==BID_IMPORT_JAVA) {
+ if (checked==false) {
+ return;
+ }
+ if (id==BID_IMPORT_XML) {
+ configureAsXMLImport();
+ setVisibleControl(fKindButtonComposite,true);
+ }
+ else if (id==BID_IMPORT_XSD) {
+ configureAsSchemaImport();
+ setVisibleControl(fKindButtonComposite,true);
+ }
+ else if (id==BID_IMPORT_WSDL) {
+ configureAsWSDLImport();
+ setVisibleControl(fKindButtonComposite,true);
+ }
+ else if (id==BID_IMPORT_BPMN2) {
+ configureAsBPMN2Import();
+ setVisibleControl(fKindButtonComposite,true);
+ }
+ else if (id==BID_IMPORT_JAVA) {
+ configureAsJavaImport();
+ setVisibleControl(fKindButtonComposite,false);
+ }
+
+ fImportType = id;
+ fSettings.put(IMPORT_TYPE, fImportType);
+ }
+
+ setVisibleControl(fResourceComposite, fImportSource==BID_BROWSE_WORKSPACE && fImportType != BID_IMPORT_JAVA);
+ setVisibleControl(fLocationComposite, fImportSource==BID_BROWSE_URL || fImportSource==BID_BROWSE_FILE || fImportType==BID_IMPORT_JAVA);
+ setVisibleControl(fWSILComposite, fImportSource==BID_BROWSE_WSIL && fImportType != BID_IMPORT_JAVA);
+ if (fImportType==BID_IMPORT_JAVA) {
+ setVisibleControl(fKindButtonComposite, false);
+ setVisibleControl(fBrowseButton,false);
+ fLocationLabel.setText(Messages.SchemaImportDialog_27);
+ }
+ else {
+ setVisibleControl(fKindButtonComposite, true);
+ setVisibleControl(fBrowseButton,true);
+ fLocationLabel.setText(Messages.SchemaImportDialog_8);
+ fBrowseButton.setText(fImportSource==BID_BROWSE_FILE || fImportSource==BID_BROWSE_WSIL ?
+ Messages.SchemaImportDialog_9 : Messages.SchemaImportDialog_26);
+ }
+ fLocation.setText(EMPTY);
+ fTypeGroup.getParent().layout(true);
+ fKindGroup.getParent().layout(true);
+
+ markEmptySelection();
+ }
+
+ protected void setVisibleControl(Control c, boolean b) {
+ Object layoutData = c.getLayoutData();
+
+ if (layoutData instanceof GridData) {
+ GridData data = (GridData) layoutData;
+ data.exclude = !b;
+ }
+ c.setVisible(b);
+ }
+
+ /**
+ * Create the dialog.
+ *
+ */
+
+ @Override
+ public void create() {
+ super.create();
+ buttonPressed(fImportSource, true);
+ }
+
+ protected Button createRadioButton(Composite parent, String label, int id,
+ boolean checked) {
+
+ Button button = new Button(parent, SWT.RADIO);
+ button.setText(label);
+ button.setFont(JFaceResources.getDialogFont());
+ button.setData( Integer.valueOf( id ));
+ button.setSelection(checked);
+
+ button.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent event) {
+ Button b = (Button) event.widget;
+ int bid = ((Integer) b.getData()).intValue();
+
+ buttonPressed(bid, b.getSelection());
+ }
+ });
+
+ return button;
+
+ }
+
+ protected void createImportType(Composite parent) {
+ fTypeGroup = new Group(parent, SWT.SHADOW_ETCHED_IN);
+ fTypeGroup.setText(Messages.SchemaImportDialog_3);
+ GridLayout layout = new GridLayout(1, true);
+ GridData typeGroupGridData = new GridData();
+ typeGroupGridData.grabExcessVerticalSpace = false;
+ typeGroupGridData.grabExcessHorizontalSpace = true;
+ typeGroupGridData.horizontalAlignment = GridData.FILL;
+ typeGroupGridData.verticalAlignment = GridData.FILL;
+
+ fTypeGroup.setLayout(layout);
+ fTypeGroup.setLayoutData(typeGroupGridData);
+
+ Composite container = new Composite(fTypeGroup, SWT.NONE);
+
+ layout = new GridLayout();
+ layout.makeColumnsEqualWidth = false;
+ layout.numColumns = 4;
+ container.setLayout(layout);
+ GridData data = new GridData();
+ data.grabExcessVerticalSpace = false;
+ data.grabExcessHorizontalSpace = true;
+ data.horizontalAlignment = GridData.FILL;
+ data.verticalAlignment = GridData.CENTER;
+ container.setLayoutData(data);
+
+ Button button;
+
+// button = createRadioButton(control, Messages.SchemaImportDialog_20,
+// BID_IMPORT_XML, fImportType == BID_IMPORT_XML);
+// button.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,1,1));
+ int buttonCount = 0;
+ if ((allowedResourceTypes & ALLOW_XSD) != 0) {
+ button = createRadioButton(container, Messages.SchemaImportDialog_21,
+ BID_IMPORT_XSD, fImportType == BID_IMPORT_XSD);
+ button.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,1,1));
+ ++buttonCount;
+ }
+
+ if ((allowedResourceTypes & ALLOW_WSDL) != 0) {
+ button = createRadioButton(container, Messages.SchemaImportDialog_22,
+ BID_IMPORT_WSDL, fImportType == BID_IMPORT_WSDL);
+ button.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,1,1));
+ ++buttonCount;
+ }
+
+ if ((allowedResourceTypes & ALLOW_BPMN2) != 0) {
+ button = createRadioButton(container, Messages.SchemaImportDialog_28,
+ BID_IMPORT_BPMN2, fImportType == BID_IMPORT_BPMN2);
+ button.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,1,1));
+ ++buttonCount;
+ }
+
+ if ((allowedResourceTypes & ALLOW_JAVA) != 0) {
+ button = createRadioButton(container, Messages.SchemaImportDialog_23,
+ BID_IMPORT_JAVA, fImportType == BID_IMPORT_JAVA);
+ button.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true,1,1));
+ ++buttonCount;
+ }
+ if (buttonCount==1) {
+ fTypeGroup.setVisible(false);
+ typeGroupGridData.exclude = true;
+ }
+ }
+
+ protected void createImportLocation(Composite parent) {
+
+ fKindGroup = new Group(parent, SWT.SHADOW_ETCHED_IN);
+ fKindGroup.setText(Messages.SchemaImportDialog_4);
+ GridLayout layout = new GridLayout(1, true);
+ GridData data = new GridData();
+ data.grabExcessVerticalSpace = false;
+ data.grabExcessHorizontalSpace = true;
+ data.horizontalAlignment = GridData.FILL;
+ data.verticalAlignment = GridData.FILL;
+
+ fKindGroup.setLayout(layout);
+ fKindGroup.setLayoutData(data);
+
+ fKindButtonComposite = new Composite(fKindGroup, SWT.NONE);
+
+ layout = new GridLayout();
+ layout.makeColumnsEqualWidth = true;
+ layout.numColumns = 4;
+ fKindButtonComposite.setLayout(layout);
+ data = new GridData();
+ data.grabExcessVerticalSpace = false;
+ data.grabExcessHorizontalSpace = true;
+ data.horizontalAlignment = GridData.FILL;
+ data.verticalAlignment = GridData.CENTER;
+ fKindButtonComposite.setLayoutData(data);
+
+ fBtnResource = createRadioButton(fKindButtonComposite, Messages.SchemaImportDialog_5,
+ BID_BROWSE_WORKSPACE, fImportSource == BID_BROWSE_WORKSPACE);
+ createRadioButton(fKindButtonComposite, Messages.SchemaImportDialog_6,
+ BID_BROWSE_FILE, fImportSource == BID_BROWSE_FILE);
+ createRadioButton(fKindButtonComposite, Messages.SchemaImportDialog_7,
+ BID_BROWSE_URL, fImportSource == BID_BROWSE_URL);
+
+ // Add WSIL option
+ fBtnWSIL = createRadioButton(fKindButtonComposite, Messages.SchemaImportDialog_15,
+ BID_BROWSE_WSIL, fImportSource == BID_BROWSE_WSIL);
+
+ // Create location variant
+ fLocationComposite = new Composite(fKindGroup, SWT.NONE);
+
+ layout = new GridLayout();
+ layout.numColumns = 3;
+ fLocationComposite.setLayout(layout);
+ data = new GridData();
+ data.grabExcessVerticalSpace = true;
+ data.grabExcessHorizontalSpace = true;
+ data.horizontalAlignment = GridData.FILL;
+ data.verticalAlignment = GridData.FILL;
+ fLocationComposite.setLayoutData(data);
+
+ fLocationLabel = new Label(fLocationComposite, SWT.NONE);
+ fLocationLabel.setText(Messages.SchemaImportDialog_8);
+
+ fLocation = new Text(fLocationComposite, SWT.BORDER);
+ fLocation.setText(EMPTY);
+ data = new GridData();
+ data.grabExcessVerticalSpace = false;
+ data.grabExcessHorizontalSpace = true;
+ data.horizontalAlignment = GridData.FILL;
+ data.verticalAlignment = GridData.FILL;
+ fLocation.setLayoutData(data);
+// fLocation.addListener(SWT.FocusOut, new Listener() {
+//
+// public void handleEvent(Event event) {
+// String loc = fLocation.getText();
+// if (loc.length() > 0) {
+// attemptLoad(loc);
+// }
+// }
+// });
+ fLocation.addKeyListener(new KeyListener() {
+
+ public void keyPressed(KeyEvent event) {
+ if (fImportType == BID_IMPORT_JAVA) {
+ }
+ else if (event.keyCode == SWT.CR) {
+ attemptLoad(fLocation.getText());
+ event.doit = false;
+ }
+ }
+
+ public void keyReleased(KeyEvent e) {
+ if (fImportType == BID_IMPORT_JAVA) {
+ String s = fLocation.getText();
+ if (s!=null && s.length()>1) {
+ if (!s.equals(fLocationText)) {
+ fLocationText = s;
+ attemptLoad(s);
+ }
+ }
+ }
+ }
+
+ });
+
+ fBrowseButton = createButton(fLocationComposite, BID_BROWSE,
+ Messages.SchemaImportDialog_9, false);
+
+ // End of location variant
+
+ // Start Resource Variant
+ fResourceComposite = new FileSelectionGroup(fKindGroup, new Listener() {
+ public void handleEvent(Event event) {
+ IResource resource = fResourceComposite.getSelectedResource();
+ if (resource != null && resource.getType() == IResource.FILE) {
+ // only attempt to load a resource which is not a control
+ attemptLoad((IFile) resource);
+ return;
+ }
+ markEmptySelection();
+ }
+ }, Messages.SchemaImportDialog_10, resourceFilter); //$NON-NLS-1$
+
+ TreeViewer viewer = fResourceComposite.getTreeViewer();
+ viewer.setAutoExpandLevel(2);
+
+ // End resource variant
+
+ // create WSIL UI widgets
+ createWSILStructure(fKindGroup);
+
+ }
+
+ protected Object createWSILStructure(Composite parent) {
+
+ fWSILComposite = new Composite(parent, SWT.NONE);
+
+ GridLayout layout = new GridLayout();
+ layout.marginWidth = 0;
+ fWSILComposite.setLayout(layout);
+
+ GridData data = new GridData();
+ data.grabExcessVerticalSpace = true;
+ data.grabExcessHorizontalSpace = true;
+ data.horizontalAlignment = GridData.FILL;
+ data.verticalAlignment = GridData.FILL;
+ data.minimumHeight = 220;
+ fWSILComposite.setLayoutData(data);
+
+ Label location = new Label(fWSILComposite, SWT.NONE);
+ location.setText( Messages.SchemaImportDialog_16 );
+
+ data = new GridData();
+ data.grabExcessHorizontalSpace = true;
+ data.horizontalAlignment = SWT.LEFT;
+ location.setLayoutData(data);
+
+ filterText = new Text(fWSILComposite, SWT.BORDER);
+ data = new GridData(GridData.FILL_HORIZONTAL);
+ filterText.setLayoutData(data);
+
+ filterText.addKeyListener(new KeyListener() {
+
+ public void keyPressed(KeyEvent e) {
+
+ }
+
+ public void keyReleased(KeyEvent e) {
+ // set the value of the filter.
+ fFilter = filterText.getText().trim().toLowerCase();
+
+ if (fFilter.length() > 0) {
+ /* for the time being, only filter 3 levels deep
+ * since link references within WSIL are rare at
+ * this time. when adoption of WSIL directories
+ * take off, this needs to businessObject rehashed */
+ fWSILTreeViewer.expandToLevel(3);
+ }
+ fWSILTreeViewer.refresh();
+ e.doit = false;
+ }
+ });
+
+ DrillDownComposite wsilTreeComposite = new DrillDownComposite(fWSILComposite, SWT.BORDER);
+
+ layout = new GridLayout();
+ layout.marginWidth = 0;
+ layout.marginHeight = 0;
+ layout.verticalSpacing = 0;
+ wsilTreeComposite.setLayout(layout);
+
+ data = new GridData();
+ data.grabExcessVerticalSpace = true;
+ data.grabExcessHorizontalSpace = true;
+ data.horizontalAlignment = GridData.FILL;
+ data.verticalAlignment = GridData.FILL;
+ wsilTreeComposite.setLayoutData(data);
+
+ // Tree viewer for variable structure ...
+ fWSILTree = new Tree(wsilTreeComposite, SWT.NONE );
+ data = new GridData();
+ data.grabExcessVerticalSpace = true;
+ data.grabExcessHorizontalSpace = true;
+ data.horizontalAlignment = GridData.FILL;
+ data.verticalAlignment = GridData.FILL;
+ data.minimumHeight = 200;
+ fWSILTree.setLayoutData(data);
+
+ fWSILTreeViewer = new TreeViewer( fWSILTree );
+ fWSILTreeViewer.setContentProvider( new WSILContentProvider() );
+ fWSILTreeViewer.setLabelProvider( new ModelLabelProvider() );
+
+ Object wsilDoc = attemptLoad(URI.createURI(fBasePath),"wsil");
+ fWSILTreeViewer.setInput ( wsilDoc ) ;
+ if (wsilDoc == null || wsilDoc instanceof Throwable ) {
+// fBtnWSIL.setEnabled(false);
+ // that's always available.
+ // delete fImportSource = BID_BROWSE_WORKSPACE; by Grid.Qian
+ // because if not, the dialog always display the resource Control
+ // regardless last time if user choose the resource button
+
+ /*// that's always available.
+ fImportSource = BID_BROWSE_WORKSPACE;*/
+ }
+
+
+ // set default tree expansion to the 2nd level
+ fWSILTreeViewer.expandToLevel(2);
+ fWSILTreeViewer.addFilter(new TreeFilter());
+ fWSILTreeViewer.setComparator(new WSILViewerComparator());
+
+ wsilTreeComposite.setChildTree(fWSILTreeViewer);
+
+ fWSILTreeViewer
+ .addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ // TODO Auto-generated method stub
+ IStructuredSelection sel = (IStructuredSelection) event.getSelection();
+ if (sel.getFirstElement() instanceof Service) {
+ Service serv = (Service) sel.getFirstElement();
+ Description descr = serv.getDescription().get(0);
+ attemptLoad(descr.getLocation());
+ } else {
+ markEmptySelection();
+ }
+ }
+ });
+ // end tree viewer for variable structure
+
+ return fWSILComposite;
+ }
+
+ protected Object createImportStructure(Composite parent) {
+
+ fStructureLabel = new Label(parent, SWT.NONE);
+ fStructureLabel.setText(fStructureTitle);
+
+ // Tree viewer for variable structure ...
+ fTree = new Tree(parent, SWT.BORDER);
+
+ fTreeViewer = new TreeViewer(fTree);
+ fTreeViewer.setContentProvider(fTreeContentProvider);
+ fTreeViewer.setLabelProvider(new ModelTreeLabelProvider());
+ fTreeViewer.setInput(null);
+ fTreeViewer.setAutoExpandLevel(3);
+ fTreeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ IStructuredSelection sel = (IStructuredSelection) event.getSelection();
+ if (!sel.isEmpty()) {
+ computeResult();
+ if (getResult()!=null)
+ updateStatus(Status.OK_STATUS);
+ else
+ updateStatus(new Status(IStatus.ERROR, Activator.getDefault().getID(),0,
+ Messages.SchemaImportDialog_31,null));
+ } else {
+ markEmptySelection();
+ }
+ }
+ });
+ // end tree viewer for variable structure
+ GridData data = new GridData();
+ data.grabExcessVerticalSpace = true;
+ data.grabExcessHorizontalSpace = true;
+ data.horizontalAlignment = GridData.FILL;
+ data.verticalAlignment = GridData.FILL;
+ data.minimumHeight = 200;
+ fTree.setLayoutData(data);
+
+ return fTree;
+ }
+
+ Object attemptLoad(URI uri, String kind) {
+
+ Resource resource = null;
+ if ("java".equals(kind)) {
+ final String fileName = uri.lastSegment();
+ final List<Class> results = new ArrayList<Class>();
+ IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
+ for (IProject p : projects) {
+ try {
+ if (p.isOpen() && p.hasNature(JavaCore.NATURE_ID)) {
+ final IJavaProject javaProject = JavaCore.create(p);
+ JavaProjectClassLoader cl = new JavaProjectClassLoader(javaProject);
+ results.addAll(cl.findClasses(fileName));
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ return results;
+ }
+ else {
+ try {
+ resource = fHackedResourceSet.getResource(uri, true, kind);
+ } catch (Throwable t) {
+ // BPELUIPlugin.log(t);
+ return t;
+ }
+
+ if (resource!=null && resource.getErrors().isEmpty() && resource.isLoaded()) {
+ return resource.getContents().get(0);
+ }
+ }
+ return null;
+ }
+
+ Object attemptLoad ( URI uri ) {
+ return attemptLoad (uri, fResourceKind );
+ }
+
+
+ void attemptLoad ( IFile file ) {
+ attemptLoad ( file.getFullPath().toString() );
+ }
+
+
+ void attemptLoad ( String path ) {
+
+ if (fLoaderJob != null) {
+ if (fLoaderJob.getState() == Job.RUNNING) {
+ fLoaderJob.cancel();
+ }
+ }
+
+ updateStatus ( Status.OK_STATUS );
+
+ // empty paths are ignored
+ path = path.trim();
+ if (path.length() == 0) {
+ return ;
+ }
+
+
+ URI uri = convertToURI ( path );
+ if (uri == null) {
+ return ;
+ }
+
+
+ if (uri.isRelative()) {
+ // construct absolute path
+ String absolutepath = fBasePath.substring(0, fBasePath.lastIndexOf('/')+1) + path;
+ uri = URI.createURI(absolutepath);
+ }
+
+
+ fRunnableLoadURI = uri;
+ final String msg = MessageFormat.format(Messages.SchemaImportDialog_17,fRunnableLoadURI);
+ fLoaderJob = new Job(msg) {
+
+ @Override
+ protected IStatus run (IProgressMonitor monitor) {
+ monitor.beginTask(msg, 1);
+ // Bug 290090 - move this to asyncExec() as below because the method will
+ // modify UI parameter, if not, will have a invalid access error.
+
+ /* fInput = attemptLoad(fRunnableLoadURI); */
+
+ monitor.worked(1);
+ if (fBrowseButton != null
+ && fBrowseButton.isDisposed() == false) {
+ fBrowseButton.getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ fInput = attemptLoad(fRunnableLoadURI);
+ loadDone();
+ }
+ });
+ }
+
+ return Status.OK_STATUS;
+ }
+ };
+
+ fLoaderJob.schedule();
+ fRunnableStart = System.currentTimeMillis();
+
+ updateStatus ( new Status(IStatus.INFO, Activator.getDefault().getID(),0,msg,null));
+ }
+
+
+
+ @SuppressWarnings("boxing")
+ void loadDone () {
+
+ long elapsed = System.currentTimeMillis() - fRunnableStart;
+
+ if (fInput == null || fInput instanceof Throwable) {
+ markEmptySelection();
+
+ updateStatus( new Status(IStatus.ERROR,Activator.getDefault().getID(),0,
+ MessageFormat.format(Messages.SchemaImportDialog_19,fRunnableLoadURI,elapsed),(Throwable) fInput) );
+ fInput = null;
+
+ } else {
+
+ updateStatus ( new Status(IStatus.INFO, Activator.getDefault().getID(),0,
+ MessageFormat.format(Messages.SchemaImportDialog_18,fRunnableLoadURI,elapsed),null)) ;
+
+
+ // display a warning if this import does not define a targetNamespace
+ String type = null;
+ String ns = null;
+ String loc = null;
+ if (fInput instanceof XSDSchema) {
+ XSDSchema schema = (XSDSchema)fInput;
+ ns = schema.getTargetNamespace();
+ loc = schema.getSchemaLocation();
+ type = "XSD Schema";
+ }
+ else if (fInput instanceof Definition) {
+ Definition definition = (Definition)fInput;
+ ns = definition.getTargetNamespace();
+ loc = definition.getLocation();
+ type = "WSDL";
+ }
+ else if (fInput instanceof org.eclipse.bpmn2.DocumentRoot) {
+ DocumentRoot root = (DocumentRoot)fInput;
+ org.eclipse.bpmn2.Definitions definitions = root.getDefinitions();
+ ns = definitions.getTargetNamespace();
+ loc = root.eResource().getURI().toString();
+ type = "BPMN2";
+ fInput = definitions;
+ }
+ else if (fInput instanceof List) {
+ markEmptySelection();
+ }
+ if (type!=null) {
+ if (ns==null || ns.isEmpty()) {
+ updateStatus ( new Status(IStatus.WARNING, Activator.getDefault().getID(),0,
+ "This "+type+" does not define a target namespace",null)) ;
+ }
+ if (loc==null || loc.isEmpty()) {
+ updateStatus( new Status(IStatus.ERROR,Activator.getDefault().getID(),0,
+ MessageFormat.format(Messages.SchemaImportDialog_19,fRunnableLoadURI,elapsed),null) );
+ fInput = null;
+ }
+ }
+
+ fTreeViewer.setInput(fInput);
+ fTree.getVerticalBar().setSelection(0);
+ }
+ }
+
+
+
+ void markEmptySelection () {
+ updateStatus ( Status.OK_STATUS );
+ updateOK(false);
+ fTreeViewer.setInput(null);
+ }
+
+
+ private URI convertToURI (String path ) {
+
+ try {
+ switch (fImportSource) {
+ case BID_BROWSE_FILE :
+ return URI.createFileURI( path );
+
+ case BID_BROWSE_WORKSPACE :
+ return URI.createPlatformResourceURI(path,false);
+
+ case BID_BROWSE_WSIL :
+ //return URI.createFileURI( path );
+ case BID_BROWSE_URL :
+ return URI.createURI(path);
+
+
+
+ default :
+ return null;
+ }
+
+ } catch (Exception ex) {
+ updateStatus ( new Status(IStatus.ERROR,Activator.getDefault().getID(),0,Messages.SchemaImportDialog_13,ex) );
+ return null;
+ }
+ }
+
+ /**
+ * Update the state of the OK button to the state indicated.
+ *
+ * @param state
+ * false to disable, true to enable.
+ */
+
+ public void updateOK(boolean state) {
+ Button okButton = getOkButton();
+ if (okButton != null && !okButton.isDisposed()) {
+ okButton.setEnabled(state);
+ }
+ }
+
+ /**
+ * @see org.eclipse.ui.dialogs.SelectionStatusDialog#computeResult()
+ */
+
+ @Override
+ protected void computeResult() {
+ Object object = fTreeViewer.getInput();
+ if (object == null) {
+ return;
+ }
+ if (fImportType == BID_IMPORT_JAVA) {
+ IStructuredSelection sel = (IStructuredSelection)fTreeViewer.getSelection();
+ if (!sel.isEmpty()) {
+ TreeNode treeNode = (TreeNode)sel.getFirstElement();
+ if (treeNode.getModelObject() instanceof Class)
+ setSelectionResult(new Object[] { treeNode.getModelObject() });
+ else
+ setSelectionResult(null);
+ }
+ }
+ else {
+ setSelectionResult(new Object[] { object });
+ }
+ }
+
+ /**
+ * TODO: not implemented - do we need this?
+ */
+ public void configureAsXMLImport() {
+ setTitle(Messages.SchemaImportDialog_1);
+ fStructureTitle = Messages.SchemaImportDialog_12;
+ if (fStructureLabel!=null)
+ fStructureLabel.setText(fStructureTitle);
+ fTreeContentProvider = new VariableTypeTreeContentProvider(true, true);
+ if (fTreeViewer!=null)
+ fTreeViewer.setContentProvider(fTreeContentProvider);
+ fResourceKind = "xml";
+
+ String[] wsdl_FILTER_EXTENSIONS = {
+ "*.xml",
+ "*.xsd",
+ "*.wsdl",
+ "*.*"
+ };
+ FILTER_EXTENSIONS = wsdl_FILTER_EXTENSIONS;
+
+ String[] wsdl_FILTER_NAMES = {
+ "XML Files",
+ "XML Schema Files",
+ "WSDL Definition Files",
+ "All"
+ };
+ FILTER_NAMES = wsdl_FILTER_NAMES;
+
+ resourceFilter = ".xml";
+ if (fResourceComposite!=null)
+ fResourceComposite.setFileFilter(resourceFilter);
+ }
+
+ /**
+ * Configure the dialog as a schema import dialog. Set the title and the
+ * structure pane message.
+ *
+ */
+
+ public void configureAsSchemaImport() {
+ setTitle(Messages.SchemaImportDialog_2);
+ fStructureTitle = Messages.SchemaImportDialog_11;
+ if (fStructureLabel!=null)
+ fStructureLabel.setText(fStructureTitle);
+ fTreeContentProvider = new VariableTypeTreeContentProvider(true, true);
+ if (fTreeViewer!=null)
+ fTreeViewer.setContentProvider(fTreeContentProvider);
+ fResourceKind = "xsd";
+
+ String[] wsdl_FILTER_EXTENSIONS = {
+ "*.xml",
+ "*.xsd",
+ "*.wsdl",
+ "*.*"
+ };
+ FILTER_EXTENSIONS = wsdl_FILTER_EXTENSIONS;
+
+ String[] wsdl_FILTER_NAMES = {
+ "XML Files",
+ "XML Schema Files",
+ "WSDL Definition Files",
+ "All"
+ };
+ FILTER_NAMES = wsdl_FILTER_NAMES;
+
+ resourceFilter = ".xsd";
+ if (fResourceComposite!=null)
+ fResourceComposite.setFileFilter(resourceFilter);
+ }
+
+ /**
+ * Configure the dialog as a WSDL import dialog. Set the title and the
+ * structure pane message.
+ *
+ */
+
+ public void configureAsWSDLImport() {
+
+ setTitle(Messages.SchemaImportDialog_0);
+ fStructureTitle = Messages.SchemaImportDialog_14;
+ if (fStructureLabel!=null)
+ fStructureLabel.setText(fStructureTitle);
+ fTreeContentProvider = new ServiceTreeContentProvider(true);
+ if (fTreeViewer!=null)
+ fTreeViewer.setContentProvider(fTreeContentProvider);
+ fResourceKind = "wsdl";
+
+ String[] wsdl_FILTER_EXTENSIONS = {
+ "*.wsdl",
+ "*.*"
+ };
+ FILTER_EXTENSIONS = wsdl_FILTER_EXTENSIONS;
+
+ String[] wsdl_FILTER_NAMES = {
+ "WSDL Definition Files",
+ "All"
+ };
+ FILTER_NAMES = wsdl_FILTER_NAMES;
+
+ resourceFilter = ".wsdl";
+ if (fResourceComposite!=null)
+ fResourceComposite.setFileFilter(resourceFilter);
+ }
+
+ public void configureAsBPMN2Import() {
+
+ setTitle(Messages.SchemaImportDialog_29);
+ fStructureTitle = Messages.SchemaImportDialog_30;
+ if (fStructureLabel!=null)
+ fStructureLabel.setText(fStructureTitle);
+ fTreeContentProvider = new BPMN2DefinitionsTreeContentProvider(true);
+ if (fTreeViewer!=null)
+ fTreeViewer.setContentProvider(fTreeContentProvider);
+ fResourceKind = "";
+
+ String[] wsdl_FILTER_EXTENSIONS = {
+ "*.bpmn",
+ "*.bpmn2",
+ "*.*"
+ };
+ FILTER_EXTENSIONS = wsdl_FILTER_EXTENSIONS;
+
+ String[] wsdl_FILTER_NAMES = {
+ "BPMN 2.0 Diagram Files",
+ "BPMN 2.0 Diagram Files",
+ "All"
+ };
+ FILTER_NAMES = wsdl_FILTER_NAMES;
+
+ resourceFilter = ".bpmn";
+ if (fResourceComposite!=null)
+ fResourceComposite.setFileFilter(resourceFilter);
+ }
+
+ public void configureAsJavaImport() {
+
+ setTitle(Messages.SchemaImportDialog_24);
+ fStructureTitle = Messages.SchemaImportDialog_25;
+ if (fStructureLabel!=null)
+ fStructureLabel.setText(fStructureTitle);
+ fTreeContentProvider = new JavaTreeContentProvider(true);
+ if (fTreeViewer!=null)
+ fTreeViewer.setContentProvider(fTreeContentProvider);
+ fResourceKind = "java";
+
+ String[] java_FILTER_EXTENSIONS = {
+ "*.java",
+ "*.class",
+ "*.jar",
+ "*.*"
+ };
+ FILTER_EXTENSIONS = java_FILTER_EXTENSIONS;
+
+ String[] wsdl_FILTER_NAMES = {
+ "Java Source Files",
+ "Compiled Java Files",
+ "Java Archives",
+ "All"
+ };
+ FILTER_NAMES = wsdl_FILTER_NAMES;
+
+ // Resource selection widget not used (yet)
+ resourceFilter = ".java";
+ if (fResourceComposite!=null)
+ fResourceComposite.setFileFilter(resourceFilter);
+ }
+
+ @Override
+ public void setTitle(String title) {
+ super.setTitle(title);
+ if (getShell()!=null)
+ getShell().setText(title);
+ }
+
+ /**
+ *
+ * @author Michal Chmielewski (michal.chmielewski@oracle.com)
+ * @date May 4, 2007
+ *
+ */
+ public class TreeFilter extends ViewerFilter {
+
+ /**
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer,
+ * java.lang.Object, java.lang.Object)
+ */
+ @Override
+ public boolean select(Viewer viewer, Object parentElement,
+ Object element) {
+
+ if (fFilter == null || fFilter.length() == 0) {
+ return true;
+ }
+
+ if (element instanceof Service) {
+ String text = ""; //$NON-NLS-1$
+ Service service = (Service) element;
+ if (service.getName().size() > 0) {
+ Name name = service.getName().get(0);
+ text += name.getValue();
+ }
+ if (service.getAbstract().size() > 0) {
+ TypeOfAbstract abst = service.getAbstract().get(0);
+ text += abst.getValue();
+ }
+ return (text.toLowerCase().indexOf(fFilter) > -1);
+ }
+
+ return true;
+ }
+ }
+
+ /**
+ *
+ * @author Michal Chmielewski (michal.chmielewski@oracle.com)
+ * @date May 10, 2007
+ *
+ */
+ public class WSILViewerComparator extends ViewerComparator {
+
+ /**
+ * @see org.eclipse.jface.viewers.ViewerComparator#category(java.lang.Object)
+ */
+ @Override
+ public int category(Object element) {
+ if (element instanceof Inspection)
+ return 1;
+ if (element instanceof Link)
+ return 2;
+ if (element instanceof Service)
+ return 3;
+
+ return 0;
+ }
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/editors/SchemaObjectEditor.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/editors/SchemaObjectEditor.java
index 4f50d00..bd23999 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/editors/SchemaObjectEditor.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/editors/SchemaObjectEditor.java
@@ -1,193 +1,193 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Bob Brodt
- ******************************************************************************/
-
-package org.eclipse.bpmn2.modeler.ui.property.editors;
-
-import javax.xml.namespace.QName;
-
-import org.eclipse.bpmn2.Import;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.dialogs.TextAndButtonObjectEditor;
-import org.eclipse.bpmn2.modeler.core.utils.NamespaceUtil;
-import org.eclipse.bpmn2.modeler.ui.editor.BPMN2Editor;
-import org.eclipse.bpmn2.modeler.ui.property.dialogs.SchemaSelectionDialog;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.window.Window;
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.wst.wsdl.Fault;
-import org.eclipse.wst.wsdl.Input;
-import org.eclipse.wst.wsdl.Message;
-import org.eclipse.wst.wsdl.Operation;
-import org.eclipse.wst.wsdl.Output;
-import org.eclipse.wst.wsdl.Part;
-import org.eclipse.wst.wsdl.PortType;
-import org.eclipse.xsd.XSDAttributeDeclaration;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDTypeDefinition;
-
-/**
- * @author Bob Brodt
- *
- */
-public class SchemaObjectEditor extends TextAndButtonObjectEditor {
-
- protected Resource resource;
- protected Import imp;
- protected Button editButton;
-
- /**
- * @param parent
- * @param object
- * @param feature
- */
- public SchemaObjectEditor(AbstractDetailComposite parent, EObject object, EStructuralFeature feature) {
- super(parent, object, feature);
- resource = BPMN2Editor.getActiveEditor().getModelHandler().getResource();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.bpmn2.modeler.ui.property.editors.ObjectEditor#createControl
- * (org.eclipse.swt.widgets.Composite, java.lang.String, int)
- */
- @Override
- public Control createControl(Composite composite, String label, int style) {
- super.createControl(composite, label, style);
- // the Text field should be editable
- text.setEditable(true);
- // and change the "Edit" button to a "Browse" to make it clear that
- // an XML type can be selected from the imports
- button.setText("Browse...");
- return text;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.ui.property.editors.TextAndButtonObjectEditor#buttonClicked()
- */
- @Override
- protected void buttonClicked() {
- SchemaSelectionDialog dialog = new SchemaSelectionDialog(parent.getShell(), object);
-
- if (dialog.open() == Window.OK) {
- Object result = dialog.getResult()[0];
- String selectionPath = dialog.getSelectionPath();
- String value = "";
- String selectionType = "";
-
- // TODO: do we need these?
- if (result instanceof PortType) {
- PortType portType = (PortType)result;
- QName qname = portType.getQName();
- String prefix = NamespaceUtil.getPrefixForNamespace(resource, qname.getNamespaceURI());
- if (prefix==null)
- prefix = NamespaceUtil.addNamespace(resource, qname.getNamespaceURI());
- if (prefix!=null)
- value = prefix + ":";
- value += qname.getLocalPart();
- selectionType = "WSDL Port Type";
- }
- if (result instanceof Operation) {
- selectionType = "WSDL Operation";
- }
- if (result instanceof Input) {
- Input input = (Input)result;
- result = input.getMessage();
- selectionType = "WSDL Input";
- }
- if (result instanceof Output) {
- Output output = (Output)result;
- result = output.getMessage();
- selectionType = "WSDL Output";
- }
- if (result instanceof Fault) {
- Fault fault = (Fault)result;
- result = fault.getMessage();
- selectionType = "WSDL Fault";
- }
- if (result instanceof Part) {
- Part part = (Part)result;
- result = part.getElementDeclaration();
- selectionType = "WSDL Message Part";
- }
- if (result instanceof Message) {
- Message message = (Message)result;
- QName qname = message.getQName();
- String prefix = NamespaceUtil.getPrefixForNamespace(resource, qname.getNamespaceURI());
- if (prefix==null)
- prefix = NamespaceUtil.addNamespace(resource, qname.getNamespaceURI());
- if (prefix!=null)
- value = prefix + ":";
- value += qname.getLocalPart();
- selectionType = "WSDL Message";
- }
- if (result instanceof XSDAttributeDeclaration) {
- selectionType = "XML Attribute";
- }
-
- if (result instanceof XSDElementDeclaration) {
- XSDElementDeclaration decl = (XSDElementDeclaration)result;
- XSDSchema schema = getContainingSchema(decl);
- String ns = schema.getTargetNamespace();
- if (ns==null) {
- XSDTypeDefinition type = decl.getTypeDefinition();
- if (type!=null) {
- ns = type.getSchema().getTargetNamespace();
- }
- }
- String prefix = NamespaceUtil.getPrefixForNamespace(resource, ns);
- if (prefix!=null)
- value = prefix + ":";
- value += selectionPath;
- }
- if (result instanceof XSDTypeDefinition) {
- XSDTypeDefinition type = (XSDTypeDefinition)result;
- XSDSchema schema = getContainingSchema(type);
- String ns = schema.getTargetNamespace();
- String prefix = NamespaceUtil.getPrefixForNamespace(resource, ns);
- if (prefix!=null)
- value = prefix + ":";
- value += selectionPath;
- }
- if (result instanceof XSDSchema) {
- XSDSchema schema = (XSDSchema)result;
- String prefix = NamespaceUtil.getPrefixForNamespace(resource, schema.getTargetNamespace());
- if (prefix!=null)
- value = prefix + ":";
- value += "schema";
- }
- if (value.isEmpty()) {
- MessageDialog.openWarning(parent.getShell(), "Invalid Selection","The selection, "+
- selectionType+" is not a valid type definition.");
- }
- else
- updateObject(value);
- }
- }
-
- private XSDSchema getContainingSchema(EObject object) {
- EObject container = object.eContainer();
- if (container instanceof XSDSchema)
- return (XSDSchema) container;
- if (container!=null)
- return getContainingSchema(container);
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Bob Brodt
+ ******************************************************************************/
+
+package org.eclipse.bpmn2.modeler.ui.property.editors;
+
+import javax.xml.namespace.QName;
+
+import org.eclipse.bpmn2.Import;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
+import org.eclipse.bpmn2.modeler.core.merrimac.dialogs.TextAndButtonObjectEditor;
+import org.eclipse.bpmn2.modeler.core.utils.NamespaceUtil;
+import org.eclipse.bpmn2.modeler.ui.editor.BPMN2Editor;
+import org.eclipse.bpmn2.modeler.ui.property.dialogs.SchemaSelectionDialog;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.resource.Resource;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.wst.wsdl.Fault;
+import org.eclipse.wst.wsdl.Input;
+import org.eclipse.wst.wsdl.Message;
+import org.eclipse.wst.wsdl.Operation;
+import org.eclipse.wst.wsdl.Output;
+import org.eclipse.wst.wsdl.Part;
+import org.eclipse.wst.wsdl.PortType;
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDTypeDefinition;
+
+/**
+ * @author Bob Brodt
+ *
+ */
+public class SchemaObjectEditor extends TextAndButtonObjectEditor {
+
+ protected Resource resource;
+ protected Import imp;
+ protected Button editButton;
+
+ /**
+ * @param parent
+ * @param object
+ * @param feature
+ */
+ public SchemaObjectEditor(AbstractDetailComposite parent, EObject object, EStructuralFeature feature) {
+ super(parent, object, feature);
+ resource = BPMN2Editor.getActiveEditor().getModelHandler().getResource();
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.bpmn2.modeler.ui.property.editors.ObjectEditor#createControl
+ * (org.eclipse.swt.widgets.Composite, java.lang.String, int)
+ */
+ @Override
+ public Control createControl(Composite composite, String label, int style) {
+ super.createControl(composite, label, style);
+ // the Text field should businessObject editable
+ text.setEditable(true);
+ // and change the "Edit" button to a "Browse" to make it clear that
+ // an XML type can businessObject selected from the imports
+ button.setText("Browse...");
+ return text;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.ui.property.editors.TextAndButtonObjectEditor#buttonClicked()
+ */
+ @Override
+ protected void buttonClicked() {
+ SchemaSelectionDialog dialog = new SchemaSelectionDialog(parent.getShell(), object);
+
+ if (dialog.open() == Window.OK) {
+ Object result = dialog.getResult()[0];
+ String selectionPath = dialog.getSelectionPath();
+ String value = "";
+ String selectionType = "";
+
+ // TODO: do we need these?
+ if (result instanceof PortType) {
+ PortType portType = (PortType)result;
+ QName qname = portType.getQName();
+ String prefix = NamespaceUtil.getPrefixForNamespace(resource, qname.getNamespaceURI());
+ if (prefix==null)
+ prefix = NamespaceUtil.addNamespace(resource, qname.getNamespaceURI());
+ if (prefix!=null)
+ value = prefix + ":";
+ value += qname.getLocalPart();
+ selectionType = "WSDL Port Type";
+ }
+ if (result instanceof Operation) {
+ selectionType = "WSDL Operation";
+ }
+ if (result instanceof Input) {
+ Input input = (Input)result;
+ result = input.getMessage();
+ selectionType = "WSDL Input";
+ }
+ if (result instanceof Output) {
+ Output output = (Output)result;
+ result = output.getMessage();
+ selectionType = "WSDL Output";
+ }
+ if (result instanceof Fault) {
+ Fault fault = (Fault)result;
+ result = fault.getMessage();
+ selectionType = "WSDL Fault";
+ }
+ if (result instanceof Part) {
+ Part part = (Part)result;
+ result = part.getElementDeclaration();
+ selectionType = "WSDL Message Part";
+ }
+ if (result instanceof Message) {
+ Message message = (Message)result;
+ QName qname = message.getQName();
+ String prefix = NamespaceUtil.getPrefixForNamespace(resource, qname.getNamespaceURI());
+ if (prefix==null)
+ prefix = NamespaceUtil.addNamespace(resource, qname.getNamespaceURI());
+ if (prefix!=null)
+ value = prefix + ":";
+ value += qname.getLocalPart();
+ selectionType = "WSDL Message";
+ }
+ if (result instanceof XSDAttributeDeclaration) {
+ selectionType = "XML Attribute";
+ }
+
+ if (result instanceof XSDElementDeclaration) {
+ XSDElementDeclaration decl = (XSDElementDeclaration)result;
+ XSDSchema schema = getContainingSchema(decl);
+ String ns = schema.getTargetNamespace();
+ if (ns==null) {
+ XSDTypeDefinition type = decl.getTypeDefinition();
+ if (type!=null) {
+ ns = type.getSchema().getTargetNamespace();
+ }
+ }
+ String prefix = NamespaceUtil.getPrefixForNamespace(resource, ns);
+ if (prefix!=null)
+ value = prefix + ":";
+ value += selectionPath;
+ }
+ if (result instanceof XSDTypeDefinition) {
+ XSDTypeDefinition type = (XSDTypeDefinition)result;
+ XSDSchema schema = getContainingSchema(type);
+ String ns = schema.getTargetNamespace();
+ String prefix = NamespaceUtil.getPrefixForNamespace(resource, ns);
+ if (prefix!=null)
+ value = prefix + ":";
+ value += selectionPath;
+ }
+ if (result instanceof XSDSchema) {
+ XSDSchema schema = (XSDSchema)result;
+ String prefix = NamespaceUtil.getPrefixForNamespace(resource, schema.getTargetNamespace());
+ if (prefix!=null)
+ value = prefix + ":";
+ value += "schema";
+ }
+ if (value.isEmpty()) {
+ MessageDialog.openWarning(parent.getShell(), "Invalid Selection","The selection, "+
+ selectionType+" is not a valid type definition.");
+ }
+ else
+ updateObject(value);
+ }
+ }
+
+ private XSDSchema getContainingSchema(EObject object) {
+ EObject container = object.eContainer();
+ if (container instanceof XSDSchema)
+ return (XSDSchema) container;
+ if (container!=null)
+ return getContainingSchema(container);
+ return null;
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/events/CommonEventPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/events/CommonEventPropertySection.java
index 866289e..50948f2 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/events/CommonEventPropertySection.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/events/CommonEventPropertySection.java
@@ -1,89 +1,70 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Innar Made
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.property.events;
-
-import org.eclipse.bpmn2.BoundaryEvent;
-import org.eclipse.bpmn2.Bpmn2Package;
-import org.eclipse.bpmn2.CatchEvent;
-import org.eclipse.bpmn2.CompensateEventDefinition;
-import org.eclipse.bpmn2.ConditionalEventDefinition;
-import org.eclipse.bpmn2.EndEvent;
-import org.eclipse.bpmn2.ErrorEventDefinition;
-import org.eclipse.bpmn2.EscalationEventDefinition;
-import org.eclipse.bpmn2.Event;
-import org.eclipse.bpmn2.LinkEventDefinition;
-import org.eclipse.bpmn2.MessageEventDefinition;
-import org.eclipse.bpmn2.SignalEventDefinition;
-import org.eclipse.bpmn2.StartEvent;
-import org.eclipse.bpmn2.ThrowEvent;
-import org.eclipse.bpmn2.TimerEventDefinition;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.DefaultDialogComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
-import org.eclipse.bpmn2.modeler.ui.property.data.ConditionalEventDefinitionDetailComposite;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
-
-public class CommonEventPropertySection extends AbstractBpmn2PropertySection implements ITabbedPropertyConstants {
- static {
- PropertiesCompositeFactory.register(Event.class, CommonEventDetailComposite.class);
- PropertiesCompositeFactory.register(StartEvent.class, StartEventDetailComposite.class);
- PropertiesCompositeFactory.register(EndEvent.class, EndEventDetailComposite.class);
- PropertiesCompositeFactory.register(CatchEvent.class, CatchEventDetailComposite.class);
- PropertiesCompositeFactory.register(ThrowEvent.class, ThrowEventDetailComposite.class);
- PropertiesCompositeFactory.register(BoundaryEvent.class, BoundaryEventDetailComposite.class);
- PropertiesCompositeFactory.register(TimerEventDefinition.class, TimerEventDefinitionDetailComposite.class);
- PropertiesCompositeFactory.register(ConditionalEventDefinition.class, ConditionalEventDefinitionDetailComposite.class);
-
- PropertiesCompositeFactory.register(CompensateEventDefinition.class, EventDefinitionDialogComposite.class);
- PropertiesCompositeFactory.register(ConditionalEventDefinition.class, EventDefinitionDialogComposite.class);
- PropertiesCompositeFactory.register(ErrorEventDefinition.class, EventDefinitionDialogComposite.class);
- PropertiesCompositeFactory.register(EscalationEventDefinition.class, EventDefinitionDialogComposite.class);
- PropertiesCompositeFactory.register(LinkEventDefinition.class, EventDefinitionDialogComposite.class);
- PropertiesCompositeFactory.register(MessageEventDefinition.class, EventDefinitionDialogComposite.class);
- PropertiesCompositeFactory.register(SignalEventDefinition.class, EventDefinitionDialogComposite.class);
- PropertiesCompositeFactory.register(TimerEventDefinition.class, EventDefinitionDialogComposite.class);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
- */
- @Override
- protected AbstractDetailComposite createSectionRoot() {
- return new CommonEventDetailComposite(this);
- }
-
- @Override
- public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
- return new CommonEventDetailComposite(parent,style);
- }
-
- @Override
- protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
- EObject be = super.getBusinessObjectForPictogramElement(pe);
- if (be instanceof Event)
- return be;
- return null;
- }
-
- public class EventDefinitionDialogComposite extends DefaultDialogComposite {
- public EventDefinitionDialogComposite(Composite parent, EClass eclass, int style) {
- super(parent, eclass, style);
- }
- protected int getDetailsCount() { return 0; }
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Innar Made
+ ******************************************************************************/
+package org.eclipse.bpmn2.modeler.ui.property.events;
+
+import org.eclipse.bpmn2.BoundaryEvent;
+import org.eclipse.bpmn2.Bpmn2Package;
+import org.eclipse.bpmn2.CatchEvent;
+import org.eclipse.bpmn2.CompensateEventDefinition;
+import org.eclipse.bpmn2.ConditionalEventDefinition;
+import org.eclipse.bpmn2.EndEvent;
+import org.eclipse.bpmn2.ErrorEventDefinition;
+import org.eclipse.bpmn2.EscalationEventDefinition;
+import org.eclipse.bpmn2.Event;
+import org.eclipse.bpmn2.LinkEventDefinition;
+import org.eclipse.bpmn2.MessageEventDefinition;
+import org.eclipse.bpmn2.SignalEventDefinition;
+import org.eclipse.bpmn2.StartEvent;
+import org.eclipse.bpmn2.ThrowEvent;
+import org.eclipse.bpmn2.TimerEventDefinition;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.DefaultDialogComposite;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
+import org.eclipse.bpmn2.modeler.ui.property.data.ConditionalEventDefinitionDetailComposite;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+
+public class CommonEventPropertySection extends AbstractBpmn2PropertySection implements ITabbedPropertyConstants {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
+ */
+ @Override
+ protected AbstractDetailComposite createSectionRoot() {
+ return new CommonEventDetailComposite(this);
+ }
+
+ @Override
+ public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
+ return new CommonEventDetailComposite(parent,style);
+ }
+
+ @Override
+ protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
+ EObject be = super.getBusinessObjectForPictogramElement(pe);
+ if (be instanceof Event)
+ return be;
+ return null;
+ }
+
+ public class EventDefinitionDialogComposite extends DefaultDialogComposite {
+ public EventDefinitionDialogComposite(Composite parent, EClass eclass, int style) {
+ super(parent, eclass, style);
+ }
+ protected int getDetailsCount() { return 0; }
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/events/EndEventPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/events/EndEventPropertySection.java
index b933392..453153b 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/events/EndEventPropertySection.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/events/EndEventPropertySection.java
@@ -22,9 +22,6 @@
import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
public class EndEventPropertySection extends AbstractBpmn2PropertySection implements ITabbedPropertyConstants {
- static {
- PropertiesCompositeFactory.register(EndEvent.class, EndEventDetailComposite.class);
- }
@Override
protected AbstractDetailComposite createSectionRoot() {
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/events/StartEventPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/events/StartEventPropertySection.java
index 5f77343..e613c88 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/events/StartEventPropertySection.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/events/StartEventPropertySection.java
@@ -1,49 +1,46 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Innar Made
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.property.events;
-
-import org.eclipse.bpmn2.StartEvent;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
-
-public class StartEventPropertySection extends AbstractBpmn2PropertySection implements ITabbedPropertyConstants {
- static {
- PropertiesCompositeFactory.register(StartEvent.class, StartEventDetailComposite.class);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
- */
- @Override
- protected AbstractDetailComposite createSectionRoot() {
- return new StartEventDetailComposite(this);
- }
-
- @Override
- public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
- return new StartEventDetailComposite(parent,style);
- }
-
- @Override
- protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
- EObject be = super.getBusinessObjectForPictogramElement(pe);
- if (be instanceof StartEvent)
- return be;
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Innar Made
+ ******************************************************************************/
+package org.eclipse.bpmn2.modeler.ui.property.events;
+
+import org.eclipse.bpmn2.StartEvent;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+
+public class StartEventPropertySection extends AbstractBpmn2PropertySection implements ITabbedPropertyConstants {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
+ */
+ @Override
+ protected AbstractDetailComposite createSectionRoot() {
+ return new StartEventDetailComposite(this);
+ }
+
+ @Override
+ public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
+ return new StartEventDetailComposite(parent,style);
+ }
+
+ @Override
+ protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
+ EObject be = super.getBusinessObjectForPictogramElement(pe);
+ if (be instanceof StartEvent)
+ return be;
+ return null;
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/events/ThrowEventPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/events/ThrowEventPropertySection.java
index e11b389..3851690 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/events/ThrowEventPropertySection.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/events/ThrowEventPropertySection.java
@@ -1,49 +1,46 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Innar Made
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.property.events;
-
-import org.eclipse.bpmn2.ThrowEvent;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
-
-public class ThrowEventPropertySection extends AbstractBpmn2PropertySection implements ITabbedPropertyConstants {
- static {
- PropertiesCompositeFactory.register(ThrowEvent.class, ThrowEventDetailComposite.class);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
- */
- @Override
- protected AbstractDetailComposite createSectionRoot() {
- return new ThrowEventDetailComposite(this);
- }
-
- @Override
- public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
- return new ThrowEventDetailComposite(parent,style);
- }
-
- @Override
- protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
- EObject be = super.getBusinessObjectForPictogramElement(pe);
- if (be instanceof ThrowEvent)
- return be;
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Innar Made
+ ******************************************************************************/
+package org.eclipse.bpmn2.modeler.ui.property.events;
+
+import org.eclipse.bpmn2.ThrowEvent;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+
+public class ThrowEventPropertySection extends AbstractBpmn2PropertySection implements ITabbedPropertyConstants {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
+ */
+ @Override
+ protected AbstractDetailComposite createSectionRoot() {
+ return new ThrowEventDetailComposite(this);
+ }
+
+ @Override
+ public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
+ return new ThrowEventDetailComposite(parent,style);
+ }
+
+ @Override
+ protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
+ EObject be = super.getBusinessObjectForPictogramElement(pe);
+ if (be instanceof ThrowEvent)
+ return be;
+ return null;
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/gateways/GatewayDetailComposite.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/gateways/GatewayDetailComposite.java
index 61c5411..8431fbb 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/gateways/GatewayDetailComposite.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/gateways/GatewayDetailComposite.java
@@ -61,7 +61,7 @@
propertiesProvider = new AbstractPropertiesProvider(object) {
// lump all the gateway properties into one composite
// if a gateway doesn't have one of the attributes listed here,
- // it simply won't be displayed.
+ // it simply won't businessObject displayed.
String[] properties = new String[] {
"gatewayDirection",
"instantiate",
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/gateways/GatewayPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/gateways/GatewayPropertySection.java
index 35d1a07..6e6398c 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/gateways/GatewayPropertySection.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/gateways/GatewayPropertySection.java
@@ -1,49 +1,46 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Innar Made
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.property.gateways;
-
-import org.eclipse.bpmn2.Gateway;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
-
-public class GatewayPropertySection extends AbstractBpmn2PropertySection implements ITabbedPropertyConstants {
- static {
- PropertiesCompositeFactory.register(Gateway.class, GatewayDetailComposite.class);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
- */
- @Override
- protected AbstractDetailComposite createSectionRoot() {
- return new GatewayDetailComposite(this);
- }
-
- @Override
- public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
- return new GatewayDetailComposite(parent,style);
- }
-
- @Override
- protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
- EObject be = super.getBusinessObjectForPictogramElement(pe);
- if (be instanceof Gateway)
- return be;
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Innar Made
+ ******************************************************************************/
+package org.eclipse.bpmn2.modeler.ui.property.gateways;
+
+import org.eclipse.bpmn2.Gateway;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+
+public class GatewayPropertySection extends AbstractBpmn2PropertySection implements ITabbedPropertyConstants {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
+ */
+ @Override
+ protected AbstractDetailComposite createSectionRoot() {
+ return new GatewayDetailComposite(this);
+ }
+
+ @Override
+ public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
+ return new GatewayDetailComposite(parent,style);
+ }
+
+ @Override
+ protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
+ EObject be = super.getBusinessObjectForPictogramElement(pe);
+ if (be instanceof Gateway)
+ return be;
+ return null;
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/providers/AbstractContentProvider.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/providers/AbstractContentProvider.java
index f3f0615..f0b47d3 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/providers/AbstractContentProvider.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/providers/AbstractContentProvider.java
@@ -1,107 +1,107 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.property.providers;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-
-/**
- * Common base class for our content providers.
- */
-public abstract class AbstractContentProvider implements IStructuredContentProvider {
-
- protected static final Object[] EMPTY_ARRAY = new Object[0];
-
- /**
- * @see org.eclipse.jface.viewers.IContentProvider#dispose()
- */
- public void dispose() {
-
- }
-
- /**
- * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
- */
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
-
- }
-
-
- /**
- * Provide the elements to be shown from this content provider.
- * The generic implementation creates a list, then calls collectElements, and
- * subsequently returns the array created from the list or the empty array if no
- * elements are collected.
- *
- * Under no circumstances null is returned.
- * @param input
- * @return
- *
- */
-
- public Object[] getElements(Object input) {
- if (input == null) {
- return EMPTY_ARRAY;
- }
-
- List<Object> list = new ArrayList<Object>();
- collectElements ( input, list );
-
- return list.isEmpty()? EMPTY_ARRAY : list.toArray();
- }
-
-
- /**
- * Collect the elements to be returned by this provider.
- * Subclasses will override this method.
- *
- * @param input the object to provide elements from (input)
- * @param list the list in which the elements are to be inserted.
- */
-
- public void collectElements (Object input, List<Object> list) {
- // need to override this method.
- }
-
-
-
- /**
- * Collect elements from the input object if the object is a list or an array.
- * The method returns true if it discovers that the passed object is "complex",
- * meaning it is either an array or a list of objects.
- *
- * @param input the complex object to look at.
- * @param list the list to collect elements into
- * @return
- */
-
- public boolean collectComplex ( Object input, List<Object> list) {
-
- Object[] arr = null;
-
- if (input.getClass().isArray()) {
- arr = (Object[]) input;
- } else if (input instanceof List) {
- arr = ((List)input).toArray();
- }
-
- if (arr == null) {
- return false;
- }
- for(Object n : arr) {
- collectElements(n, list);
- }
- return arr.length > 0;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpmn2.modeler.ui.property.providers;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+/**
+ * Common base class for our content providers.
+ */
+public abstract class AbstractContentProvider implements IStructuredContentProvider {
+
+ protected static final Object[] EMPTY_ARRAY = new Object[0];
+
+ /**
+ * @see org.eclipse.jface.viewers.IContentProvider#dispose()
+ */
+ public void dispose() {
+
+ }
+
+ /**
+ * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
+ */
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+
+ }
+
+
+ /**
+ * Provide the elements to businessObject shown from this content provider.
+ * The generic implementation creates a list, then calls collectElements, and
+ * subsequently returns the array created from the list or the empty array if no
+ * elements are collected.
+ *
+ * Under no circumstances null is returned.
+ * @param input
+ * @return
+ *
+ */
+
+ public Object[] getElements(Object input) {
+ if (input == null) {
+ return EMPTY_ARRAY;
+ }
+
+ List<Object> list = new ArrayList<Object>();
+ collectElements ( input, list );
+
+ return list.isEmpty()? EMPTY_ARRAY : list.toArray();
+ }
+
+
+ /**
+ * Collect the elements to businessObject returned by this provider.
+ * Subclasses will override this method.
+ *
+ * @param input the object to provide elements from (input)
+ * @param list the list in which the elements are to businessObject inserted.
+ */
+
+ public void collectElements (Object input, List<Object> list) {
+ // need to override this method.
+ }
+
+
+
+ /**
+ * Collect elements from the input object if the object is a list or an array.
+ * The method returns true if it discovers that the passed object is "complex",
+ * meaning it is either an array or a list of objects.
+ *
+ * @param input the complex object to look at.
+ * @param list the list to collect elements into
+ * @return
+ */
+
+ public boolean collectComplex ( Object input, List<Object> list) {
+
+ Object[] arr = null;
+
+ if (input.getClass().isArray()) {
+ arr = (Object[]) input;
+ } else if (input instanceof List) {
+ arr = ((List)input).toArray();
+ }
+
+ if (arr == null) {
+ return false;
+ }
+ for(Object n : arr) {
+ collectElements(n, list);
+ }
+ return arr.length > 0;
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/providers/CachedTreeContentProvider.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/providers/CachedTreeContentProvider.java
index bc53dc1..5e5e953 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/providers/CachedTreeContentProvider.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/providers/CachedTreeContentProvider.java
@@ -1,141 +1,141 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.property.providers;
-
-import java.util.HashMap;
-import java.util.Vector;
-
-import org.eclipse.jface.viewers.ITreeContentProvider;
-import org.eclipse.jface.viewers.Viewer;
-
-/**
- * An abstract content provider that caches the tree nodes as they are discovered.
- *
- * This is useful for two reasons: it guarantees that the same object will be returned
- * until the cache is cleared (which is convenient for trees that wrap a different set
- * of model objects), and it handles the parent relationship automatically.
- *
- * Note that the parent of a node will only be known if the node appeared in an array
- * previously returned by primGetChildren()! The value UNKNOWN_PARENT is returned
- * as the parent of a node whose parent has never had primGetChildren() called on it.
- * null is returned as the parent of the root nodes, that is, those returned by
- * primGetElements().
- */
-public abstract class CachedTreeContentProvider implements ITreeContentProvider {
-
- protected static final Object[] EMPTY_ARRAY = new Object[0];
-
- public static final Object UNKNOWN_PARENT = new Object();
-
- // A null value in the treeNodeToParent parentMap means the node is a root parameter.
- protected HashMap treeNodeToParent;
-
- // A null value in the treeNodeToChildren parentMap means the node has children, button
- // we don't yet know what they are. (If it has no children, an empty array would
- // be present instead).
- protected HashMap treeNodeToChildren;
-
- Object[] rootChildren;
-
- public CachedTreeContentProvider() {
- super();
- treeNodeToParent = new HashMap();
- treeNodeToChildren = new HashMap();
- }
-
- protected abstract boolean primHasChildren(Object node);
- protected abstract Object[] primGetChildren(Object node);
- protected abstract Object[] primGetElements(Object node);
-
- /**
- * Returns an array describing the path from a node up to the root. The node will
- * be the first parameter of the array, its parent will be the 2nd, and so on, with
- * a top-level node (i.e. a root) as the last parameter of the array. Note that the
- * input object of the content provider is *NOT* included in this path, because the
- * top-level nodes returned by getElements() have a parent value of null.
- */
- public Object[] getPathToRoot(Object node) {
- Vector v = new Vector();
- while (node != null && node != UNKNOWN_PARENT) {
- v.add(node);
- node = getParent(node);
- }
- return v.toArray();
- }
-
- /* IStructuredContentProvider */
-
- public final Object[] getElements(Object node) {
- if (rootChildren == null) {
- rootChildren = primGetElements(node);
- if (rootChildren == null) rootChildren = EMPTY_ARRAY;
- for (int i = 0; i<rootChildren.length; i++) {
- treeNodeToParent.put(rootChildren[i], null);
- }
- }
- return rootChildren;
- }
-
- /* ITreeContentProvider */
-
- public final boolean hasChildren(Object node) {
- Object[] result = (Object[])treeNodeToChildren.get(node);
- if (result != null) return (result.length > 0);
- if (treeNodeToChildren.containsKey(node)) {
- // it has children, we just haven't seen them yet.
- return true;
- }
- if (primHasChildren(node)) {
- treeNodeToChildren.put(node, null);
- return true;
- }
-
- treeNodeToChildren.put(node, EMPTY_ARRAY);
- return false;
- }
-
- public final Object[] getChildren(Object node) {
- Object[] result = (Object[])treeNodeToChildren.get(node);
- if (result == null) {
- result = primGetChildren(node);
- if (result == null) result = EMPTY_ARRAY;
- treeNodeToChildren.put(node, result);
- for (int i = 0; i<result.length; i++) {
- treeNodeToParent.put(result[i], node);
- }
- }
- return result;
- }
-
- public final Object getParent(Object node) {
- // Prevent stack overflow in cases where a caller is walking up the
- // parent chain of a stale object and doesn't recognize UNKNOWN_PARENT.
- // (e.g. in a StructuredViewer, internalExpand() will keep asking for
- // the parent of UNKNOWN_PARENT until stack overflow).
- if (node==UNKNOWN_PARENT) return null;
-
- Object result = treeNodeToParent.get(node);
- if (result != null || treeNodeToParent.containsKey(node)) return result;
- return UNKNOWN_PARENT;
- }
-
- /* IContentProvider */
-
- public void dispose() {
- }
-
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- rootChildren = null;
- treeNodeToParent.clear();
- treeNodeToChildren.clear();
- }
-
-}
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpmn2.modeler.ui.property.providers;
+
+import java.util.HashMap;
+import java.util.Vector;
+
+import org.eclipse.jface.viewers.ITreeContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+/**
+ * An abstract content provider that caches the tree nodes as they are discovered.
+ *
+ * This is useful for two reasons: it guarantees that the same object will businessObject returned
+ * until the cache is cleared (which is convenient for trees that wrap a different set
+ * of model objects), and it handles the parent relationship automatically.
+ *
+ * Note that the parent of a node will only businessObject known if the node appeared in an array
+ * previously returned by primGetChildren()! The value UNKNOWN_PARENT is returned
+ * as the parent of a node whose parent has never had primGetChildren() called on it.
+ * null is returned as the parent of the root nodes, that is, those returned by
+ * primGetElements().
+ */
+public abstract class CachedTreeContentProvider implements ITreeContentProvider {
+
+ protected static final Object[] EMPTY_ARRAY = new Object[0];
+
+ public static final Object UNKNOWN_PARENT = new Object();
+
+ // A null value in the treeNodeToParent parentMap means the node is a root parameter.
+ protected HashMap treeNodeToParent;
+
+ // A null value in the treeNodeToChildren parentMap means the node has children, button
+ // we don't yet know what they are. (If it has no children, an empty array would
+ // businessObject present instead).
+ protected HashMap treeNodeToChildren;
+
+ Object[] rootChildren;
+
+ public CachedTreeContentProvider() {
+ super();
+ treeNodeToParent = new HashMap();
+ treeNodeToChildren = new HashMap();
+ }
+
+ protected abstract boolean primHasChildren(Object node);
+ protected abstract Object[] primGetChildren(Object node);
+ protected abstract Object[] primGetElements(Object node);
+
+ /**
+ * Returns an array describing the path from a node up to the root. The node will
+ * businessObject the first parameter of the array, its parent will businessObject the 2nd, and so on, with
+ * a top-level node (i.e. a root) as the last parameter of the array. Note that the
+ * input object of the content provider is *NOT* included in this path, because the
+ * top-level nodes returned by getElements() have a parent value of null.
+ */
+ public Object[] getPathToRoot(Object node) {
+ Vector v = new Vector();
+ while (node != null && node != UNKNOWN_PARENT) {
+ v.add(node);
+ node = getParent(node);
+ }
+ return v.toArray();
+ }
+
+ /* IStructuredContentProvider */
+
+ public final Object[] getElements(Object node) {
+ if (rootChildren == null) {
+ rootChildren = primGetElements(node);
+ if (rootChildren == null) rootChildren = EMPTY_ARRAY;
+ for (int i = 0; i<rootChildren.length; i++) {
+ treeNodeToParent.put(rootChildren[i], null);
+ }
+ }
+ return rootChildren;
+ }
+
+ /* ITreeContentProvider */
+
+ public final boolean hasChildren(Object node) {
+ Object[] result = (Object[])treeNodeToChildren.get(node);
+ if (result != null) return (result.length > 0);
+ if (treeNodeToChildren.containsKey(node)) {
+ // it has children, we just haven't seen them yet.
+ return true;
+ }
+ if (primHasChildren(node)) {
+ treeNodeToChildren.put(node, null);
+ return true;
+ }
+
+ treeNodeToChildren.put(node, EMPTY_ARRAY);
+ return false;
+ }
+
+ public final Object[] getChildren(Object node) {
+ Object[] result = (Object[])treeNodeToChildren.get(node);
+ if (result == null) {
+ result = primGetChildren(node);
+ if (result == null) result = EMPTY_ARRAY;
+ treeNodeToChildren.put(node, result);
+ for (int i = 0; i<result.length; i++) {
+ treeNodeToParent.put(result[i], node);
+ }
+ }
+ return result;
+ }
+
+ public final Object getParent(Object node) {
+ // Prevent stack overflow in cases where a caller is walking up the
+ // parent chain of a stale object and doesn't recognize UNKNOWN_PARENT.
+ // (e.g. in a StructuredViewer, internalExpand() will keep asking for
+ // the parent of UNKNOWN_PARENT until stack overflow).
+ if (node==UNKNOWN_PARENT) return null;
+
+ Object result = treeNodeToParent.get(node);
+ if (result != null || treeNodeToParent.containsKey(node)) return result;
+ return UNKNOWN_PARENT;
+ }
+
+ /* IContentProvider */
+
+ public void dispose() {
+ }
+
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ rootChildren = null;
+ treeNodeToParent.clear();
+ treeNodeToChildren.clear();
+ }
+
+}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/providers/ITreeNode.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/providers/ITreeNode.java
index 9ae2be3..f7a79f7 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/providers/ITreeNode.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/providers/ITreeNode.java
@@ -1,55 +1,55 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.property.providers;
-
-import org.eclipse.swt.graphics.Image;
-
-/**
- * Interface to tree nodes which represent a model object. The model objects can't
- * represent themselves in the tree because they have to have unique parents, and
- * in general, our model objects don't. In addition, the model object might want to
- * present different children in different contexts (e.g. variable/property versus
- * variable/part/query).
- */
-public interface ITreeNode {
-
- /**
- * Returns the regular label for the node (not including a suffix).
- */
- public String getLabel();
-
- /**
- * Returns the suffix which should be appended to the label. This is useful to
- * show the label of a condensed node in condensed trees.
- */
- public String getLabelSuffix();
-
- /**
- * Returns an image descriptor from which the label provider can create an image
- * for this node.
- */
- public Image getImage();
-
- /**
- * Returns the underlying model object represented by this node.
- */
- public Object getModelObject();
-
- /**
- * Similar in purpose to the getChildren() method of ITreeContentProvider.
- */
- public Object[] getChildren();
-
- /**
- * Similar in purpose to the hasChildren() method of ITreeContentProvider.
- */
- public boolean hasChildren();
-}
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpmn2.modeler.ui.property.providers;
+
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Interface to tree nodes which represent a model object. The model objects can't
+ * represent themselves in the tree because they have to have unique parents, and
+ * in general, our model objects don't. In addition, the model object might want to
+ * present different children in different contexts (e.g. variable/property versus
+ * variable/part/query).
+ */
+public interface ITreeNode {
+
+ /**
+ * Returns the regular label for the node (not including a suffix).
+ */
+ public String getLabel();
+
+ /**
+ * Returns the suffix which should businessObject appended to the label. This is useful to
+ * show the label of a condensed node in condensed trees.
+ */
+ public String getLabelSuffix();
+
+ /**
+ * Returns an image descriptor from which the label provider can create an image
+ * for this node.
+ */
+ public Image getImage();
+
+ /**
+ * Returns the underlying model object represented by this node.
+ */
+ public Object getModelObject();
+
+ /**
+ * Similar in purpose to the getChildren() method of ITreeContentProvider.
+ */
+ public Object[] getChildren();
+
+ /**
+ * Similar in purpose to the hasChildren() method of ITreeContentProvider.
+ */
+ public boolean hasChildren();
+}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/providers/ModelLabelProvider.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/providers/ModelLabelProvider.java
index 8d1062a..fecfa1b 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/providers/ModelLabelProvider.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/providers/ModelLabelProvider.java
@@ -20,7 +20,7 @@
/**
* A label provider for objects which adapt to the ILabeledElement interface.
- * This can be used as a "generic" label provider for details pages, etc.
+ * This can businessObject used as a "generic" label provider for details pages, etc.
*/
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/providers/ModelTreeContentProvider.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/providers/ModelTreeContentProvider.java
index 0bd266c..327176a 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/providers/ModelTreeContentProvider.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/providers/ModelTreeContentProvider.java
@@ -1,99 +1,99 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.property.providers;
-
-import org.eclipse.jface.viewers.Viewer;
-
-
-/**
- * A content provider for a tree of ITreeNode objects representing some expansion of
- * the underlying graph of model objects. CachedTreeContentProvider keeps track of the
- * parent relationships so the ITreeNode objects don't have to; however, the ITreeNode
- * objects *must have unique parents*, so our model objects can't represent themselves
- * directly. After all, our model is a graph, not a tree. Another reason to wrap our
- * model objects in ITreeNode objects is that there may be different tree expansions
- * of a particular model object in different contexts (e.g. variable/property versus
- * variable/part/query).
- *
- * To programatically expose a particular branch of the tree, you must first walk down
- * the content provider from the root to the ITreeNode you want to expose (causing the
- * necessary ITreeNode objects to be created). Then, you call viewer.expandToLevel()
- * on this ITreeNode. Using this content provider, the TreeViewer will walk up from
- * the given node to the deepest already-expanded item, then back down again expanding
- * the remaining items.
- */
-public class ModelTreeContentProvider extends CachedTreeContentProvider {
-
- protected boolean isCondensed;
-
- public ModelTreeContentProvider(boolean isCondensed) {
- super();
- this.isCondensed = isCondensed;
- }
-
- public boolean isCondensed() { return isCondensed; }
-
- @Override
- protected Object[] primGetChildren(Object node) {
- if (!(node instanceof ITreeNode)) return EMPTY_ARRAY;
- return ((ITreeNode)node).getChildren();
- }
-
- @Override
- protected Object[] primGetElements(Object node) {
- return primGetChildren(node);
- }
-
- @Override
- protected boolean primHasChildren(Object node) {
- if (!(node instanceof ITreeNode)) return false;
- return ((ITreeNode)node).hasChildren();
- }
-
- /**
- * Searches each of the nodes in the given array to find the node representing a
- * particular modelObject.
- *
- * If subtreeDepth > 0, the children of each node in the given array are recursively
- * searched to a depth of subtreeDepth-1.
- *
- * Values larger than 1 or 2 should be avoided whenever possible, because all of the
- * nodes in the subtree up to subtreeDepth have to be created and cached. The most
- * efficient subtreeDepth is 0.
- */
- public ITreeNode findModelNode(Object[] nodes, Object modelObject, int subtreeDepth) {
- for (int i = 0; i<nodes.length; i++) {
- if (!(nodes[i] instanceof ITreeNode)) continue;
- ITreeNode treeNode = (ITreeNode)nodes[i];
- if (treeNode.getModelObject().equals(modelObject)) return treeNode;
- }
- ITreeNode result = null;
- if (subtreeDepth > 0) {
- for (int i = 0; result==null && i<nodes.length; i++) {
- result = findModelNode(getChildren(nodes[i]), modelObject, subtreeDepth-1);
- }
- }
- return result;
- }
-
- /* IContentProvider */
-
- @Override
- public void dispose() {
- super.dispose();
- }
-
- @Override
- public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
- super.inputChanged(viewer, oldInput, newInput);
- // TODO: hook model listener?
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpmn2.modeler.ui.property.providers;
+
+import org.eclipse.jface.viewers.Viewer;
+
+
+/**
+ * A content provider for a tree of ITreeNode objects representing some expansion of
+ * the underlying graph of model objects. CachedTreeContentProvider keeps track of the
+ * parent relationships so the ITreeNode objects don't have to; however, the ITreeNode
+ * objects *must have unique parents*, so our model objects can't represent themselves
+ * directly. After all, our model is a graph, not a tree. Another reason to wrap our
+ * model objects in ITreeNode objects is that there may businessObject different tree expansions
+ * of a particular model object in different contexts (e.g. variable/property versus
+ * variable/part/query).
+ *
+ * To programatically expose a particular branch of the tree, you must first walk down
+ * the content provider from the root to the ITreeNode you want to expose (causing the
+ * necessary ITreeNode objects to businessObject created). Then, you call viewer.expandToLevel()
+ * on this ITreeNode. Using this content provider, the TreeViewer will walk up from
+ * the given node to the deepest already-expanded item, then back down again expanding
+ * the remaining items.
+ */
+public class ModelTreeContentProvider extends CachedTreeContentProvider {
+
+ protected boolean isCondensed;
+
+ public ModelTreeContentProvider(boolean isCondensed) {
+ super();
+ this.isCondensed = isCondensed;
+ }
+
+ public boolean isCondensed() { return isCondensed; }
+
+ @Override
+ protected Object[] primGetChildren(Object node) {
+ if (!(node instanceof ITreeNode)) return EMPTY_ARRAY;
+ return ((ITreeNode)node).getChildren();
+ }
+
+ @Override
+ protected Object[] primGetElements(Object node) {
+ return primGetChildren(node);
+ }
+
+ @Override
+ protected boolean primHasChildren(Object node) {
+ if (!(node instanceof ITreeNode)) return false;
+ return ((ITreeNode)node).hasChildren();
+ }
+
+ /**
+ * Searches each of the nodes in the given array to find the node representing a
+ * particular modelObject.
+ *
+ * If subtreeDepth > 0, the children of each node in the given array are recursively
+ * searched to a depth of subtreeDepth-1.
+ *
+ * Values larger than 1 or 2 should businessObject avoided whenever possible, because all of the
+ * nodes in the subtree up to subtreeDepth have to businessObject created and cached. The most
+ * efficient subtreeDepth is 0.
+ */
+ public ITreeNode findModelNode(Object[] nodes, Object modelObject, int subtreeDepth) {
+ for (int i = 0; i<nodes.length; i++) {
+ if (!(nodes[i] instanceof ITreeNode)) continue;
+ ITreeNode treeNode = (ITreeNode)nodes[i];
+ if (treeNode.getModelObject().equals(modelObject)) return treeNode;
+ }
+ ITreeNode result = null;
+ if (subtreeDepth > 0) {
+ for (int i = 0; result==null && i<nodes.length; i++) {
+ result = findModelNode(getChildren(nodes[i]), modelObject, subtreeDepth-1);
+ }
+ }
+ return result;
+ }
+
+ /* IContentProvider */
+
+ @Override
+ public void dispose() {
+ super.dispose();
+ }
+
+ @Override
+ public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
+ super.inputChanged(viewer, oldInput, newInput);
+ // TODO: hook model listener?
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/providers/TreeNode.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/providers/TreeNode.java
index 3c6ad25..1a6e6eb 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/providers/TreeNode.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/providers/TreeNode.java
@@ -1,59 +1,59 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.property.providers;
-
-import org.eclipse.bpmn2.modeler.core.adapters.AdapterUtil;
-import org.eclipse.bpmn2.modeler.ui.adapters.ILabeledElement;
-import org.eclipse.swt.graphics.Image;
-
-
-/**
- * Abstract implementation of ITreeNode which implements default getLabel() and
- * getImage() behaviour by adapting the model object to ILabeledElement.
- *
- * TODO: condensed trees should be implemented using a ListFlattener rather than
- * the ad-hoc way they are implemented now. @see ModelTreeContentProvider.
- */
-public abstract class TreeNode implements ITreeNode {
-
- public static final Object[] EMPTY_ARRAY = new Object[0];
-
- protected Object modelObject;
- protected boolean isCondensed;
-
- public TreeNode(Object modelObject, boolean isCondensed) {
- this.modelObject = modelObject;
- this.isCondensed = isCondensed;
- }
-
- /* ITreeNode */
-
- // May need to override this default getLabel() for some objects!
- public String getLabel() {
- ILabeledElement label = AdapterUtil.adapt(modelObject, ILabeledElement.class);
- if (label == null) return null;
- return label.getLabel(modelObject);
- }
-
- public String getLabelSuffix() { return null; }
-
- public boolean isNodeFlattenable() { return false; }
- public Object getModelObject() { return modelObject; }
-
- public Image getImage() {
- ILabeledElement label = AdapterUtil.adapt(modelObject, ILabeledElement.class);
- if (label == null) return null;
- return label.getSmallImage(modelObject);
- }
-
- public abstract Object[] getChildren();
- public abstract boolean hasChildren();
-}
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpmn2.modeler.ui.property.providers;
+
+import org.eclipse.bpmn2.modeler.core.adapters.AdapterUtil;
+import org.eclipse.bpmn2.modeler.ui.adapters.ILabeledElement;
+import org.eclipse.swt.graphics.Image;
+
+
+/**
+ * Abstract implementation of ITreeNode which implements default getLabel() and
+ * getImage() behaviour by adapting the model object to ILabeledElement.
+ *
+ * TODO: condensed trees should businessObject implemented using a ListFlattener rather than
+ * the ad-hoc way they are implemented now. @see ModelTreeContentProvider.
+ */
+public abstract class TreeNode implements ITreeNode {
+
+ public static final Object[] EMPTY_ARRAY = new Object[0];
+
+ protected Object modelObject;
+ protected boolean isCondensed;
+
+ public TreeNode(Object modelObject, boolean isCondensed) {
+ this.modelObject = modelObject;
+ this.isCondensed = isCondensed;
+ }
+
+ /* ITreeNode */
+
+ // May need to override this default getLabel() for some objects!
+ public String getLabel() {
+ ILabeledElement label = AdapterUtil.adapt(modelObject, ILabeledElement.class);
+ if (label == null) return null;
+ return label.getLabel(modelObject);
+ }
+
+ public String getLabelSuffix() { return null; }
+
+ public boolean isNodeFlattenable() { return false; }
+ public Object getModelObject() { return modelObject; }
+
+ public Image getImage() {
+ ILabeledElement label = AdapterUtil.adapt(modelObject, ILabeledElement.class);
+ if (label == null) return null;
+ return label.getSmallImage(modelObject);
+ }
+
+ public abstract Object[] getChildren();
+ public abstract boolean hasChildren();
+}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ActivityDetailComposite.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ActivityDetailComposite.java
index 9e13042..aa001f7 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ActivityDetailComposite.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ActivityDetailComposite.java
@@ -37,11 +37,6 @@
public class ActivityDetailComposite extends DefaultDetailComposite {
- static {
- PropertiesCompositeFactory.register(StandardLoopCharacteristics.class, StandardLoopCharacteristicsDetailComposite.class);
- PropertiesCompositeFactory.register(MultiInstanceLoopCharacteristics.class, MultiInstanceLoopCharacteristicsDetailComposite.class);
- }
-
private Button addStandardLoopButton;
private Button addMultiLoopButton;
private Button removeLoopButton;
@@ -74,13 +69,18 @@
"anyAttribute",
"calledElementRef", // only used in CallActivity
"calledChoreographyRef", // only used in CallChoreography
- "completionQuantity",
"startQuantity",
+ "completionQuantity",
+ "completionCondition",
"isForCompensation",
+ "triggeredByEvent",
+ "cancelRemainingInstances",
"loopCharacteristics",
- "boundaryEventDefs",
"properties",
"resources",
+ "method",
+ "ordering",
+ "protocol",
};
@Override
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ActivityInputPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ActivityInputPropertySection.java
index c47af94..8195596 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ActivityInputPropertySection.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ActivityInputPropertySection.java
@@ -1,50 +1,46 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Innar Made
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.property.tasks;
-
-import org.eclipse.bpmn2.Activity;
-import org.eclipse.bpmn2.InputOutputSpecification;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.swt.widgets.Composite;
-
-public class ActivityInputPropertySection extends AbstractBpmn2PropertySection {
- static {
- PropertiesCompositeFactory.register(Activity.class, ActivityInputDetailComposite.class);
- PropertiesCompositeFactory.register(InputOutputSpecification.class, ActivityInputDetailComposite.class);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
- */
- @Override
- protected AbstractDetailComposite createSectionRoot() {
- return new ActivityInputDetailComposite(this);
- }
-
- @Override
- public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
- return new ActivityInputDetailComposite(parent,style);
- }
-
- @Override
- protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
- EObject be = super.getBusinessObjectForPictogramElement(pe);
- if (be instanceof Activity)
- return be;
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Innar Made
+ ******************************************************************************/
+package org.eclipse.bpmn2.modeler.ui.property.tasks;
+
+import org.eclipse.bpmn2.Activity;
+import org.eclipse.bpmn2.InputOutputSpecification;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.swt.widgets.Composite;
+
+public class ActivityInputPropertySection extends AbstractBpmn2PropertySection {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
+ */
+ @Override
+ protected AbstractDetailComposite createSectionRoot() {
+ return new ActivityInputDetailComposite(this);
+ }
+
+ @Override
+ public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
+ return new ActivityInputDetailComposite(parent,style);
+ }
+
+ @Override
+ protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
+ EObject be = super.getBusinessObjectForPictogramElement(pe);
+ if (be instanceof Activity)
+ return be;
+ return null;
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ActivityOutputPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ActivityOutputPropertySection.java
index 46b0848..e3fbaaf 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ActivityOutputPropertySection.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ActivityOutputPropertySection.java
@@ -1,48 +1,45 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Innar Made
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.property.tasks;
-
-import org.eclipse.bpmn2.Activity;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.swt.widgets.Composite;
-
-public class ActivityOutputPropertySection extends AbstractBpmn2PropertySection {
- static {
- PropertiesCompositeFactory.register(Activity.class, ActivityOutputDetailComposite.class);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
- */
- @Override
- protected AbstractDetailComposite createSectionRoot() {
- return new ActivityOutputDetailComposite(this);
- }
-
- @Override
- public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
- return new ActivityOutputDetailComposite(parent,style);
- }
-
- @Override
- protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
- EObject be = super.getBusinessObjectForPictogramElement(pe);
- if (be instanceof Activity)
- return be;
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Innar Made
+ ******************************************************************************/
+package org.eclipse.bpmn2.modeler.ui.property.tasks;
+
+import org.eclipse.bpmn2.Activity;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.swt.widgets.Composite;
+
+public class ActivityOutputPropertySection extends AbstractBpmn2PropertySection {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
+ */
+ @Override
+ protected AbstractDetailComposite createSectionRoot() {
+ return new ActivityOutputDetailComposite(this);
+ }
+
+ @Override
+ public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
+ return new ActivityOutputDetailComposite(parent,style);
+ }
+
+ @Override
+ protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
+ EObject be = super.getBusinessObjectForPictogramElement(pe);
+ if (be instanceof Activity)
+ return be;
+ return null;
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/SubProcessPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ActivityPropertySection.java
similarity index 81%
rename from org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/SubProcessPropertySection.java
rename to org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ActivityPropertySection.java
index 70bd66c..fe52c45 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/SubProcessPropertySection.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ActivityPropertySection.java
@@ -1,54 +1,52 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Bob Brodt
- ******************************************************************************/
-
-package org.eclipse.bpmn2.modeler.ui.property.tasks;
-
-import org.eclipse.bpmn2.SubProcess;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
-
-/**
- * @author Bob Brodt
- *
- */
-public class SubProcessPropertySection extends AbstractBpmn2PropertySection implements ITabbedPropertyConstants {
- static {
- PropertiesCompositeFactory.register(SubProcess.class, SubProcessDetailComposite.class);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
- */
- @Override
- protected AbstractDetailComposite createSectionRoot() {
- return new SubProcessDetailComposite(this);
- }
-
- @Override
- public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
- return new SubProcessDetailComposite(parent,style);
- }
-
- @Override
- protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
- EObject be = super.getBusinessObjectForPictogramElement(pe);
- if (be instanceof SubProcess)
- return be;
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Bob Brodt
+ ******************************************************************************/
+
+package org.eclipse.bpmn2.modeler.ui.property.tasks;
+
+import org.eclipse.bpmn2.SubProcess;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.DefaultPropertySection;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+
+/**
+ * @author Bob Brodt
+ *
+ */
+public class ActivityPropertySection extends DefaultPropertySection {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
+ */
+ @Override
+ protected AbstractDetailComposite createSectionRoot() {
+ return new ActivityDetailComposite(this);
+ }
+
+ @Override
+ public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
+ return new ActivityDetailComposite(parent,style);
+ }
+
+ @Override
+ protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
+ EObject be = super.getBusinessObjectForPictogramElement(pe);
+ if (appliesToClass!=null && appliesToClass.isInstance(be))
+ return be;
+ return null;
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/BusinessRuleTaskDetailComposite.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/BusinessRuleTaskDetailComposite.java
deleted file mode 100644
index e903be4..0000000
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/BusinessRuleTaskDetailComposite.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Bob Brodt
- ******************************************************************************/
-
-
-package org.eclipse.bpmn2.modeler.ui.property.tasks;
-
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.DefaultDetailComposite;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.swt.widgets.Composite;
-
-public class BusinessRuleTaskDetailComposite extends DefaultDetailComposite {
-
- /**
- * @param section
- */
- public BusinessRuleTaskDetailComposite(AbstractBpmn2PropertySection section) {
- super(section);
- }
-
- public BusinessRuleTaskDetailComposite(Composite parent, int style) {
- super(parent, style);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2DetailComposite
- * #createBindings(org.eclipse.emf.ecore.EObject)
- */
- @Override
- public void createBindings(EObject be) {
- bindAttribute(be,"anyAttribute");
- bindAttribute(be,"implementation");
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/BusinessRuleTaskPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/BusinessRuleTaskPropertySection.java
deleted file mode 100644
index 42e2539..0000000
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/BusinessRuleTaskPropertySection.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Innar Made
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.property.tasks;
-
-import org.eclipse.bpmn2.BusinessRuleTask;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
-
-public class BusinessRuleTaskPropertySection extends AbstractBpmn2PropertySection implements ITabbedPropertyConstants {
- static {
- PropertiesCompositeFactory.register(BusinessRuleTask.class, BusinessRuleTaskDetailComposite.class);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
- */
- @Override
- protected AbstractDetailComposite createSectionRoot() {
- return new BusinessRuleTaskDetailComposite(this);
- }
-
- @Override
- public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
- return new BusinessRuleTaskDetailComposite(parent,style);
- }
-
- @Override
- protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
- EObject be = super.getBusinessObjectForPictogramElement(pe);
- if (be instanceof BusinessRuleTask)
- return be;
- return null;
- }
-}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/CallActivityDetailComposite.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/CallActivityDetailComposite.java
deleted file mode 100644
index 92943c2..0000000
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/CallActivityDetailComposite.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Bob Brodt
- ******************************************************************************/
-
-
-package org.eclipse.bpmn2.modeler.ui.property.tasks;
-
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.swt.widgets.Composite;
-
-public class CallActivityDetailComposite extends ActivityDetailComposite {
-
- public CallActivityDetailComposite(Composite parent, int style) {
- super(parent, style);
- }
-
- /**
- * @param section
- */
- public CallActivityDetailComposite(AbstractBpmn2PropertySection section) {
- super(section);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/CallActivityPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/CallActivityPropertySection.java
deleted file mode 100644
index d264f9a..0000000
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/CallActivityPropertySection.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Bob Brodt
- ******************************************************************************/
-
-package org.eclipse.bpmn2.modeler.ui.property.tasks;
-
-import org.eclipse.bpmn2.CallActivity;
-import org.eclipse.bpmn2.GlobalBusinessRuleTask;
-import org.eclipse.bpmn2.GlobalManualTask;
-import org.eclipse.bpmn2.GlobalScriptTask;
-import org.eclipse.bpmn2.GlobalTask;
-import org.eclipse.bpmn2.GlobalUserTask;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.DefaultDetailComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
-
-/**
- * @author Bob Brodt
- *
- */
-public class CallActivityPropertySection extends AbstractBpmn2PropertySection implements ITabbedPropertyConstants {
- static {
- PropertiesCompositeFactory.register(CallActivity.class, CallActivityDetailComposite.class);
- PropertiesCompositeFactory.register(GlobalTask.class, GlobalTaskDetailComposite.class);
- PropertiesCompositeFactory.register(GlobalBusinessRuleTask.class, GlobalTaskDetailComposite.class);
- PropertiesCompositeFactory.register(GlobalManualTask.class, GlobalTaskDetailComposite.class);
- PropertiesCompositeFactory.register(GlobalScriptTask.class, GlobalTaskDetailComposite.class);
- PropertiesCompositeFactory.register(GlobalUserTask.class, GlobalTaskDetailComposite.class);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
- */
- @Override
- protected AbstractDetailComposite createSectionRoot() {
- return new CallActivityDetailComposite(this);
- }
-
- @Override
- public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
- return new CallActivityDetailComposite(parent,style);
- }
-
- @Override
- protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
- EObject be = super.getBusinessObjectForPictogramElement(pe);
- if (be instanceof CallActivity)
- return be;
- return null;
- }
-
- public class GlobalTaskDetailComposite extends DefaultDetailComposite {
-
- public GlobalTaskDetailComposite(Composite parent, int style) {
- super(parent, style);
- }
-
- public GlobalTaskDetailComposite(AbstractBpmn2PropertySection section) {
- super(section);
- }
-
- @Override
- public AbstractPropertiesProvider getPropertiesProvider(EObject object) {
- if (propertiesProvider==null) {
- propertiesProvider = new AbstractPropertiesProvider(object) {
- String[] properties = new String[] {
- "id", // BaseElement
- "name", // CallableElement
- "ioBinding", // CallableElement
- "ioSpecification",// CallableElement
- "supportedInterfaceRefs",// CallableElement
- "resources", // GlobalTask
- "implementation", // GlobalBusinessRuleTask & GlobalUserTask
- "script", // GlobalScriptTask
- "scriptLanguage", // GlobalScriptTask
- "renderings", // GlobalUserTask
- };
-
- @Override
- public String[] getProperties() {
- return properties;
- }
- };
- }
- return propertiesProvider;
- }
-
- }
-}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/CallChoreographyDetailComposite.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/CallChoreographyDetailComposite.java
deleted file mode 100644
index b3f3141..0000000
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/CallChoreographyDetailComposite.java
+++ /dev/null
@@ -1,32 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Bob Brodt
- ******************************************************************************/
-
-
-package org.eclipse.bpmn2.modeler.ui.property.tasks;
-
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.swt.widgets.Composite;
-
-public class CallChoreographyDetailComposite extends ActivityDetailComposite {
-
- public CallChoreographyDetailComposite(Composite parent, int style) {
- super(parent, style);
- }
-
- /**
- * @param section
- */
- public CallChoreographyDetailComposite(AbstractBpmn2PropertySection section) {
- super(section);
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/CallChoreographyPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/CallChoreographyPropertySection.java
deleted file mode 100644
index f8f163c..0000000
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/CallChoreographyPropertySection.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Bob Brodt
- ******************************************************************************/
-
-package org.eclipse.bpmn2.modeler.ui.property.tasks;
-
-import org.eclipse.bpmn2.CallChoreography;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
-
-/**
- * @author Bob Brodt
- *
- */
-public class CallChoreographyPropertySection extends AbstractBpmn2PropertySection implements ITabbedPropertyConstants {
- static {
- PropertiesCompositeFactory.register(CallChoreography.class, CallChoreographyDetailComposite.class);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
- */
- @Override
- protected AbstractDetailComposite createSectionRoot() {
- return new CallChoreographyDetailComposite(this);
- }
-
- @Override
- public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
- return new CallChoreographyDetailComposite(parent,style);
- }
-
- @Override
- protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
- EObject be = super.getBusinessObjectForPictogramElement(pe);
- if (be instanceof CallChoreography)
- return be;
- return null;
- }
-}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ChoreographyTaskDetailComposite.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ChoreographyTaskDetailComposite.java
deleted file mode 100644
index 9499210..0000000
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ChoreographyTaskDetailComposite.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Bob Brodt
- ******************************************************************************/
-
-
-package org.eclipse.bpmn2.modeler.ui.property.tasks;
-
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.DefaultDetailComposite;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.swt.widgets.Composite;
-
-public class ChoreographyTaskDetailComposite extends DefaultDetailComposite {
-
- private AbstractPropertiesProvider itemProvider;
-
- /**
- * @param section
- */
- public ChoreographyTaskDetailComposite(AbstractBpmn2PropertySection section) {
- super(section);
- }
-
- public ChoreographyTaskDetailComposite(Composite parent, int style) {
- super(parent, style);
- }
-
- @Override
- public AbstractPropertiesProvider getPropertiesProvider(EObject object) {
- if (itemProvider == null) {
- itemProvider = new AbstractPropertiesProvider(object) {
- String[] properties = new String[] {
- "loopType",
- "initiatingParticipantRef",
- "participantRefs",
- "correlationKeys",
- "messageFlowRef"
- };
-
- @Override
- public String[] getProperties() {
- return properties;
- }
- };
- }
- return itemProvider;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ChoreographyTaskPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ChoreographyTaskPropertySection.java
deleted file mode 100644
index dde4928..0000000
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ChoreographyTaskPropertySection.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Innar Made
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.property.tasks;
-
-import org.eclipse.bpmn2.ChoreographyTask;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
-
-public class ChoreographyTaskPropertySection extends AbstractBpmn2PropertySection implements ITabbedPropertyConstants {
- static {
- PropertiesCompositeFactory.register(ChoreographyTask.class, ChoreographyTaskDetailComposite.class);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
- */
- @Override
- protected AbstractDetailComposite createSectionRoot() {
- return new ChoreographyTaskDetailComposite(this);
- }
-
- @Override
- public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
- return new ChoreographyTaskDetailComposite(parent,style);
- }
-
- @Override
- protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
- EObject be = super.getBusinessObjectForPictogramElement(pe);
- if (be instanceof ChoreographyTask)
- return be;
- return null;
- }
-}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/DataAssociationDetailComposite.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/DataAssociationDetailComposite.java
index f5b3af4..7283754 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/DataAssociationDetailComposite.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/DataAssociationDetailComposite.java
@@ -61,9 +61,9 @@
* This class renders the property sheet tab for Data I/O Associations (a.k.a. parameter mappings)
* defined in Activities and ThrowEvents.
*
- * The DataInput/OutputAssociation can be used to associate an ItemAwareElement
+ * The DataInput/OutputAssociation can businessObject used to associate an ItemAwareElement
* parameter with a DataInput/Output contained in an Activity. The source of such
- * a DataAssociation can be every ItemAwareElement accessible in the
+ * a DataAssociation can businessObject every ItemAwareElement accessible in the
* current scope, e.g., a Data Object, a Property, or an Expression.
*
* The execution of any Data Associations MUST follow these semantics:
@@ -73,7 +73,7 @@
* o For each “assignment” parameter specified:
* o Evaluate the Assignment’s “from” expression and obtain the *source value*.
* o Evaluate the Assignment’s “to” expression and obtain the *target parameter*.
- * The *target parameter* can be any parameter in the context or a sub-parameter of
+ * The *target parameter* can businessObject any parameter in the context or a sub-parameter of
* it (e.g., a DataObject or a sub-parameter of it).
* o Copy the *source value* to the *target parameter*.
* o If no “transformation” Expression nor any “assignment” elements are defined
@@ -284,7 +284,7 @@
}
private void redrawParent() {
- // this DetailComposite should be sitting in a SashForm created
+ // this DetailComposite should businessObject sitting in a SashForm created
// by a ListComposite. layout this thing first
layout();
// and then search for the DetailComposite that contains the list
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/IoParameterMappingColumn.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/IoParameterMappingColumn.java
index 4a24833..b12daad 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/IoParameterMappingColumn.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/IoParameterMappingColumn.java
@@ -1,188 +1,188 @@
-package org.eclipse.bpmn2.modeler.ui.property.tasks;
-
-import java.util.List;
-
-import org.eclipse.bpmn2.Activity;
-import org.eclipse.bpmn2.Assignment;
-import org.eclipse.bpmn2.Bpmn2Package;
-import org.eclipse.bpmn2.CatchEvent;
-import org.eclipse.bpmn2.DataAssociation;
-import org.eclipse.bpmn2.DataInput;
-import org.eclipse.bpmn2.DataInputAssociation;
-import org.eclipse.bpmn2.DataOutput;
-import org.eclipse.bpmn2.DataOutputAssociation;
-import org.eclipse.bpmn2.FormalExpression;
-import org.eclipse.bpmn2.ItemAwareElement;
-import org.eclipse.bpmn2.ThrowEvent;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.TableColumn;
-import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.jface.viewers.CellEditor;
-
-public class IoParameterMappingColumn extends TableColumn {
-
- protected DataAssociation association = null;
-
- public IoParameterMappingColumn(EObject o, EStructuralFeature f) {
- super(o, f);
- }
-
- @Override
- public String getHeaderText() {
- return ModelUtil.getLabel(
- Bpmn2Package.eINSTANCE.getDataAssociation(),
- feature.getName().startsWith("dataInput") ?
- Bpmn2Package.eINSTANCE.getDataAssociation_SourceRef() :
- Bpmn2Package.eINSTANCE.getDataAssociation_TargetRef()
- );
- }
-
- @Override
- public String getText(Object element) {
- String text = null;
- ItemAwareElement source = (ItemAwareElement)element;
- DataAssociation da = getDataAssociation(source);
- if (da!=null) {
- ItemAwareElement target = getTargetElement(da);
- if (target!=null)
- text = ModelUtil.getDisplayName(target);
- else {
- if (da.getTransformation()!=null) {
- text = "Transform: " + ModelUtil.getDisplayName(da.getTransformation());
- }
- if (!da.getAssignment().isEmpty()) {
- String text2 = null;
- for ( Assignment assign : da.getAssignment()) {
- FormalExpression expr = getTargetExpression(da, assign);
- String body = ModelUtil.getDisplayName(expr);
- if (text2==null)
- text2 = "Expression: " + body;
- else
- text2 += ",\n" + body;
- }
- if (text==null)
- text = text2;
- else
- text += " + " + text2;
- }
- }
- }
- return text==null ? "" : text;
- }
-
- private FormalExpression getTargetExpression(DataAssociation da, Assignment assign) {
- return (FormalExpression) ((da instanceof DataInputAssociation) ? assign.getFrom() : assign.getTo());
- }
-
- @Override
- public Object getValue(Object element, String property) {
- Integer value = new Integer(-1);
- ItemAwareElement source = (ItemAwareElement)element;
- DataAssociation da = getDataAssociation(source);
- if (da!=null) {
- ItemAwareElement target = getTargetElement(da);
- association = da;
- EStructuralFeature f = getTargetFeature(source);
- ((CustomComboBoxCellEditor)cellEditor).setValue(da,f,target);
- value = (Integer)cellEditor.getValue();
- }
- return value;
- }
-
- @Override
- protected CellEditor createCellEditor(Object element, String property) {
- CellEditor ce = new CustomComboBoxCellEditor(getParent(), object, feature);
- setCellEditor(ce);
- return ce;
- }
-
- @Override
- public boolean canModify(Object element, String property) {
- if (super.canModify(element, property)) {
- // only allow the combobox cell editor to work if the DataAssociation is
- // with a Property (no Assignments or Transformations please!)
- // Other types of associations must be done in the Detail section
- DataAssociation da = getDataAssociation((ItemAwareElement)element);
- if (da!= null) {
- if (getTargetElement(da) == null) {
- if (!da.getAssignment().isEmpty() || da.getTransformation()!=null)
- return false;
- }
- return true;
- }
- }
- return false;
- }
-
- public void modify(Object element, String property, Object value) {
- // the real object to be modified is the DataAssociation
- EStructuralFeature f = getTargetFeature((ItemAwareElement)element);
- super.modify(association, f, value);
- }
-
- protected List<DataAssociation> getDataAssociations(ItemAwareElement element) {
- if (element instanceof DataInput)
- return getDataInputAssociations();
- if (element instanceof DataOutput)
- return getDataOutputAssociations();
- return null;
- }
-
- public List getDataInputAssociations() {
- if (object instanceof Activity) {
- return ((Activity)object).getDataInputAssociations();
- }
- else if (object instanceof ThrowEvent) {
- return ((ThrowEvent)object).getDataInputAssociation();
- }
- return null;
- }
-
- public List getDataOutputAssociations() {
- if (object instanceof Activity) {
- return ((Activity)object).getDataOutputAssociations();
- }
- else if (object instanceof CatchEvent) {
- return ((CatchEvent)object).getDataOutputAssociation();
- }
- return null;
- }
-
- protected DataAssociation getDataAssociation(ItemAwareElement element) {
- for (DataAssociation da : getDataAssociations(element)) {
- if (element==getSourceElement(da)) {
- return da;
- }
- }
- return null;
- }
-
- protected ItemAwareElement getSourceElement(DataAssociation da) {
- if (da instanceof DataOutputAssociation) {
- if (da.getSourceRef().size()==1)
- return da.getSourceRef().get(0);
- }
- else if (da instanceof DataInputAssociation) {
- return da.getTargetRef();
- }
- return null;
- }
-
- protected ItemAwareElement getTargetElement(DataAssociation da) {
- if (da instanceof DataInputAssociation) {
- if (da.getSourceRef().size()==1)
- return da.getSourceRef().get(0);
- }
- else if (da instanceof DataOutputAssociation) {
- return da.getTargetRef();
- }
- return null;
- }
-
- protected EStructuralFeature getTargetFeature(ItemAwareElement element) {
- return element instanceof DataInput ?
- Bpmn2Package.eINSTANCE.getDataAssociation_SourceRef() :
- Bpmn2Package.eINSTANCE.getDataAssociation_TargetRef();
- }
+package org.eclipse.bpmn2.modeler.ui.property.tasks;
+
+import java.util.List;
+
+import org.eclipse.bpmn2.Activity;
+import org.eclipse.bpmn2.Assignment;
+import org.eclipse.bpmn2.Bpmn2Package;
+import org.eclipse.bpmn2.CatchEvent;
+import org.eclipse.bpmn2.DataAssociation;
+import org.eclipse.bpmn2.DataInput;
+import org.eclipse.bpmn2.DataInputAssociation;
+import org.eclipse.bpmn2.DataOutput;
+import org.eclipse.bpmn2.DataOutputAssociation;
+import org.eclipse.bpmn2.FormalExpression;
+import org.eclipse.bpmn2.ItemAwareElement;
+import org.eclipse.bpmn2.ThrowEvent;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.TableColumn;
+import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jface.viewers.CellEditor;
+
+public class IoParameterMappingColumn extends TableColumn {
+
+ protected DataAssociation association = null;
+
+ public IoParameterMappingColumn(EObject o, EStructuralFeature f) {
+ super(o, f);
+ }
+
+ @Override
+ public String getHeaderText() {
+ return ModelUtil.getLabel(
+ Bpmn2Package.eINSTANCE.getDataAssociation(),
+ feature.getName().startsWith("dataInput") ?
+ Bpmn2Package.eINSTANCE.getDataAssociation_SourceRef() :
+ Bpmn2Package.eINSTANCE.getDataAssociation_TargetRef()
+ );
+ }
+
+ @Override
+ public String getText(Object element) {
+ String text = null;
+ ItemAwareElement source = (ItemAwareElement)element;
+ DataAssociation da = getDataAssociation(source);
+ if (da!=null) {
+ ItemAwareElement target = getTargetElement(da);
+ if (target!=null)
+ text = ModelUtil.getDisplayName(target);
+ else {
+ if (da.getTransformation()!=null) {
+ text = "Transform: " + ModelUtil.getDisplayName(da.getTransformation());
+ }
+ if (!da.getAssignment().isEmpty()) {
+ String text2 = null;
+ for ( Assignment assign : da.getAssignment()) {
+ FormalExpression expr = getTargetExpression(da, assign);
+ String body = ModelUtil.getDisplayName(expr);
+ if (text2==null)
+ text2 = "Expression: " + body;
+ else
+ text2 += ",\n" + body;
+ }
+ if (text==null)
+ text = text2;
+ else
+ text += " + " + text2;
+ }
+ }
+ }
+ return text==null ? "" : text;
+ }
+
+ private FormalExpression getTargetExpression(DataAssociation da, Assignment assign) {
+ return (FormalExpression) ((da instanceof DataInputAssociation) ? assign.getFrom() : assign.getTo());
+ }
+
+ @Override
+ public Object getValue(Object element, String property) {
+ Integer value = new Integer(-1);
+ ItemAwareElement source = (ItemAwareElement)element;
+ DataAssociation da = getDataAssociation(source);
+ if (da!=null) {
+ ItemAwareElement target = getTargetElement(da);
+ association = da;
+ EStructuralFeature f = getTargetFeature(source);
+ ((CustomComboBoxCellEditor)cellEditor).setValue(da,f,target);
+ value = (Integer)cellEditor.getValue();
+ }
+ return value;
+ }
+
+ @Override
+ protected CellEditor createCellEditor(Object element, String property) {
+ CellEditor ce = new CustomComboBoxCellEditor(getParent(), object, feature);
+ setCellEditor(ce);
+ return ce;
+ }
+
+ @Override
+ public boolean canModify(Object element, String property) {
+ if (super.canModify(element, property)) {
+ // only allow the combobox cell editor to work if the DataAssociation is
+ // with a Property (no Assignments or Transformations please!)
+ // Other types of associations must businessObject done in the Detail section
+ DataAssociation da = getDataAssociation((ItemAwareElement)element);
+ if (da!= null) {
+ if (getTargetElement(da) == null) {
+ if (!da.getAssignment().isEmpty() || da.getTransformation()!=null)
+ return false;
+ }
+ return true;
+ }
+ }
+ return false;
+ }
+
+ public void modify(Object element, String property, Object value) {
+ // the real object to businessObject modified is the DataAssociation
+ EStructuralFeature f = getTargetFeature((ItemAwareElement)element);
+ super.modify(association, f, value);
+ }
+
+ protected List<DataAssociation> getDataAssociations(ItemAwareElement element) {
+ if (element instanceof DataInput)
+ return getDataInputAssociations();
+ if (element instanceof DataOutput)
+ return getDataOutputAssociations();
+ return null;
+ }
+
+ public List getDataInputAssociations() {
+ if (object instanceof Activity) {
+ return ((Activity)object).getDataInputAssociations();
+ }
+ else if (object instanceof ThrowEvent) {
+ return ((ThrowEvent)object).getDataInputAssociation();
+ }
+ return null;
+ }
+
+ public List getDataOutputAssociations() {
+ if (object instanceof Activity) {
+ return ((Activity)object).getDataOutputAssociations();
+ }
+ else if (object instanceof CatchEvent) {
+ return ((CatchEvent)object).getDataOutputAssociation();
+ }
+ return null;
+ }
+
+ protected DataAssociation getDataAssociation(ItemAwareElement element) {
+ for (DataAssociation da : getDataAssociations(element)) {
+ if (element==getSourceElement(da)) {
+ return da;
+ }
+ }
+ return null;
+ }
+
+ protected ItemAwareElement getSourceElement(DataAssociation da) {
+ if (da instanceof DataOutputAssociation) {
+ if (da.getSourceRef().size()==1)
+ return da.getSourceRef().get(0);
+ }
+ else if (da instanceof DataInputAssociation) {
+ return da.getTargetRef();
+ }
+ return null;
+ }
+
+ protected ItemAwareElement getTargetElement(DataAssociation da) {
+ if (da instanceof DataInputAssociation) {
+ if (da.getSourceRef().size()==1)
+ return da.getSourceRef().get(0);
+ }
+ else if (da instanceof DataOutputAssociation) {
+ return da.getTargetRef();
+ }
+ return null;
+ }
+
+ protected EStructuralFeature getTargetFeature(ItemAwareElement element) {
+ return element instanceof DataInput ?
+ Bpmn2Package.eINSTANCE.getDataAssociation_SourceRef() :
+ Bpmn2Package.eINSTANCE.getDataAssociation_TargetRef();
+ }
}
\ No newline at end of file
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/IoParametersDetailComposite.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/IoParametersDetailComposite.java
index 0ed741c..e055ce2 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/IoParametersDetailComposite.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/IoParametersDetailComposite.java
@@ -65,7 +65,7 @@
public void createBindings(final EObject be) {
final EStructuralFeature ioSpecificationFeature = be.eClass().getEStructuralFeature("ioSpecification");
if (ioSpecificationFeature != null) {
- // the control parameter must be an Activity or CallableElement (i.e. a Process or GlobalTask)
+ // the control parameter must businessObject an Activity or CallableElement (i.e. a Process or GlobalTask)
InputOutputSpecification ioSpecification = (InputOutputSpecification)be.eGet(ioSpecificationFeature);
if (ioSpecification==null) {
ioSpecification = (InputOutputSpecification) FACTORY.createInputOutputSpecification();
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/IoParametersPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/IoParametersPropertySection.java
index 441abe0..0051ba4 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/IoParametersPropertySection.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/IoParametersPropertySection.java
@@ -1,75 +1,70 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Innar Made
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.property.tasks;
-
-import org.eclipse.bpmn2.DataInput;
-import org.eclipse.bpmn2.DataOutput;
-import org.eclipse.bpmn2.InputOutputSpecification;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
-import org.eclipse.bpmn2.modeler.core.runtime.ModelEnablementDescriptor;
-import org.eclipse.bpmn2.modeler.core.utils.BusinessObjectUtil;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IWorkbenchPart;
-
-public class IoParametersPropertySection extends AbstractBpmn2PropertySection {
- static {
- PropertiesCompositeFactory.register(InputOutputSpecification.class, IoParametersDetailComposite.class);
- PropertiesCompositeFactory.register(DataInput.class, DataAssociationDetailComposite.class);
- PropertiesCompositeFactory.register(DataOutput.class, DataAssociationDetailComposite.class);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
- */
- @Override
- protected AbstractDetailComposite createSectionRoot() {
- return new IoParametersDetailComposite(this);
- }
-
- @Override
- public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
- return new IoParametersDetailComposite(parent,style);
- }
-
- @Override
- public boolean appliesTo(IWorkbenchPart part, ISelection selection) {
- if (super.appliesTo(part, selection)) {
- ModelEnablementDescriptor modelEnablement = getModelEnablement(selection);
- EObject selectionBO = BusinessObjectUtil.getBusinessObjectForSelection(selection);
- EStructuralFeature feature = selectionBO.eClass().getEStructuralFeature("ioSpecification");
- if (feature != null) {
- if (!modelEnablement.isEnabled(selectionBO.eClass(), feature))
- return false;
- }
- return true;
- }
- return false;
- }
-
- @Override
- protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
- EObject be = super.getBusinessObjectForPictogramElement(pe);
- if (be!=null) {
- EStructuralFeature feature = be.eClass().getEStructuralFeature("ioSpecification");
- if (feature != null)
- return be;
- }
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Innar Made
+ ******************************************************************************/
+package org.eclipse.bpmn2.modeler.ui.property.tasks;
+
+import org.eclipse.bpmn2.DataInput;
+import org.eclipse.bpmn2.DataOutput;
+import org.eclipse.bpmn2.InputOutputSpecification;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
+import org.eclipse.bpmn2.modeler.core.runtime.ModelEnablementDescriptor;
+import org.eclipse.bpmn2.modeler.core.utils.BusinessObjectUtil;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.IWorkbenchPart;
+
+public class IoParametersPropertySection extends AbstractBpmn2PropertySection {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
+ */
+ @Override
+ protected AbstractDetailComposite createSectionRoot() {
+ return new IoParametersDetailComposite(this);
+ }
+
+ @Override
+ public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
+ return new IoParametersDetailComposite(parent,style);
+ }
+
+ @Override
+ public boolean appliesTo(IWorkbenchPart part, ISelection selection) {
+ if (super.appliesTo(part, selection)) {
+ ModelEnablementDescriptor modelEnablement = getModelEnablement(selection);
+ EObject selectionBO = BusinessObjectUtil.getBusinessObjectForSelection(selection);
+ EStructuralFeature feature = selectionBO.eClass().getEStructuralFeature("ioSpecification");
+ if (feature != null) {
+ if (!modelEnablement.isEnabled(selectionBO.eClass(), feature))
+ return false;
+ }
+ return true;
+ }
+ return false;
+ }
+
+ @Override
+ protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
+ EObject be = super.getBusinessObjectForPictogramElement(pe);
+ if (be!=null) {
+ EStructuralFeature feature = be.eClass().getEStructuralFeature("ioSpecification");
+ if (feature != null)
+ return be;
+ }
+ return null;
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ManualTaskPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ManualTaskPropertySection.java
index 2ac76e3..8bceee3 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ManualTaskPropertySection.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ManualTaskPropertySection.java
@@ -1,49 +1,46 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Innar Made
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.property.tasks;
-
-import org.eclipse.bpmn2.ManualTask;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
-
-public class ManualTaskPropertySection extends AbstractBpmn2PropertySection implements ITabbedPropertyConstants {
- static {
- PropertiesCompositeFactory.register(ManualTask.class, ManualTaskDetailComposite.class);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
- */
- @Override
- protected AbstractDetailComposite createSectionRoot() {
- return new ManualTaskDetailComposite(this);
- }
-
- @Override
- public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
- return new ManualTaskDetailComposite(parent,style);
- }
-
- @Override
- protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
- EObject be = super.getBusinessObjectForPictogramElement(pe);
- if (be instanceof ManualTask)
- return be;
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Innar Made
+ ******************************************************************************/
+package org.eclipse.bpmn2.modeler.ui.property.tasks;
+
+import org.eclipse.bpmn2.ManualTask;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+
+public class ManualTaskPropertySection extends AbstractBpmn2PropertySection implements ITabbedPropertyConstants {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
+ */
+ @Override
+ protected AbstractDetailComposite createSectionRoot() {
+ return new ManualTaskDetailComposite(this);
+ }
+
+ @Override
+ public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
+ return new ManualTaskDetailComposite(parent,style);
+ }
+
+ @Override
+ protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
+ EObject be = super.getBusinessObjectForPictogramElement(pe);
+ if (be instanceof ManualTask)
+ return be;
+ return null;
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ReceiveTaskDetailComposite.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ReceiveTaskDetailComposite.java
deleted file mode 100644
index c88c97c..0000000
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ReceiveTaskDetailComposite.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Bob Brodt
- ******************************************************************************/
-
-
-package org.eclipse.bpmn2.modeler.ui.property.tasks;
-
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.DefaultDetailComposite;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.swt.widgets.Composite;
-
-public class ReceiveTaskDetailComposite extends DefaultDetailComposite {
-
- public ReceiveTaskDetailComposite(Composite parent, int style) {
- super(parent, style);
- }
-
- /**
- * @param section
- */
- public ReceiveTaskDetailComposite(AbstractBpmn2PropertySection section) {
- super(section);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2DetailComposite
- * #createBindings(org.eclipse.emf.ecore.EObject)
- */
- @Override
- public void createBindings(EObject be) {
- bindAttribute(be,"implementation");
- bindAttribute(be,"instantiate");
- bindReference(be,"messageRef");
- bindReference(be,"operationRef");
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ReceiveTaskPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ReceiveTaskPropertySection.java
deleted file mode 100644
index 81aa7b5..0000000
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ReceiveTaskPropertySection.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Innar Made
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.property.tasks;
-
-import org.eclipse.bpmn2.ReceiveTask;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
-
-public class ReceiveTaskPropertySection extends AbstractBpmn2PropertySection implements ITabbedPropertyConstants {
- static {
- PropertiesCompositeFactory.register(ReceiveTask.class, ReceiveTaskDetailComposite.class);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
- */
- @Override
- protected AbstractDetailComposite createSectionRoot() {
- return new ReceiveTaskDetailComposite(this);
- }
-
- @Override
- public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
- return new ReceiveTaskDetailComposite(parent,style);
- }
-
- @Override
- protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
- EObject be = super.getBusinessObjectForPictogramElement(pe);
- if (be instanceof ReceiveTask)
- return be;
- return null;
- }
-}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ScriptTaskDetailComposite.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ScriptTaskDetailComposite.java
index 1d3545e..ac6df9c 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ScriptTaskDetailComposite.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ScriptTaskDetailComposite.java
@@ -1,60 +1,60 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Bob Brodt
- ******************************************************************************/
-
-
-package org.eclipse.bpmn2.modeler.ui.property.tasks;
-
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.DefaultDetailComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.dialogs.ObjectEditor;
-import org.eclipse.bpmn2.modeler.core.merrimac.dialogs.TextObjectEditor;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
-
-public class ScriptTaskDetailComposite extends DefaultDetailComposite {
-
- private TextObjectEditor scriptEditor;
-
- public ScriptTaskDetailComposite(Composite parent, int style) {
- super(parent, style);
- }
-
- /**
- * @param section
- */
- public ScriptTaskDetailComposite(AbstractBpmn2PropertySection section) {
- super(section);
- }
-
- @Override
- public void cleanBindings() {
- super.cleanBindings();
- scriptEditor = null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2DetailComposite
- * #createBindings(org.eclipse.emf.ecore.EObject)
- */
- @Override
- public void createBindings(EObject be) {
- bindAttribute(be,"scriptFormat");
-// bindAttribute(be,"script");
- scriptEditor = new TextObjectEditor(this,be,be.eClass().getEStructuralFeature("script"));
- scriptEditor.createControl(getAttributesParent(),"Script",SWT.MULTI);
- }
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Bob Brodt
+ ******************************************************************************/
+
+
+package org.eclipse.bpmn2.modeler.ui.property.tasks;
+
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.DefaultDetailComposite;
+import org.eclipse.bpmn2.modeler.core.merrimac.dialogs.ObjectEditor;
+import org.eclipse.bpmn2.modeler.core.merrimac.dialogs.TextObjectEditor;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Composite;
+
+public class ScriptTaskDetailComposite extends DefaultDetailComposite {
+
+ private TextObjectEditor scriptEditor;
+
+ public ScriptTaskDetailComposite(Composite parent, int style) {
+ super(parent, style);
+ }
+
+ /**
+ * @param section
+ */
+ public ScriptTaskDetailComposite(AbstractBpmn2PropertySection section) {
+ super(section);
+ }
+
+ @Override
+ public void cleanBindings() {
+ super.cleanBindings();
+ scriptEditor = null;
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see
+ * org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2DetailComposite
+ * #createBindings(org.eclipse.emf.ecore.EObject)
+ */
+ @Override
+ public void createBindings(EObject be) {
+ bindAttribute(be,"scriptFormat");
+// bindAttribute(businessObject,"script");
+ scriptEditor = new TextObjectEditor(this,be,be.eClass().getEStructuralFeature("script"));
+ scriptEditor.createControl(getAttributesParent(),"Script",SWT.MULTI);
+ }
}
\ No newline at end of file
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ScriptTaskPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ScriptTaskPropertySection.java
index 880995e..b17dd62 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ScriptTaskPropertySection.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ScriptTaskPropertySection.java
@@ -1,50 +1,47 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Innar Made
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.property.tasks;
-
-import org.eclipse.bpmn2.ScriptTask;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.graphiti.services.Graphiti;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
-
-public class ScriptTaskPropertySection extends AbstractBpmn2PropertySection implements ITabbedPropertyConstants {
- static {
- PropertiesCompositeFactory.register(ScriptTask.class, ScriptTaskDetailComposite.class);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
- */
- @Override
- protected AbstractDetailComposite createSectionRoot() {
- return new ScriptTaskDetailComposite(this);
- }
-
- @Override
- public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
- return new ScriptTaskDetailComposite(parent,style);
- }
-
- @Override
- protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
- EObject be = (EObject) Graphiti.getLinkService().getBusinessObjectForLinkedPictogramElement(pe);
- if (be instanceof ScriptTask)
- return be;
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Innar Made
+ ******************************************************************************/
+package org.eclipse.bpmn2.modeler.ui.property.tasks;
+
+import org.eclipse.bpmn2.ScriptTask;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.services.Graphiti;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
+
+public class ScriptTaskPropertySection extends AbstractBpmn2PropertySection implements ITabbedPropertyConstants {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
+ */
+ @Override
+ protected AbstractDetailComposite createSectionRoot() {
+ return new ScriptTaskDetailComposite(this);
+ }
+
+ @Override
+ public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
+ return new ScriptTaskDetailComposite(parent,style);
+ }
+
+ @Override
+ protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
+ EObject be = (EObject) Graphiti.getLinkService().getBusinessObjectForLinkedPictogramElement(pe);
+ if (be instanceof ScriptTask)
+ return be;
+ return null;
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/SendTaskDetailComposite.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/SendTaskDetailComposite.java
deleted file mode 100644
index 647f2b1..0000000
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/SendTaskDetailComposite.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Bob Brodt
- ******************************************************************************/
-
-
-package org.eclipse.bpmn2.modeler.ui.property.tasks;
-
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.DefaultDetailComposite;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.swt.widgets.Composite;
-
-public class SendTaskDetailComposite extends DefaultDetailComposite {
-
- public SendTaskDetailComposite(Composite parent, int style) {
- super(parent, style);
- }
-
- /**
- * @param section
- */
- public SendTaskDetailComposite(AbstractBpmn2PropertySection section) {
- super(section);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2DetailComposite
- * #createBindings(org.eclipse.emf.ecore.EObject)
- */
- @Override
- public void createBindings(EObject be) {
- bindAttribute(be,"implementation");
- bindReference(be,"messageRef");
- bindReference(be,"operationRef");
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/SendTaskPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/SendTaskPropertySection.java
deleted file mode 100644
index 85bac3d..0000000
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/SendTaskPropertySection.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Innar Made
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.property.tasks;
-
-import org.eclipse.bpmn2.SendTask;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.swt.widgets.Composite;
-
-public class SendTaskPropertySection extends AbstractBpmn2PropertySection {
- static {
- PropertiesCompositeFactory.register(SendTask.class, SendTaskDetailComposite.class);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
- */
- @Override
- protected AbstractDetailComposite createSectionRoot() {
- return new SendTaskDetailComposite(this);
- }
-
- @Override
- public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
- return new SendTaskDetailComposite(parent,style);
- }
-
- @Override
- protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
- EObject be = super.getBusinessObjectForPictogramElement(pe);
- if (be instanceof SendTask)
- return be;
- return null;
- }
-}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ServiceTaskDetailComposite.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ServiceTaskDetailComposite.java
deleted file mode 100644
index d860979..0000000
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ServiceTaskDetailComposite.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Bob Brodt
- ******************************************************************************/
-
-
-package org.eclipse.bpmn2.modeler.ui.property.tasks;
-
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.DefaultDetailComposite;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.swt.widgets.Composite;
-
-public class ServiceTaskDetailComposite extends DefaultDetailComposite {
-
- public ServiceTaskDetailComposite(Composite parent, int style) {
- super(parent, style);
- }
-
- /**
- * @param section
- */
- public ServiceTaskDetailComposite(AbstractBpmn2PropertySection section) {
- super(section);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2DetailComposite
- * #createBindings(org.eclipse.emf.ecore.EObject)
- */
- @Override
- public void createBindings(EObject be) {
- bindAttribute(be,"implementation");
- bindReference(be,"operationRef");
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ServiceTaskPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ServiceTaskPropertySection.java
deleted file mode 100644
index abc720d..0000000
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ServiceTaskPropertySection.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Innar Made
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.property.tasks;
-
-import org.eclipse.bpmn2.ServiceTask;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
-
-public class ServiceTaskPropertySection extends AbstractBpmn2PropertySection implements ITabbedPropertyConstants {
- static {
- PropertiesCompositeFactory.register(ServiceTask.class, ServiceTaskDetailComposite.class);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
- */
- @Override
- protected AbstractDetailComposite createSectionRoot() {
- return new ServiceTaskDetailComposite(this);
- }
-
- @Override
- public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
- return new ServiceTaskDetailComposite(parent,style);
- }
-
- @Override
- protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
- EObject be = super.getBusinessObjectForPictogramElement(pe);
- if (be instanceof ServiceTask)
- return be;
- return null;
- }
-}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/SubChoreographyDetailComposite.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/SubChoreographyDetailComposite.java
deleted file mode 100644
index 69a13b3..0000000
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/SubChoreographyDetailComposite.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Bob Brodt
- ******************************************************************************/
-
-
-package org.eclipse.bpmn2.modeler.ui.property.tasks;
-
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.swt.widgets.Composite;
-
-public class SubChoreographyDetailComposite extends ActivityDetailComposite {
-
- public SubChoreographyDetailComposite(Composite parent, int style) {
- super(parent, style);
- }
-
- /**
- * @param section
- */
- public SubChoreographyDetailComposite(AbstractBpmn2PropertySection section) {
- super(section);
- }
-
- @Override
- public AbstractPropertiesProvider getPropertiesProvider(EObject object) {
- if (propertiesProvider==null) {
- propertiesProvider = new AbstractPropertiesProvider(object) {
- String[] properties = new String[] {
- "anyAttribute",
- "loopType",
- "participantRefs",
- "initiatingParticipantRef",
- "correlationKeys",
- "artifacts",
- };
-
- @Override
- public String[] getProperties() {
- return properties;
- }
- };
- }
- return propertiesProvider;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/SubChoreographyPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/SubChoreographyPropertySection.java
deleted file mode 100644
index 1a6d1cc..0000000
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/SubChoreographyPropertySection.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Bob Brodt
- ******************************************************************************/
-
-package org.eclipse.bpmn2.modeler.ui.property.tasks;
-
-import org.eclipse.bpmn2.SubChoreography;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.views.properties.tabbed.ITabbedPropertyConstants;
-
-/**
- * @author Bob Brodt
- *
- */
-public class SubChoreographyPropertySection extends AbstractBpmn2PropertySection implements ITabbedPropertyConstants {
- static {
- PropertiesCompositeFactory.register(SubChoreography.class, SubChoreographyDetailComposite.class);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
- */
- @Override
- protected AbstractDetailComposite createSectionRoot() {
- return new SubChoreographyDetailComposite(this);
- }
-
- @Override
- public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
- return new SubChoreographyDetailComposite(parent,style);
- }
-
- @Override
- protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
- EObject be = super.getBusinessObjectForPictogramElement(pe);
- if (be instanceof SubChoreography)
- return be;
- return null;
- }
-}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/SubProcessDetailComposite.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/SubProcessDetailComposite.java
deleted file mode 100644
index ba643a2..0000000
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/SubProcessDetailComposite.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Bob Brodt
- ******************************************************************************/
-
-
-package org.eclipse.bpmn2.modeler.ui.property.tasks;
-
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.swt.widgets.Composite;
-
-public class SubProcessDetailComposite extends ActivityDetailComposite {
-
- public SubProcessDetailComposite(Composite parent, int style) {
- super(parent, style);
- }
-
- /**
- * @param section
- */
- public SubProcessDetailComposite(AbstractBpmn2PropertySection section) {
- super(section);
- }
-
- @Override
- public AbstractPropertiesProvider getPropertiesProvider(EObject object) {
- if (propertiesProvider==null) {
- propertiesProvider = new AbstractPropertiesProvider(object) {
- String[] properties = new String[] {
- "anyAttribute",
- "calledElementRef", // only used in CallActivity
- "startQuantity",
- "completionQuantity",
- "completionCondition",
- "isForCompensation",
- "triggeredByEvent",
- "cancelRemainingInstances",
- "loopCharacteristics",
- "boundaryEventDefs",
- "method",
- "ordering",
- "protocol",
- "properties",
- };
-
- @Override
- public String[] getProperties() {
- return properties;
- }
- };
- }
- return propertiesProvider;
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/TaskPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/TaskPropertySection.java
index f78ec79..92a0f8d 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/TaskPropertySection.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/TaskPropertySection.java
@@ -1,53 +1,50 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Innar Made
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.property.tasks;
-
-import org.eclipse.bpmn2.Task;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDialogComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.swt.widgets.Composite;
-
-public class TaskPropertySection extends AbstractBpmn2PropertySection {
- static {
- PropertiesCompositeFactory.register(Task.class, TaskDetailComposite.class);
- }
-
- public TaskPropertySection() {
- super();
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
- */
- @Override
- protected AbstractDetailComposite createSectionRoot() {
- return new TaskDetailComposite(this);
- }
-
- @Override
- public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
- return new TaskDetailComposite(parent,style);
- }
-
- @Override
- protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
- EObject be = super.getBusinessObjectForPictogramElement(pe);
- if (be instanceof Task)
- return be;
- return null;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Innar Made
+ ******************************************************************************/
+package org.eclipse.bpmn2.modeler.ui.property.tasks;
+
+import org.eclipse.bpmn2.Task;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDialogComposite;
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.swt.widgets.Composite;
+
+public class TaskPropertySection extends AbstractBpmn2PropertySection {
+
+ public TaskPropertySection() {
+ super();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
+ */
+ @Override
+ protected AbstractDetailComposite createSectionRoot() {
+ return new TaskDetailComposite(this);
+ }
+
+ @Override
+ public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
+ return new TaskDetailComposite(parent,style);
+ }
+
+ @Override
+ protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
+ EObject be = super.getBusinessObjectForPictogramElement(pe);
+ if (be instanceof Task)
+ return be;
+ return null;
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/UserTaskDetailComposite.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/UserTaskDetailComposite.java
deleted file mode 100644
index 1487838..0000000
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/UserTaskDetailComposite.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Bob Brodt
- ******************************************************************************/
-
-
-package org.eclipse.bpmn2.modeler.ui.property.tasks;
-
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.DefaultDetailComposite;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.swt.widgets.Composite;
-
-public class UserTaskDetailComposite extends DefaultDetailComposite {
-
- public UserTaskDetailComposite(Composite parent, int style) {
- super(parent, style);
- }
-
- /**
- * @param section
- */
- public UserTaskDetailComposite(AbstractBpmn2PropertySection section) {
- super(section);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see
- * org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2DetailComposite
- * #createBindings(org.eclipse.emf.ecore.EObject)
- */
- @Override
- public void createBindings(EObject be) {
- bindAttribute(be,"implementation");
- bindList(be, "renderings");
- }
-}
\ No newline at end of file
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/UserTaskPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/UserTaskPropertySection.java
deleted file mode 100644
index 96287e8..0000000
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/UserTaskPropertySection.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Innar Made
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.property.tasks;
-
-import org.eclipse.bpmn2.UserTask;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractBpmn2PropertySection;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
-import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
-import org.eclipse.swt.widgets.Composite;
-
-public class UserTaskPropertySection extends AbstractBpmn2PropertySection {
- static {
- PropertiesCompositeFactory.register(UserTask.class, UserTaskDetailComposite.class);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.bpmn2.modeler.ui.property.AbstractBpmn2PropertySection#createSectionRoot()
- */
- @Override
- protected AbstractDetailComposite createSectionRoot() {
- return new UserTaskDetailComposite(this);
- }
-
- @Override
- public AbstractDetailComposite createSectionRoot(Composite parent, int style) {
- return new UserTaskDetailComposite(parent,style);
- }
-
- @Override
- protected EObject getBusinessObjectForPictogramElement(PictogramElement pe) {
- EObject be = super.getBusinessObjectForPictogramElement(pe);
- if (be instanceof UserTask)
- return be;
- return null;
- }
-}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/util/ListMap.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/util/ListMap.java
index 78f3767..f0dad92 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/util/ListMap.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/util/ListMap.java
@@ -1,155 +1,155 @@
-/*******************************************************************************
- * Copyright (c) 2006 Oracle Corporation and others.
- * 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:
- * Oracle Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.util;
-
-import java.util.ArrayList;
-import java.util.Comparator;
-import java.util.List;
-
-/**
- * A little bit of LISP.
- *
- * @author Michal Chmielewski (michal.chmielewski@oracle.com)
- * @date Jul 19, 2006
- *
- */
-public class ListMap {
-
- /**
- *
- */
- static final public Object IGNORE = new Object();
-
- /**
- * Interface visitor. The object returned from visit need not be the same
- * object as passed to visit. If IGNORE is returned (above), then
- * the resulting value will not be added to the resulting list.
- */
-
- static public interface Visitor {
- /**
- * @param obj the object to visit.
- * @return some other object, the object itself, or IGNORE
- */
- public Object visit ( Object obj );
- }
-
-
- /**
- * Map the visitor "visitor" on the list "list" and return the result as a list.
- *
- * @param list the list of objects
- * @param visitor the visitor
- * @return the resulting (new) list
- */
-
- static public Object Map (List<?> list, Visitor visitor) {
- return Map(list,visitor,null);
- }
-
-
-
- /**
- * Map the visitor "visitor" on the list "list" and return the result as a list. If the list argument
- * is passed (ret) the result is returned as an array of the results, otherwise it is a list.
- *
- * @param list the list of objects
- * @param visitor the visitor
- * @param ret the array class to convert the results into.
- * @return the resulting (new) list
- */
- static public Object Map ( List<?> list, Visitor visitor , Object[] ret ) {
- List<Object> output = new ArrayList<Object>(list.size());
- for(Object n : list) {
- Object result = visitor.visit(n);
- if (result != IGNORE) {
- output.add( result );
- }
- }
- if (ret == null) {
- return output;
- }
-
- return output.toArray(ret);
- }
-
-
- /**
- * Map the visitor "visitor" on the list "list" and return the result as a list.
- *
- * @param list the list of objects
- * @param visitor the visitor
- * @return the resulting (new) list
- *
- */
- static public Object Map ( Object[] list, Visitor visitor ) {
- return Map(list,visitor,null);
- }
-
-
- /**
- * Map the visitor "visitor" on the list "list" and return the result as a list. If the list argument
- * is passed (ret) the result is returned as an array of the results, otherwise it is a list.
- *
- * @param list the list of objects
- * @param visitor the visitor
- * @param ret the array class to convert the results into.
- * @return the resulting (new) list
- */
-
- static public Object Map (Object[] list, Visitor visitor, Object[] ret) {
- List<Object> l2 = new ArrayList<Object>(list.length);
- for( Object n : list) {
- l2.add(n);
- }
- return Map ( l2, visitor , ret);
- }
-
-
- /**
- * @param list the list of objects.
- * @param visitor the visitor
- * @return the object found or null
- */
- static public final Object Find (List<?> list, Visitor visitor) {
- for(Object n : list) {
- Object result = visitor.visit ( n );
- if (result != IGNORE) {
- return result;
- }
- }
- return null;
- }
-
-
-
-
-
- /**
- * Find the parameter using the comparator in the list.
- *
- * @param list
- * @param key
- * @param comparator
- * @return the parameter found or null
- */
-
- public static Object findElement (List<?> list, Object key, Comparator<Object> comparator) {
- for (Object n : list) {
- if (comparator.compare(n, key) == 0) {
- return n;
- }
- }
- return null;
- }
-
-
-}
+/*******************************************************************************
+ * Copyright (c) 2006 Oracle Corporation and others.
+ * 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:
+ * Oracle Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpmn2.modeler.ui.util;
+
+import java.util.ArrayList;
+import java.util.Comparator;
+import java.util.List;
+
+/**
+ * A little bit of LISP.
+ *
+ * @author Michal Chmielewski (michal.chmielewski@oracle.com)
+ * @date Jul 19, 2006
+ *
+ */
+public class ListMap {
+
+ /**
+ *
+ */
+ static final public Object IGNORE = new Object();
+
+ /**
+ * Interface visitor. The object returned from visit need not businessObject the same
+ * object as passed to visit. If IGNORE is returned (above), then
+ * the resulting value will not businessObject added to the resulting list.
+ */
+
+ static public interface Visitor {
+ /**
+ * @param obj the object to visit.
+ * @return some other object, the object itself, or IGNORE
+ */
+ public Object visit ( Object obj );
+ }
+
+
+ /**
+ * Map the visitor "visitor" on the list "list" and return the result as a list.
+ *
+ * @param list the list of objects
+ * @param visitor the visitor
+ * @return the resulting (new) list
+ */
+
+ static public Object Map (List<?> list, Visitor visitor) {
+ return Map(list,visitor,null);
+ }
+
+
+
+ /**
+ * Map the visitor "visitor" on the list "list" and return the result as a list. If the list argument
+ * is passed (ret) the result is returned as an array of the results, otherwise it is a list.
+ *
+ * @param list the list of objects
+ * @param visitor the visitor
+ * @param ret the array class to convert the results into.
+ * @return the resulting (new) list
+ */
+ static public Object Map ( List<?> list, Visitor visitor , Object[] ret ) {
+ List<Object> output = new ArrayList<Object>(list.size());
+ for(Object n : list) {
+ Object result = visitor.visit(n);
+ if (result != IGNORE) {
+ output.add( result );
+ }
+ }
+ if (ret == null) {
+ return output;
+ }
+
+ return output.toArray(ret);
+ }
+
+
+ /**
+ * Map the visitor "visitor" on the list "list" and return the result as a list.
+ *
+ * @param list the list of objects
+ * @param visitor the visitor
+ * @return the resulting (new) list
+ *
+ */
+ static public Object Map ( Object[] list, Visitor visitor ) {
+ return Map(list,visitor,null);
+ }
+
+
+ /**
+ * Map the visitor "visitor" on the list "list" and return the result as a list. If the list argument
+ * is passed (ret) the result is returned as an array of the results, otherwise it is a list.
+ *
+ * @param list the list of objects
+ * @param visitor the visitor
+ * @param ret the array class to convert the results into.
+ * @return the resulting (new) list
+ */
+
+ static public Object Map (Object[] list, Visitor visitor, Object[] ret) {
+ List<Object> l2 = new ArrayList<Object>(list.length);
+ for( Object n : list) {
+ l2.add(n);
+ }
+ return Map ( l2, visitor , ret);
+ }
+
+
+ /**
+ * @param list the list of objects.
+ * @param visitor the visitor
+ * @return the object found or null
+ */
+ static public final Object Find (List<?> list, Visitor visitor) {
+ for(Object n : list) {
+ Object result = visitor.visit ( n );
+ if (result != IGNORE) {
+ return result;
+ }
+ }
+ return null;
+ }
+
+
+
+
+
+ /**
+ * Find the parameter using the comparator in the list.
+ *
+ * @param list
+ * @param key
+ * @param comparator
+ * @return the parameter found or null
+ */
+
+ public static Object findElement (List<?> list, Object key, Comparator<Object> comparator) {
+ for (Object n : list) {
+ if (comparator.compare(n, key) == 0) {
+ return n;
+ }
+ }
+ return null;
+ }
+
+
+}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/util/XSDUtils.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/util/XSDUtils.java
index dddd9d6..789c3d4 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/util/XSDUtils.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/util/XSDUtils.java
@@ -1,1242 +1,1242 @@
-/*******************************************************************************
- * Copyright (c) 2005 IBM Corporation and others.
- * 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:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.util;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.emf.common.util.EList;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.xsd.XSDAnnotation;
-import org.eclipse.xsd.XSDAttributeDeclaration;
-import org.eclipse.xsd.XSDAttributeGroupDefinition;
-import org.eclipse.xsd.XSDAttributeUse;
-import org.eclipse.xsd.XSDAttributeUseCategory;
-import org.eclipse.xsd.XSDComplexTypeContent;
-import org.eclipse.xsd.XSDComplexTypeDefinition;
-import org.eclipse.xsd.XSDConcreteComponent;
-import org.eclipse.xsd.XSDConstraint;
-import org.eclipse.xsd.XSDElementDeclaration;
-import org.eclipse.xsd.XSDFacet;
-import org.eclipse.xsd.XSDFactory;
-import org.eclipse.xsd.XSDFeature;
-import org.eclipse.xsd.XSDIdentityConstraintDefinition;
-import org.eclipse.xsd.XSDImport;
-import org.eclipse.xsd.XSDInclude;
-import org.eclipse.xsd.XSDModelGroup;
-import org.eclipse.xsd.XSDModelGroupDefinition;
-import org.eclipse.xsd.XSDNamedComponent;
-import org.eclipse.xsd.XSDNotationDeclaration;
-import org.eclipse.xsd.XSDParticle;
-import org.eclipse.xsd.XSDSchema;
-import org.eclipse.xsd.XSDSchemaCompositor;
-import org.eclipse.xsd.XSDSchemaContent;
-import org.eclipse.xsd.XSDSimpleTypeDefinition;
-import org.eclipse.xsd.XSDTypeDefinition;
-import org.eclipse.xsd.XSDWildcard;
-import org.eclipse.xsd.XSDXPathDefinition;
-import org.eclipse.xsd.util.XSDConstants;
-import org.eclipse.xsd.util.XSDUtil;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.Text;
-
-/**
- * Collection of utility methods for dealing with navigation of the XSD model
- */
-public class XSDUtils {
-
- // singleton lists of XSD simple type definitions for supported primitives (see getPrimitives()) and
- // all xsd primitives (see getAdvancedPrimitives()) respectively
- private static List<XSDSimpleTypeDefinition> primitives;
- private static List<XSDTypeDefinition> advancedPrimitives;
-
- // XSD short list -- these are the types presented to the user by default, rather than inundating them with
- // all the available types
- private static List<String> xsdShortList = new ArrayList<String>();
- static
- {
- xsdShortList.add("string"); //$NON-NLS-1$
- xsdShortList.add("int"); //$NON-NLS-1$
- xsdShortList.add("double"); //$NON-NLS-1$
- xsdShortList.add("date"); //$NON-NLS-1$
- xsdShortList.add("time"); //$NON-NLS-1$
- xsdShortList.add("dateTime"); //$NON-NLS-1$
- xsdShortList.add("boolean"); //$NON-NLS-1$
- xsdShortList.add("hexBinary"); //$NON-NLS-1$
- xsdShortList.add("float"); //$NON-NLS-1$
- }
-
-
- // A list of all supported XSD types. Usually the user will not be presented with the full list, but
- // rather with the xsd short list
- private static List<String> supportedPrimitives = new ArrayList<String>();
- static {
- supportedPrimitives.add("anyType"); //$NON-NLS-1$
- supportedPrimitives.add("anyURI"); //$NON-NLS-1$
- supportedPrimitives.add("base64Binary"); //$NON-NLS-1$
- supportedPrimitives.add("boolean"); //$NON-NLS-1$
- supportedPrimitives.add("byte"); //$NON-NLS-1$
- supportedPrimitives.add("date"); //$NON-NLS-1$
- supportedPrimitives.add("dateTime"); //$NON-NLS-1$
- supportedPrimitives.add("decimal"); //$NON-NLS-1$
- supportedPrimitives.add("double"); //$NON-NLS-1$
- supportedPrimitives.add("duration"); //$NON-NLS-1$
- supportedPrimitives.add("ENTITIES"); //$NON-NLS-1$
- supportedPrimitives.add("ENTITY"); //$NON-NLS-1$
- supportedPrimitives.add("float"); //$NON-NLS-1$
- supportedPrimitives.add("gDay"); //$NON-NLS-1$
- supportedPrimitives.add("gMonth"); //$NON-NLS-1$
- supportedPrimitives.add("gMonthDay"); //$NON-NLS-1$
- supportedPrimitives.add("gYear"); //$NON-NLS-1$
- supportedPrimitives.add("gYearMonth"); //$NON-NLS-1$
- supportedPrimitives.add("hexBinary"); //$NON-NLS-1$
- supportedPrimitives.add("ID"); //$NON-NLS-1$
- supportedPrimitives.add("IDREF"); //$NON-NLS-1$
- supportedPrimitives.add("IDREFS"); //$NON-NLS-1$
- supportedPrimitives.add("int"); //$NON-NLS-1$
- supportedPrimitives.add("integer"); //$NON-NLS-1$
- supportedPrimitives.add("language"); //$NON-NLS-1$
- supportedPrimitives.add("long"); //$NON-NLS-1$
- supportedPrimitives.add("Name"); //$NON-NLS-1$
- supportedPrimitives.add("NCName"); //$NON-NLS-1$
- supportedPrimitives.add("negativeInteger"); //$NON-NLS-1$
- supportedPrimitives.add("NMTOKEN"); //$NON-NLS-1$
- supportedPrimitives.add("NMTOKENS"); //$NON-NLS-1$, "NMTOKENS");
- supportedPrimitives.add("nonNegativeInteger"); //$NON-NLS-1$
- supportedPrimitives.add("nonPositiveInteger"); //$NON-NLS-1$
- supportedPrimitives.add("normalizedString"); //$NON-NLS-1$
- supportedPrimitives.add("NOTATION"); //$NON-NLS-1$
- supportedPrimitives.add("positiveInteger"); //$NON-NLS-1$
- supportedPrimitives.add("QName"); //$NON-NLS-1$
- supportedPrimitives.add("short"); //$NON-NLS-1$
- supportedPrimitives.add("string"); //$NON-NLS-1$
- supportedPrimitives.add("time"); //$NON-NLS-1$
- supportedPrimitives.add("token"); //$NON-NLS-1$
- supportedPrimitives.add("unsignedByte"); //$NON-NLS-1$
- supportedPrimitives.add("unsignedInt"); //$NON-NLS-1$
- supportedPrimitives.add("unsignedLong"); //$NON-NLS-1$
- supportedPrimitives.add("unsignedShort"); //$NON-NLS-1$
- }
-
- /**
- * Add a local annotation with userInfo to the given item.
- *
- * <p>
- * Note: We take an XSDConcreteComponent, however we must then cast it to
- * one of the types that has a setAnnotation call defined, since it doesn't
- * have a clear 'parent' interface for annotations.
- * </p>
- *
- * <p>
- * Also note that UserInformation and ApplicationInformation objects can
- * only be added <b>after </b> the parent of the annotation has been added
- * to an XSDSchema object. This is because these objects are modeled in the
- * concrete DOM layer only, and otherwise will throw a DOMException.
- * <p>
- *
- * @param component
- * to add annotation to; may be any kind of XSDConcreteComponent
- * object including an XSDSchema
- * @param text
- * text to add as the userInformation (xsd:documentation) node to
- * the annotation
- * @return the XSDAnnotation object created, after having been added to the
- * component; null if any error occoured
- */
- public static XSDAnnotation addDocumentation(XSDConcreteComponent component, String text) {
- if (null == component) {
- throw new IllegalArgumentException("addDocumentation called with null component"); //$NON-NLS-1$
- }
- try {
-
- // First get the factory from the component: this is
- // roundabout, but saves the user from having to
- // pass it in
- XSDFactory xsdFactory = XSDFactory.eINSTANCE;
-
- // Create an XSDAnnotation object to hold everything
- XSDAnnotation xsdAnnotation = xsdFactory.createXSDAnnotation();
-
- // Depending on the XSDConcreteComponent type, cast to
- // the appropriate type and add the annotation or, if component
- // already has an annotation, use that one instead.
- if (component instanceof XSDAttributeDeclaration) {
- if(((XSDAttributeDeclaration) component).getAnnotation() == null)
- ((XSDAttributeDeclaration) component).setAnnotation(xsdAnnotation);
- else
- xsdAnnotation = ((XSDAttributeDeclaration) component).getAnnotation();
- } else if (component instanceof XSDAttributeGroupDefinition) {
- if(((XSDAttributeGroupDefinition) component).getAnnotation() == null)
- ((XSDAttributeGroupDefinition) component).setAnnotation(xsdAnnotation);
- else
- xsdAnnotation = ((XSDAttributeGroupDefinition) component).getAnnotation();
- } else if (component instanceof XSDElementDeclaration) {
- if(((XSDElementDeclaration) component).getAnnotation() == null)
- ((XSDElementDeclaration) component).setAnnotation(xsdAnnotation);
- else
- xsdAnnotation = ((XSDElementDeclaration) component).getAnnotation();
- } else if (component instanceof XSDFacet) {
- if(((XSDFacet) component).getAnnotation() == null)
- ((XSDFacet) component).setAnnotation(xsdAnnotation);
- else
- xsdAnnotation = ((XSDFacet) component).getAnnotation();
- } else if (component instanceof XSDIdentityConstraintDefinition) {
- if(((XSDIdentityConstraintDefinition) component).getAnnotation() == null)
- ((XSDIdentityConstraintDefinition) component).setAnnotation(xsdAnnotation);
- else
- xsdAnnotation = ((XSDIdentityConstraintDefinition) component).getAnnotation();
- } else if (component instanceof XSDImport) {
- if(((XSDImport) component).getAnnotation() == null)
- ((XSDImport) component).setAnnotation(xsdAnnotation);
- else
- xsdAnnotation = ((XSDImport) component).getAnnotation();
- } else if (component instanceof XSDInclude) {
- if(((XSDInclude) component).getAnnotation() == null)
- ((XSDInclude) component).setAnnotation(xsdAnnotation);
- else
- xsdAnnotation = ((XSDInclude) component).getAnnotation();
- } else if (component instanceof XSDModelGroup) {
- if(((XSDModelGroup) component).getAnnotation() == null)
- ((XSDModelGroup) component).setAnnotation(xsdAnnotation);
- else
- xsdAnnotation = ((XSDModelGroup) component).getAnnotation();
- } else if (component instanceof XSDModelGroupDefinition) {
- if(((XSDModelGroupDefinition) component).getAnnotation() == null)
- ((XSDModelGroupDefinition) component).setAnnotation(xsdAnnotation);
- else
- xsdAnnotation = ((XSDModelGroupDefinition) component).getAnnotation();
- } else if (component instanceof XSDNotationDeclaration) {
- if(((XSDNotationDeclaration) component).getAnnotation() == null)
- ((XSDNotationDeclaration) component).setAnnotation(xsdAnnotation);
- else
- xsdAnnotation = ((XSDNotationDeclaration) component).getAnnotation();
- } else if (component instanceof XSDTypeDefinition) {
- if(((XSDTypeDefinition) component).getAnnotation() == null)
- ((XSDTypeDefinition) component).setAnnotation(xsdAnnotation);
- else
- xsdAnnotation = ((XSDTypeDefinition) component).getAnnotation();
- } else if (component instanceof XSDWildcard) {
- if(((XSDWildcard) component).getAnnotation() == null)
- ((XSDWildcard) component).setAnnotation(xsdAnnotation);
- else
- xsdAnnotation = ((XSDWildcard) component).getAnnotation();
- } else if (component instanceof XSDXPathDefinition) {
- if(((XSDXPathDefinition) component).getAnnotation() == null)
- ((XSDXPathDefinition) component).setAnnotation(xsdAnnotation);
- else
- xsdAnnotation = ((XSDXPathDefinition) component).getAnnotation();
- } else if (component instanceof XSDSchema) {
- // Note that this adds a global annotation to the
- // schema itself, not to any subcomponent
- ((XSDSchema) component).getContents().add(xsdAnnotation);
- } else {
- // Whoops, asked us to annotate an unannotateable item
- throw new IllegalArgumentException("Unable to addDocumentation onto type: " + component); //$NON-NLS-1$
- }
-
- // Remove any old documentation elements
- for(int i = 0; i < xsdAnnotation.getElement().getChildNodes().getLength(); i++) {
- Node node = xsdAnnotation.getElement().getChildNodes().item(i);
- if(node.getNodeName().endsWith(XSDConstants.DOCUMENTATION_ELEMENT_TAG))
- xsdAnnotation.getElement().removeChild(node);
- }
- xsdAnnotation.getUserInformation().clear();
-
- if (text!=null)
- {
- // Now that the xsdAnnotation is added to a parent
- // XSDConcreteComponent, go ahead and create the
- // UserInformation node (xsd:documentation) and
- // add a DOM textNode to it containing the information
- Element userInfo = xsdAnnotation.createUserInformation(null);
- userInfo.appendChild(userInfo.getOwnerDocument().createTextNode(text));
-
- // Add the finished userInfo object to the concrete
- // parameter of the xsdAnnotation
- xsdAnnotation.getElement().appendChild(userInfo);
-
- // Add the finished userInfo object to the user information
- // list
- xsdAnnotation.getUserInformation().add(userInfo);
- }
-
- return xsdAnnotation;
- } catch (Exception e) {
- return null;
- }
- }
-
- /**
- * Adds the text to the component as a Documentation parameter (just like addDocumentation) and then adds the
- * Documentation properties to the Documentation parameter if they exist.
- * If text is null then no documentation is set.
- * If properties is null then no properties are added to the documentation parameter.
- * @param component
- * @param text
- * @param properties
- * @return
- */
- public static XSDAnnotation addDocumentationAndAttributes(XSDConcreteComponent component, String text, Map attributes)
- {
- if (null == component)
- {
- throw new IllegalArgumentException("addDocumentationAndAttributes called with null component"); //$NON-NLS-1$
- }
-
- // nothing to add
- if (text==null && attributes==null)
- return null;
-
- // add documentation
- XSDAnnotation annotation = addDocumentation(component, text);
-
- if (annotation==null)
- return null;
-
- // no properties so return
- if (attributes==null || attributes.isEmpty())
- return annotation;
-
- // get annotation dom parameter, create if necessary
- Element userInfo = null;
- if (annotation.getUserInformation().isEmpty())
- {
- userInfo = annotation.createUserInformation(null);
- annotation.getElement().appendChild(userInfo);
- }
- else
- {
- for (Iterator<Element> i = annotation.getUserInformation().iterator(); i.hasNext();)
- {
- userInfo = i.next();
- if (userInfo.getTagName().endsWith(XSDConstants.DOCUMENTATION_ELEMENT_TAG))
- {
- break;
- }
- }
- }
-
- if (userInfo==null)
- return null;
-
- // add properties
- String key = null;
- for (Iterator<String> iter = attributes.keySet().iterator(); iter.hasNext();)
- {
- key = iter.next();
- userInfo.setAttribute(key, (String)attributes.get(key));
- }
-
- return annotation;
- }
-
-
- /**
- * Returns a string which is not used by any parameter in 'elements'. The name
- * is generated by appending numerical suffixes on to 'prefix' until a
- * unique one is found. PRECONDITION: 'elements' is a list of
- * XSDNamedComponent instances
- *
- * @param prefix
- * @param elements
- * @return
- */
- public static String createUniqueElementName(String prefix, List elements) {
- ArrayList<String> usedNames = new ArrayList<String>();
- for(Iterator i = elements.iterator(); i.hasNext(); ) {
- usedNames.add( getDisplayName((XSDNamedComponent) i.next()));
- }
-
- int i = 1;
- String testName = prefix + i++;
- while(usedNames.contains(testName)) {
- testName = prefix + i++;
- }
- return testName;
- }
-
- /**
- * Like getPrimitives(), this returns a list of XSDTypeDefinitions. However where getPrimitives()
- * returns the basic set supported by the editor, getAdvancedPrimitives returns every known XSD
- * primitive type.
- * @return
- */
- public static List<XSDTypeDefinition> getAdvancedPrimitives() {
- advancedPrimitives = null;
- if(advancedPrimitives == null) {
- advancedPrimitives = new ArrayList<XSDTypeDefinition>();
-
- // Get the schema for schemas instance to use when resolving primitives
- XSDSchema schemaForSchemas = XSDUtil.getSchemaForSchema(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001);
-
- // Start adding the simple types using the supportedPrimitives list
- for (String typeName : supportedPrimitives) {
- XSDTypeDefinition type = schemaForSchemas.resolveSimpleTypeDefinition(typeName);
- advancedPrimitives.add(type);
- }
-
- // Return primitives in alpha order
- Collections.sort(advancedPrimitives, new Comparator() {
-
- public int compare(Object o1, Object o2) {
- if(o1 == null || o2 == null || ((XSDTypeDefinition) o1).getName() == null)
- return 0;
- return ((XSDTypeDefinition) o1).getName().compareToIgnoreCase(((XSDTypeDefinition) o2).getName());
- }
- });
- }
- return advancedPrimitives;
- }
-
- /**
- * Retrieves all the root Data types defined in the schema including complex types, user-defined simple types and anonymous
- * complex types. If there's an anonymous complex type definition (from a root parameter declaration) then we return
- * the parameter declaration's anonymous type.
- * @param schema
- * @return
- */
- public static List<XSDTypeDefinition> getAllDataTypes(XSDSchema schema)
- {
- if (schema==null)
- return Collections.emptyList();
-
- List<XSDTypeDefinition> bos = new ArrayList<XSDTypeDefinition>();
-
- EList<XSDSchemaContent> contents = schema.getContents();
- // First try the easy approach -- if this XSD contains a type definition, that's our BO,
- // return it. This is the recommended path, and the way our tooling does things.
- for (XSDSchemaContent item : contents) {
- if (item instanceof XSDTypeDefinition)
- bos.add((XSDTypeDefinition)item);
- }
-
- // If we failed, we try a second pass, this time looking for an parameter
- // with an anonymous complex
- // type defined in line
- for (XSDSchemaContent item : contents) {
- if (item instanceof XSDElementDeclaration)
- {
- XSDElementDeclaration element = (XSDElementDeclaration) item;
- if (element.getAnonymousTypeDefinition() instanceof XSDComplexTypeDefinition)
- {
- bos.add(element.getAnonymousTypeDefinition());
- }
- }
- }
- return bos;
- }
-
- /**
- * Given a BO (XSD Complex Type), return a list of the properties
- * within the complexType.
- * @param bo
- * @return List of XSDAttributeDeclaration
- */
- public static List<XSDAttributeDeclaration> getChildAttributes(XSDComplexTypeDefinition bo)
- {
- EList attrContents = bo.getAttributeContents();
- List<XSDAttributeDeclaration> attrs = new ArrayList<XSDAttributeDeclaration>();
- for (int i=0; i< attrContents.size(); i++)
- {
- Object next = attrContents.get(i);
-
- // Attribute contents may include actual attribute delcarations (wrapped in XSDAttributeUses) or
- // attribute group definitions, containing bundles of properties
- if(next instanceof XSDAttributeUse) {
- attrs.add( ((XSDAttributeUse) next).getContent().getResolvedAttributeDeclaration() );
-
- } else if (next instanceof XSDAttributeGroupDefinition) {
-
- // Add these properties to the end of attrContents to be processed in turn
- XSDAttributeGroupDefinition attrGroup = (XSDAttributeGroupDefinition) next;
- if(attrGroup.getResolvedAttributeGroupDefinition() != null)
- attrContents.addAll(attrGroup.getResolvedAttributeGroupDefinition().getAttributeUses());
-
- }
- }
- return attrs;
- }
-
- /**
- * Given a BO (XSD Complex Type), return a list of the XSDFeatures
- * within the complexType's modelgroup (sequence, choice, etc.)
- * @param bo
- * @return
- */
- public static List<XSDFeature> getChildElements(XSDComplexTypeDefinition bo)
- {
- return XSDUtils.getChildElements( getModelGroup(bo) );
- }
-
- /**
- * Given an XSDFeature, return a list of the XSDFeatures
- * within the complexType's modelgroup (sequence, choice, etc.)
- * @param bo
- * @return
- */
- public static List<XSDFeature> getChildElements(XSDFeature elem)
- {
- XSDComplexTypeDefinition cType = getResolvedComplexType(elem);
- return (cType != null) ? XSDUtils.getChildElements(cType) : Collections.EMPTY_LIST;
- }
-
-
- /**
- * Given a Model group, return a list of the XSDFeatures
- * declared within.
- * @param group
- * @return
- */
- public static List<XSDFeature> getChildElements(XSDModelGroup group)
- {
- if(group == null)
- return new ArrayList<XSDFeature>();
-
- List<XSDFeature> children = new ArrayList<XSDFeature>();
- for(Iterator<XSDParticle> i = group.getContents().iterator(); i.hasNext();)
- {
- XSDParticle next = i.next();
- if(next.getContent() instanceof XSDFeature)
- children.add((XSDFeature) next.getContent());
- else if (next.getTerm() instanceof XSDModelGroup)
- children.addAll(getChildElements((XSDModelGroup) next.getTerm()));
- }
- return children;
- }
-
- /**
- * Return the contents of the documentation parameter in type's annotation, if it has one.
- * Otherwise return null
- * @param type
- * @return
- */
- public static String getDocumentation(XSDFeature element) {
- XSDAnnotation annotation = null;
-
- if (element instanceof XSDAttributeDeclaration)
- annotation = ((XSDAttributeDeclaration)element).getAnnotation();
- else if (element instanceof XSDElementDeclaration)
- annotation = ((XSDElementDeclaration)element).getAnnotation();
-
- if(annotation != null) {
- for(Iterator i = annotation.getUserInformation().iterator(); i.hasNext(); ) {
- Element domElement = (Element) i.next();
- if(domElement.getTagName().endsWith(XSDConstants.DOCUMENTATION_ELEMENT_TAG) &&
- domElement.getFirstChild() instanceof Text) {
- return ((Text) domElement.getFirstChild()).getData();
- }
- }
- }
- return null;
- }
-
- /**
- * Returns the properties on the documentation parameter if they exist. I.e. returns source and xml:lang
- * Returns an empty parentMap if none.
- * @param type
- * @return
- */
- public static Map<String, String> getDocumentationAttributes(XSDTypeDefinition type)
- {
- Map<String, String> attributes = new HashMap<String, String>();
-
- if (type.getAnnotation() != null)
- {
- XSDAnnotation annotation = type.getAnnotation();
- for (Iterator i = annotation.getUserInformation().iterator(); i
- .hasNext();)
- {
- Element element = (Element) i.next();
- if (element.getTagName().endsWith(XSDConstants.DOCUMENTATION_ELEMENT_TAG))
- {
- String source = element.getAttribute("source"); //$NON-NLS-1$
- String lang = element.getAttribute("xml:lang"); //$NON-NLS-1$
- if (lang==null || lang.length()<1)
- lang = element.getAttribute("lang"); //$NON-NLS-1$
-
- if (source!=null && source.length()>0)
- attributes.put("source", source); //$NON-NLS-1$
-
- if (lang!=null && lang.length()>0)
- attributes.put("xml:lang", lang); //$NON-NLS-1$
-
- return attributes;
- }
- }
- }
- return null;
- }
-
- /**
- * Returns the properties on the documentation parameter if they exist. I.e. returns source and xml:lang
- * Returns an empty parentMap if none.
- * @param parameter
- * @return
- */
- public static Map<String, String> getDocumentationAttributes(XSDFeature element)
- {
- XSDAnnotation annotation = null;
- Map<String, String> attributes = new HashMap<String, String>();
-
- if (element instanceof XSDAttributeDeclaration)
- annotation = ((XSDAttributeDeclaration)element).getAnnotation();
- else if (element instanceof XSDElementDeclaration)
- annotation = ((XSDElementDeclaration)element).getAnnotation();
-
- if (annotation != null)
- {
- for (Iterator i = annotation.getUserInformation().iterator(); i
- .hasNext();)
- {
- Element domElement = (Element) i.next();
- if (domElement.getTagName().endsWith(XSDConstants.DOCUMENTATION_ELEMENT_TAG))
- {
- String source = domElement.getAttribute("source"); //$NON-NLS-1$
- String lang = domElement.getAttribute("xml:lang"); //$NON-NLS-1$
- if (lang==null || lang.length()<1)
- lang = domElement.getAttribute("lang"); //$NON-NLS-1$
-
- if (source!=null && source.length()>0)
- attributes.put("source", source); //$NON-NLS-1$
-
- if (lang!=null && lang.length()>0)
- attributes.put("xml:lang", lang); //$NON-NLS-1$
-
- return attributes;
- }
- }
- }
- return null;
- }
-
- /**
- * Return the contents of the documentation parameter in type's annotation, if it has one.
- * Otherwise return null
- * @param type
- * @return
- */
- public static String getDocumentation(XSDTypeDefinition type) {
- if(type.getAnnotation() != null) {
- XSDAnnotation annotation = type.getAnnotation();
- for(Iterator i = annotation.getUserInformation().iterator(); i.hasNext(); ) {
- Element element = (Element) i.next();
- if(element.getTagName().endsWith(XSDConstants.DOCUMENTATION_ELEMENT_TAG) &&
- element.getFirstChild() instanceof Text) {
- return ((Text) element.getFirstChild()).getData();
- }
- }
- }
- return null;
- }
-
- /**
- * Given an XSD Complex Type Definition, return the model group containing
- * its child elements.
- * @param parameter
- * @return
- */
- public static XSDModelGroup getModelGroup(XSDComplexTypeDefinition cType)
- {
- XSDParticle particle = cType.getComplexType();
-
- // In cases where cType doesn't have a model group AND cType has a parent with a modelgroup, the
- // call above will rather unexpectedly give us cType's PARENT's model group, rather than the null we
- // might expect. We don't want that here, if the model group returned is null or belongs to someone
- // other than us, return null
- if (particle==null || particle.eContainer() != cType) {
- return null;
- }
-
- // get the model group
- Object particleContent = particle.getContent();
- XSDModelGroup group = null;
-
- if (particleContent instanceof XSDModelGroupDefinition) {
- group = ((XSDModelGroupDefinition)particleContent).getResolvedModelGroupDefinition().getModelGroup();
- } else if (particleContent instanceof XSDModelGroup) {
- group = (XSDModelGroup)particleContent;
- }
-
- if (group == null) {
- return null;
- }
-
- // if the content of the complex type is empty then the content
- // must be in the complexContent, ie. we're extending another BO.
- // if the group and the type are not in the same resource then
- // we are extending another BO and we don't want to show inherited
- // properties.
- if ( group.getContents().isEmpty() || group.eResource() != cType.eResource())
- {
- // if we are extending another BO then get the elements
- // we are adding
- if (cType.getBaseType()!=null)
- {
- XSDComplexTypeContent content = cType.getContent();
-
- if (content instanceof XSDParticle) {
- particleContent = ((XSDParticle)content).getContent();
- if (particleContent instanceof XSDModelGroupDefinition) {
- group = ((XSDModelGroupDefinition)particleContent).getResolvedModelGroupDefinition().getModelGroup();
- } else if (particleContent instanceof XSDModelGroup) {
- group = (XSDModelGroup)particleContent;
- }
- }
-
- }
- }
-
- return group;
- }
-
- /**
- * General utility method for finding a name for an xsd component. This method will handle
- * mapping of xsd primitive names to their human readable counterparts, as well as resolving
- * parameter references for properties and walking up object hierarchies for anonymous types.
- * Basically this method should be used whenever a name is needed to minimize the risk of
- * having a name of 'null' -- though this method WILL return null if no name can be found.
- * @param component
- * @return
- */
- public static String getDisplayName(XSDNamedComponent component) {
-
- if(component == null)
- return null;
-
- if(component instanceof XSDTypeDefinition)
- return getDisplayNameFromXSDType((XSDTypeDefinition) component);
-
- if (component instanceof XSDFeature) {
- XSDFeature feature = (XSDFeature) component;
- if(feature.getName() != null)
- return feature.getName();
- else if (feature.getResolvedFeature() != null && feature.getResolvedFeature().getName() != null)
- return feature.getResolvedFeature().getName();
- }
-
- return component.getName();
-
- }
-
- /**
- * Try a variety of methods to get a human readable name for type. In order, this method will
- * - check whether type is null, and if so return null
- * - check whether type is a restriction of a primitive type, if so return its parent's name
- * - check whether type is a complex anonymous (un-named) inner type of a named parameter, and if so, return the parameter's name
- * - check whether type is a primitive type, and if so return a human-readable version of that type
- * - check whether type is a named, non-primitive type, and if so, return its name
- * @param xsdType
- * @return
- */
- public static String getDisplayNameFromXSDType(XSDTypeDefinition type) {
- return getDisplayNameFromXSDType(type, true);
- }
-
- /**
- * Try a variety of methods to get a human readable name for type. In order, this method will
- * - check whether type is null, and if so return null
- * - check whether type is a complex anonymous (un-named) inner type of a named parameter, and if so, return the parameter's name
- * - check whether type is a primitive type, and if so return a human-readable version of that type
- * - check whether type is a named, non-primitive type, and if so, return its name
- * - if returnPrimitiveParents is true, check whether type is a restriction of a primitive type,
- * if so return its parent's name
- * @param xsdType
- * @param returnPrimitiveParents if true, and if type is an anonymous restriction of an xsd primitive
- * type, this method will return the name of the parent primitive type. If false, restrictions of
- * primitive types will not be treated differently from other types, and their control hierarchy will
- * be walked, instead of their inheritance hierarchy.
- * @return
- */
- public static String getDisplayNameFromXSDType(XSDTypeDefinition type, boolean returnPrimitiveParents) {
- if(type == null)
- return null;
-
-
-
- // Does type have a name? If not, walk up the control tree to try and find one
- if(type.getName() == null || type.getName().length() == 0) {
-
- // In the special case where type is a restriction on a primitive type, just return the parent's
- // name (which will either be a primitive itself, or a named simple type)
- if(returnPrimitiveParents && isRestrictedPrimitiveType(type)) {
- return getDisplayNameFromXSDType(type.getBaseType());
- }
-
- EObject container = type.eContainer();
-
- while(container != null) {
- if(container instanceof XSDNamedComponent && ((XSDNamedComponent) container).getName() != null) {
- return ((XSDNamedComponent) container).getName();
- }
- container = container.eContainer();
- }
- // Type doesn't have a name, or a control with a name, nothing useful
- return null;
- } else
- return type.getName();
- }
-
- /**
- * Return the type definition for the primitive with name xsdName (note, this is not the human-readable
- * name, but the actual XSD type name.) Return null if a type with this name is not in the list of
- * all primitives
- * @param xsdName
- * @return
- */
- public static XSDSimpleTypeDefinition getPrimitive(String xsdName) {
- for(Iterator<XSDTypeDefinition> i = getAdvancedPrimitives().iterator(); i.hasNext();) {
- XSDSimpleTypeDefinition next = (XSDSimpleTypeDefinition) i.next();
- if(next.getName().equals(xsdName)) {
- return next;
- }
- }
- return null;
- }
-
- /**
- *
- * @return Returns a list of XSDSimpleTypeDefinitions representing each of the supported primitives.
- * These will have their XSD spec names (e.g. xsd:dateTime) so they will likely need to be fed to
- * getDisplayName() if they are going to be presented to humans
- */
- public static List<XSDSimpleTypeDefinition> getPrimitives() {
- if(primitives == null) {
- primitives = new ArrayList<XSDSimpleTypeDefinition>();
-
- // Get the schema for schemas instance to use when resolving primitives
- XSDSchema schemaForSchemas = XSDUtil.getSchemaForSchema(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001);
-
- // Start adding the simple types from the XSD short list
- for(Iterator<String> i = xsdShortList.iterator(); i.hasNext(); ) {
- String typeName = i.next();
-
- XSDSimpleTypeDefinition type = schemaForSchemas.resolveSimpleTypeDefinition(typeName);
- primitives.add(type);
- }
-
- // Return primitives in alpha order
- Collections.sort(primitives, new Comparator() {
-
- public int compare(Object o1, Object o2) {
- if(o1 == null || o2 == null || getDisplayNameFromXSDType((XSDTypeDefinition) o1) == null)
- return 0;
- return getDisplayNameFromXSDType((XSDTypeDefinition) o1).compareTo(getDisplayNameFromXSDType((XSDTypeDefinition) o2));
- }
- });
- }
- return primitives;
- }
-
- /**
- * Return a collection of all types referenced by the properties (XSDFeatures) of source. This
- * method is non-recursive (i.e. the list only contains direct references, not references-of-references)
- * Will not return null, but may return an empty set. This will not return a BO reference if the file
- * has been deleted (or just doesn't exist).
- * @param source The complex type to examine for references
- * @return a Collection of XSDComplexTypeDefinition instances -- no duplicates
- */
- public static Collection<XSDComplexTypeDefinition> getReferencedTypes(XSDComplexTypeDefinition source) {
- if(source == null)
- return Collections.emptySet();
-
- List<XSDComplexTypeDefinition> results = new ArrayList<XSDComplexTypeDefinition>();
- for(Iterator<XSDFeature> i = getChildElements(source).iterator(); i.hasNext(); ) {
- XSDFeature element = i.next();
- XSDComplexTypeDefinition elementType = getResolvedComplexType(element);
- if(elementType != null && !results.contains(elementType) && !XSDConstants.isSchemaForSchemaNamespace(elementType.getTargetNamespace()))
- results.add(elementType);
- }
- return results;
- }
-
- /**
- * Return a collection of all types referenced by the properties (XSDFeatures) of source. This
- * method is non-recursive (i.e. the list only contains direct references, not references-of-references)
- * Will not return null, but may return an empty set. This will return a BO reference if the file
- * has been deleted (or just doesn't exist).
- * @param source The complex type to examine for references
- * @return a Collection of XSDTypeDefinition (could be complex or simple type) instances -- no duplicates
- */
- public static Collection<XSDTypeDefinition> getAllReferencedTypes(XSDComplexTypeDefinition source)
- {
- return getAllReferencedTypes(source, false);
- }
-
- /**
- * Return a collection of all types referenced by the properties (XSDFeatures) of source. This
- * method is non-recursive (i.e. the list only contains direct references, not references-of-references)
- * Will not return null, but may return an empty set. This will return a BO reference if the file
- * has been deleted (or just doesn't exist).
- * @param source The complex type to examine for references
- * @param includeAnonymous if true, the returned list will include anonymous inlined types as well. These
- * are not technically "referenced", however it allows this method to be used as a way to get all non-primitive
- * types used in any way by source
- * @return a Collection of XSDTypeDefinition (could be complex or simple type) instances -- no duplicates
- */
- public static Collection<XSDTypeDefinition> getAllReferencedTypes(XSDComplexTypeDefinition source, boolean includeAnonymous)
- {
- if (source == null)
- return Collections.emptySet();
-
- List<XSDTypeDefinition> results = new ArrayList<XSDTypeDefinition>();
- XSDTypeDefinition elementType = null;
- for (Iterator<XSDFeature> i = getChildElements(source).iterator(); i.hasNext();)
- {
- XSDFeature next = i.next();
- elementType = getResolvedType(next);
-
- // Only add non-null, non-duplicate, non-primitive types. If includeAnonymous is false,
- // anonymous types should be filtered out as well
- if( elementType != null &&
- !results.contains(elementType) &&
- !XSDConstants.isSchemaForSchemaNamespace(elementType.getTargetNamespace()) &&
- (includeAnonymous || elementType.eContainer() != next) )
- results.add(elementType);
- }
- return results;
- }
-
- /**
- * Given an parameter, return its complex type, or null if it does not have a complex type. This is
- * slightly more complicated than just calling getType() since an parameter may not have a type at all, it
- * may reference another parameter.
- * @param parameter
- * @return
- */
- public static XSDComplexTypeDefinition getResolvedComplexType(XSDFeature feature) {
- // The contents of this method have been adapted to the more general getResolvedType,
- // but this method is maintained for compatibility and convenience
- XSDTypeDefinition resolvedType = getResolvedType(feature);
- if(resolvedType instanceof XSDComplexTypeDefinition)
- return (XSDComplexTypeDefinition) resolvedType;
- return null;
- }
-
- /**
- * Given an parameter, return its type, or null if it does not have a type. This is
- * slightly more complicated than just calling getType() since an parameter may not have
- * a type at all, it may reference another parameter.
- * @param parameter
- * @return
- */
- public static XSDTypeDefinition getResolvedType(XSDFeature feature) {
-
- // Special case of elements referencing stale XSD complex types
- if (feature instanceof XSDElementDeclaration && ((XSDElementDeclaration) feature).getTypeDefinition() instanceof XSDComplexTypeDefinition) {
-
- XSDElementDeclaration element = (XSDElementDeclaration) feature;
-
- // We have a type, but types can be proxies, and proxies can become
- // stale if the referenced
- // type changes, so before we return it, re-resolve the proxy and
- // then return it
- XSDComplexTypeDefinition oldType = (XSDComplexTypeDefinition) element.getTypeDefinition();
- EObject newType = EcoreUtil.resolve(element.getTypeDefinition(), element);
- if (oldType != newType) {
- // We only return the resolved type if the name and the namespace has not changed. Changing the name
- // and namespace is essentially an unresolved BO.
- String oldName = oldType.getName();
- String newName = ((XSDTypeDefinition)newType).getName();
- String oldTNS = oldType.getTargetNamespace();
- String newTNS = ((XSDTypeDefinition)newType).getTargetNamespace();
-
- if ( ((oldName==newName) || (oldName!=null && oldName.equals(newName))) &&
- ((oldTNS==newTNS) || (oldTNS!=null && oldTNS.equals(newTNS))) )
- element.setTypeDefinition((XSDTypeDefinition) newType);
- }
- return element.getTypeDefinition();
-
- } else if (feature.getType() != null) {
- return feature.getType();
- } else if (feature.getResolvedFeature() != null && feature.getResolvedFeature().getType() != null) {
- // We reference another parameter
- return feature.getResolvedFeature().getType();
- } else {
- return null;
- }
- }
-
- /**
- * Return the base type from which this type inherits - that is, all xsd types are
- * either xsd:anyType or xsd:anySimpleType at the topmost level of inheritance, so return the second
- * topmost level of type's inheritance. The first specific type from which type inherits.
- * @param type
- * @return
- */
- public static XSDTypeDefinition getRootType(XSDTypeDefinition type) {
- if(type == null)
- return null;
-
- XSDTypeDefinition baseType = type.getBaseType();
- while(baseType != null && !XSDConstants.isAnySimpleType(baseType) && !XSDConstants.isAnyType(baseType)) {
- // walk one more step up the hierarchy
- type = baseType;
- baseType = type.getBaseType();
- }
-
- // Since baseType, type's immediate parent, broke the while condition, we know that type is now
- // as high up the tree as we want to be
- return type;
-
-
-
- }
-
- /**
- * Given a schema, return the list of XSDSimpleTypeDefinitions found within it. Will not return null,
- * but may return an empty list
- * @param schema
- * @return
- */
- public static List<XSDSimpleTypeDefinition> getUserDefinedSimpleTypes(XSDSchema schema) {
- if(schema == null)
- return Collections.emptyList();
-
- List<XSDSimpleTypeDefinition> result = new ArrayList<XSDSimpleTypeDefinition>();
- for (XSDSchemaContent next : schema.getContents()) {
- if(next instanceof XSDSimpleTypeDefinition)
- result.add((XSDSimpleTypeDefinition)next);
- }
- return result;
- }
-
- /**
- * Given a display name for a BO attribute type, return the XSD type name.
- * If the given input is not a display name, the input is returned.
- * @param displayName
- * @return
- */
- public static String getXSDTypeFromDisplayName(String displayName)
- {
- // Now a no-op since we no longer translate XSD type names to "human readable" ones
- return displayName;
- }
-
- /**
- * Return true iff type is a descendant of a primitive xsd type. Will not return true for primitives
- * themselves.
- * @param type
- * @return
- */
- public static boolean isRestrictedPrimitiveType(XSDTypeDefinition type) {
- if(type instanceof XSDComplexTypeDefinition)
- return false;
-
- XSDTypeDefinition baseType = getRootType(type);
- return getAdvancedPrimitives().contains(baseType);
- }
-
- /**
- * Gets the "minOccurs" attribute value for the given XSDFeature, if
- * there is none then it returns the default 1.
- * @param xsdElem
- * @return
- */
- public static int getMinOccurs(XSDFeature xsdElem)
- {
- if (xsdElem.eContainer() instanceof XSDAttributeUse)
- {
- return (((XSDAttributeUse)xsdElem.eContainer()).getUse()==XSDAttributeUseCategory.REQUIRED_LITERAL?1:0);
- }
-
- XSDParticle particle = (XSDParticle)xsdElem.eContainer();
- int min = 1;
- if (particle.isSetMinOccurs())
- min = particle.getMinOccurs();
-
- return min;
- }
-
- /**
- * Gets the "maxOccurs" attribute value for the given XSDFeature, if
- * there is none then it returns the default 1.
- * @param xsdElem
- * @return
- */
- public static int getMaxOccurs(XSDFeature xsdElem)
- {
- int max = 1;
-
- // not a particle means an attribute use. properties are maxed at 1.
- if ( !(xsdElem.eContainer() instanceof XSDParticle) )
- return max;
-
- XSDParticle particle = (XSDParticle)xsdElem.eContainer();
- if (particle.isSetMaxOccurs())
- max = particle.getMaxOccurs();
-
- return max;
- }
-
- /**
- * Return the Data Type from the given schema with the given name.
- * @param schema - The schema containing the type.
- * @param boName - The local name of the type to retrieve -- if null method returns first type found.
- * @return The XSDTypeDefinition if one exists, null otherwise
- */
- public static XSDTypeDefinition getDataType(XSDSchema schema, String typeName) {
- if(schema == null)
- return null;
-
- boolean pickFirstFound = (typeName==null || typeName.length()<1);
-
- EList<XSDSchemaContent> contents = schema.getContents();
-
- // First try the easy approach -- if this XSD contains a type definition with the right name, that's
- // our type, return it. This is the recommended path, and the way our tooling does things.
- for(Iterator<XSDSchemaContent> i = contents.iterator(); i.hasNext(); ) {
- Object item = i.next();
- if(item instanceof XSDTypeDefinition)
- if (pickFirstFound)
- return (XSDTypeDefinition) item;
- else if ( typeName.equals(getDisplayName((XSDTypeDefinition)item)))
- return (XSDTypeDefinition) item;
- }
-
- // If we failed, we try a second pass, this time looking for an parameter with an anonymous
- // type defined in line
- for(Iterator<XSDSchemaContent> i = contents.iterator(); i.hasNext(); ) {
- Object item = i.next();
- if(item instanceof XSDFeature) {
- XSDFeature element = (XSDFeature) item;
- XSDTypeDefinition resolvedType = getResolvedType(element);
- if(resolvedType != null && resolvedType.getSchema() == schema) {
- if (pickFirstFound)
- return resolvedType;
- else if (typeName.equals(getDisplayName(element)))
- return resolvedType;
- }
- }
- }
- return null;
-
- }
-
- /**
- * Gets the "default" attribute value for the given XSDFeature, if there
- * is none then it returns an empty string.
- * @param xsdElem
- * @return
- */
- public static String getDefaultValue(XSDFeature xsdElem)
- {
- XSDConstraint constraint = null;
- if (xsdElem instanceof XSDAttributeDeclaration)
- {
- // attribute declarations store their default values in
- // their containers (attribute uses)
- XSDAttributeUse use = (XSDAttributeUse)xsdElem.getContainer();
- if (use.isSetConstraint())
- constraint = use.getConstraint();
-
- if (constraint!=null && constraint.equals(XSDConstraint.DEFAULT_LITERAL))
- if (use.getLexicalValue()!=null)
- return use.getLexicalValue();
- else
- return ""; //$NON-NLS-1$
- }
- else if (xsdElem instanceof XSDElementDeclaration)
- {
- if (xsdElem.isSetConstraint())
- constraint = xsdElem.getConstraint();
-
- if (constraint!=null && constraint.equals(XSDConstraint.DEFAULT_LITERAL))
- if (xsdElem.getLexicalValue()!=null)
- return xsdElem.getLexicalValue();
- else
- return ""; //$NON-NLS-1$
-
- }
- return ""; //$NON-NLS-1$
- }
-
- /**
- * Return the enclosing Complex Type definition.
- * @param component
- * @return
- */
- public static XSDComplexTypeDefinition getEnclosingTypeDefinition(EObject component)
- {
- if (component == null)
- return null;
-
- if (component instanceof XSDComplexTypeDefinition)
- return (XSDComplexTypeDefinition)component;
-
- return getEnclosingTypeDefinition(component.eContainer());
- }
-
- /**
- * Given an XSD schema with a new target namespace set, this method will cycle through the XSD schema directives
- * (i.e. imports/includes/redefines) and remove as appropriate.
- *
- * I.e. this method will remove all includes/redefines if the new TNS is different than the old TNS and it will remove
- * all imports that have the same namespace as the new TNS (since these should now be includes).
- *
- * @param schema - has the new target namespace set
- * @param oldTNS
- */
- public static void removeImportsAndIncludes(XSDSchema schema, String oldTNS)
- {
- if (schema==null)
- return;
-
- String newTNS = schema.getTargetNamespace();
-
- // namespace hasn't changed
- if (newTNS==null && oldTNS==null)
- return;
-
- // namespace hasn't changed
- if (newTNS!=null && newTNS.equals(oldTNS))
- return;
-
- // namespace has changed so remove all includes and remove any imports to the new namespace
- ArrayList schemaContents = new ArrayList(schema.getContents());
- for (Iterator i = schemaContents.iterator(); i.hasNext();)
- {
- Object next = i.next();
- if (next instanceof XSDImport)
- {
- XSDImport nextImport = (XSDImport) next;
- if (nextImport.getNamespace()==null && newTNS==null)
- schema.getContents().remove(nextImport);
- else if (nextImport.getNamespace()!=null && nextImport.getNamespace().equals(newTNS))
- schema.getContents().remove(nextImport);
- }
- else if (next instanceof XSDSchemaCompositor)
- {
- schema.getContents().remove(next);
- }
- }
-
- }
-
- /**
- * Given an XSD complex type, return a list of the XSDFeatures (parameter
- * and attribute declarations) within the complex type.
- */
- public static List<XSDFeature> getXSDElementsAndAttributes(XSDComplexTypeDefinition complexType)
- {
- List<XSDFeature> result = getChildElements(complexType);
- result.addAll( getChildAttributes(complexType));
-
- return result;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2005 IBM Corporation and others.
+ * 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:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.bpmn2.modeler.ui.util;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.emf.common.util.EList;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.xsd.XSDAnnotation;
+import org.eclipse.xsd.XSDAttributeDeclaration;
+import org.eclipse.xsd.XSDAttributeGroupDefinition;
+import org.eclipse.xsd.XSDAttributeUse;
+import org.eclipse.xsd.XSDAttributeUseCategory;
+import org.eclipse.xsd.XSDComplexTypeContent;
+import org.eclipse.xsd.XSDComplexTypeDefinition;
+import org.eclipse.xsd.XSDConcreteComponent;
+import org.eclipse.xsd.XSDConstraint;
+import org.eclipse.xsd.XSDElementDeclaration;
+import org.eclipse.xsd.XSDFacet;
+import org.eclipse.xsd.XSDFactory;
+import org.eclipse.xsd.XSDFeature;
+import org.eclipse.xsd.XSDIdentityConstraintDefinition;
+import org.eclipse.xsd.XSDImport;
+import org.eclipse.xsd.XSDInclude;
+import org.eclipse.xsd.XSDModelGroup;
+import org.eclipse.xsd.XSDModelGroupDefinition;
+import org.eclipse.xsd.XSDNamedComponent;
+import org.eclipse.xsd.XSDNotationDeclaration;
+import org.eclipse.xsd.XSDParticle;
+import org.eclipse.xsd.XSDSchema;
+import org.eclipse.xsd.XSDSchemaCompositor;
+import org.eclipse.xsd.XSDSchemaContent;
+import org.eclipse.xsd.XSDSimpleTypeDefinition;
+import org.eclipse.xsd.XSDTypeDefinition;
+import org.eclipse.xsd.XSDWildcard;
+import org.eclipse.xsd.XSDXPathDefinition;
+import org.eclipse.xsd.util.XSDConstants;
+import org.eclipse.xsd.util.XSDUtil;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.Text;
+
+/**
+ * Collection of utility methods for dealing with navigation of the XSD model
+ */
+public class XSDUtils {
+
+ // singleton lists of XSD simple type definitions for supported primitives (see getPrimitives()) and
+ // all xsd primitives (see getAdvancedPrimitives()) respectively
+ private static List<XSDSimpleTypeDefinition> primitives;
+ private static List<XSDTypeDefinition> advancedPrimitives;
+
+ // XSD short list -- these are the types presented to the user by default, rather than inundating them with
+ // all the available types
+ private static List<String> xsdShortList = new ArrayList<String>();
+ static
+ {
+ xsdShortList.add("string"); //$NON-NLS-1$
+ xsdShortList.add("int"); //$NON-NLS-1$
+ xsdShortList.add("double"); //$NON-NLS-1$
+ xsdShortList.add("date"); //$NON-NLS-1$
+ xsdShortList.add("time"); //$NON-NLS-1$
+ xsdShortList.add("dateTime"); //$NON-NLS-1$
+ xsdShortList.add("boolean"); //$NON-NLS-1$
+ xsdShortList.add("hexBinary"); //$NON-NLS-1$
+ xsdShortList.add("float"); //$NON-NLS-1$
+ }
+
+
+ // A list of all supported XSD types. Usually the user will not businessObject presented with the full list, but
+ // rather with the xsd short list
+ private static List<String> supportedPrimitives = new ArrayList<String>();
+ static {
+ supportedPrimitives.add("anyType"); //$NON-NLS-1$
+ supportedPrimitives.add("anyURI"); //$NON-NLS-1$
+ supportedPrimitives.add("base64Binary"); //$NON-NLS-1$
+ supportedPrimitives.add("boolean"); //$NON-NLS-1$
+ supportedPrimitives.add("byte"); //$NON-NLS-1$
+ supportedPrimitives.add("date"); //$NON-NLS-1$
+ supportedPrimitives.add("dateTime"); //$NON-NLS-1$
+ supportedPrimitives.add("decimal"); //$NON-NLS-1$
+ supportedPrimitives.add("double"); //$NON-NLS-1$
+ supportedPrimitives.add("duration"); //$NON-NLS-1$
+ supportedPrimitives.add("ENTITIES"); //$NON-NLS-1$
+ supportedPrimitives.add("ENTITY"); //$NON-NLS-1$
+ supportedPrimitives.add("float"); //$NON-NLS-1$
+ supportedPrimitives.add("gDay"); //$NON-NLS-1$
+ supportedPrimitives.add("gMonth"); //$NON-NLS-1$
+ supportedPrimitives.add("gMonthDay"); //$NON-NLS-1$
+ supportedPrimitives.add("gYear"); //$NON-NLS-1$
+ supportedPrimitives.add("gYearMonth"); //$NON-NLS-1$
+ supportedPrimitives.add("hexBinary"); //$NON-NLS-1$
+ supportedPrimitives.add("ID"); //$NON-NLS-1$
+ supportedPrimitives.add("IDREF"); //$NON-NLS-1$
+ supportedPrimitives.add("IDREFS"); //$NON-NLS-1$
+ supportedPrimitives.add("int"); //$NON-NLS-1$
+ supportedPrimitives.add("integer"); //$NON-NLS-1$
+ supportedPrimitives.add("language"); //$NON-NLS-1$
+ supportedPrimitives.add("long"); //$NON-NLS-1$
+ supportedPrimitives.add("Name"); //$NON-NLS-1$
+ supportedPrimitives.add("NCName"); //$NON-NLS-1$
+ supportedPrimitives.add("negativeInteger"); //$NON-NLS-1$
+ supportedPrimitives.add("NMTOKEN"); //$NON-NLS-1$
+ supportedPrimitives.add("NMTOKENS"); //$NON-NLS-1$, "NMTOKENS");
+ supportedPrimitives.add("nonNegativeInteger"); //$NON-NLS-1$
+ supportedPrimitives.add("nonPositiveInteger"); //$NON-NLS-1$
+ supportedPrimitives.add("normalizedString"); //$NON-NLS-1$
+ supportedPrimitives.add("NOTATION"); //$NON-NLS-1$
+ supportedPrimitives.add("positiveInteger"); //$NON-NLS-1$
+ supportedPrimitives.add("QName"); //$NON-NLS-1$
+ supportedPrimitives.add("short"); //$NON-NLS-1$
+ supportedPrimitives.add("string"); //$NON-NLS-1$
+ supportedPrimitives.add("time"); //$NON-NLS-1$
+ supportedPrimitives.add("token"); //$NON-NLS-1$
+ supportedPrimitives.add("unsignedByte"); //$NON-NLS-1$
+ supportedPrimitives.add("unsignedInt"); //$NON-NLS-1$
+ supportedPrimitives.add("unsignedLong"); //$NON-NLS-1$
+ supportedPrimitives.add("unsignedShort"); //$NON-NLS-1$
+ }
+
+ /**
+ * Add a local annotation with userInfo to the given item.
+ *
+ * <p>
+ * Note: We take an XSDConcreteComponent, however we must then cast it to
+ * one of the types that has a setAnnotation call defined, since it doesn't
+ * have a clear 'parent' interface for annotations.
+ * </p>
+ *
+ * <p>
+ * Also note that UserInformation and ApplicationInformation objects can
+ * only businessObject added <b>after </b> the parent of the annotation has been added
+ * to an XSDSchema object. This is because these objects are modeled in the
+ * concrete DOM layer only, and otherwise will throw a DOMException.
+ * <p>
+ *
+ * @param component
+ * to add annotation to; may businessObject any kind of XSDConcreteComponent
+ * object including an XSDSchema
+ * @param text
+ * text to add as the userInformation (xsd:documentation) node to
+ * the annotation
+ * @return the XSDAnnotation object created, after having been added to the
+ * component; null if any error occoured
+ */
+ public static XSDAnnotation addDocumentation(XSDConcreteComponent component, String text) {
+ if (null == component) {
+ throw new IllegalArgumentException("addDocumentation called with null component"); //$NON-NLS-1$
+ }
+ try {
+
+ // First get the factory from the component: this is
+ // roundabout, but saves the user from having to
+ // pass it in
+ XSDFactory xsdFactory = XSDFactory.eINSTANCE;
+
+ // Create an XSDAnnotation object to hold everything
+ XSDAnnotation xsdAnnotation = xsdFactory.createXSDAnnotation();
+
+ // Depending on the XSDConcreteComponent type, cast to
+ // the appropriate type and add the annotation or, if component
+ // already has an annotation, use that one instead.
+ if (component instanceof XSDAttributeDeclaration) {
+ if(((XSDAttributeDeclaration) component).getAnnotation() == null)
+ ((XSDAttributeDeclaration) component).setAnnotation(xsdAnnotation);
+ else
+ xsdAnnotation = ((XSDAttributeDeclaration) component).getAnnotation();
+ } else if (component instanceof XSDAttributeGroupDefinition) {
+ if(((XSDAttributeGroupDefinition) component).getAnnotation() == null)
+ ((XSDAttributeGroupDefinition) component).setAnnotation(xsdAnnotation);
+ else
+ xsdAnnotation = ((XSDAttributeGroupDefinition) component).getAnnotation();
+ } else if (component instanceof XSDElementDeclaration) {
+ if(((XSDElementDeclaration) component).getAnnotation() == null)
+ ((XSDElementDeclaration) component).setAnnotation(xsdAnnotation);
+ else
+ xsdAnnotation = ((XSDElementDeclaration) component).getAnnotation();
+ } else if (component instanceof XSDFacet) {
+ if(((XSDFacet) component).getAnnotation() == null)
+ ((XSDFacet) component).setAnnotation(xsdAnnotation);
+ else
+ xsdAnnotation = ((XSDFacet) component).getAnnotation();
+ } else if (component instanceof XSDIdentityConstraintDefinition) {
+ if(((XSDIdentityConstraintDefinition) component).getAnnotation() == null)
+ ((XSDIdentityConstraintDefinition) component).setAnnotation(xsdAnnotation);
+ else
+ xsdAnnotation = ((XSDIdentityConstraintDefinition) component).getAnnotation();
+ } else if (component instanceof XSDImport) {
+ if(((XSDImport) component).getAnnotation() == null)
+ ((XSDImport) component).setAnnotation(xsdAnnotation);
+ else
+ xsdAnnotation = ((XSDImport) component).getAnnotation();
+ } else if (component instanceof XSDInclude) {
+ if(((XSDInclude) component).getAnnotation() == null)
+ ((XSDInclude) component).setAnnotation(xsdAnnotation);
+ else
+ xsdAnnotation = ((XSDInclude) component).getAnnotation();
+ } else if (component instanceof XSDModelGroup) {
+ if(((XSDModelGroup) component).getAnnotation() == null)
+ ((XSDModelGroup) component).setAnnotation(xsdAnnotation);
+ else
+ xsdAnnotation = ((XSDModelGroup) component).getAnnotation();
+ } else if (component instanceof XSDModelGroupDefinition) {
+ if(((XSDModelGroupDefinition) component).getAnnotation() == null)
+ ((XSDModelGroupDefinition) component).setAnnotation(xsdAnnotation);
+ else
+ xsdAnnotation = ((XSDModelGroupDefinition) component).getAnnotation();
+ } else if (component instanceof XSDNotationDeclaration) {
+ if(((XSDNotationDeclaration) component).getAnnotation() == null)
+ ((XSDNotationDeclaration) component).setAnnotation(xsdAnnotation);
+ else
+ xsdAnnotation = ((XSDNotationDeclaration) component).getAnnotation();
+ } else if (component instanceof XSDTypeDefinition) {
+ if(((XSDTypeDefinition) component).getAnnotation() == null)
+ ((XSDTypeDefinition) component).setAnnotation(xsdAnnotation);
+ else
+ xsdAnnotation = ((XSDTypeDefinition) component).getAnnotation();
+ } else if (component instanceof XSDWildcard) {
+ if(((XSDWildcard) component).getAnnotation() == null)
+ ((XSDWildcard) component).setAnnotation(xsdAnnotation);
+ else
+ xsdAnnotation = ((XSDWildcard) component).getAnnotation();
+ } else if (component instanceof XSDXPathDefinition) {
+ if(((XSDXPathDefinition) component).getAnnotation() == null)
+ ((XSDXPathDefinition) component).setAnnotation(xsdAnnotation);
+ else
+ xsdAnnotation = ((XSDXPathDefinition) component).getAnnotation();
+ } else if (component instanceof XSDSchema) {
+ // Note that this adds a global annotation to the
+ // schema itself, not to any subcomponent
+ ((XSDSchema) component).getContents().add(xsdAnnotation);
+ } else {
+ // Whoops, asked us to annotate an unannotateable item
+ throw new IllegalArgumentException("Unable to addDocumentation onto type: " + component); //$NON-NLS-1$
+ }
+
+ // Remove any old documentation elements
+ for(int i = 0; i < xsdAnnotation.getElement().getChildNodes().getLength(); i++) {
+ Node node = xsdAnnotation.getElement().getChildNodes().item(i);
+ if(node.getNodeName().endsWith(XSDConstants.DOCUMENTATION_ELEMENT_TAG))
+ xsdAnnotation.getElement().removeChild(node);
+ }
+ xsdAnnotation.getUserInformation().clear();
+
+ if (text!=null)
+ {
+ // Now that the xsdAnnotation is added to a parent
+ // XSDConcreteComponent, go ahead and create the
+ // UserInformation node (xsd:documentation) and
+ // add a DOM textNode to it containing the information
+ Element userInfo = xsdAnnotation.createUserInformation(null);
+ userInfo.appendChild(userInfo.getOwnerDocument().createTextNode(text));
+
+ // Add the finished userInfo object to the concrete
+ // parameter of the xsdAnnotation
+ xsdAnnotation.getElement().appendChild(userInfo);
+
+ // Add the finished userInfo object to the user information
+ // list
+ xsdAnnotation.getUserInformation().add(userInfo);
+ }
+
+ return xsdAnnotation;
+ } catch (Exception e) {
+ return null;
+ }
+ }
+
+ /**
+ * Adds the text to the component as a Documentation parameter (just like addDocumentation) and then adds the
+ * Documentation properties to the Documentation parameter if they exist.
+ * If text is null then no documentation is set.
+ * If properties is null then no properties are added to the documentation parameter.
+ * @param component
+ * @param text
+ * @param properties
+ * @return
+ */
+ public static XSDAnnotation addDocumentationAndAttributes(XSDConcreteComponent component, String text, Map attributes)
+ {
+ if (null == component)
+ {
+ throw new IllegalArgumentException("addDocumentationAndAttributes called with null component"); //$NON-NLS-1$
+ }
+
+ // nothing to add
+ if (text==null && attributes==null)
+ return null;
+
+ // add documentation
+ XSDAnnotation annotation = addDocumentation(component, text);
+
+ if (annotation==null)
+ return null;
+
+ // no properties so return
+ if (attributes==null || attributes.isEmpty())
+ return annotation;
+
+ // get annotation dom parameter, create if necessary
+ Element userInfo = null;
+ if (annotation.getUserInformation().isEmpty())
+ {
+ userInfo = annotation.createUserInformation(null);
+ annotation.getElement().appendChild(userInfo);
+ }
+ else
+ {
+ for (Iterator<Element> i = annotation.getUserInformation().iterator(); i.hasNext();)
+ {
+ userInfo = i.next();
+ if (userInfo.getTagName().endsWith(XSDConstants.DOCUMENTATION_ELEMENT_TAG))
+ {
+ break;
+ }
+ }
+ }
+
+ if (userInfo==null)
+ return null;
+
+ // add properties
+ String key = null;
+ for (Iterator<String> iter = attributes.keySet().iterator(); iter.hasNext();)
+ {
+ key = iter.next();
+ userInfo.setAttribute(key, (String)attributes.get(key));
+ }
+
+ return annotation;
+ }
+
+
+ /**
+ * Returns a string which is not used by any parameter in 'elements'. The name
+ * is generated by appending numerical suffixes on to 'prefix' until a
+ * unique one is found. PRECONDITION: 'elements' is a list of
+ * XSDNamedComponent instances
+ *
+ * @param prefix
+ * @param elements
+ * @return
+ */
+ public static String createUniqueElementName(String prefix, List elements) {
+ ArrayList<String> usedNames = new ArrayList<String>();
+ for(Iterator i = elements.iterator(); i.hasNext(); ) {
+ usedNames.add( getDisplayName((XSDNamedComponent) i.next()));
+ }
+
+ int i = 1;
+ String testName = prefix + i++;
+ while(usedNames.contains(testName)) {
+ testName = prefix + i++;
+ }
+ return testName;
+ }
+
+ /**
+ * Like getPrimitives(), this returns a list of XSDTypeDefinitions. However where getPrimitives()
+ * returns the basic set supported by the editor, getAdvancedPrimitives returns every known XSD
+ * primitive type.
+ * @return
+ */
+ public static List<XSDTypeDefinition> getAdvancedPrimitives() {
+ advancedPrimitives = null;
+ if(advancedPrimitives == null) {
+ advancedPrimitives = new ArrayList<XSDTypeDefinition>();
+
+ // Get the schema for schemas instance to use when resolving primitives
+ XSDSchema schemaForSchemas = XSDUtil.getSchemaForSchema(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001);
+
+ // Start adding the simple types using the supportedPrimitives list
+ for (String typeName : supportedPrimitives) {
+ XSDTypeDefinition type = schemaForSchemas.resolveSimpleTypeDefinition(typeName);
+ advancedPrimitives.add(type);
+ }
+
+ // Return primitives in alpha order
+ Collections.sort(advancedPrimitives, new Comparator() {
+
+ public int compare(Object o1, Object o2) {
+ if(o1 == null || o2 == null || ((XSDTypeDefinition) o1).getName() == null)
+ return 0;
+ return ((XSDTypeDefinition) o1).getName().compareToIgnoreCase(((XSDTypeDefinition) o2).getName());
+ }
+ });
+ }
+ return advancedPrimitives;
+ }
+
+ /**
+ * Retrieves all the root Data types defined in the schema including complex types, user-defined simple types and anonymous
+ * complex types. If there's an anonymous complex type definition (from a root parameter declaration) then we return
+ * the parameter declaration's anonymous type.
+ * @param schema
+ * @return
+ */
+ public static List<XSDTypeDefinition> getAllDataTypes(XSDSchema schema)
+ {
+ if (schema==null)
+ return Collections.emptyList();
+
+ List<XSDTypeDefinition> bos = new ArrayList<XSDTypeDefinition>();
+
+ EList<XSDSchemaContent> contents = schema.getContents();
+ // First try the easy approach -- if this XSD contains a type definition, that's our BO,
+ // return it. This is the recommended path, and the way our tooling does things.
+ for (XSDSchemaContent item : contents) {
+ if (item instanceof XSDTypeDefinition)
+ bos.add((XSDTypeDefinition)item);
+ }
+
+ // If we failed, we try a second pass, this time looking for an parameter
+ // with an anonymous complex
+ // type defined in line
+ for (XSDSchemaContent item : contents) {
+ if (item instanceof XSDElementDeclaration)
+ {
+ XSDElementDeclaration element = (XSDElementDeclaration) item;
+ if (element.getAnonymousTypeDefinition() instanceof XSDComplexTypeDefinition)
+ {
+ bos.add(element.getAnonymousTypeDefinition());
+ }
+ }
+ }
+ return bos;
+ }
+
+ /**
+ * Given a BO (XSD Complex Type), return a list of the properties
+ * within the complexType.
+ * @param bo
+ * @return List of XSDAttributeDeclaration
+ */
+ public static List<XSDAttributeDeclaration> getChildAttributes(XSDComplexTypeDefinition bo)
+ {
+ EList attrContents = bo.getAttributeContents();
+ List<XSDAttributeDeclaration> attrs = new ArrayList<XSDAttributeDeclaration>();
+ for (int i=0; i< attrContents.size(); i++)
+ {
+ Object next = attrContents.get(i);
+
+ // Attribute contents may include actual attribute delcarations (wrapped in XSDAttributeUses) or
+ // attribute group definitions, containing bundles of properties
+ if(next instanceof XSDAttributeUse) {
+ attrs.add( ((XSDAttributeUse) next).getContent().getResolvedAttributeDeclaration() );
+
+ } else if (next instanceof XSDAttributeGroupDefinition) {
+
+ // Add these properties to the end of attrContents to businessObject processed in turn
+ XSDAttributeGroupDefinition attrGroup = (XSDAttributeGroupDefinition) next;
+ if(attrGroup.getResolvedAttributeGroupDefinition() != null)
+ attrContents.addAll(attrGroup.getResolvedAttributeGroupDefinition().getAttributeUses());
+
+ }
+ }
+ return attrs;
+ }
+
+ /**
+ * Given a BO (XSD Complex Type), return a list of the XSDFeatures
+ * within the complexType's modelgroup (sequence, choice, etc.)
+ * @param bo
+ * @return
+ */
+ public static List<XSDFeature> getChildElements(XSDComplexTypeDefinition bo)
+ {
+ return XSDUtils.getChildElements( getModelGroup(bo) );
+ }
+
+ /**
+ * Given an XSDFeature, return a list of the XSDFeatures
+ * within the complexType's modelgroup (sequence, choice, etc.)
+ * @param bo
+ * @return
+ */
+ public static List<XSDFeature> getChildElements(XSDFeature elem)
+ {
+ XSDComplexTypeDefinition cType = getResolvedComplexType(elem);
+ return (cType != null) ? XSDUtils.getChildElements(cType) : Collections.EMPTY_LIST;
+ }
+
+
+ /**
+ * Given a Model group, return a list of the XSDFeatures
+ * declared within.
+ * @param group
+ * @return
+ */
+ public static List<XSDFeature> getChildElements(XSDModelGroup group)
+ {
+ if(group == null)
+ return new ArrayList<XSDFeature>();
+
+ List<XSDFeature> children = new ArrayList<XSDFeature>();
+ for(Iterator<XSDParticle> i = group.getContents().iterator(); i.hasNext();)
+ {
+ XSDParticle next = i.next();
+ if(next.getContent() instanceof XSDFeature)
+ children.add((XSDFeature) next.getContent());
+ else if (next.getTerm() instanceof XSDModelGroup)
+ children.addAll(getChildElements((XSDModelGroup) next.getTerm()));
+ }
+ return children;
+ }
+
+ /**
+ * Return the contents of the documentation parameter in type's annotation, if it has one.
+ * Otherwise return null
+ * @param type
+ * @return
+ */
+ public static String getDocumentation(XSDFeature element) {
+ XSDAnnotation annotation = null;
+
+ if (element instanceof XSDAttributeDeclaration)
+ annotation = ((XSDAttributeDeclaration)element).getAnnotation();
+ else if (element instanceof XSDElementDeclaration)
+ annotation = ((XSDElementDeclaration)element).getAnnotation();
+
+ if(annotation != null) {
+ for(Iterator i = annotation.getUserInformation().iterator(); i.hasNext(); ) {
+ Element domElement = (Element) i.next();
+ if(domElement.getTagName().endsWith(XSDConstants.DOCUMENTATION_ELEMENT_TAG) &&
+ domElement.getFirstChild() instanceof Text) {
+ return ((Text) domElement.getFirstChild()).getData();
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the properties on the documentation parameter if they exist. I.e. returns source and xml:lang
+ * Returns an empty parentMap if none.
+ * @param type
+ * @return
+ */
+ public static Map<String, String> getDocumentationAttributes(XSDTypeDefinition type)
+ {
+ Map<String, String> attributes = new HashMap<String, String>();
+
+ if (type.getAnnotation() != null)
+ {
+ XSDAnnotation annotation = type.getAnnotation();
+ for (Iterator i = annotation.getUserInformation().iterator(); i
+ .hasNext();)
+ {
+ Element element = (Element) i.next();
+ if (element.getTagName().endsWith(XSDConstants.DOCUMENTATION_ELEMENT_TAG))
+ {
+ String source = element.getAttribute("source"); //$NON-NLS-1$
+ String lang = element.getAttribute("xml:lang"); //$NON-NLS-1$
+ if (lang==null || lang.length()<1)
+ lang = element.getAttribute("lang"); //$NON-NLS-1$
+
+ if (source!=null && source.length()>0)
+ attributes.put("source", source); //$NON-NLS-1$
+
+ if (lang!=null && lang.length()>0)
+ attributes.put("xml:lang", lang); //$NON-NLS-1$
+
+ return attributes;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Returns the properties on the documentation parameter if they exist. I.e. returns source and xml:lang
+ * Returns an empty parentMap if none.
+ * @param parameter
+ * @return
+ */
+ public static Map<String, String> getDocumentationAttributes(XSDFeature element)
+ {
+ XSDAnnotation annotation = null;
+ Map<String, String> attributes = new HashMap<String, String>();
+
+ if (element instanceof XSDAttributeDeclaration)
+ annotation = ((XSDAttributeDeclaration)element).getAnnotation();
+ else if (element instanceof XSDElementDeclaration)
+ annotation = ((XSDElementDeclaration)element).getAnnotation();
+
+ if (annotation != null)
+ {
+ for (Iterator i = annotation.getUserInformation().iterator(); i
+ .hasNext();)
+ {
+ Element domElement = (Element) i.next();
+ if (domElement.getTagName().endsWith(XSDConstants.DOCUMENTATION_ELEMENT_TAG))
+ {
+ String source = domElement.getAttribute("source"); //$NON-NLS-1$
+ String lang = domElement.getAttribute("xml:lang"); //$NON-NLS-1$
+ if (lang==null || lang.length()<1)
+ lang = domElement.getAttribute("lang"); //$NON-NLS-1$
+
+ if (source!=null && source.length()>0)
+ attributes.put("source", source); //$NON-NLS-1$
+
+ if (lang!=null && lang.length()>0)
+ attributes.put("xml:lang", lang); //$NON-NLS-1$
+
+ return attributes;
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Return the contents of the documentation parameter in type's annotation, if it has one.
+ * Otherwise return null
+ * @param type
+ * @return
+ */
+ public static String getDocumentation(XSDTypeDefinition type) {
+ if(type.getAnnotation() != null) {
+ XSDAnnotation annotation = type.getAnnotation();
+ for(Iterator i = annotation.getUserInformation().iterator(); i.hasNext(); ) {
+ Element element = (Element) i.next();
+ if(element.getTagName().endsWith(XSDConstants.DOCUMENTATION_ELEMENT_TAG) &&
+ element.getFirstChild() instanceof Text) {
+ return ((Text) element.getFirstChild()).getData();
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Given an XSD Complex Type Definition, return the model group containing
+ * its child elements.
+ * @param parameter
+ * @return
+ */
+ public static XSDModelGroup getModelGroup(XSDComplexTypeDefinition cType)
+ {
+ XSDParticle particle = cType.getComplexType();
+
+ // In cases where cType doesn't have a model group AND cType has a parent with a modelgroup, the
+ // call above will rather unexpectedly give us cType's PARENT's model group, rather than the null we
+ // might expect. We don't want that here, if the model group returned is null or belongs to someone
+ // other than us, return null
+ if (particle==null || particle.eContainer() != cType) {
+ return null;
+ }
+
+ // get the model group
+ Object particleContent = particle.getContent();
+ XSDModelGroup group = null;
+
+ if (particleContent instanceof XSDModelGroupDefinition) {
+ group = ((XSDModelGroupDefinition)particleContent).getResolvedModelGroupDefinition().getModelGroup();
+ } else if (particleContent instanceof XSDModelGroup) {
+ group = (XSDModelGroup)particleContent;
+ }
+
+ if (group == null) {
+ return null;
+ }
+
+ // if the content of the complex type is empty then the content
+ // must businessObject in the complexContent, ie. we're extending another BO.
+ // if the group and the type are not in the same resource then
+ // we are extending another BO and we don't want to show inherited
+ // properties.
+ if ( group.getContents().isEmpty() || group.eResource() != cType.eResource())
+ {
+ // if we are extending another BO then get the elements
+ // we are adding
+ if (cType.getBaseType()!=null)
+ {
+ XSDComplexTypeContent content = cType.getContent();
+
+ if (content instanceof XSDParticle) {
+ particleContent = ((XSDParticle)content).getContent();
+ if (particleContent instanceof XSDModelGroupDefinition) {
+ group = ((XSDModelGroupDefinition)particleContent).getResolvedModelGroupDefinition().getModelGroup();
+ } else if (particleContent instanceof XSDModelGroup) {
+ group = (XSDModelGroup)particleContent;
+ }
+ }
+
+ }
+ }
+
+ return group;
+ }
+
+ /**
+ * General utility method for finding a name for an xsd component. This method will handle
+ * mapping of xsd primitive names to their human readable counterparts, as well as resolving
+ * parameter references for properties and walking up object hierarchies for anonymous types.
+ * Basically this method should businessObject used whenever a name is needed to minimize the risk of
+ * having a name of 'null' -- though this method WILL return null if no name can businessObject found.
+ * @param component
+ * @return
+ */
+ public static String getDisplayName(XSDNamedComponent component) {
+
+ if(component == null)
+ return null;
+
+ if(component instanceof XSDTypeDefinition)
+ return getDisplayNameFromXSDType((XSDTypeDefinition) component);
+
+ if (component instanceof XSDFeature) {
+ XSDFeature feature = (XSDFeature) component;
+ if(feature.getName() != null)
+ return feature.getName();
+ else if (feature.getResolvedFeature() != null && feature.getResolvedFeature().getName() != null)
+ return feature.getResolvedFeature().getName();
+ }
+
+ return component.getName();
+
+ }
+
+ /**
+ * Try a variety of methods to get a human readable name for type. In order, this method will
+ * - check whether type is null, and if so return null
+ * - check whether type is a restriction of a primitive type, if so return its parent's name
+ * - check whether type is a complex anonymous (un-named) inner type of a named parameter, and if so, return the parameter's name
+ * - check whether type is a primitive type, and if so return a human-readable version of that type
+ * - check whether type is a named, non-primitive type, and if so, return its name
+ * @param xsdType
+ * @return
+ */
+ public static String getDisplayNameFromXSDType(XSDTypeDefinition type) {
+ return getDisplayNameFromXSDType(type, true);
+ }
+
+ /**
+ * Try a variety of methods to get a human readable name for type. In order, this method will
+ * - check whether type is null, and if so return null
+ * - check whether type is a complex anonymous (un-named) inner type of a named parameter, and if so, return the parameter's name
+ * - check whether type is a primitive type, and if so return a human-readable version of that type
+ * - check whether type is a named, non-primitive type, and if so, return its name
+ * - if returnPrimitiveParents is true, check whether type is a restriction of a primitive type,
+ * if so return its parent's name
+ * @param xsdType
+ * @param returnPrimitiveParents if true, and if type is an anonymous restriction of an xsd primitive
+ * type, this method will return the name of the parent primitive type. If false, restrictions of
+ * primitive types will not businessObject treated differently from other types, and their control hierarchy will
+ * businessObject walked, instead of their inheritance hierarchy.
+ * @return
+ */
+ public static String getDisplayNameFromXSDType(XSDTypeDefinition type, boolean returnPrimitiveParents) {
+ if(type == null)
+ return null;
+
+
+
+ // Does type have a name? If not, walk up the control tree to try and find one
+ if(type.getName() == null || type.getName().length() == 0) {
+
+ // In the special case where type is a restriction on a primitive type, just return the parent's
+ // name (which will either businessObject a primitive itself, or a named simple type)
+ if(returnPrimitiveParents && isRestrictedPrimitiveType(type)) {
+ return getDisplayNameFromXSDType(type.getBaseType());
+ }
+
+ EObject container = type.eContainer();
+
+ while(container != null) {
+ if(container instanceof XSDNamedComponent && ((XSDNamedComponent) container).getName() != null) {
+ return ((XSDNamedComponent) container).getName();
+ }
+ container = container.eContainer();
+ }
+ // Type doesn't have a name, or a control with a name, nothing useful
+ return null;
+ } else
+ return type.getName();
+ }
+
+ /**
+ * Return the type definition for the primitive with name xsdName (note, this is not the human-readable
+ * name, but the actual XSD type name.) Return null if a type with this name is not in the list of
+ * all primitives
+ * @param xsdName
+ * @return
+ */
+ public static XSDSimpleTypeDefinition getPrimitive(String xsdName) {
+ for(Iterator<XSDTypeDefinition> i = getAdvancedPrimitives().iterator(); i.hasNext();) {
+ XSDSimpleTypeDefinition next = (XSDSimpleTypeDefinition) i.next();
+ if(next.getName().equals(xsdName)) {
+ return next;
+ }
+ }
+ return null;
+ }
+
+ /**
+ *
+ * @return Returns a list of XSDSimpleTypeDefinitions representing each of the supported primitives.
+ * These will have their XSD spec names (e.g. xsd:dateTime) so they will likely need to businessObject fed to
+ * getDisplayName() if they are going to businessObject presented to humans
+ */
+ public static List<XSDSimpleTypeDefinition> getPrimitives() {
+ if(primitives == null) {
+ primitives = new ArrayList<XSDSimpleTypeDefinition>();
+
+ // Get the schema for schemas instance to use when resolving primitives
+ XSDSchema schemaForSchemas = XSDUtil.getSchemaForSchema(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001);
+
+ // Start adding the simple types from the XSD short list
+ for(Iterator<String> i = xsdShortList.iterator(); i.hasNext(); ) {
+ String typeName = i.next();
+
+ XSDSimpleTypeDefinition type = schemaForSchemas.resolveSimpleTypeDefinition(typeName);
+ primitives.add(type);
+ }
+
+ // Return primitives in alpha order
+ Collections.sort(primitives, new Comparator() {
+
+ public int compare(Object o1, Object o2) {
+ if(o1 == null || o2 == null || getDisplayNameFromXSDType((XSDTypeDefinition) o1) == null)
+ return 0;
+ return getDisplayNameFromXSDType((XSDTypeDefinition) o1).compareTo(getDisplayNameFromXSDType((XSDTypeDefinition) o2));
+ }
+ });
+ }
+ return primitives;
+ }
+
+ /**
+ * Return a collection of all types referenced by the properties (XSDFeatures) of source. This
+ * method is non-recursive (i.e. the list only contains direct references, not references-of-references)
+ * Will not return null, but may return an empty set. This will not return a BO reference if the file
+ * has been deleted (or just doesn't exist).
+ * @param source The complex type to examine for references
+ * @return a Collection of XSDComplexTypeDefinition instances -- no duplicates
+ */
+ public static Collection<XSDComplexTypeDefinition> getReferencedTypes(XSDComplexTypeDefinition source) {
+ if(source == null)
+ return Collections.emptySet();
+
+ List<XSDComplexTypeDefinition> results = new ArrayList<XSDComplexTypeDefinition>();
+ for(Iterator<XSDFeature> i = getChildElements(source).iterator(); i.hasNext(); ) {
+ XSDFeature element = i.next();
+ XSDComplexTypeDefinition elementType = getResolvedComplexType(element);
+ if(elementType != null && !results.contains(elementType) && !XSDConstants.isSchemaForSchemaNamespace(elementType.getTargetNamespace()))
+ results.add(elementType);
+ }
+ return results;
+ }
+
+ /**
+ * Return a collection of all types referenced by the properties (XSDFeatures) of source. This
+ * method is non-recursive (i.e. the list only contains direct references, not references-of-references)
+ * Will not return null, but may return an empty set. This will return a BO reference if the file
+ * has been deleted (or just doesn't exist).
+ * @param source The complex type to examine for references
+ * @return a Collection of XSDTypeDefinition (could businessObject complex or simple type) instances -- no duplicates
+ */
+ public static Collection<XSDTypeDefinition> getAllReferencedTypes(XSDComplexTypeDefinition source)
+ {
+ return getAllReferencedTypes(source, false);
+ }
+
+ /**
+ * Return a collection of all types referenced by the properties (XSDFeatures) of source. This
+ * method is non-recursive (i.e. the list only contains direct references, not references-of-references)
+ * Will not return null, but may return an empty set. This will return a BO reference if the file
+ * has been deleted (or just doesn't exist).
+ * @param source The complex type to examine for references
+ * @param includeAnonymous if true, the returned list will include anonymous inlined types as well. These
+ * are not technically "referenced", however it allows this method to businessObject used as a way to get all non-primitive
+ * types used in any way by source
+ * @return a Collection of XSDTypeDefinition (could businessObject complex or simple type) instances -- no duplicates
+ */
+ public static Collection<XSDTypeDefinition> getAllReferencedTypes(XSDComplexTypeDefinition source, boolean includeAnonymous)
+ {
+ if (source == null)
+ return Collections.emptySet();
+
+ List<XSDTypeDefinition> results = new ArrayList<XSDTypeDefinition>();
+ XSDTypeDefinition elementType = null;
+ for (Iterator<XSDFeature> i = getChildElements(source).iterator(); i.hasNext();)
+ {
+ XSDFeature next = i.next();
+ elementType = getResolvedType(next);
+
+ // Only add non-null, non-duplicate, non-primitive types. If includeAnonymous is false,
+ // anonymous types should businessObject filtered out as well
+ if( elementType != null &&
+ !results.contains(elementType) &&
+ !XSDConstants.isSchemaForSchemaNamespace(elementType.getTargetNamespace()) &&
+ (includeAnonymous || elementType.eContainer() != next) )
+ results.add(elementType);
+ }
+ return results;
+ }
+
+ /**
+ * Given an parameter, return its complex type, or null if it does not have a complex type. This is
+ * slightly more complicated than just calling getType() since an parameter may not have a type at all, it
+ * may reference another parameter.
+ * @param parameter
+ * @return
+ */
+ public static XSDComplexTypeDefinition getResolvedComplexType(XSDFeature feature) {
+ // The contents of this method have been adapted to the more general getResolvedType,
+ // but this method is maintained for compatibility and convenience
+ XSDTypeDefinition resolvedType = getResolvedType(feature);
+ if(resolvedType instanceof XSDComplexTypeDefinition)
+ return (XSDComplexTypeDefinition) resolvedType;
+ return null;
+ }
+
+ /**
+ * Given an parameter, return its type, or null if it does not have a type. This is
+ * slightly more complicated than just calling getType() since an parameter may not have
+ * a type at all, it may reference another parameter.
+ * @param parameter
+ * @return
+ */
+ public static XSDTypeDefinition getResolvedType(XSDFeature feature) {
+
+ // Special case of elements referencing stale XSD complex types
+ if (feature instanceof XSDElementDeclaration && ((XSDElementDeclaration) feature).getTypeDefinition() instanceof XSDComplexTypeDefinition) {
+
+ XSDElementDeclaration element = (XSDElementDeclaration) feature;
+
+ // We have a type, but types can businessObject proxies, and proxies can become
+ // stale if the referenced
+ // type changes, so before we return it, re-resolve the proxy and
+ // then return it
+ XSDComplexTypeDefinition oldType = (XSDComplexTypeDefinition) element.getTypeDefinition();
+ EObject newType = EcoreUtil.resolve(element.getTypeDefinition(), element);
+ if (oldType != newType) {
+ // We only return the resolved type if the name and the namespace has not changed. Changing the name
+ // and namespace is essentially an unresolved BO.
+ String oldName = oldType.getName();
+ String newName = ((XSDTypeDefinition)newType).getName();
+ String oldTNS = oldType.getTargetNamespace();
+ String newTNS = ((XSDTypeDefinition)newType).getTargetNamespace();
+
+ if ( ((oldName==newName) || (oldName!=null && oldName.equals(newName))) &&
+ ((oldTNS==newTNS) || (oldTNS!=null && oldTNS.equals(newTNS))) )
+ element.setTypeDefinition((XSDTypeDefinition) newType);
+ }
+ return element.getTypeDefinition();
+
+ } else if (feature.getType() != null) {
+ return feature.getType();
+ } else if (feature.getResolvedFeature() != null && feature.getResolvedFeature().getType() != null) {
+ // We reference another parameter
+ return feature.getResolvedFeature().getType();
+ } else {
+ return null;
+ }
+ }
+
+ /**
+ * Return the base type from which this type inherits - that is, all xsd types are
+ * either xsd:anyType or xsd:anySimpleType at the topmost level of inheritance, so return the second
+ * topmost level of type's inheritance. The first specific type from which type inherits.
+ * @param type
+ * @return
+ */
+ public static XSDTypeDefinition getRootType(XSDTypeDefinition type) {
+ if(type == null)
+ return null;
+
+ XSDTypeDefinition baseType = type.getBaseType();
+ while(baseType != null && !XSDConstants.isAnySimpleType(baseType) && !XSDConstants.isAnyType(baseType)) {
+ // walk one more step up the hierarchy
+ type = baseType;
+ baseType = type.getBaseType();
+ }
+
+ // Since baseType, type's immediate parent, broke the while condition, we know that type is now
+ // as high up the tree as we want to businessObject
+ return type;
+
+
+
+ }
+
+ /**
+ * Given a schema, return the list of XSDSimpleTypeDefinitions found within it. Will not return null,
+ * but may return an empty list
+ * @param schema
+ * @return
+ */
+ public static List<XSDSimpleTypeDefinition> getUserDefinedSimpleTypes(XSDSchema schema) {
+ if(schema == null)
+ return Collections.emptyList();
+
+ List<XSDSimpleTypeDefinition> result = new ArrayList<XSDSimpleTypeDefinition>();
+ for (XSDSchemaContent next : schema.getContents()) {
+ if(next instanceof XSDSimpleTypeDefinition)
+ result.add((XSDSimpleTypeDefinition)next);
+ }
+ return result;
+ }
+
+ /**
+ * Given a display name for a BO attribute type, return the XSD type name.
+ * If the given input is not a display name, the input is returned.
+ * @param displayName
+ * @return
+ */
+ public static String getXSDTypeFromDisplayName(String displayName)
+ {
+ // Now a no-op since we no longer translate XSD type names to "human readable" ones
+ return displayName;
+ }
+
+ /**
+ * Return true iff type is a descendant of a primitive xsd type. Will not return true for primitives
+ * themselves.
+ * @param type
+ * @return
+ */
+ public static boolean isRestrictedPrimitiveType(XSDTypeDefinition type) {
+ if(type instanceof XSDComplexTypeDefinition)
+ return false;
+
+ XSDTypeDefinition baseType = getRootType(type);
+ return getAdvancedPrimitives().contains(baseType);
+ }
+
+ /**
+ * Gets the "minOccurs" attribute value for the given XSDFeature, if
+ * there is none then it returns the default 1.
+ * @param xsdElem
+ * @return
+ */
+ public static int getMinOccurs(XSDFeature xsdElem)
+ {
+ if (xsdElem.eContainer() instanceof XSDAttributeUse)
+ {
+ return (((XSDAttributeUse)xsdElem.eContainer()).getUse()==XSDAttributeUseCategory.REQUIRED_LITERAL?1:0);
+ }
+
+ XSDParticle particle = (XSDParticle)xsdElem.eContainer();
+ int min = 1;
+ if (particle.isSetMinOccurs())
+ min = particle.getMinOccurs();
+
+ return min;
+ }
+
+ /**
+ * Gets the "maxOccurs" attribute value for the given XSDFeature, if
+ * there is none then it returns the default 1.
+ * @param xsdElem
+ * @return
+ */
+ public static int getMaxOccurs(XSDFeature xsdElem)
+ {
+ int max = 1;
+
+ // not a particle means an attribute use. properties are maxed at 1.
+ if ( !(xsdElem.eContainer() instanceof XSDParticle) )
+ return max;
+
+ XSDParticle particle = (XSDParticle)xsdElem.eContainer();
+ if (particle.isSetMaxOccurs())
+ max = particle.getMaxOccurs();
+
+ return max;
+ }
+
+ /**
+ * Return the Data Type from the given schema with the given name.
+ * @param schema - The schema containing the type.
+ * @param boName - The local name of the type to retrieve -- if null method returns first type found.
+ * @return The XSDTypeDefinition if one exists, null otherwise
+ */
+ public static XSDTypeDefinition getDataType(XSDSchema schema, String typeName) {
+ if(schema == null)
+ return null;
+
+ boolean pickFirstFound = (typeName==null || typeName.length()<1);
+
+ EList<XSDSchemaContent> contents = schema.getContents();
+
+ // First try the easy approach -- if this XSD contains a type definition with the right name, that's
+ // our type, return it. This is the recommended path, and the way our tooling does things.
+ for(Iterator<XSDSchemaContent> i = contents.iterator(); i.hasNext(); ) {
+ Object item = i.next();
+ if(item instanceof XSDTypeDefinition)
+ if (pickFirstFound)
+ return (XSDTypeDefinition) item;
+ else if ( typeName.equals(getDisplayName((XSDTypeDefinition)item)))
+ return (XSDTypeDefinition) item;
+ }
+
+ // If we failed, we try a second pass, this time looking for an parameter with an anonymous
+ // type defined in line
+ for(Iterator<XSDSchemaContent> i = contents.iterator(); i.hasNext(); ) {
+ Object item = i.next();
+ if(item instanceof XSDFeature) {
+ XSDFeature element = (XSDFeature) item;
+ XSDTypeDefinition resolvedType = getResolvedType(element);
+ if(resolvedType != null && resolvedType.getSchema() == schema) {
+ if (pickFirstFound)
+ return resolvedType;
+ else if (typeName.equals(getDisplayName(element)))
+ return resolvedType;
+ }
+ }
+ }
+ return null;
+
+ }
+
+ /**
+ * Gets the "default" attribute value for the given XSDFeature, if there
+ * is none then it returns an empty string.
+ * @param xsdElem
+ * @return
+ */
+ public static String getDefaultValue(XSDFeature xsdElem)
+ {
+ XSDConstraint constraint = null;
+ if (xsdElem instanceof XSDAttributeDeclaration)
+ {
+ // attribute declarations store their default values in
+ // their containers (attribute uses)
+ XSDAttributeUse use = (XSDAttributeUse)xsdElem.getContainer();
+ if (use.isSetConstraint())
+ constraint = use.getConstraint();
+
+ if (constraint!=null && constraint.equals(XSDConstraint.DEFAULT_LITERAL))
+ if (use.getLexicalValue()!=null)
+ return use.getLexicalValue();
+ else
+ return ""; //$NON-NLS-1$
+ }
+ else if (xsdElem instanceof XSDElementDeclaration)
+ {
+ if (xsdElem.isSetConstraint())
+ constraint = xsdElem.getConstraint();
+
+ if (constraint!=null && constraint.equals(XSDConstraint.DEFAULT_LITERAL))
+ if (xsdElem.getLexicalValue()!=null)
+ return xsdElem.getLexicalValue();
+ else
+ return ""; //$NON-NLS-1$
+
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ /**
+ * Return the enclosing Complex Type definition.
+ * @param component
+ * @return
+ */
+ public static XSDComplexTypeDefinition getEnclosingTypeDefinition(EObject component)
+ {
+ if (component == null)
+ return null;
+
+ if (component instanceof XSDComplexTypeDefinition)
+ return (XSDComplexTypeDefinition)component;
+
+ return getEnclosingTypeDefinition(component.eContainer());
+ }
+
+ /**
+ * Given an XSD schema with a new target namespace set, this method will cycle through the XSD schema directives
+ * (i.e. imports/includes/redefines) and remove as appropriate.
+ *
+ * I.e. this method will remove all includes/redefines if the new TNS is different than the old TNS and it will remove
+ * all imports that have the same namespace as the new TNS (since these should now businessObject includes).
+ *
+ * @param schema - has the new target namespace set
+ * @param oldTNS
+ */
+ public static void removeImportsAndIncludes(XSDSchema schema, String oldTNS)
+ {
+ if (schema==null)
+ return;
+
+ String newTNS = schema.getTargetNamespace();
+
+ // namespace hasn't changed
+ if (newTNS==null && oldTNS==null)
+ return;
+
+ // namespace hasn't changed
+ if (newTNS!=null && newTNS.equals(oldTNS))
+ return;
+
+ // namespace has changed so remove all includes and remove any imports to the new namespace
+ ArrayList schemaContents = new ArrayList(schema.getContents());
+ for (Iterator i = schemaContents.iterator(); i.hasNext();)
+ {
+ Object next = i.next();
+ if (next instanceof XSDImport)
+ {
+ XSDImport nextImport = (XSDImport) next;
+ if (nextImport.getNamespace()==null && newTNS==null)
+ schema.getContents().remove(nextImport);
+ else if (nextImport.getNamespace()!=null && nextImport.getNamespace().equals(newTNS))
+ schema.getContents().remove(nextImport);
+ }
+ else if (next instanceof XSDSchemaCompositor)
+ {
+ schema.getContents().remove(next);
+ }
+ }
+
+ }
+
+ /**
+ * Given an XSD complex type, return a list of the XSDFeatures (parameter
+ * and attribute declarations) within the complex type.
+ */
+ public static List<XSDFeature> getXSDElementsAndAttributes(XSDComplexTypeDefinition complexType)
+ {
+ List<XSDFeature> result = getChildElements(complexType);
+ result.addAll( getChildAttributes(complexType));
+
+ return result;
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/views/BPMN2ModelView.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/views/BPMN2ModelView.java
index 38b47e7..df7bd5d 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/views/BPMN2ModelView.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/views/BPMN2ModelView.java
@@ -1,104 +1,104 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Innar Made
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.views;
-
-import org.eclipse.bpmn2.BaseElement;
-import org.eclipse.jface.util.LocalSelectionTransfer;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.TreeViewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.dnd.DND;
-import org.eclipse.swt.dnd.DragSourceAdapter;
-import org.eclipse.swt.dnd.DragSourceEvent;
-import org.eclipse.swt.dnd.Transfer;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.ISelectionListener;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.part.ViewPart;
-
-/**
- * This sample class demonstrates how to plug-in a new workbench view. The view shows data obtained from the model. The
- * sample creates a dummy model on the fly, but a real implementation would connect to the model available either in
- * this or another plug-in (e.g. the workspace). The view is connected to the model using a content provider.
- * <p>
- * The view uses a label provider to define how model objects should be presented in the view. Each view can present the
- * same model objects using different labels and icons, if needed. Alternatively, a single label provider can be shared
- * between views in order to ensure that objects of the same description are presented in the same way everywhere.
- * <p>
- */
-
-public class BPMN2ModelView extends ViewPart {
-
- private final class BpmnModelDragSourceLisener extends DragSourceAdapter {
- @Override
- public void dragStart(DragSourceEvent event) {
- if (((IStructuredSelection) viewer.getSelection()).getFirstElement() instanceof TreeObject) {
-
- IStructuredSelection iStructuredSelection = (IStructuredSelection) viewer.getSelection();
- TreeObject treeObject = (TreeObject) iStructuredSelection.getFirstElement();
- BaseElement baseElement = treeObject.getBaseElement();
- LocalSelectionTransfer.getTransfer().setSelection(new StructuredSelection(baseElement));
- }
-
- }
- }
-
- /**
- * The ID of the view as specified by the extension.
- */
- public static final String ID = "org.eclipse.bpmn2.modeler.ui.views.BPMN2ModelView";
-
- private TreeViewer viewer;
- private ISelectionListener listener;
-
- /**
- * The constructor.
- */
- public BPMN2ModelView() {
- }
-
- /**
- * This is a callback that will allow us to create the viewer and initialize it.
- */
- public void createPartControl(Composite parent) {
- viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
-
- final ViewContentProvider contentProvider = new ViewContentProvider();
- viewer.setContentProvider(contentProvider);
- viewer.setLabelProvider(new ViewLabelProvider());
- viewer.setInput(getViewSite());
-
- viewer.addDragSupport(DND.DROP_MOVE | DND.DROP_COPY, new Transfer[] { LocalSelectionTransfer.getTransfer() },
- new BpmnModelDragSourceLisener());
-
- listener = new BpmnModelViewerSelectionListener(viewer);
- getSite().getPage().addSelectionListener(listener);
-
- // Create the help context id for the viewer's control
- PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(), "org.eclipse.bpmn2.modeler.ui.viewer");
- }
-
- @Override
- public void dispose() {
- getSite().getPage().removeSelectionListener(listener);
- super.dispose();
- }
-
- /**
- * Passing the focus request to the viewer's control.
- */
- public void setFocus() {
- viewer.getControl().setFocus();
- }
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Innar Made
+ ******************************************************************************/
+package org.eclipse.bpmn2.modeler.ui.views;
+
+import org.eclipse.bpmn2.BaseElement;
+import org.eclipse.jface.util.LocalSelectionTransfer;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.dnd.DND;
+import org.eclipse.swt.dnd.DragSourceAdapter;
+import org.eclipse.swt.dnd.DragSourceEvent;
+import org.eclipse.swt.dnd.Transfer;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.ui.ISelectionListener;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.part.ViewPart;
+
+/**
+ * This sample class demonstrates how to plug-in a new workbench view. The view shows data obtained from the model. The
+ * sample creates a dummy model on the fly, but a real implementation would connect to the model available either in
+ * this or another plug-in (e.g. the workspace). The view is connected to the model using a content provider.
+ * <p>
+ * The view uses a label provider to define how model objects should businessObject presented in the view. Each view can present the
+ * same model objects using different labels and icons, if needed. Alternatively, a single label provider can businessObject shared
+ * between views in order to ensure that objects of the same description are presented in the same way everywhere.
+ * <p>
+ */
+
+public class BPMN2ModelView extends ViewPart {
+
+ private final class BpmnModelDragSourceLisener extends DragSourceAdapter {
+ @Override
+ public void dragStart(DragSourceEvent event) {
+ if (((IStructuredSelection) viewer.getSelection()).getFirstElement() instanceof TreeObject) {
+
+ IStructuredSelection iStructuredSelection = (IStructuredSelection) viewer.getSelection();
+ TreeObject treeObject = (TreeObject) iStructuredSelection.getFirstElement();
+ BaseElement baseElement = treeObject.getBaseElement();
+ LocalSelectionTransfer.getTransfer().setSelection(new StructuredSelection(baseElement));
+ }
+
+ }
+ }
+
+ /**
+ * The ID of the view as specified by the extension.
+ */
+ public static final String ID = "org.eclipse.bpmn2.modeler.ui.views.BPMN2ModelView";
+
+ private TreeViewer viewer;
+ private ISelectionListener listener;
+
+ /**
+ * The constructor.
+ */
+ public BPMN2ModelView() {
+ }
+
+ /**
+ * This is a callback that will allow us to create the viewer and initialize it.
+ */
+ public void createPartControl(Composite parent) {
+ viewer = new TreeViewer(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
+
+ final ViewContentProvider contentProvider = new ViewContentProvider();
+ viewer.setContentProvider(contentProvider);
+ viewer.setLabelProvider(new ViewLabelProvider());
+ viewer.setInput(getViewSite());
+
+ viewer.addDragSupport(DND.DROP_MOVE | DND.DROP_COPY, new Transfer[] { LocalSelectionTransfer.getTransfer() },
+ new BpmnModelDragSourceLisener());
+
+ listener = new BpmnModelViewerSelectionListener(viewer);
+ getSite().getPage().addSelectionListener(listener);
+
+ // Create the help context id for the viewer's control
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(viewer.getControl(), "org.eclipse.bpmn2.modeler.ui.viewer");
+ }
+
+ @Override
+ public void dispose() {
+ getSite().getPage().removeSelectionListener(listener);
+ super.dispose();
+ }
+
+ /**
+ * Passing the focus request to the viewer's control.
+ */
+ public void setFocus() {
+ viewer.getControl().setFocus();
+ }
}
\ No newline at end of file
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/wizards/BPMN2DiagramCreator.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/wizards/BPMN2DiagramCreator.java
index bd85da6..b73fd3e 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/wizards/BPMN2DiagramCreator.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/wizards/BPMN2DiagramCreator.java
@@ -1,245 +1,245 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Innar Made
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.wizards;
-
-import org.eclipse.bpmn2.modeler.core.utils.ErrorUtils;
-import org.eclipse.bpmn2.modeler.core.utils.ModelUtil.Bpmn2DiagramType;
-import org.eclipse.bpmn2.modeler.ui.Activator;
-import org.eclipse.bpmn2.modeler.ui.editor.BPMN2Editor;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IFile;
-import org.eclipse.core.resources.IFolder;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.IWorkspaceRoot;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.common.util.URI;
-import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.emf.transaction.TransactionalEditingDomain;
-import org.eclipse.graphiti.mm.pictograms.Diagram;
-import org.eclipse.graphiti.services.Graphiti;
-import org.eclipse.graphiti.ui.editor.DiagramEditorInput;
-import org.eclipse.graphiti.ui.services.GraphitiUi;
-import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.PlatformUI;
-
-public class BPMN2DiagramCreator {
-
- private final static String TEMPFILE_EXTENSION = "bpmn2d";
- private IFolder diagramFolder;
- private IFile diagramFile;
- private URI uri;
-
- public Bpmn2DiagramEditorInput createDiagram(Bpmn2DiagramType diagramType, String targetNamespace) throws CoreException {
- return createDiagram(diagramType, targetNamespace, null);
- }
-
- public Bpmn2DiagramEditorInput createDiagram(Bpmn2DiagramType diagramType, String targetNamespace, BPMN2Editor diagramEditor) throws CoreException {
- if (diagramFolder != null && !diagramFolder.exists()) {
- diagramFolder.create(false, true, null);
- }
-
- final Diagram diagram = Graphiti.getPeCreateService().createDiagram("BPMN2",
- diagramFile.getFullPath().removeFileExtension().lastSegment(), true);
- uri = URI.createPlatformResourceURI(diagramFile.getFullPath().toString(), true);
-
- TransactionalEditingDomain domain = FileService.createEmfFileForDiagram(uri, diagram, diagramEditor);
-
- String providerId = GraphitiUi.getExtensionManager().getDiagramTypeProviderId(diagram.getDiagramTypeId());
- final Bpmn2DiagramEditorInput editorInput = new Bpmn2DiagramEditorInput(EcoreUtil.getURI(diagram), domain,
- providerId);
- editorInput.setInitialDiagramType(diagramType);
- editorInput.setTargetNamespace(targetNamespace);
-
- if (diagramEditor==null) {
- openEditor(editorInput);
- }
-
- return editorInput;
- }
-
- private void openEditor(final DiagramEditorInput editorInput) {
- PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
- @Override
- public void run() {
- try {
- PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
- .openEditor(editorInput, BPMN2Editor.EDITOR_ID);
-
- } catch (PartInitException e) {
- String error = "Error while opening diagram editor";
- IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, error, e);
- ErrorUtils.showErrorWithLogging(status);
- }
- }
- });
- }
-
- public IFolder getDiagramFolder() {
- return diagramFolder;
- }
-
- public void setDiagramFolder(IFolder diagramFolder) {
- this.diagramFolder = diagramFolder;
- }
-
- public IFile getDiagramFile() {
- return diagramFile;
- }
-
- public void setDiagramFile(IFile diagramFile) {
- this.diagramFile = diagramFile;
- }
-
- public URI getUri() {
- return uri;
- }
-
- /**
- * Construct a temporary folder based on the given path. The folder is constructed
- * in the project root and its name will be the same as the given path's file extension.
- *
- * @param fullPath - path of the actual BPMN2 model file
- * @return an IFolder for the temporary folder.
- * @throws CoreException
- */
- public static IFolder getTempFolder(IPath fullPath) throws CoreException {
- IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
-
- String name = fullPath.getFileExtension();
- if (name==null || name.length()==0)
- name = "bpmn2";
- IFolder folder = root.getProject(fullPath.segment(0)).getFolder("."+name);
- if (!folder.exists()) {
- folder.create(true, true, null);
- }
- String[] segments = fullPath.segments();
- for (int i = 1; i < segments.length - 1; i++) {
- String segment = segments[i];
- folder = folder.getFolder(segment);
- if (!folder.exists()) {
- folder.create(true, true, null);
- }
- }
- return folder;
- }
-
- /**
- * Return the temporary file to be used as editor input. Conceptually, this is the
- * "diagramFile" mentioned here which is just a placeholder for use by Graphiti
- * as the DiagramEditorInput file.
- *
- * @param fullPath - path of the actual BPMN2 model file
- * @param folder - folder containing the model file
- * @return an IFile for the temporary file. If the file exists, it is first deleted.
- */
- public static IFile getTempFile(IPath fullPath, IFolder folder) {
- IPath path = fullPath.removeFileExtension().addFileExtension(TEMPFILE_EXTENSION);
- IFile tempFile = folder.getFile(path.lastSegment());
-
- // We don't need anything from that file and to be sure there are no side effects we delete the file
- if (tempFile.exists()) {
- try {
- tempFile.delete(true, null);
- } catch (CoreException e) {
- Activator.showErrorWithLogging(e);
- }
- }
- return tempFile;
- }
-
- /**
- * Return the BPMN2 model file given a path to either the "diagramFile" temporary file,
- * or the actual model file.
- *
- * @param fullPath - path of the actual BPMN2 model file
- * @return an IFile for the model file.
- */
- public static IFile getModelFile(IPath fullPath) {
- IProject project = ResourcesPlugin.getWorkspace().getRoot().getFile(fullPath).getProject();
- int matchingSegments = project.getFullPath().matchingFirstSegments(fullPath);
- int totalSegments = fullPath.segmentCount();
- String ext = fullPath.getFileExtension();
- // sanity check: make sure the fullPath is not the project
- if (totalSegments<=matchingSegments)
- return null;
-
- String[] segments = fullPath.segments();
- IPath path = null;
-
- if (TEMPFILE_EXTENSION.equals(ext)) {
- // this is a tempFile - rebuild the BPMN2 model file name from its path
- ext = fullPath.segment(matchingSegments);
- if (ext.startsWith("."))
- ext = ext.substring(1);
- path = project.getFullPath();
- for (int i=matchingSegments+1; i<segments.length; ++i) {
- path = path.append(segments[i]);
- }
- path = path.removeFileExtension().addFileExtension(ext);
- }
- else {
- // this is a model file - normalize path
- path = fullPath.makeAbsolute();
- }
-
- return ResourcesPlugin.getWorkspace().getRoot().getFile(path);
- }
-
- /**
- * Delete the temporary diagram file. If the containing folder hierarchy is empty,
- * it will also be deleted.
- *
- * @param file - the temporary diagram file.
- */
- public static void dispose(IFile file) {
- try {
- IContainer container = file.getParent();
- file.delete(true, null);
- while ( isEmptyFolder(container) ) {
- container.delete(true, null);
- container = container.getParent();
- }
- } catch (CoreException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
-
- /**
- * Check if the given folder is empty. This is true if it contains no files, or only
- * empty folders.
- *
- * @param control - folder to check
- * @return true if the folder is empty.
- */
- public static boolean isEmptyFolder(IContainer container) {
- try {
- IResource[] members = container.members();
- for ( IResource res : members ) {
- int type = res.getType();
- if (type==IResource.FILE || type==IResource.PROJECT || type==IResource.ROOT)
- return false;
- if ( !isEmptyFolder((IContainer)res) )
- return false;
- }
- } catch (CoreException e) {
- return false;
- }
- return true;
- }
-}
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Innar Made
+ ******************************************************************************/
+package org.eclipse.bpmn2.modeler.ui.wizards;
+
+import org.eclipse.bpmn2.modeler.core.utils.ErrorUtils;
+import org.eclipse.bpmn2.modeler.core.utils.ModelUtil.Bpmn2DiagramType;
+import org.eclipse.bpmn2.modeler.ui.Activator;
+import org.eclipse.bpmn2.modeler.ui.editor.BPMN2Editor;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IFolder;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+import org.eclipse.graphiti.services.Graphiti;
+import org.eclipse.graphiti.ui.editor.DiagramEditorInput;
+import org.eclipse.graphiti.ui.services.GraphitiUi;
+import org.eclipse.ui.PartInitException;
+import org.eclipse.ui.PlatformUI;
+
+public class BPMN2DiagramCreator {
+
+ private final static String TEMPFILE_EXTENSION = "bpmn2d";
+ private IFolder diagramFolder;
+ private IFile diagramFile;
+ private URI uri;
+
+ public Bpmn2DiagramEditorInput createDiagram(Bpmn2DiagramType diagramType, String targetNamespace) throws CoreException {
+ return createDiagram(diagramType, targetNamespace, null);
+ }
+
+ public Bpmn2DiagramEditorInput createDiagram(Bpmn2DiagramType diagramType, String targetNamespace, BPMN2Editor diagramEditor) throws CoreException {
+ if (diagramFolder != null && !diagramFolder.exists()) {
+ diagramFolder.create(false, true, null);
+ }
+
+ final Diagram diagram = Graphiti.getPeCreateService().createDiagram("BPMN2",
+ diagramFile.getFullPath().removeFileExtension().lastSegment(), true);
+ uri = URI.createPlatformResourceURI(diagramFile.getFullPath().toString(), true);
+
+ TransactionalEditingDomain domain = FileService.createEmfFileForDiagram(uri, diagram, diagramEditor);
+
+ String providerId = GraphitiUi.getExtensionManager().getDiagramTypeProviderId(diagram.getDiagramTypeId());
+ final Bpmn2DiagramEditorInput editorInput = new Bpmn2DiagramEditorInput(EcoreUtil.getURI(diagram), domain,
+ providerId);
+ editorInput.setInitialDiagramType(diagramType);
+ editorInput.setTargetNamespace(targetNamespace);
+
+ if (diagramEditor==null) {
+ openEditor(editorInput);
+ }
+
+ return editorInput;
+ }
+
+ private void openEditor(final DiagramEditorInput editorInput) {
+ PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ try {
+ PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage()
+ .openEditor(editorInput, BPMN2Editor.EDITOR_ID);
+
+ } catch (PartInitException e) {
+ String error = "Error while opening diagram editor";
+ IStatus status = new Status(IStatus.ERROR, Activator.PLUGIN_ID, error, e);
+ ErrorUtils.showErrorWithLogging(status);
+ }
+ }
+ });
+ }
+
+ public IFolder getDiagramFolder() {
+ return diagramFolder;
+ }
+
+ public void setDiagramFolder(IFolder diagramFolder) {
+ this.diagramFolder = diagramFolder;
+ }
+
+ public IFile getDiagramFile() {
+ return diagramFile;
+ }
+
+ public void setDiagramFile(IFile diagramFile) {
+ this.diagramFile = diagramFile;
+ }
+
+ public URI getUri() {
+ return uri;
+ }
+
+ /**
+ * Construct a temporary folder based on the given path. The folder is constructed
+ * in the project root and its name will businessObject the same as the given path's file extension.
+ *
+ * @param fullPath - path of the actual BPMN2 model file
+ * @return an IFolder for the temporary folder.
+ * @throws CoreException
+ */
+ public static IFolder getTempFolder(IPath fullPath) throws CoreException {
+ IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
+
+ String name = fullPath.getFileExtension();
+ if (name==null || name.length()==0)
+ name = "bpmn2";
+ IFolder folder = root.getProject(fullPath.segment(0)).getFolder("."+name);
+ if (!folder.exists()) {
+ folder.create(true, true, null);
+ }
+ String[] segments = fullPath.segments();
+ for (int i = 1; i < segments.length - 1; i++) {
+ String segment = segments[i];
+ folder = folder.getFolder(segment);
+ if (!folder.exists()) {
+ folder.create(true, true, null);
+ }
+ }
+ return folder;
+ }
+
+ /**
+ * Return the temporary file to businessObject used as editor input. Conceptually, this is the
+ * "diagramFile" mentioned here which is just a placeholder for use by Graphiti
+ * as the DiagramEditorInput file.
+ *
+ * @param fullPath - path of the actual BPMN2 model file
+ * @param folder - folder containing the model file
+ * @return an IFile for the temporary file. If the file exists, it is first deleted.
+ */
+ public static IFile getTempFile(IPath fullPath, IFolder folder) {
+ IPath path = fullPath.removeFileExtension().addFileExtension(TEMPFILE_EXTENSION);
+ IFile tempFile = folder.getFile(path.lastSegment());
+
+ // We don't need anything from that file and to businessObject sure there are no side effects we delete the file
+ if (tempFile.exists()) {
+ try {
+ tempFile.delete(true, null);
+ } catch (CoreException e) {
+ Activator.showErrorWithLogging(e);
+ }
+ }
+ return tempFile;
+ }
+
+ /**
+ * Return the BPMN2 model file given a path to either the "diagramFile" temporary file,
+ * or the actual model file.
+ *
+ * @param fullPath - path of the actual BPMN2 model file
+ * @return an IFile for the model file.
+ */
+ public static IFile getModelFile(IPath fullPath) {
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getFile(fullPath).getProject();
+ int matchingSegments = project.getFullPath().matchingFirstSegments(fullPath);
+ int totalSegments = fullPath.segmentCount();
+ String ext = fullPath.getFileExtension();
+ // sanity check: make sure the fullPath is not the project
+ if (totalSegments<=matchingSegments)
+ return null;
+
+ String[] segments = fullPath.segments();
+ IPath path = null;
+
+ if (TEMPFILE_EXTENSION.equals(ext)) {
+ // this is a tempFile - rebuild the BPMN2 model file name from its path
+ ext = fullPath.segment(matchingSegments);
+ if (ext.startsWith("."))
+ ext = ext.substring(1);
+ path = project.getFullPath();
+ for (int i=matchingSegments+1; i<segments.length; ++i) {
+ path = path.append(segments[i]);
+ }
+ path = path.removeFileExtension().addFileExtension(ext);
+ }
+ else {
+ // this is a model file - normalize path
+ path = fullPath.makeAbsolute();
+ }
+
+ return ResourcesPlugin.getWorkspace().getRoot().getFile(path);
+ }
+
+ /**
+ * Delete the temporary diagram file. If the containing folder hierarchy is empty,
+ * it will also businessObject deleted.
+ *
+ * @param file - the temporary diagram file.
+ */
+ public static void dispose(IFile file) {
+ try {
+ IContainer container = file.getParent();
+ file.delete(true, null);
+ while ( isEmptyFolder(container) ) {
+ container.delete(true, null);
+ container = container.getParent();
+ }
+ } catch (CoreException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * Check if the given folder is empty. This is true if it contains no files, or only
+ * empty folders.
+ *
+ * @param control - folder to check
+ * @return true if the folder is empty.
+ */
+ public static boolean isEmptyFolder(IContainer container) {
+ try {
+ IResource[] members = container.members();
+ for ( IResource res : members ) {
+ int type = res.getType();
+ if (type==IResource.FILE || type==IResource.PROJECT || type==IResource.ROOT)
+ return false;
+ if ( !isEmptyFolder((IContainer)res) )
+ return false;
+ }
+ } catch (CoreException e) {
+ return false;
+ }
+ return true;
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/wizards/BPMN2DiagramWizardPage2.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/wizards/BPMN2DiagramWizardPage2.java
index 51e1f0b..ac01b4f 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/wizards/BPMN2DiagramWizardPage2.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/wizards/BPMN2DiagramWizardPage2.java
@@ -1,331 +1,331 @@
-/*******************************************************************************
- * Copyright (c) 2011 Red Hat, Inc.
- * All rights reserved.
- * This program is 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:
- * Red Hat, Inc. - initial API and implementation
- *
- * @author Innar Made
- ******************************************************************************/
-package org.eclipse.bpmn2.modeler.ui.wizards;
-
-import org.eclipse.bpmn2.modeler.core.preferences.Bpmn2Preferences;
-import org.eclipse.bpmn2.modeler.core.runtime.TargetRuntime;
-import org.eclipse.bpmn2.modeler.core.utils.ModelUtil.Bpmn2DiagramType;
-import org.eclipse.core.resources.IContainer;
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.IAdaptable;
-import org.eclipse.core.runtime.Path;
-import org.eclipse.jface.dialogs.IDialogPage;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.viewers.TreePath;
-import org.eclipse.jface.viewers.TreeSelection;
-import org.eclipse.jface.window.Window;
-import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-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.Label;
-import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.dialogs.ContainerSelectionDialog;
-
-public class BPMN2DiagramWizardPage2 extends WizardPage {
- private Text containerText;
-
- private Text fileText;
- private Text targetNamespaceText;
-
- private ISelection selection;
-
- private IResource diagramContainer;
- private Bpmn2DiagramType diagramType = Bpmn2DiagramType.NONE;
-
- /**
- * Constructor for SampleNewWizardPage.
- *
- * @param pageName
- */
- public BPMN2DiagramWizardPage2(ISelection selection) {
- super("wizardPage2");
- setTitle("BPMN2 Diagram File");
- setDescription("Select file name.");
- this.selection = selection;
- }
-
- /**
- * @see IDialogPage#createControl(Composite)
- */
- @Override
- public void createControl(Composite parent) {
- Composite container = new Composite(parent, SWT.NULL);
- GridLayout layout = new GridLayout();
- container.setLayout(layout);
- layout.numColumns = 3;
- layout.verticalSpacing = 9;
- Label label = new Label(container, SWT.NULL);
- label.setText("&Location:");
-
- containerText = new Text(container, SWT.BORDER | SWT.SINGLE);
- GridData gd = new GridData(GridData.FILL_HORIZONTAL);
- containerText.setLayoutData(gd);
- containerText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- dialogChanged();
- }
- });
-
- Button button = new Button(container, SWT.PUSH);
- button.setText("Browse...");
- button.addSelectionListener(new SelectionAdapter() {
- @Override
- public void widgetSelected(SelectionEvent e) {
- handleBrowse();
- }
- });
- label = new Label(container, SWT.NULL);
- label.setText("&File name:");
-
- fileText = new Text(container, SWT.BORDER | SWT.SINGLE);
- fileText.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1));
- fileText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- dialogChanged();
- }
- });
-
- label = new Label(container, SWT.NULL);
- label.setText("&Target Namespace:");
-
- targetNamespaceText = new Text(container, SWT.BORDER | SWT.SINGLE);
- targetNamespaceText.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1));
- targetNamespaceText.addModifyListener(new ModifyListener() {
- @Override
- public void modifyText(ModifyEvent e) {
- dialogChanged();
- }
- });
-
- updatePageDescription();
- updateFilename();
- dialogChanged();
- setControl(container);
- }
-
- private Bpmn2DiagramType getDiagramType() {
- BPMN2DiagramWizardPage1 page1 = (BPMN2DiagramWizardPage1)getWizard().getPage("wizardPage1");
- return page1.getDiagramType();
- }
-
- /**
- * Tests if the current workbench selection is a suitable diagramContainer to use.
- */
-
- private void updatePageDescription() {
- BPMN2DiagramWizardPage1 page1 = (BPMN2DiagramWizardPage1)getWizard().getPage("wizardPage1");
- String descriptionType = "Unknown Diagram Type";
- switch (page1.getDiagramType()) {
- case PROCESS:
- descriptionType = "Process Diagram";
- break;
- case COLLABORATION:
- descriptionType = "Collaboration Diagram";
- break;
- case CHOREOGRAPHY:
- descriptionType = "Choreography Diagram";
- break;
- }
- setDescription("Enter a file name for the new "+descriptionType);
- }
-
- private void updateFilename() {
- BPMN2DiagramWizardPage1 page1 = (BPMN2DiagramWizardPage1)getWizard().getPage("wizardPage1");
- String fileType = "unknown";
- String filename = fileType+".bpmn";
- switch (page1.getDiagramType()) {
- case PROCESS:
- fileType = "process";
- break;
- case COLLABORATION:
- fileType = "collaboration";
- break;
- case CHOREOGRAPHY:
- fileType = "choreography";
- break;
- default:
- return;
- }
-
- IContainer container = getFileContainer();
- if (container!=null) {
- String text = container.getFullPath().toString();
- if (text!=null && !text.equals(containerText.getText()))
- containerText.setText(text);
- for (int i=1; ; ++i) {
- filename = fileType+"_" + i + ".bpmn";
- IResource file = container.findMember(filename);
- if (file==null) {
- break;
- }
- }
- }
-
- String oldFileText = fileText.getText();
- if (filename!=null && !filename.equals(oldFileText))
- fileText.setText(filename);
- }
-
- private IContainer getFileContainer() {
- if (selection != null && selection.isEmpty() == false && selection instanceof IStructuredSelection) {
- IStructuredSelection ssel = (IStructuredSelection) selection;
- if (ssel.size() == 1) {
- Object obj = ssel.getFirstElement();
- if (obj instanceof IAdaptable) {
- Object res = ((IAdaptable)obj).getAdapter(IResource.class);
- if (res!=null)
- obj = res;
- }
- if (obj instanceof Path) {
- obj = ResourcesPlugin.getWorkspace().getRoot().findMember((Path)obj);
- }
- if (obj instanceof IResource) {
- if (obj instanceof IContainer) {
- return (IContainer) obj;
- } else {
- return ((IResource) obj).getParent();
- }
- }
- }
- }
- return null;
- }
-
- @Override
- public void setVisible(boolean visible) {
- if (visible) {
- updatePageDescription();
- updateFilename();
- }
- super.setVisible(visible);
- }
-
- /**
- * Uses the standard diagramContainer selection dialog to choose the new value for the diagramContainer field.
- */
-
- private void handleBrowse() {
- ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), ResourcesPlugin.getWorkspace()
- .getRoot(), false, "Select Folder for the diagram");
- if (dialog.open() == Window.OK) {
- Object[] result = dialog.getResult();
- if (result.length == 1) {
- selection = new TreeSelection(new TreePath(result));
- containerText.setText(((Path) result[0]).toString());
- }
- }
- }
-
- /**
- * Ensures that both text fields are set.
- */
-
- private void dialogChanged() {
- diagramContainer = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(getContainerName()));
- String fileName = getFileName();
-
- if (getContainerName().length() == 0) {
- updateStatus("Folder must be specified");
- return;
- }
- if (diagramContainer == null || (diagramContainer.getType() & (IResource.PROJECT | IResource.FOLDER)) == 0) {
- updateStatus("Folder must exist");
- return;
- }
- if (!diagramContainer.isAccessible()) {
- updateStatus("Project must be writable");
- return;
- }
- if (fileName.length() == 0) {
- updateStatus("Name must be specified");
- return;
- }
- if (fileName.replace('\\', '/').indexOf('/', 1) > 0) {
- updateStatus("Name must be valid");
- return;
- }
- int dotLoc = fileName.lastIndexOf('.');
- if (dotLoc != -1) {
- String ext = fileName.substring(dotLoc + 1);
- if (ext.equalsIgnoreCase("bpmn") == false && ext.equalsIgnoreCase("bpmn2") == false) {
- updateStatus("File extension must be \"bpmn\" or \"bpmn2\"");
- return;
- }
- }
-
- TargetRuntime rt = Bpmn2Preferences.getInstance(diagramContainer.getProject()).getRuntime();
- String targetNamespace = rt.getRuntimeExtension().getTargetNamespace(getDiagramType());
- if (targetNamespace==null)
- targetNamespace = "";
- if (!targetNamespaceText.getText().equals(targetNamespace)) {
- targetNamespaceText.setText(targetNamespace);
- updateFilename();
- }
-
- updateStatus(null);
- }
-
- @Override
- public boolean isPageComplete() {
- IContainer container = getFileContainer();
- if (container!=null) {
- String filename = fileText.getText();
- IResource file = container.findMember(filename);
- if (file==null) {
- String targetNamespace = targetNamespaceText.getText();
- if (!targetNamespace.isEmpty()) {
- setErrorMessage(null);
- return true;
- }
- else
- setErrorMessage("A Target Namespace must be specified");
- }
- else
- setErrorMessage("The file "+filename+" already exists in this project");
- }
- return false;
- }
-
- private void updateStatus(String message) {
- setErrorMessage(message);
- setPageComplete(message == null);
- }
-
- public String getContainerName() {
- return containerText.getText();
- }
-
- public String getFileName() {
- return fileText.getText();
- }
-
- public IResource getDiagramContainer() {
- return diagramContainer;
- }
-
- public String getTargetNamespace() {
- return targetNamespaceText.getText();
- }
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * All rights reserved.
+ * This program is 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:
+ * Red Hat, Inc. - initial API and implementation
+ *
+ * @author Innar Made
+ ******************************************************************************/
+package org.eclipse.bpmn2.modeler.ui.wizards;
+
+import org.eclipse.bpmn2.modeler.core.preferences.Bpmn2Preferences;
+import org.eclipse.bpmn2.modeler.core.runtime.TargetRuntime;
+import org.eclipse.bpmn2.modeler.core.utils.ModelUtil.Bpmn2DiagramType;
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.IAdaptable;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.jface.dialogs.IDialogPage;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.TreePath;
+import org.eclipse.jface.viewers.TreeSelection;
+import org.eclipse.jface.window.Window;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+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.Label;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.dialogs.ContainerSelectionDialog;
+
+public class BPMN2DiagramWizardPage2 extends WizardPage {
+ private Text containerText;
+
+ private Text fileText;
+ private Text targetNamespaceText;
+
+ private ISelection selection;
+
+ private IResource diagramContainer;
+ private Bpmn2DiagramType diagramType = Bpmn2DiagramType.NONE;
+
+ /**
+ * Constructor for SampleNewWizardPage.
+ *
+ * @param pageName
+ */
+ public BPMN2DiagramWizardPage2(ISelection selection) {
+ super("wizardPage2");
+ setTitle("BPMN2 Diagram File");
+ setDescription("Select file name.");
+ this.selection = selection;
+ }
+
+ /**
+ * @see IDialogPage#createControl(Composite)
+ */
+ @Override
+ public void createControl(Composite parent) {
+ Composite container = new Composite(parent, SWT.NULL);
+ GridLayout layout = new GridLayout();
+ container.setLayout(layout);
+ layout.numColumns = 3;
+ layout.verticalSpacing = 9;
+ Label label = new Label(container, SWT.NULL);
+ label.setText("&Location:");
+
+ containerText = new Text(container, SWT.BORDER | SWT.SINGLE);
+ GridData gd = new GridData(GridData.FILL_HORIZONTAL);
+ containerText.setLayoutData(gd);
+ containerText.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ dialogChanged();
+ }
+ });
+
+ Button button = new Button(container, SWT.PUSH);
+ button.setText("Browse...");
+ button.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ handleBrowse();
+ }
+ });
+ label = new Label(container, SWT.NULL);
+ label.setText("&File name:");
+
+ fileText = new Text(container, SWT.BORDER | SWT.SINGLE);
+ fileText.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1));
+ fileText.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ dialogChanged();
+ }
+ });
+
+ label = new Label(container, SWT.NULL);
+ label.setText("&Target Namespace:");
+
+ targetNamespaceText = new Text(container, SWT.BORDER | SWT.SINGLE);
+ targetNamespaceText.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, 2, 1));
+ targetNamespaceText.addModifyListener(new ModifyListener() {
+ @Override
+ public void modifyText(ModifyEvent e) {
+ dialogChanged();
+ }
+ });
+
+ updatePageDescription();
+ updateFilename();
+ dialogChanged();
+ setControl(container);
+ }
+
+ private Bpmn2DiagramType getDiagramType() {
+ BPMN2DiagramWizardPage1 page1 = (BPMN2DiagramWizardPage1)getWizard().getPage("wizardPage1");
+ return page1.getDiagramType();
+ }
+
+ /**
+ * Tests if the current workbench selection is a suitable diagramContainer to use.
+ */
+
+ private void updatePageDescription() {
+ BPMN2DiagramWizardPage1 page1 = (BPMN2DiagramWizardPage1)getWizard().getPage("wizardPage1");
+ String descriptionType = "Unknown Diagram Type";
+ switch (page1.getDiagramType()) {
+ case PROCESS:
+ descriptionType = "Process Diagram";
+ break;
+ case COLLABORATION:
+ descriptionType = "Collaboration Diagram";
+ break;
+ case CHOREOGRAPHY:
+ descriptionType = "Choreography Diagram";
+ break;
+ }
+ setDescription("Enter a file name for the new "+descriptionType);
+ }
+
+ private void updateFilename() {
+ BPMN2DiagramWizardPage1 page1 = (BPMN2DiagramWizardPage1)getWizard().getPage("wizardPage1");
+ String fileType = "unknown";
+ String filename = fileType+".bpmn";
+ switch (page1.getDiagramType()) {
+ case PROCESS:
+ fileType = "process";
+ break;
+ case COLLABORATION:
+ fileType = "collaboration";
+ break;
+ case CHOREOGRAPHY:
+ fileType = "choreography";
+ break;
+ default:
+ return;
+ }
+
+ IContainer container = getFileContainer();
+ if (container!=null) {
+ String text = container.getFullPath().toString();
+ if (text!=null && !text.equals(containerText.getText()))
+ containerText.setText(text);
+ for (int i=1; ; ++i) {
+ filename = fileType+"_" + i + ".bpmn";
+ IResource file = container.findMember(filename);
+ if (file==null) {
+ break;
+ }
+ }
+ }
+
+ String oldFileText = fileText.getText();
+ if (filename!=null && !filename.equals(oldFileText))
+ fileText.setText(filename);
+ }
+
+ private IContainer getFileContainer() {
+ if (selection != null && selection.isEmpty() == false && selection instanceof IStructuredSelection) {
+ IStructuredSelection ssel = (IStructuredSelection) selection;
+ if (ssel.size() == 1) {
+ Object obj = ssel.getFirstElement();
+ if (obj instanceof IAdaptable) {
+ Object res = ((IAdaptable)obj).getAdapter(IResource.class);
+ if (res!=null)
+ obj = res;
+ }
+ if (obj instanceof Path) {
+ obj = ResourcesPlugin.getWorkspace().getRoot().findMember((Path)obj);
+ }
+ if (obj instanceof IResource) {
+ if (obj instanceof IContainer) {
+ return (IContainer) obj;
+ } else {
+ return ((IResource) obj).getParent();
+ }
+ }
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public void setVisible(boolean visible) {
+ if (visible) {
+ updatePageDescription();
+ updateFilename();
+ }
+ super.setVisible(visible);
+ }
+
+ /**
+ * Uses the standard diagramContainer selection dialog to choose the new value for the diagramContainer field.
+ */
+
+ private void handleBrowse() {
+ ContainerSelectionDialog dialog = new ContainerSelectionDialog(getShell(), ResourcesPlugin.getWorkspace()
+ .getRoot(), false, "Select Folder for the diagram");
+ if (dialog.open() == Window.OK) {
+ Object[] result = dialog.getResult();
+ if (result.length == 1) {
+ selection = new TreeSelection(new TreePath(result));
+ containerText.setText(((Path) result[0]).toString());
+ }
+ }
+ }
+
+ /**
+ * Ensures that both text fields are set.
+ */
+
+ private void dialogChanged() {
+ diagramContainer = ResourcesPlugin.getWorkspace().getRoot().findMember(new Path(getContainerName()));
+ String fileName = getFileName();
+
+ if (getContainerName().length() == 0) {
+ updateStatus("Folder must businessObject specified");
+ return;
+ }
+ if (diagramContainer == null || (diagramContainer.getType() & (IResource.PROJECT | IResource.FOLDER)) == 0) {
+ updateStatus("Folder must exist");
+ return;
+ }
+ if (!diagramContainer.isAccessible()) {
+ updateStatus("Project must businessObject writable");
+ return;
+ }
+ if (fileName.length() == 0) {
+ updateStatus("Name must businessObject specified");
+ return;
+ }
+ if (fileName.replace('\\', '/').indexOf('/', 1) > 0) {
+ updateStatus("Name must businessObject valid");
+ return;
+ }
+ int dotLoc = fileName.lastIndexOf('.');
+ if (dotLoc != -1) {
+ String ext = fileName.substring(dotLoc + 1);
+ if (ext.equalsIgnoreCase("bpmn") == false && ext.equalsIgnoreCase("bpmn2") == false) {
+ updateStatus("File extension must businessObject \"bpmn\" or \"bpmn2\"");
+ return;
+ }
+ }
+
+ TargetRuntime rt = Bpmn2Preferences.getInstance(diagramContainer.getProject()).getRuntime();
+ String targetNamespace = rt.getRuntimeExtension().getTargetNamespace(getDiagramType());
+ if (targetNamespace==null)
+ targetNamespace = "";
+ if (!targetNamespaceText.getText().equals(targetNamespace)) {
+ targetNamespaceText.setText(targetNamespace);
+ updateFilename();
+ }
+
+ updateStatus(null);
+ }
+
+ @Override
+ public boolean isPageComplete() {
+ IContainer container = getFileContainer();
+ if (container!=null) {
+ String filename = fileText.getText();
+ IResource file = container.findMember(filename);
+ if (file==null) {
+ String targetNamespace = targetNamespaceText.getText();
+ if (!targetNamespace.isEmpty()) {
+ setErrorMessage(null);
+ return true;
+ }
+ else
+ setErrorMessage("A Target Namespace must businessObject specified");
+ }
+ else
+ setErrorMessage("The file "+filename+" already exists in this project");
+ }
+ return false;
+ }
+
+ private void updateStatus(String message) {
+ setErrorMessage(message);
+ setPageComplete(message == null);
+ }
+
+ public String getContainerName() {
+ return containerText.getText();
+ }
+
+ public String getFileName() {
+ return fileText.getText();
+ }
+
+ public IResource getDiagramContainer() {
+ return diagramContainer;
+ }
+
+ public String getTargetNamespace() {
+ return targetNamespaceText.getText();
+ }
}
\ No newline at end of file
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/wizards/Bpmn2DiagramEditorInput.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/wizards/Bpmn2DiagramEditorInput.java
index 86e6418..26940de 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/wizards/Bpmn2DiagramEditorInput.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/wizards/Bpmn2DiagramEditorInput.java
@@ -53,7 +53,7 @@
return true;
}
- // Eclipse makes FileEditorInputs for files to be opened. Here we check if the file is actually the same
+ // Eclipse makes FileEditorInputs for files to businessObject opened. Here we check if the file is actually the same
// as the DiagramEditorInput uses. This is for preventing opening new editors for the same file.
if (obj instanceof FileEditorInput) {
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/wizards/FileService.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/wizards/FileService.java
index 0392759..a079f60 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/wizards/FileService.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/wizards/FileService.java
@@ -161,7 +161,7 @@
}
private static String createMessage(Map<URI, Throwable> failedSaves) {
- final StringBuilder buf = new StringBuilder("The following resources could not be saved:");
+ final StringBuilder buf = new StringBuilder("The following resources could not businessObject saved:");
for (final Entry<URI, Throwable> entry : failedSaves.entrySet()) {
buf.append("\nURI: ").append(entry.getKey().toString()).append(", cause: \n")
.append(getExceptionAsString(entry.getValue()));