Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBob Brodt2015-01-30 04:12:27 +0000
committerBob Brodt2015-01-30 04:12:27 +0000
commitfa33dbd73091ed917e9e8dc943523d180bea6af6 (patch)
treec0d7b58cdc0e47edfa1bd5c22a8f6ea6f5615092
parentcde001a30aae9d38d33a9b8ef65d33ee5cadcc77 (diff)
downloadorg.eclipse.bpmn2-modeler-fa33dbd73091ed917e9e8dc943523d180bea6af6.tar.gz
org.eclipse.bpmn2-modeler-fa33dbd73091ed917e9e8dc943523d180bea6af6.tar.xz
org.eclipse.bpmn2-modeler-fa33dbd73091ed917e9e8dc943523d180bea6af6.zip
Backport bug fixes from Luna:
https://bugzilla.redhat.com/show_bug.cgi?id=1138987 - Expression language is not saved the first time after a new Timer Event is created. Bug 457995 - Regression: problem decorators are no longer drawn. Bug 458431 - Regression: Morph activity/gateway no longer working. https://bugzilla.redhat.com/show_bug.cgi?id=1183743 - - "Data Input Association has missing or incomplete Source" when UserTask is added. https://bugzilla.redhat.com/show_bug.cgi?id=1184422 - Escalation and Signal in process definitions cause validation errors. Bug 458294 - Property popup dialog does not update file dirty state when opened from Outline or Problems view https://bugzilla.redhat.com/show_bug.cgi?id=1178839 - Process is deformed when special characters are used. https://bugzilla.redhat.com/show_bug.cgi?id=1183853 - Modeler replace a character '<' to "&lt" when user inputs charactoers to a business process id and save it. https://bugzilla.redhat.com/show_bug.cgi?id=1179075 - Modeler automatically change an input charactor to '_'. Bug 427470 - Refactor validation classes to allow Target Runtimes to override specific BPMN 2.0 core constraints. https://bugzilla.redhat.com/show_bug.cgi?id=1147940 - Incorrect validation of Ad Hoc process https://bugzilla.redhat.com/show_bug.cgi?id=1173140 - Process id is not modifiable
-rw-r--r--org.eclipse.bpmn2.modeler.core/META-INF/MANIFEST.MF3
-rw-r--r--org.eclipse.bpmn2.modeler.core/OSGI-INF/l10n/bundle.properties35
-rw-r--r--org.eclipse.bpmn2.modeler.core/plugin.properties14
-rw-r--r--org.eclipse.bpmn2.modeler.core/plugin.xml184
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/adapters/ExtendedPropertiesAdapter.java1
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/AbstractBpmn2PropertySection.java56
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/AbstractDetailComposite.java24
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/AbstractListComposite.java3
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/DefaultDetailComposite.java11
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/DefaultDialogComposite.java6
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/DefaultListComposite.java14
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/DefaultPropertySection.java12
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/ListAndDetailCompositeBase.java10
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/AbstractObjectEditingDialog.java72
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/BooleanObjectEditor.java14
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/ComboObjectEditor.java76
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/FeatureEditingDialog.java12
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/FloatObjectEditor.java39
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/IntObjectEditor.java14
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/JavaVariableNameObjectEditor.java92
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/Messages.java10
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/NCNameObjectEditor.java15
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/ObjectEditor.java53
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/TextAndButtonObjectEditor.java21
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/TextObjectEditor.java20
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/messages.properties10
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/providers/Messages.java10
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/providers/messages.properties10
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/runtime/TargetRuntime.java27
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/EventDefinitionsUtil.java243
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/MarkerUtils.java62
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/BPMN2ProjectValidator.java28
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/BPMN2ValidationConstraints.java927
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/BPMN2ValidationStatusLoader.java41
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/FormalExpressionConstraint.java55
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/LiveValidationListener.java10
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/Messages.java29
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/ResourcePropertyTester.java4
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/SyntaxCheckerUtils.java88
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/TaskNameNotEmpty.java45
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/ValidIdConstraint.java63
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/messages.properties29
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/AbstractBpmn2ElementValidator.java255
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ActivityValidator.java55
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/AssignmentValidator.java60
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/AssociationValidator.java60
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/BaseElementValidator.java99
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/CallActivityValidator.java58
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/CatchEventValidator.java64
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ChoreographyActivityValidator.java60
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ChoreographyTaskValidator.java69
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/DataAssociationValidator.java91
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/DataObjectValidator.java62
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/DefinitionsValidator.java72
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/EndEventValidator.java56
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ErrorValidator.java73
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/EscalationValidator.java73
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/EventDefinitionValidator.java141
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/EventValidator.java73
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ExpressionValidator.java67
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/FlowElementsContainerValidator.java62
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/FlowNodeValidator.java106
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/GatewayValidator.java149
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/IBpmn2ElementValidator.java58
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/InputOutputSpecificationValidator.java60
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/InterfaceValidator.java60
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ItemAwareElementValidator.java68
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ItemDefinitionValidator.java62
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/MessageValidator.java70
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/MultiInstanceLoopCharacteristicsValidator.java76
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/OperationValidator.java60
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ProcessValidator.java102
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ResourceValidator.java58
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ScriptTaskValidator.java60
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/SendTaskValidator.java62
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/SequenceFlowValidator.java60
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/SignalValidator.java70
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/StandardLoopCharacteristicsValidator.java61
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/StartEventValidator.java56
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/SubProcessValidator.java88
-rw-r--r--org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ThrowEventValidator.java64
-rw-r--r--org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/plugin.xml205
-rw-r--r--org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/ProcessVariableNameChangeAdapter.java3
-rw-r--r--org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/JbpmCustomTaskPropertySection.java2
-rw-r--r--org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/JbpmIoParametersPropertySection.java2
-rw-r--r--org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/JbpmProcessDiagramPropertySection.java7
-rw-r--r--org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmDataInputPropertiesAdapter.java4
-rw-r--r--org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmErrorPropertiesAdapter.java4
-rw-r--r--org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmEscalationPropertiesAdapter.java4
-rw-r--r--org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmGlobalTypePropertiesAdapter.java2
-rw-r--r--org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmMessagePropertiesAdapter.java6
-rw-r--r--org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmMultiInstanceLoopCharacteristicsPropertiesAdapter.java32
-rw-r--r--org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmPropertyPropertiesAdapter.java4
-rw-r--r--org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmSignalPropertiesAdapter.java6
-rw-r--r--org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/BusinessRuleTaskConstraint.java49
-rw-r--r--org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/CallActivityConstraint.java64
-rw-r--r--org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/GatewayConstraint.java80
-rw-r--r--org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/JbpmModelConstraint.java71
-rw-r--r--org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/Messages.java10
-rw-r--r--org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/ProcessConstraint.java51
-rw-r--r--org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/ProcessVariableNameConstraint.java46
-rw-r--r--org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/TaskConstraint.java123
-rw-r--r--org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/UserTaskConstraint.java116
-rw-r--r--org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/messages.properties14
-rw-r--r--org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/BusinessRuleTaskValidator.java58
-rw-r--r--org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/CallActivityValidator.java69
-rw-r--r--org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/DataAssociationValidator.java68
-rw-r--r--org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/DefinitionsValidator.java68
-rw-r--r--org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/EscalationValidator.java60
-rw-r--r--org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/GlobalTypeValidator.java66
-rw-r--r--org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/ProcessValidator.java111
-rw-r--r--org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/ProcessVariableNameValidator.java110
-rw-r--r--org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/SignalValidator.java57
-rw-r--r--org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/UserTaskValidator.java116
-rw-r--r--org.eclipse.bpmn2.modeler.ui/plugin.xml9
-rw-r--r--org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2Editor.java30
-rw-r--r--org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2EditorDiagramBehavior.java4
-rw-r--r--org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2EditorUpdateBehavior.java115
-rw-r--r--org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2MarkerChangeListener.java11
-rw-r--r--org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/DesignEditor.java29
-rw-r--r--org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/Messages.java1
-rw-r--r--org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/messages.properties1
-rw-r--r--org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/AdvancedPropertySection.java2
-rw-r--r--org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/artifact/TextAnnotationPropertySection.java2
-rw-r--r--org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/MessageFlowPropertySection.java2
-rw-r--r--org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/connectors/SequenceFlowPropertySection.java2
-rw-r--r--org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/DataInputPropertySection.java2
-rw-r--r--org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/DataObjectPropertySection.java2
-rw-r--r--org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/DataObjectReferencePropertySection.java2
-rw-r--r--org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/DataOutputPropertySection.java2
-rw-r--r--org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/DataStorePropertySection.java2
-rw-r--r--org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/DataStoreReferencePropertySection.java2
-rw-r--r--org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/InterfacePropertySection.java2
-rw-r--r--org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/diagrams/DataItemsPropertySection.java2
-rw-r--r--org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/diagrams/DefinitionsPropertySection.java2
-rw-r--r--org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/diagrams/ParticipantPropertySection.java2
-rw-r--r--org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/diagrams/ProcessDiagramPropertySection.java2
-rw-r--r--org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/events/BoundaryEventPropertySection.java2
-rw-r--r--org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/events/CommonEventPropertySection.java2
-rw-r--r--org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/events/ConditionalEventDefinitionPropertySection.java2
-rw-r--r--org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/gateways/GatewayPropertySection.java2
-rw-r--r--org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/IoParametersPropertySection.java2
-rw-r--r--org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ManualTaskPropertySection.java2
-rw-r--r--org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/MultiInstanceLoopCharacteristicsDetailComposite.java52
-rw-r--r--org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/ScriptTaskPropertySection.java2
-rw-r--r--org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/TaskPropertySection.java2
-rw-r--r--org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/util/PropertyUtil.java42
-rw-r--r--org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/views/outline/BPMN2EditorOutlinePage.java63
148 files changed, 5535 insertions, 2048 deletions
diff --git a/org.eclipse.bpmn2.modeler.core/META-INF/MANIFEST.MF b/org.eclipse.bpmn2.modeler.core/META-INF/MANIFEST.MF
index a2557b70..bd75c3ef 100644
--- a/org.eclipse.bpmn2.modeler.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.bpmn2.modeler.core/META-INF/MANIFEST.MF
@@ -65,7 +65,8 @@ Export-Package: org.eclipse.bpmn2.modeler.core,
org.eclipse.bpmn2.modeler.core.preferences,
org.eclipse.bpmn2.modeler.core.runtime,
org.eclipse.bpmn2.modeler.core.utils,
- org.eclipse.bpmn2.modeler.core.validation
+ org.eclipse.bpmn2.modeler.core.validation,
+ org.eclipse.bpmn2.modeler.core.validation.validators
Import-Package: org.eclipse.bpmn2.modeler.help,
org.eclipse.graphiti.ui.features,
org.eclipse.jface.preference,
diff --git a/org.eclipse.bpmn2.modeler.core/OSGI-INF/l10n/bundle.properties b/org.eclipse.bpmn2.modeler.core/OSGI-INF/l10n/bundle.properties
index 694940fd..fa083402 100644
--- a/org.eclipse.bpmn2.modeler.core/OSGI-INF/l10n/bundle.properties
+++ b/org.eclipse.bpmn2.modeler.core/OSGI-INF/l10n/bundle.properties
@@ -1,32 +1,13 @@
#Properties file for org.eclipse.bpmn2.modeler.core
+pluginName = BPMN2 Modeler Core
+providerName = Eclipse SOA
category.name = Core BPMN 2.0 Constraints
-constraint.name = Valid IDs
-constraint.description = IDs must be valid.
-constraint.message = The {0} ID must be a valid ID.
-constraint.name.0 = StartEventIncoming
-constraint.description.0 = Start Event must not have incoming flows
-constraint.message.0 = Start Event must not have incoming sequence flows.
-constraint.name.1 = EndEventOutgoing
-constraint.description.1 = End Event must not have outgoing flows
-constraint.message.1 = End Event must not have outgoing sequence flows.
-constraint.name.2 = UniqueId
-constraint.description.2 = ID must be unique.
-constraint.message.2 = ID must be unqiue.
-constraint.name.3 = Errors
-constraint.message.3 = {0}
-constraint.description.3 = Diagram Validation Errors
-constraint.name.4 = Warnings
-constraint.message.4 = {0}
-constraint.description.4 = Diagram Validation Warnings
-constraint.name.5 = Infos
-constraint.message.5 = {0}
-constraint.description.5 = Diagram Validation Errors
-constraint.name.6 = TaskEmptyNameConstraint
-constraint.message.6 = The {0} Name must not be empty
-constraint.description.6 = Name must not be empty
-constraint.name.7 = FormalExpressionConstraint
-constraint.message.7 = Expression is blank
-constraint.description.7 = Expressions should not be blank
+constraint.name.live = Live Validation Error
+constraint.description.live = Live Validation Error
+constraint.message.live = {0}
+constraint.name.batch = Batch Validation Error
+constraint.description.batch = Batch Validation Errors
+constraint.message.batch = {0}
extension.name = BPMN 2.0 Project Validator
extension.name.0 = Core BPMN 2.0 Problem
extension.name.1 = BPMN2 Validation Builder
diff --git a/org.eclipse.bpmn2.modeler.core/plugin.properties b/org.eclipse.bpmn2.modeler.core/plugin.properties
index ba0a1111..ca9bf67e 100644
--- a/org.eclipse.bpmn2.modeler.core/plugin.properties
+++ b/org.eclipse.bpmn2.modeler.core/plugin.properties
@@ -1,4 +1,16 @@
+# <copyright>
+###############################################################################
+# Copyright (c) 2011, 2012, 2013, 2014 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
+###############################################################################
+# </copyright>
+#
+# $Id$
pluginName = BPMN2 Modeler Core
providerName = Eclipse.org
diff --git a/org.eclipse.bpmn2.modeler.core/plugin.xml b/org.eclipse.bpmn2.modeler.core/plugin.xml
index eabf18fa..52cedbd1 100644
--- a/org.eclipse.bpmn2.modeler.core/plugin.xml
+++ b/org.eclipse.bpmn2.modeler.core/plugin.xml
@@ -17,154 +17,40 @@
point="org.eclipse.emf.validation.constraintProviders">
<category
name="%category.name"
- id="org.eclipse.bpmn2.modeler.core.validation"/>
+ id="org.eclipse.bpmn2.modeler.core.validation.category"/>
+ <category
+ name="Core Validation Overrides"
+ id="org.eclipse.bpmn2.modeler.core.validation.category.override"/>
<constraintProvider cache="true">
<package namespaceUri="http://www.omg.org/spec/BPMN/20100524/MODEL-XMI"/>
- <constraints categories="org.eclipse.bpmn2.modeler.core.validation">
- <constraint
- lang="Java"
- class="org.eclipse.bpmn2.modeler.core.validation.ValidIdConstraint"
- severity="WARNING"
- mode="Batch"
- name="%constraint.name"
- id="org.eclipse.bpmn2.modeler.core.validation.ValidId"
- statusCode="1">
- <description>
- %constraint.description
- </description>
- <message>
- %constraint.message
- </message>
- <target class="BaseElement">
- <event name="Set">
- <feature name="id"/>
- </event>
- <event name="Unset">
- <feature name="id"/>
- </event>
- </target>
- </constraint>
- <constraint
- lang="OCL"
- severity="ERROR"
- mode="Live"
- name="%constraint.name.0"
- id="org.eclipse.bpmn2.modeler.core.validation.StartEvent.incoming"
- statusCode="2" isEnabledByDefault="true">
- <description>%constraint.description.0</description>
- <message>%constraint.message.0</message>
- <target class="StartEvent" />
- <![CDATA[
- self.incoming->isEmpty()
- ]]>
- </constraint>
- <constraint
- lang="OCL"
- severity="ERROR"
- mode="Live"
- name="%constraint.name.1"
- id="org.eclipse.bpmn2.modeler.core.validation.EndEvent.outgoing"
- statusCode="3" isEnabledByDefault="true">
- <description>%constraint.description.1</description>
- <message>%constraint.message.1</message>
- <target class="EndEvent" />
- <![CDATA[
- self.outgoing->isEmpty()
- ]]>
- </constraint>
- <constraint
- lang="OCL"
- severity="WARNING"
- mode="Live"
- name="%constraint.name.2"
- id="org.eclipse.bpmn2.modeler.core.validation.BaseElement.id"
- statusCode="3" isEnabledByDefault="true">
- <description>%constraint.description.2</description>
- <message>%constraint.message.2</message>
- <target class="BaseElement" />
- <![CDATA[
- self.id->notEmpty() implies bpmn2::BaseElement.allInstances()->select(s | s.id = self.id)->size() <= 1
- ]]>
- </constraint>
+ <constraints categories="org.eclipse.bpmn2.modeler.core.validation.category">
+
+ <!-- Live validation constraints -->
<constraint
class="org.eclipse.bpmn2.modeler.core.validation.BPMN2ValidationConstraints"
- id="org.eclipse.bpmn2.modeler.core.validation.error"
- isEnabledByDefault="true"
- lang="Java"
- mode="Batch"
- name="%constraint.name.3"
- severity="ERROR"
- statusCode="1">
- <message>%constraint.message.3</message>
- <description>%constraint.description.3</description>
- <target class="Definitions"/>
- <target class="BaseElement"/>
- </constraint>
- <constraint
- class="org.eclipse.bpmn2.modeler.core.validation.BPMN2ValidationConstraints"
- id="org.eclipse.bpmn2.modeler.core.validation.warning"
- isEnabledByDefault="true"
+ id="org.eclipse.bpmn2.modeler.core.live.validation.error"
lang="Java"
- mode="Batch"
- name="%constraint.name.4"
- severity="WARNING"
- statusCode="1">
- <message>%constraint.message.4</message>
- <description>%constraint.description.4</description>
- <target class="Definitions"/>
- <target class="BaseElement"/>
+ mode="Live"
+ name="%constraint.name.live"
+ statusCode="3" isEnabledByDefault="true">
+ <description>%constraint.description.live</description>
+ <message>%constraint.message.live</message>
+ <target class="BaseElement" />
</constraint>
- <!-- Live validation constraints for user feedback during editing -->
+
+ <!-- Batch validation constraints -->
<constraint
class="org.eclipse.bpmn2.modeler.core.validation.BPMN2ValidationConstraints"
- id="org.eclipse.bpmn2.modeler.core.validation.live.error"
+ id="org.eclipse.bpmn2.modeler.core.validation.error"
isEnabledByDefault="true"
lang="Java"
- mode="Live"
- name="%constraint.name.5"
- severity="INFO"
- statusCode="1">
- <message>%constraint.message.5</message>
- <description>%constraint.description.5</description>
- <target class="Definitions"/>
+ mode="Batch"
+ name="%constraint.name.batch"
+ statusCode="0">
+ <description>%constraint.description.batch</description>
+ <message>%constraint.message.batch</message>
<target class="BaseElement"/>
</constraint>
- <constraint
- class="org.eclipse.bpmn2.modeler.core.validation.TaskNameNotEmpty"
- id="org.eclipse.bpmn2.modeler.core.validation.TaskEmptyNameConstraint"
- lang="java"
- mode="Batch"
- name="%constraint.name.6"
- severity="ERROR"
- statusCode="1">
- <message>
- %constraint.message.6
- </message>
- <description>
- %constraint.description.6
- </description>
- <target
- class="Task">
- </target>
- </constraint>
- <constraint
- class="org.eclipse.bpmn2.modeler.core.validation.FormalExpressionConstraint"
- id="org.eclipse.bpmn2.modeler.core.validation.FormalExpressionConstraint"
- lang="java"
- mode="Batch"
- name="%constraint.name.7"
- severity="WARNING"
- statusCode="1">
- <message>
- %constraint.message.7
- </message>
- <description>
- %constraint.description.7
- </description>
- <target
- class="FormalExpression">
- </target>
- </constraint>
</constraints>
</constraintProvider>
@@ -174,7 +60,7 @@
point="org.eclipse.emf.validation.constraintBindings">
<clientContext
default="false"
- id="org.eclipse.bpmn2.modeler.core.validationContext">
+ id="org.eclipse.bpmn2.modeler.core.validation.context">
<enablement>
<or>
<test
@@ -187,13 +73,31 @@
</enablement>
</clientContext>
<binding
- context="org.eclipse.bpmn2.modeler.core.validationContext"
- category="org.eclipse.bpmn2.modeler.core.validation"/>
+ context="org.eclipse.bpmn2.modeler.core.validation.context"
+ category="org.eclipse.bpmn2.modeler.core.validation.category"/>
+ </extension>
+
+ <extension
+ point="org.eclipse.emf.validation.constraintBindings">
+ <clientContext
+ default="false"
+ id="org.eclipse.bpmn2.modeler.core.validation.context.override">
+ <enablement>
+ <not>
+ <test
+ property="org.eclipse.bpmn2.modeler.property.targetRuntimeId"
+ value="org.eclipse.bpmn2.modeler.runtime.none"/>
+ </not>
+ </enablement>
+ </clientContext>
+ <binding
+ context="org.eclipse.bpmn2.modeler.core.validation.context.override"
+ category="org.eclipse.bpmn2.modeler.core.validation.category.override"/>
</extension>
<extension point="org.eclipse.emf.validation.validationListeners">
<listener class="org.eclipse.bpmn2.modeler.core.validation.LiveValidationListener">
- <clientContext id="org.eclipse.bpmn2.modeler.core.validationContext"/>
+ <clientContext id="org.eclipse.bpmn2.modeler.core.validation.context"/>
</listener>
</extension>
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 461bcb0e..9031b75a 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
@@ -57,6 +57,7 @@ public class ExtendedPropertiesAdapter<T extends EObject> extends AdapterImpl {
public static final String PROPERTY_DESCRIPTOR = "property.descriptor"; //$NON-NLS-1$
// Line number in XML document where this object is defined
public static final String LINE_NUMBER = "line.number"; //$NON-NLS-1$
+ public final static String UI_OBJECT_EDITOR_CLASS = "ui.object.editor.class"; //$NON-NLS-1$
protected static Hashtable<EClass,EObject> dummyObjects = new Hashtable<EClass,EObject>();
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 dacdad61..58c42064 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
@@ -148,7 +148,16 @@ public abstract class AbstractBpmn2PropertySection extends GFPropertySection imp
* @return the TabbedPropertySheetPage that owns this section.
*/
public TabbedPropertySheetPage getTabbedPropertySheetPage() {
- return tabbedPropertySheetPage;
+ /**
+ * Check if the Tabbed Property Sheet Page is still alive. This prevents SWT
+ * widget disposed errors during a stray refresh attempt when the editor is
+ * shutting down.
+ */
+ if (tabbedPropertySheetPage!=null
+ && tabbedPropertySheetPage.getControl()!=null
+ && !tabbedPropertySheetPage.getControl().isDisposed())
+ return tabbedPropertySheetPage;
+ return null;
}
/**
@@ -178,7 +187,7 @@ public abstract class AbstractBpmn2PropertySection extends GFPropertySection imp
*/
protected abstract AbstractDetailComposite createSectionRoot();
public abstract AbstractDetailComposite createSectionRoot(Composite parent, int style);
- protected abstract EObject getBusinessObjectForSelection(ISelection selection);
+ public abstract EObject getBusinessObjectForSelection(ISelection selection);
/* (non-Javadoc)
* Yet another ugly hack: this restores the current property sheet page parent
@@ -201,20 +210,22 @@ public abstract class AbstractBpmn2PropertySection extends GFPropertySection imp
*/
@Override
public void refresh() {
- EObject be = getBusinessObjectForSelection(getSelection());
-
- if (be!=null) {
- AbstractDetailComposite sectionRoot = getSectionRoot();
- if (sectionRoot!=null) {
- if (sectionRoot.getBusinessObject() != be) {
- sectionRoot.setDiagramEditor((DiagramEditor) getDiagramEditor());
- if (!parent.isLayoutDeferred())
- parent.setLayoutDeferred(true);
- sectionRoot.setBusinessObject(be);
- if (parent.isLayoutDeferred())
- parent.setLayoutDeferred(false);
+ if (getTabbedPropertySheetPage()!=null) {
+ EObject be = getBusinessObjectForSelection(getSelection());
+
+ if (be!=null) {
+ AbstractDetailComposite sectionRoot = getSectionRoot();
+ if (sectionRoot!=null) {
+ if (sectionRoot.getBusinessObject() != be) {
+ sectionRoot.setDiagramEditor((DiagramEditor) getDiagramEditor());
+ if (!parent.isLayoutDeferred())
+ parent.setLayoutDeferred(true);
+ sectionRoot.setBusinessObject(be);
+ if (parent.isLayoutDeferred())
+ parent.setLayoutDeferred(false);
+ }
+ sectionRoot.refresh();
}
- sectionRoot.refresh();
}
}
}
@@ -229,9 +240,11 @@ public abstract class AbstractBpmn2PropertySection extends GFPropertySection imp
* Force a layout of the property sheet page.
*/
public void layout() {
- Composite composite = (Composite)tabbedPropertySheetPage.getControl();
- composite.layout(true);
- tabbedPropertySheetPage.resizeScrolledComposite();
+ if (getTabbedPropertySheetPage()!=null) {
+ Composite composite = (Composite)tabbedPropertySheetPage.getControl();
+ composite.layout(true);
+ tabbedPropertySheetPage.resizeScrolledComposite();
+ }
}
/* (non-Javadoc)
@@ -244,6 +257,9 @@ public abstract class AbstractBpmn2PropertySection extends GFPropertySection imp
/* (non-Javadoc)
* Override this to allow the section to decide whether or not it will be rendered.
+ * Subclasses MUST call this method because it sets the DiagramEditor as a side effect
+ * and checks if the selected business object is enabled in the Tool Profile.
+ *
* @see org.eclipse.bpmn2.modeler.core.runtime.IBpmn2PropertySection#appliesTo(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
*/
@Override
@@ -257,7 +273,9 @@ public abstract class AbstractBpmn2PropertySection extends GFPropertySection imp
editor = (DiagramEditor)part.getAdapter(DiagramEditor.class);
if (editor!=null) {
- return true;
+ EObject be = getBusinessObjectForSelection(selection);
+ if (be!=null)
+ return isModelObjectEnabled(be);
}
return false;
}
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 87c32b7f..437d5b25 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
@@ -13,10 +13,12 @@
******************************************************************************/
package org.eclipse.bpmn2.modeler.core.merrimac.clad;
+import java.lang.reflect.Constructor;
import java.math.BigInteger;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.bpmn2.modeler.core.adapters.ExtendedPropertiesAdapter;
import org.eclipse.bpmn2.modeler.core.merrimac.IConstants;
import org.eclipse.bpmn2.modeler.core.merrimac.dialogs.AbstractObjectEditingDialog;
import org.eclipse.bpmn2.modeler.core.merrimac.dialogs.BooleanObjectEditor;
@@ -31,6 +33,7 @@ import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EAttribute;
import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
@@ -433,13 +436,30 @@ public abstract class AbstractDetailComposite extends ListAndDetailCompositeBase
if (label==null)
label = getPropertiesProvider().getLabel(object, attribute);
- Class eTypeClass = attribute.getEType().getInstanceClass();
+ ExtendedPropertiesAdapter adapter = ExtendedPropertiesAdapter.adapt(object);
+ if (adapter!=null) {
+ Object o = adapter.getProperty(attribute,ExtendedPropertiesAdapter.UI_OBJECT_EDITOR_CLASS);
+ if (o instanceof Class) {
+ try {
+ Constructor ctor = ((Class)o).getConstructor(AbstractDetailComposite.class,EObject.class,EStructuralFeature.class);
+ ObjectEditor editor = (ObjectEditor) ctor.newInstance(this,object,attribute);
+ editor.createControl(parent,label);
+ // success!
+ return;
+ } catch (Exception e) {
+ // otherwise fall through and create a default ObjectEditor...
+ e.printStackTrace();
+ }
+ }
+ }
+ EClassifier eTypeClassifier = attribute.getEType();
+ Class eTypeClass = eTypeClassifier.getInstanceClass();
if (ModelUtil.isMultiChoice(object, attribute)) {
ObjectEditor editor = new ComboObjectEditor(this,object,attribute);
editor.createControl(parent,label);
}
else if (String.class.equals(eTypeClass)) {
- TextObjectEditor editor = new TextObjectEditor(this,object,attribute);
+ ObjectEditor editor = new TextObjectEditor(this,object,attribute);
editor.createControl(parent,label);
if (attribute.getName().equals("id"))
editor.setEditable(false);
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 1d0352fd..a54ff341 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
@@ -551,8 +551,7 @@ public abstract class AbstractListComposite extends ListAndDetailCompositeBase i
};
dialog.setCompositeFactory(factory);
- if (dialog.open() == Window.OK)
- System.out.println();
+ dialog.open();
}
}
}
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 650fac42..80292a5f 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
@@ -107,6 +107,17 @@ public class DefaultDetailComposite extends AbstractDetailComposite {
String[] featureAndClassArray = prop0.split("#"); //$NON-NLS-1$
String featureName = featureAndClassArray[0];
EStructuralFeature feature = getFeature(be,featureName);
+ // FIXME: This is a quick hack to prevent extension elements from causing
+ // an IllegalArgumentException if not set. This only happens when opening
+ // the Property Dialog (not in Property View).
+ if (feature!=null) {
+ try {
+ be.eGet(feature);
+ }
+ catch (IllegalArgumentException e) {
+ feature = null;
+ }
+ }
EClass eclass = null;
if (featureAndClassArray.length>1) {
String className = featureAndClassArray[1];
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/DefaultDialogComposite.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/DefaultDialogComposite.java
index 314a201b..8d06112a 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/DefaultDialogComposite.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/clad/DefaultDialogComposite.java
@@ -16,6 +16,7 @@ import java.util.List;
import org.eclipse.bpmn2.modeler.core.Activator;
import org.eclipse.bpmn2.modeler.core.runtime.Bpmn2SectionDescriptor;
import org.eclipse.bpmn2.modeler.core.runtime.Bpmn2TabDescriptor;
+import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.preference.IPreferenceStore;
@@ -109,7 +110,10 @@ public class DefaultDialogComposite extends AbstractDialogComposite {
form.setContent(body);
- tab.setText(td.getLabel());
+ String label = td.getLabel();
+ if (label==null)
+ label = ModelUtil.getLabel(businessObject);
+ tab.setText(label);
tab.setControl(form);
details.add(detail);
sections.add(section);
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 c99301b4..e327659a 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
@@ -26,6 +26,9 @@ import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.ecore.util.EObjectContainmentEList;
import org.eclipse.emf.ecore.util.EcoreUtil;
+import org.eclipse.graphiti.mm.pictograms.Diagram;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+import org.eclipse.graphiti.services.Graphiti;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
@@ -63,10 +66,10 @@ public class DefaultListComposite extends AbstractListComposite {
if (!(list instanceof EObjectContainmentEList)) {
// this is not a containment list so we can't add it
// because we don't know where the new object belongs
-
+ String name = object.eClass().getName() + "." +feature.getName(); //$NON-NLS-1$
MessageDialog.openError(getShell(), Messages.DefaultListComposite_Internal_Error_Title,
NLS.bind(Messages.DefaultListComposite_Error_Internal_Error_Message_No_List,
- listItemClass.getName())
+ name)
);
return null;
}
@@ -137,6 +140,13 @@ public class DefaultListComposite extends AbstractListComposite {
EObject selected = null;
if (index<map.length-1)
selected = list.get(map[index+1]);
+ EObject removed = list.get(map[index]);
+ Diagram diagram = getDiagramEditor().getDiagramTypeProvider().getDiagram();
+ for (PictogramElement pe : Graphiti.getLinkService().getPictogramElements(diagram, removed)) {
+ if (pe.getLink()!=null) {
+ pe.getLink().getBusinessObjects().remove(removed);
+ }
+ }
list.remove(map[index]);
return selected;
}
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 3fd37886..57d2f046 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
@@ -15,6 +15,7 @@ package org.eclipse.bpmn2.modeler.core.merrimac.clad;
import java.util.ArrayList;
import java.util.List;
+import org.eclipse.bpmn2.di.BPMNDiagram;
import org.eclipse.bpmn2.modeler.core.utils.BusinessObjectUtil;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.graphiti.mm.pictograms.ConnectionDecorator;
@@ -97,9 +98,11 @@ public class DefaultPropertySection extends AbstractBpmn2PropertySection {
}
public boolean appliesTo(EObject eObj) {
+ if (isModelObjectEnabled(eObj)) {
for (Class c : appliesToClasses) {
if (c.isInstance(eObj))
return true;
+ }
}
return false;
}
@@ -108,7 +111,12 @@ public class DefaultPropertySection extends AbstractBpmn2PropertySection {
appliesToClasses.add(c);
}
- protected EObject getBusinessObjectForSelection(ISelection selection) {
- return BusinessObjectUtil.getBusinessObjectForSelection(selection);
+ public EObject getBusinessObjectForSelection(ISelection selection) {
+ EObject bo = BusinessObjectUtil.getBusinessObjectForSelection(selection);
+ if (bo instanceof BPMNDiagram) {
+ if (((BPMNDiagram)bo).getPlane()!=null && ((BPMNDiagram)bo).getPlane().getBpmnElement()!=null)
+ return ((BPMNDiagram)bo).getPlane().getBpmnElement();
+ }
+ return bo;
}
}
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 c6c8bda6..10024802 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
@@ -25,6 +25,7 @@ import org.eclipse.bpmn2.modeler.core.preferences.Bpmn2Preferences;
import org.eclipse.bpmn2.modeler.core.preferences.ModelEnablements;
import org.eclipse.bpmn2.modeler.core.runtime.TargetRuntime;
import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
@@ -424,9 +425,14 @@ public class ListAndDetailCompositeBase extends Composite implements ResourceSet
this.isPopupDialog = isPopupDialog;
}
- protected void validate(Notification notification) {
+ public IStatus validate() {
+ Notification n = new ENotificationImpl((InternalEObject) businessObject, 0, null, null, null, false);
+ return validate(n);
+ }
+
+ protected IStatus validate(Notification notification) {
IValidator<Notification> validator = ModelValidationService.getInstance().newValidator(EvaluationMode.LIVE);
- validator.validate(notification);
+ return validator.validate(notification);
}
@Override
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/AbstractObjectEditingDialog.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/AbstractObjectEditingDialog.java
index 636ed3c2..1cc09082 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/AbstractObjectEditingDialog.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/AbstractObjectEditingDialog.java
@@ -20,14 +20,18 @@ import org.eclipse.bpmn2.modeler.core.validation.ValidationErrorHandler;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.transaction.RecordingCommand;
import org.eclipse.emf.transaction.RollbackException;
import org.eclipse.emf.transaction.Transaction;
+import org.eclipse.emf.transaction.TransactionChangeDescription;
+import org.eclipse.emf.transaction.impl.InternalTransaction;
import org.eclipse.emf.transaction.impl.InternalTransactionalEditingDomain;
import org.eclipse.graphiti.ui.editor.DiagramEditor;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.StringConverter;
+import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.events.ControlListener;
@@ -40,10 +44,14 @@ import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
+import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.ui.forms.FormDialog;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.widgets.ScrolledForm;
+import org.eclipse.ui.forms.widgets.Section;
+import org.eclipse.ui.forms.widgets.Twistie;
public abstract class AbstractObjectEditingDialog extends FormDialog implements ValidationErrorHandler {
@@ -56,13 +64,14 @@ public abstract class AbstractObjectEditingDialog extends FormDialog implements
protected Transaction transaction;
protected ScrolledForm form;
protected Composite dialogContent;
+ protected InternalTransactionalEditingDomain domain;
private Text errorMessageText;
private IPropertiesCompositeFactory compositeFactory = null;
// If this property is set on a Control, then don't try to
// adapt the Control's colors/fonts/etc. to dialog defaults
// This is used by the Description Styled Text widget.
public final static String DO_NOT_ADAPT = "do_not_adapt"; //$NON-NLS-1$
-
+
public AbstractObjectEditingDialog(DiagramEditor editor, EObject object) {
super(editor.getEditorSite().getShell());
setShellStyle(SWT.DIALOG_TRIM | SWT.APPLICATION_MODAL | SWT.MAX | SWT.RESIZE
@@ -70,6 +79,7 @@ public abstract class AbstractObjectEditingDialog extends FormDialog implements
this.editor = editor;
this.object = object;
+ domain = (InternalTransactionalEditingDomain) editor.getEditingDomain();
}
public void setCompositeFactory(IPropertiesCompositeFactory compositeFactory) {
@@ -181,8 +191,48 @@ public abstract class AbstractObjectEditingDialog extends FormDialog implements
super.create();
startTransaction();
}
+
+ public static int openWithTransaction(final AbstractObjectEditingDialog dialog) {
+ final int result[] = new int[1];
+ // wrap this dialog in a transaction
+ if (dialog.domain.getActiveTransaction()==null) {
+ dialog.domain.getCommandStack().execute(new RecordingCommand(dialog.domain) {
+ @Override
+ protected void doExecute() {
+ result[0] = openWithRollback(dialog);
+ }
+ });
+ }
+ else {
+ result[0] = openWithRollback(dialog);
+ }
+ return result[0];
+ }
+
+ private static int openWithRollback(final AbstractObjectEditingDialog dialog) {
+ int result = dialog.open();
+ InternalTransaction transaction = dialog.domain.getActiveTransaction();
+ if (transaction!=null) {
+ if (dialog.cancel) {
+ // roll back transaction if CANCEL button was pressed
+ IStatus status = new Status(Status.CANCEL, Activator.PLUGIN_ID, "cancel");
+ transaction.setStatus(status);
+ result = Window.CANCEL;
+ }
+ else {
+ TransactionChangeDescription cd = dialog.transaction.getChangeDescription();
+ if (cd.getObjectChanges().size()==0) {
+ // also roll back if there were no changes made even if
+ // OK button was pressed.
+ IStatus status = new Status(Status.CANCEL, Activator.PLUGIN_ID, "no changes");
+ transaction.setStatus(status);
+ result = Window.CANCEL;
+ }
+ }
+ }
+ return result;
+ }
- @Override
public int open() {
if (getShell()==null)
create();
@@ -209,20 +259,24 @@ public abstract class AbstractObjectEditingDialog extends FormDialog implements
}
protected void adapt(Composite content) {
-
+
// The AbstractDetailComposite controls don't actually get constructed until
// setBusinessObject() is called - the business object determines which controls
// are required. So, this needs to happen very late in the dialog lifecycle.
- // We can now safely set the background color of all controls to match the dialog.
+ // We can now safely set the background color of all controls to match
+ // the dialog.
content.setBackground(form.getBackground());
for (Control k : content.getChildren()) {
Object data = k.getData(AbstractObjectEditingDialog.DO_NOT_ADAPT);
- if (data instanceof Boolean && (Boolean)data == true)
+ if (data instanceof Boolean && (Boolean) data == true)
continue;
-
+ if (k instanceof Twistie || k instanceof ToolBar
+ || (k instanceof Label && k.getParent() instanceof Section)) {
+ continue;
+ }
k.setBackground(form.getBackground());
if (k instanceof Composite) {
- adapt((Composite)k);
+ adapt((Composite) k);
}
}
}
@@ -275,9 +329,7 @@ public abstract class AbstractObjectEditingDialog extends FormDialog implements
protected void startTransaction() {
if (transaction==null) {
try {
- final InternalTransactionalEditingDomain transactionalDomain = (InternalTransactionalEditingDomain) editor
- .getEditingDomain();
- transaction = transactionalDomain.startTransaction(false, null);
+ transaction = domain.startTransaction(false, null);
}
catch (InterruptedException e) {
e.printStackTrace();
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 0af549df..a254cce0 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
@@ -14,13 +14,10 @@
package org.eclipse.bpmn2.modeler.core.merrimac.dialogs;
import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
-import org.eclipse.bpmn2.modeler.core.utils.ErrorUtils;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.events.SelectionListener;
import org.eclipse.swt.layout.GridData;
@@ -69,17 +66,6 @@ public class BooleanObjectEditor extends ObjectEditor {
}
});
- button.addFocusListener(new FocusListener() {
-
- @Override
- public void focusGained(FocusEvent e) {
- }
-
- @Override
- public void focusLost(FocusEvent e) {
- ErrorUtils.showErrorMessage(null);
- }
- });
return button;
}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/ComboObjectEditor.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/ComboObjectEditor.java
index d7c984a4..2716d141 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/ComboObjectEditor.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/ComboObjectEditor.java
@@ -21,7 +21,6 @@ import java.util.Map.Entry;
import org.eclipse.bpmn2.modeler.core.Activator;
import org.eclipse.bpmn2.modeler.core.IConstants;
import org.eclipse.bpmn2.modeler.core.adapters.AdapterRegistry;
-import org.eclipse.bpmn2.modeler.core.adapters.AdapterUtil;
import org.eclipse.bpmn2.modeler.core.adapters.ExtendedPropertiesAdapter;
import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
@@ -156,17 +155,7 @@ public class ComboObjectEditor extends MultivalueObjectEditor {
createButton.setImage( Activator.getDefault().getImage(IConstants.ICON_ADD_20));
createButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
- // create a new target object
- try {
- EObject value = createObject();
- setValue(value);
- fillCombo();
- }
- catch (OperationCanceledException ex1) {
- }
- catch (Exception ex2) {
- Activator.logError(ex2);
- }
+ buttonClicked(ID_CREATE_BUTTON);
}
});
}
@@ -174,27 +163,7 @@ public class ComboObjectEditor extends MultivalueObjectEditor {
editButton.setImage( Activator.getDefault().getImage(IConstants.ICON_EDIT_20));
editButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
- ISelection selection = comboViewer.getSelection();
- if (selection instanceof StructuredSelection) {
- String firstElement = (String) ((StructuredSelection) selection).getFirstElement();
- if ((firstElement != null && firstElement.isEmpty())) {
- // nothing to edit
- firstElement = null;
- }
- if (firstElement != null && comboViewer.getData(firstElement) instanceof EObject) {
- EObject value = (EObject) comboViewer.getData(firstElement);
- try {
- value = editObject(value);
- setValue(value);
- fillCombo();
- }
- catch (OperationCanceledException ex1) {
- }
- catch (Exception ex2) {
- Activator.logError(ex2);
- }
- }
- }
+ buttonClicked(ID_EDIT_BUTTON);
}
});
editButton.setEnabled(canEdit());
@@ -230,6 +199,45 @@ public class ComboObjectEditor extends MultivalueObjectEditor {
return combo;
}
+ protected void buttonClicked(int buttonId) {
+ if (buttonId==ID_CREATE_BUTTON) {
+ // create a new target object
+ try {
+ EObject value = createObject();
+ setValue(value);
+ fillCombo();
+ }
+ catch (OperationCanceledException ex1) {
+ }
+ catch (Exception ex2) {
+ Activator.logError(ex2);
+ }
+ }
+ else if (buttonId==ID_EDIT_BUTTON) {
+ ISelection selection = comboViewer.getSelection();
+ if (selection instanceof StructuredSelection) {
+ String firstElement = (String) ((StructuredSelection) selection).getFirstElement();
+ if ((firstElement != null && firstElement.isEmpty())) {
+ // nothing to edit
+ firstElement = null;
+ }
+ if (firstElement != null && comboViewer.getData(firstElement) instanceof EObject) {
+ EObject value = (EObject) comboViewer.getData(firstElement);
+ try {
+ value = editObject(value);
+ setValue(value);
+ fillCombo();
+ }
+ catch (OperationCanceledException ex1) {
+ }
+ catch (Exception ex2) {
+ Activator.logError(ex2);
+ }
+ }
+ }
+ }
+ }
+
protected EObject createObject() throws Exception {
FeatureEditingDialog dialog = createFeatureEditingDialog(null);
dialog.setFeatureEType(featureEType);
@@ -388,7 +396,7 @@ public class ComboObjectEditor extends MultivalueObjectEditor {
@Override
public void notifyChanged(Notification notification) {
super.notifyChanged(notification);
- if (notification.getEventType() == -1 || itemsChanged()) {
+ if ((notification.getEventType() == -1 || notification.getFeature()==feature) && itemsChanged()) {
fillCombo();
}
}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/FeatureEditingDialog.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/FeatureEditingDialog.java
index c0aeebf5..3aef0c1c 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/FeatureEditingDialog.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/FeatureEditingDialog.java
@@ -26,8 +26,6 @@ import org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl;
import org.eclipse.graphiti.ui.editor.DiagramEditor;
import org.eclipse.jface.window.Window;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.widgets.Composite;
public class FeatureEditingDialog extends ObjectEditingDialog {
@@ -70,6 +68,8 @@ public class FeatureEditingDialog extends ObjectEditingDialog {
else if (feature.getEType() instanceof EClass)
featureEType = (EClass)feature.getEType();
}
+ if (newObject==null)
+ cancel = true;
if (cancel) {
rollbackTransaction();
@@ -79,15 +79,8 @@ public class FeatureEditingDialog extends ObjectEditingDialog {
}
}
- protected Composite createDialogContent(Composite parent) {
- Composite content = PropertiesCompositeFactory.INSTANCE.createDetailComposite(
- featureEType.getInstanceClass(), parent, SWT.NONE);
- return content;
- }
-
protected EObject createNewObject(final EObject object, final EStructuralFeature feature, final EClass eclass) {
final EObject[] result = new EObject[1];
- final TransactionalEditingDomain domain = (TransactionalEditingDomainImpl)editor.getEditingDomain();
if (domain!=null) {
domain.getCommandStack().execute(new RecordingCommand(domain) {
@Override
@@ -132,7 +125,6 @@ public class FeatureEditingDialog extends ObjectEditingDialog {
private void undoCreateNewObject() {
if (createNew && newObject!=null) {
ModelUtil.unsetID(newObject, object.eResource());
- final TransactionalEditingDomain domain = (TransactionalEditingDomainImpl)editor.getEditingDomain();
if (domain!=null) {
if (domain.getCommandStack().canUndo()) {
domain.getCommandStack().undo();
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/FloatObjectEditor.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/FloatObjectEditor.java
index 86b6be6a..b9c56e7e 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/FloatObjectEditor.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/FloatObjectEditor.java
@@ -13,8 +13,9 @@
package org.eclipse.bpmn2.modeler.core.merrimac.dialogs;
+import java.math.BigInteger;
+
import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
-import org.eclipse.bpmn2.modeler.core.utils.ErrorUtils;
import org.eclipse.core.databinding.observable.value.IObservableValue;
import org.eclipse.core.databinding.observable.value.IValueChangeListener;
import org.eclipse.core.databinding.observable.value.ValueChangeEvent;
@@ -22,8 +23,6 @@ import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.jface.databinding.swt.SWTObservables;
import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.FocusEvent;
-import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.layout.GridData;
@@ -69,6 +68,7 @@ public class FloatObjectEditor extends TextObjectEditor {
for (int i = 0; i < chars.length; i++) {
if (!('0' <= chars[i] && chars[i] <= '9') && chars[i]!='.') {
e.doit = false;
+ showErrorMessage("The character '"+e.text+"' is not valid");
return;
}
}
@@ -103,19 +103,28 @@ public class FloatObjectEditor extends TextObjectEditor {
}
});
-
- text.addFocusListener(new FocusListener() {
-
- @Override
- public void focusGained(FocusEvent e) {
+ return text;
+ }
+
+ public Double getValue() {
+ Object v = object.eGet(feature);
+ if (v instanceof Short)
+ return ((Short)v).doubleValue();
+ if (v instanceof Integer)
+ return ((Integer)v).doubleValue();
+ if (v instanceof Long)
+ return ((Long)v).doubleValue();
+ if (v instanceof Double)
+ return (Double)v;
+ if (v instanceof BigInteger)
+ return ((BigInteger)v).doubleValue();
+ if (v instanceof String) {
+ try {
+ return Double.parseDouble((String)v);
}
-
- @Override
- public void focusLost(FocusEvent e) {
- ErrorUtils.showErrorMessage(null);
+ catch (Exception e){
}
- });
-
- return text;
+ }
+ return new Double(0);
}
}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/IntObjectEditor.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/IntObjectEditor.java
index 8c9e9729..afc3e0c6 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/IntObjectEditor.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/IntObjectEditor.java
@@ -71,6 +71,7 @@ public class IntObjectEditor extends TextObjectEditor {
for (int i = 0; i < chars.length; i++) {
if (!('0' <= chars[i] && chars[i] <= '9')) {
e.doit = false;
+ showErrorMessage("The character '"+e.text+"' is not valid");
return;
}
}
@@ -109,19 +110,6 @@ public class IntObjectEditor extends TextObjectEditor {
}
});
-
- text.addFocusListener(new FocusListener() {
-
- @Override
- public void focusGained(FocusEvent e) {
- }
-
- @Override
- public void focusLost(FocusEvent e) {
- ErrorUtils.showErrorMessage(null);
- }
- });
-
return text;
}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/JavaVariableNameObjectEditor.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/JavaVariableNameObjectEditor.java
new file mode 100644
index 00000000..b5c3bdb4
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/JavaVariableNameObjectEditor.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 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.dialogs;
+
+import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
+import org.eclipse.bpmn2.modeler.core.validation.SyntaxCheckerUtils;
+import org.eclipse.core.databinding.observable.value.IObservableValue;
+import org.eclipse.core.databinding.observable.value.IValueChangeListener;
+import org.eclipse.core.databinding.observable.value.ValueChangeEvent;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.jface.databinding.swt.SWTObservables;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.VerifyEvent;
+import org.eclipse.swt.events.VerifyListener;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * @author Bob Brodt
+ *
+ */
+public class JavaVariableNameObjectEditor extends TextObjectEditor {
+
+ /**
+ * @param parent
+ * @param object
+ * @param feature
+ */
+ public JavaVariableNameObjectEditor(AbstractDetailComposite parent, EObject object, EStructuralFeature feature) {
+ super(parent, object, feature);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.ui.property.editors.ObjectEditor#createControl(org.eclipse.swt.widgets.Composite, java.lang.String)
+ */
+ @Override
+ protected Control createControl(Composite composite, String label, int style) {
+ createLabel(composite,label);
+
+ text = getToolkit().createText(composite, ""); //$NON-NLS-1$
+ text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1));
+ text.addVerifyListener(new VerifyListener() {
+
+ /**
+ * taken from
+ * http://dev.eclipse.org/viewcvs/viewvc.cgi/org.eclipse.swt.snippets/src/org/eclipse/swt/snippets
+ * /Snippet19.java?view=co
+ */
+ @Override
+ public void verifyText(VerifyEvent e) {
+ if (Character.isISOControl(e.character)) {
+ return;
+ }
+ String s = getValue() + e.text;
+ e.doit = SyntaxCheckerUtils.isJavaIdentifier(s);
+ if (!e.doit) {
+ showErrorMessage("The character '"+e.text+"' is not valid");
+ }
+ }
+ });
+
+ updateText();
+
+ IObservableValue textObserveTextObserveWidget = SWTObservables.observeText(text, SWT.Modify);
+ textObserveTextObserveWidget.addValueChangeListener(new IValueChangeListener() {
+ @Override
+ public void handleValueChange(ValueChangeEvent event) {
+
+ String s = text.getText();
+ if (!getValue().equals(s)) {
+ setValue(s);
+ }
+ }
+ });
+
+
+ return text;
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/Messages.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/Messages.java
index 4e917a96..d825cace 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/Messages.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/Messages.java
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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
+ ******************************************************************************/
package org.eclipse.bpmn2.modeler.core.merrimac.dialogs;
import org.eclipse.osgi.util.NLS;
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/NCNameObjectEditor.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/NCNameObjectEditor.java
index e49eaf41..587d4d6d 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/NCNameObjectEditor.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/NCNameObjectEditor.java
@@ -70,6 +70,9 @@ public class NCNameObjectEditor extends TextObjectEditor {
return;
String s = getValue() + e.text;
e.doit = SyntaxCheckerUtils.isNCName(s);
+ if (!e.doit) {
+ showErrorMessage("The character '"+e.text+"' is not valid");
+ }
}
});
@@ -87,18 +90,6 @@ public class NCNameObjectEditor extends TextObjectEditor {
}
});
-
- text.addFocusListener(new FocusListener() {
-
- @Override
- public void focusGained(FocusEvent e) {
- }
-
- @Override
- public void focusLost(FocusEvent e) {
- ErrorUtils.showErrorMessage(null);
- }
- });
return text;
}
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 9dd383a4..87e745f4 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
@@ -15,7 +15,6 @@ package org.eclipse.bpmn2.modeler.core.merrimac.dialogs;
import java.lang.reflect.Field;
-import org.eclipse.bpmn2.modeler.core.Activator;
import org.eclipse.bpmn2.modeler.core.merrimac.IConstants;
import org.eclipse.bpmn2.modeler.core.merrimac.clad.AbstractDetailComposite;
import org.eclipse.bpmn2.modeler.core.utils.ErrorUtils;
@@ -23,6 +22,7 @@ import org.eclipse.bpmn2.modeler.core.utils.JavaReflectionUtil;
import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
import org.eclipse.bpmn2.modeler.core.validation.ValidationStatusAdapter;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EStructuralFeature;
@@ -32,13 +32,17 @@ import org.eclipse.emf.transaction.TransactionalEditingDomain;
import org.eclipse.emf.validation.model.ConstraintStatus;
import org.eclipse.graphiti.mm.pictograms.Diagram;
import org.eclipse.graphiti.ui.editor.DiagramEditor;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.fieldassist.ControlDecoration;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.FocusEvent;
+import org.eclipse.swt.events.FocusListener;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.forms.widgets.FormToolkit;
@@ -52,6 +56,12 @@ import org.eclipse.ui.forms.widgets.FormToolkit;
* @author Bob Brodt
*/
public abstract class ObjectEditor implements INotifyChangedListener {
+
+ public static int ID_CREATE_BUTTON = 1;
+ public static int ID_EDIT_BUTTON = 2;
+ public static int ID_DELETE_BUTTON = 3;
+ public static int ID_OTHER_BUTTONS = 4;
+
protected EObject object;
protected EStructuralFeature feature;
protected AbstractDetailComposite parent;
@@ -60,6 +70,7 @@ public abstract class ObjectEditor implements INotifyChangedListener {
protected int style;
protected Class messages;
protected boolean isWidgetUpdating = false;
+ private boolean valueChanged = false;
public ObjectEditor(AbstractDetailComposite parent, EObject object, EStructuralFeature feature) {
this.parent = parent;
@@ -86,8 +97,30 @@ public abstract class ObjectEditor implements INotifyChangedListener {
}
public Control createControl(Composite composite, String label) {
- Control c = createControl(composite,label,style);
+ final Control c = createControl(composite,label,style);
c.setData(IConstants.NOTIFY_CHANGE_LISTENER_KEY, this);
+ c.addFocusListener(new FocusListener() {
+
+ @Override
+ public void focusGained(FocusEvent e) {
+ valueChanged = false;
+ }
+
+ @Override
+ public void focusLost(FocusEvent e) {
+ if (valueChanged) {
+ IStatus status = parent.validate();
+ if (status.getSeverity() >= Status.ERROR) {
+ if (statusApplies(status)) {
+ MessageDialog.openError(parent.getShell(), "Validation Error", status.getMessage());
+ if (!c.isDisposed())
+ c.setFocus();
+ }
+ }
+ }
+ ErrorUtils.showErrorMessage(null);
+ }
+ });
return c;
}
@@ -272,6 +305,10 @@ public abstract class ObjectEditor implements INotifyChangedListener {
return true;
}
+ protected void showErrorMessage(String message) {
+ ErrorUtils.showErrorMessage(message);
+ }
+
public abstract Object getValue();
@Override
@@ -283,6 +320,7 @@ public abstract class ObjectEditor implements INotifyChangedListener {
label.setVisible(visible);
GridData data = (GridData)label.getLayoutData();
data.exclude = !visible;
+ updateLabelDecorator();
}
public boolean isVisible() {
@@ -295,6 +333,7 @@ public abstract class ObjectEditor implements INotifyChangedListener {
label = null;
}
if (decoration!=null) {
+ decoration.hide();
decoration.dispose();
decoration = null;
}
@@ -327,4 +366,14 @@ public abstract class ObjectEditor implements INotifyChangedListener {
protected boolean canRemove() {
return false;
}
+
+ public void setEditable(boolean editable) {
+ Control control = getControl();
+ if (control instanceof Text) {
+ ((Text)control).setEditable(editable);
+ control.setBackground(control.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
+ control.setForeground(control.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
+ control.setData(AbstractObjectEditingDialog.DO_NOT_ADAPT, Boolean.TRUE);
+ }
+ }
}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/TextAndButtonObjectEditor.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/TextAndButtonObjectEditor.java
index 969402f9..02a9a88d 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/TextAndButtonObjectEditor.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/TextAndButtonObjectEditor.java
@@ -34,9 +34,9 @@ import org.eclipse.swt.widgets.Control;
*/
public abstract class TextAndButtonObjectEditor extends TextObjectEditor {
- protected static int ID_DEFAULT_BUTTON = 0;
- protected static int ID_ADD_BUTTON = 1;
- protected static int ID_REMOVE_BUTTON = 2;
+ protected static int ID_DEFAULT_BUTTON = ID_OTHER_BUTTONS+0;
+ protected static int ID_ADD_BUTTON = ID_OTHER_BUTTONS+1;
+ protected static int ID_REMOVE_BUTTON = ID_OTHER_BUTTONS+2;
protected Button defaultButton;
protected Button addButton;
@@ -125,6 +125,21 @@ public abstract class TextAndButtonObjectEditor extends TextObjectEditor {
}
}
+ public void setVisible(boolean visible) {
+ super.setVisible(visible);
+ if (defaultButton!=null && !defaultButton.isDisposed()) {
+ defaultButton.setVisible(visible);
+ }
+ if (addButton!=null && !addButton.isDisposed()) {
+ addButton.setVisible(visible);
+ }
+ if (removeButton!=null && !removeButton.isDisposed()) {
+ removeButton.setVisible(visible);
+ }
+ text.getParent().pack();
+ text.getParent().layout();
+ }
+
/**
* The implementation must override this to handle the "Edit..." button click.
* @param buttonId TODO
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/TextObjectEditor.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/TextObjectEditor.java
index 255f4268..d6f8cce6 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/TextObjectEditor.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/TextObjectEditor.java
@@ -87,17 +87,6 @@ public class TextObjectEditor extends ObjectEditor {
setValue(text.getText());
}
});
- text.addFocusListener(new FocusListener() {
-
- @Override
- public void focusGained(FocusEvent e) {
- }
-
- @Override
- public void focusLost(FocusEvent e) {
- ErrorUtils.showErrorMessage(null);
- }
- });
// ask the object if this feature is read-only
ExtendedPropertiesAdapter adapter = ExtendedPropertiesAdapter.adapt(object);
@@ -116,14 +105,6 @@ public class TextObjectEditor extends ObjectEditor {
}
- public void setEditable(boolean editable) {
- text.setEditable(editable);
- text.setEditable(editable);
- text.setBackground(text.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND));
- text.setForeground(text.getDisplay().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
- text.setData(AbstractObjectEditingDialog.DO_NOT_ADAPT, Boolean.TRUE);
- }
-
@Override
public void setObject(EObject object) {
super.setObject(object);
@@ -229,6 +210,7 @@ public class TextObjectEditor extends ObjectEditor {
text.setVisible(visible);
GridData data = (GridData)text.getLayoutData();
data.exclude = !visible;
+ text.getParent().redraw();
}
public void dispose() {
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/messages.properties b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/messages.properties
index 9e833f7a..76af09b8 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/messages.properties
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/dialogs/messages.properties
@@ -1,3 +1,13 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2011, 2012, 2013, 2014 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
+#-------------------------------------------------------------------------------
AbstractObjectEditingDialog_Commit_Error=Error Commiting Model Changes
AbstractObjectEditingDialog_Commit_Error_Title=An error occurred while trying to commit changes.
FeatureEditingDialog_Create=Create New {0}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/providers/Messages.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/providers/Messages.java
index 70a1559a..65b2701a 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/providers/Messages.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/providers/Messages.java
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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
+ ******************************************************************************/
package org.eclipse.bpmn2.modeler.core.merrimac.providers;
import org.eclipse.osgi.util.NLS;
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/providers/messages.properties b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/providers/messages.properties
index 7f164701..6e5f10f9 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/providers/messages.properties
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/merrimac/providers/messages.properties
@@ -1 +1,11 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2011, 2012, 2013, 2014 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
+#-------------------------------------------------------------------------------
TableCursor_Edit=Edit field
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 602e9e01..43425f6d 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
@@ -13,19 +13,17 @@
package org.eclipse.bpmn2.modeler.core.runtime;
import java.util.ArrayList;
-import java.util.Collections;
import java.util.HashMap;
-import java.util.HashSet;
import java.util.Iterator;
-import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
-import org.eclipse.bpmn2.Activity;
import org.eclipse.bpmn2.Bpmn2Package;
import org.eclipse.bpmn2.modeler.core.AbstractPropertyChangeListenerProvider;
import org.eclipse.bpmn2.modeler.core.Activator;
import org.eclipse.bpmn2.modeler.core.IBpmn2RuntimeExtension;
+import org.eclipse.bpmn2.modeler.core.IBpmn2RuntimeExtension2;
+import org.eclipse.bpmn2.modeler.core.LifecycleEvent;
import org.eclipse.bpmn2.modeler.core.features.activity.task.ICustomElementFeatureContainer;
import org.eclipse.bpmn2.modeler.core.model.Bpmn2ModelerResourceImpl;
import org.eclipse.bpmn2.modeler.core.preferences.ShapeStyle;
@@ -39,7 +37,6 @@ import org.eclipse.core.runtime.IContributor;
import org.eclipse.core.runtime.Platform;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EClassifier;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
import org.eclipse.emf.ecore.resource.ResourceSet;
@@ -490,6 +487,26 @@ public class TargetRuntime extends AbstractPropertyChangeListenerProvider {
return serviceImplementationDescriptors;
}
+ /**
+ * Notify the TargetRuntime of a LifeCycle event.
+ *
+ * @param event
+ */
+ public void notify(LifecycleEvent event) {
+ Object rte = TargetRuntime.getDefaultRuntime().getRuntimeExtension();
+ if (rte instanceof IBpmn2RuntimeExtension2)
+ ((IBpmn2RuntimeExtension2)rte).notify(event);
+ if (this!=TargetRuntime.getDefaultRuntime()) {
+ for (TargetRuntime rt : targetRuntimes) {
+ if (rt.getId().equals(this.id)) {
+ rte = rt.getRuntimeExtension();
+ if (rte instanceof IBpmn2RuntimeExtension2)
+ ((IBpmn2RuntimeExtension2)rte).notify(event);
+ }
+ }
+ }
+ }
+
public String getName() {
return name;
}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/EventDefinitionsUtil.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/EventDefinitionsUtil.java
new file mode 100644
index 00000000..08f17d8b
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/EventDefinitionsUtil.java
@@ -0,0 +1,243 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.List;
+
+import org.eclipse.bpmn2.BaseElement;
+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.Error;
+import org.eclipse.bpmn2.ErrorEventDefinition;
+import org.eclipse.bpmn2.Escalation;
+import org.eclipse.bpmn2.EscalationEventDefinition;
+import org.eclipse.bpmn2.Event;
+import org.eclipse.bpmn2.EventDefinition;
+import org.eclipse.bpmn2.InputSet;
+import org.eclipse.bpmn2.ItemAwareElement;
+import org.eclipse.bpmn2.ItemDefinition;
+import org.eclipse.bpmn2.Message;
+import org.eclipse.bpmn2.MessageEventDefinition;
+import org.eclipse.bpmn2.OutputSet;
+import org.eclipse.bpmn2.RootElement;
+import org.eclipse.bpmn2.Signal;
+import org.eclipse.bpmn2.SignalEventDefinition;
+import org.eclipse.bpmn2.ThrowEvent;
+import org.eclipse.bpmn2.modeler.core.model.Bpmn2ModelerFactory;
+import org.eclipse.emf.ecore.resource.Resource;
+
+/**
+ *
+ */
+public class EventDefinitionsUtil {
+
+ private EventDefinitionsUtil() {
+ }
+
+ public static Tuple<ItemAwareElement, DataAssociation> getIOParameter(Event event, EventDefinition eventDefinition) {
+ Resource resource = event.eResource();
+ ItemAwareElement element = null;
+ DataAssociation association = null;
+ BaseElement ioSet = null;
+ List<EventDefinition> eventDefinitions = null;
+ List<ItemAwareElement> parameters = null;
+ List<DataAssociation> associations = null;
+ ThrowEvent throwEvent = null;
+ CatchEvent catchEvent = null;
+ boolean isInput = false;
+ if (event instanceof ThrowEvent) {
+ throwEvent = (ThrowEvent)event;
+ eventDefinitions = throwEvent.getEventDefinitions();
+ parameters = (List)throwEvent.getDataInputs();
+ associations = (List)throwEvent.getDataInputAssociation();
+ ioSet = throwEvent.getInputSet();
+ isInput = true;
+ }
+ else {
+ catchEvent = (CatchEvent)event;
+ eventDefinitions = catchEvent.getEventDefinitions();
+ parameters = (List)catchEvent.getDataOutputs();
+ associations = (List)catchEvent.getDataOutputAssociation();
+ ioSet = catchEvent.getOutputSet();
+ }
+
+ int index = -1;
+ for (EventDefinition ed : eventDefinitions) {
+ element = null;
+ association = null;
+ if (hasItemDefinition(ed)) {
+ ItemDefinition itemDefinition = getItemDefinition(ed);
+ ++index;
+ if (parameters.size()<=index) {
+ String name = ed.getId().replace("EventDefinition", ""); //$NON-NLS-1$ //$NON-NLS-2$
+ if (isInput) {
+ element = Bpmn2ModelerFactory.create(resource, DataInput.class);
+ ((DataInput)element).setName(name+"_Input"); //$NON-NLS-1$
+ }
+ else {
+ element = Bpmn2ModelerFactory.create(resource, DataOutput.class);
+ ((DataOutput)element).setName(name+"_Output"); //$NON-NLS-1$
+ }
+ if (itemDefinition!=null) {
+ element.setItemSubjectRef(itemDefinition);
+ }
+ parameters.add(element);
+ }
+ else {
+ element = parameters.get(index);
+ }
+ if (isInput) {
+ for (DataAssociation a : associations) {
+ if (a.getTargetRef() == element) {
+ association = a;
+ break;
+ }
+ }
+ if (association==null) {
+ association = Bpmn2ModelerFactory.create(resource, DataInputAssociation.class);
+ association.setTargetRef(element);
+ associations.add(association);
+ }
+ }
+ else {
+ for (DataAssociation a : associations) {
+ if (a.getSourceRef().contains(element)) {
+ association = a;
+ break;
+ }
+ }
+ if (association==null) {
+ association = Bpmn2ModelerFactory.create(resource, DataOutputAssociation.class);
+ if (element!=null)
+ association.getSourceRef().add(element);
+ associations.add(association);
+ }
+ }
+ if (ioSet==null) {
+ if (isInput) {
+ ioSet = (BaseElement) Bpmn2ModelerFactory.create(resource, InputSet.class);
+ throwEvent.setInputSet((InputSet)ioSet);
+ }
+ else {
+ ioSet = (BaseElement) Bpmn2ModelerFactory.create(resource, OutputSet.class);
+ catchEvent.setOutputSet((OutputSet)ioSet);
+ }
+ }
+ if (isInput) {
+ if (!((InputSet)ioSet).getDataInputRefs().contains(element)) {
+ ((InputSet)ioSet).getDataInputRefs().add((DataInput)element);
+ }
+ }
+ else {
+ if (!((OutputSet)ioSet).getDataOutputRefs().contains(element)) {
+ ((OutputSet)ioSet).getDataOutputRefs().add((DataOutput)element);
+ }
+ }
+ }
+ if (ed==eventDefinition)
+ break;
+ }
+ return new Tuple(element,association);
+ }
+
+ public static boolean hasItemDefinition(EventDefinition eventDefinition) {
+ return (eventDefinition instanceof ErrorEventDefinition ||
+ eventDefinition instanceof EscalationEventDefinition ||
+ eventDefinition instanceof SignalEventDefinition ||
+ eventDefinition instanceof MessageEventDefinition);
+ }
+
+ public static ItemDefinition getItemDefinition(EventDefinition eventDefinition) {
+ ItemDefinition itemDefinition = null;
+ if (eventDefinition instanceof ErrorEventDefinition) {
+ Error payloadContainer = ((ErrorEventDefinition)eventDefinition).getErrorRef();
+ itemDefinition = payloadContainer==null ? null : payloadContainer.getStructureRef();
+ }
+ if (eventDefinition instanceof EscalationEventDefinition) {
+ Escalation payloadContainer = ((EscalationEventDefinition)eventDefinition).getEscalationRef();
+ itemDefinition = payloadContainer==null ? null : payloadContainer.getStructureRef();
+ }
+ if (eventDefinition instanceof SignalEventDefinition) {
+ Signal payloadContainer = ((SignalEventDefinition)eventDefinition).getSignalRef();
+ itemDefinition = payloadContainer==null ? null : payloadContainer.getStructureRef();
+ }
+ if (eventDefinition instanceof MessageEventDefinition) {
+ Message payloadContainer = ((MessageEventDefinition)eventDefinition).getMessageRef();
+ itemDefinition = payloadContainer==null ? null : payloadContainer.getItemRef();
+ }
+ return itemDefinition;
+ }
+
+ public static void setItemDefinition(EventDefinition eventDefinition, ItemDefinition itemDefinition) {
+ if (eventDefinition instanceof ErrorEventDefinition) {
+ Error payloadContainer = ((ErrorEventDefinition)eventDefinition).getErrorRef();
+ payloadContainer.setStructureRef(itemDefinition);
+ }
+ if (eventDefinition instanceof EscalationEventDefinition) {
+ Escalation payloadContainer = ((EscalationEventDefinition)eventDefinition).getEscalationRef();
+ payloadContainer.setStructureRef(itemDefinition);
+ }
+ if (eventDefinition instanceof SignalEventDefinition) {
+ Signal payloadContainer = ((SignalEventDefinition)eventDefinition).getSignalRef();
+ payloadContainer.setStructureRef(itemDefinition);
+ }
+ if (eventDefinition instanceof MessageEventDefinition) {
+ Message payloadContainer = ((MessageEventDefinition)eventDefinition).getMessageRef();
+ payloadContainer.setItemRef(itemDefinition);
+ }
+ }
+
+ public static EventDefinition getEventDefinition(ItemAwareElement element) {
+ Event event = null;
+ List<EventDefinition> eventDefinitions = null;
+ if (element.eContainer() instanceof CatchEvent) {
+ event = (Event) element.eContainer();
+ eventDefinitions = ((CatchEvent)event).getEventDefinitions();
+ }
+ else if (element.eContainer() instanceof ThrowEvent) {
+ event = (Event) element.eContainer();
+ eventDefinitions = ((ThrowEvent)event).getEventDefinitions();
+ }
+ if (eventDefinitions!=null) {
+ for (EventDefinition ed : eventDefinitions) {
+ Tuple<ItemAwareElement, DataAssociation> param = getIOParameter(event, ed);
+ if (param.getFirst()==element) {
+ return ed;
+ }
+ }
+ }
+ return null;
+ }
+
+ public static RootElement getEventDefinitionTarget(EventDefinition eventDefinition) {
+ if (eventDefinition instanceof ErrorEventDefinition) {
+ return ((ErrorEventDefinition)eventDefinition).getErrorRef();
+ }
+ if (eventDefinition instanceof EscalationEventDefinition) {
+ return ((EscalationEventDefinition)eventDefinition).getEscalationRef();
+ }
+ if (eventDefinition instanceof SignalEventDefinition) {
+ return ((SignalEventDefinition)eventDefinition).getSignalRef();
+ }
+ if (eventDefinition instanceof MessageEventDefinition) {
+ return ((MessageEventDefinition)eventDefinition).getMessageRef();
+ }
+ return null;
+ }
+
+}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/MarkerUtils.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/MarkerUtils.java
new file mode 100644
index 00000000..e36d177c
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/utils/MarkerUtils.java
@@ -0,0 +1,62 @@
+package org.eclipse.bpmn2.modeler.core.utils;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.eclipse.core.resources.IMarker;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.ecore.EValidator;
+import org.eclipse.emf.ecore.resource.ResourceSet;
+import org.eclipse.graphiti.features.IFeatureProvider;
+import org.eclipse.graphiti.mm.pictograms.ContainerShape;
+import org.eclipse.graphiti.mm.pictograms.PictogramElement;
+
+public class MarkerUtils {
+
+ public static List<EObject> getAllObjects(ResourceSet resourceSet, IMarker marker) {
+ List<EObject> result = new ArrayList<EObject>();
+ result.add(getTargetObject(resourceSet, marker));
+ result.addAll(getRelatedObjects(resourceSet, marker));
+ return result;
+ }
+
+ public static List<EObject> getRelatedObjects(ResourceSet resourceSet, IMarker marker) {
+ List<EObject> result = new ArrayList<EObject>();
+ String targetUri = marker.getAttribute(EValidator.URI_ATTRIBUTE, null);
+ String uriString = marker.getAttribute(EValidator.RELATED_URIS_ATTRIBUTE,null);
+ if (uriString!=null) {
+ String[] uris = uriString.split(" ");
+ for (String s : uris) {
+ if (s.equals(targetUri))
+ continue;
+ URI uri = URI.createURI(s);
+ EObject o = resourceSet.getEObject(uri, false);
+ if (!(o instanceof EStructuralFeature))
+ result.add(o);
+ }
+ }
+ return result;
+ }
+
+ public static EObject getTargetObject(ResourceSet resourceSet, IMarker marker) {
+ final String uriString = marker.getAttribute(EValidator.URI_ATTRIBUTE, null);
+ final URI uri = uriString == null ? null : URI.createURI(uriString);
+ if (uri == null) {
+ return null;
+ }
+ return resourceSet.getEObject(uri, false);
+ }
+
+ public static ContainerShape getContainerShape(IFeatureProvider fp, IMarker marker) {
+ ResourceSet rs = fp.getDiagramTypeProvider().getDiagramBehavior().getEditingDomain().getResourceSet();
+ for (EObject o : getAllObjects(rs, marker)) {
+ for (PictogramElement pe : fp.getAllPictogramElementsForBusinessObject(o)) {
+ if (pe instanceof ContainerShape)
+ return (ContainerShape)pe;
+ }
+ }
+ return null;
+ }
+}
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 f102833f..736fa5db 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
@@ -15,12 +15,11 @@ import java.util.HashMap;
import java.util.Map;
import org.eclipse.bpmn2.modeler.core.Activator;
-import org.eclipse.bpmn2.modeler.core.ProxyURIConverterImplExtension;
-import org.eclipse.bpmn2.modeler.core.adapters.AdapterUtil;
import org.eclipse.bpmn2.modeler.core.adapters.ExtendedPropertiesAdapter;
import org.eclipse.bpmn2.modeler.core.builder.BPMN2Nature;
import org.eclipse.bpmn2.modeler.core.model.Bpmn2ModelerResourceImpl;
import org.eclipse.bpmn2.modeler.core.model.Bpmn2ModelerResourceSetImpl;
+import org.eclipse.bpmn2.modeler.core.ProxyURIConverterImplExtension;
import org.eclipse.bpmn2.modeler.core.preferences.Bpmn2Preferences;
import org.eclipse.bpmn2.modeler.core.runtime.TargetRuntime;
import org.eclipse.core.resources.IFile;
@@ -38,15 +37,19 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.content.IContentDescription;
+import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EValidator;
+import org.eclipse.emf.ecore.InternalEObject;
+import org.eclipse.emf.ecore.impl.ENotificationImpl;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.validation.marker.MarkerUtil;
import org.eclipse.emf.validation.model.EvaluationMode;
import org.eclipse.emf.validation.model.IConstraintStatus;
import org.eclipse.emf.validation.service.IBatchValidator;
+import org.eclipse.emf.validation.service.IValidator;
import org.eclipse.emf.validation.service.ModelValidationService;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.dialogs.MessageDialog;
@@ -79,7 +82,7 @@ public class BPMN2ProjectValidator extends AbstractValidator {
}
modelFile = (IFile) file;
try {
- modelFile.deleteMarkers(null, false, IProject.DEPTH_INFINITE);
+ modelFile.deleteMarkers(null, true, IProject.DEPTH_INFINITE);
} catch (CoreException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
@@ -136,6 +139,23 @@ public class BPMN2ProjectValidator extends AbstractValidator {
}
}
+ /**
+ * Perform a "Live" validation of the given model object. Errors resulting
+ * from a Live validation should be cause to consider the model as being
+ * corrupt and should not allow the Resource to be saved in this corrupt
+ * state, until the issues are resolved.
+ *
+ * @param object the model object to validate.
+ * @return an IStatus object indicating the result of the validation. A
+ * status severity of ERROR or higher should be considered reasons
+ * for believing the model is corrupt.
+ */
+ public static IStatus validateLive(EObject object) {
+ IValidator<Notification> validator = ModelValidationService.getInstance().newValidator(EvaluationMode.LIVE);
+ Notification n = new ENotificationImpl((InternalEObject) object, 0, null, null, null, false);
+ return validator.validate(n);
+ }
+
public static boolean isBPMN2File(IResource resource) {
if (resource instanceof IFile) {
try {
@@ -146,7 +166,7 @@ public class BPMN2ProjectValidator extends AbstractValidator {
cd.getContentType().getId());
}
String ext = file.getFileExtension();
- if ("bpmn".equals(ext) || "bpmn2".equals(ext))
+ if ("bpmn".equals(ext) || "bpmn2".equals(ext)) //$NON-NLS-1$ //$NON-NLS-2$
return true;
} catch (Exception e) {
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/BPMN2ValidationConstraints.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/BPMN2ValidationConstraints.java
index cb7a465c..437cb3bc 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/BPMN2ValidationConstraints.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/BPMN2ValidationConstraints.java
@@ -10,779 +10,246 @@
*******************************************************************************/
package org.eclipse.bpmn2.modeler.core.validation;
+import java.util.ArrayList;
+import java.util.Collections;
import java.util.List;
-import org.eclipse.bpmn2.Activity;
-import org.eclipse.bpmn2.AdHocSubProcess;
-import org.eclipse.bpmn2.Assignment;
-import org.eclipse.bpmn2.Association;
-import org.eclipse.bpmn2.BaseElement;
-import org.eclipse.bpmn2.Bpmn2Package;
-import org.eclipse.bpmn2.CallActivity;
-import org.eclipse.bpmn2.CatchEvent;
-import org.eclipse.bpmn2.ChoreographyActivity;
-import org.eclipse.bpmn2.ChoreographyTask;
-import org.eclipse.bpmn2.CompensateEventDefinition;
-import org.eclipse.bpmn2.ComplexGateway;
-import org.eclipse.bpmn2.ConditionalEventDefinition;
-import org.eclipse.bpmn2.DataAssociation;
-import org.eclipse.bpmn2.DataInput;
-import org.eclipse.bpmn2.DataObject;
-import org.eclipse.bpmn2.DataOutput;
-import org.eclipse.bpmn2.Definitions;
-import org.eclipse.bpmn2.EndEvent;
-import org.eclipse.bpmn2.Error;
-import org.eclipse.bpmn2.ErrorEventDefinition;
-import org.eclipse.bpmn2.Escalation;
-import org.eclipse.bpmn2.EscalationEventDefinition;
-import org.eclipse.bpmn2.Event;
-import org.eclipse.bpmn2.EventBasedGateway;
-import org.eclipse.bpmn2.EventDefinition;
-import org.eclipse.bpmn2.ExclusiveGateway;
-import org.eclipse.bpmn2.Expression;
-import org.eclipse.bpmn2.FlowElement;
-import org.eclipse.bpmn2.FlowNode;
-import org.eclipse.bpmn2.FormalExpression;
-import org.eclipse.bpmn2.Gateway;
-import org.eclipse.bpmn2.GatewayDirection;
-import org.eclipse.bpmn2.Import;
-import org.eclipse.bpmn2.InclusiveGateway;
-import org.eclipse.bpmn2.InputOutputSpecification;
-import org.eclipse.bpmn2.InteractionNode;
-import org.eclipse.bpmn2.Interface;
-import org.eclipse.bpmn2.ItemAwareElement;
-import org.eclipse.bpmn2.ItemDefinition;
-import org.eclipse.bpmn2.Message;
-import org.eclipse.bpmn2.MessageEventDefinition;
-import org.eclipse.bpmn2.MessageFlow;
-import org.eclipse.bpmn2.Operation;
-import org.eclipse.bpmn2.ParallelGateway;
-import org.eclipse.bpmn2.Process;
-import org.eclipse.bpmn2.ProcessType;
-import org.eclipse.bpmn2.Resource;
-import org.eclipse.bpmn2.ScriptTask;
-import org.eclipse.bpmn2.SendTask;
-import org.eclipse.bpmn2.SequenceFlow;
-import org.eclipse.bpmn2.Signal;
-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.utils.ModelUtil;
-import org.eclipse.core.runtime.Assert;
+import org.eclipse.bpmn2.modeler.core.preferences.Bpmn2Preferences;
+import org.eclipse.bpmn2.modeler.core.runtime.TargetRuntime;
+import org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator;
+import org.eclipse.bpmn2.modeler.core.validation.validators.IBpmn2ElementValidator;
+import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.emf.validation.AbstractModelConstraint;
import org.eclipse.emf.validation.EMFEventType;
import org.eclipse.emf.validation.IValidationContext;
-import org.eclipse.osgi.util.NLS;
-
+import org.eclipse.emf.validation.model.ConstraintStatus;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleReference;
+
+/**
+ * Implements a Model Constraint validation object for BPMN2 elements. This Constraint
+ * is invoked for every object in a BPMN2 resource. The strategy is to search for an
+ * object validator to handle each specific BPMN2 element type. If none is found, move
+ * up the object's super type hierarchy until a validator can be found. That validator
+ * is used as the "base type validator" and controls whether we will continue to move
+ * up the type hierarchy for additional validations.
+ */
public class BPMN2ValidationConstraints extends AbstractModelConstraint {
- public final static String ERROR_ID = "org.eclipse.bpmn2.modeler.core.validation.error"; //$NON-NLS-1$
- public final static String WARNING_ID = "org.eclipse.bpmn2.modeler.core.validation.warning"; //$NON-NLS-1$
-
- private boolean warnings = false;
+ public final static String CATEGORY_ID = "org.eclipse.bpmn2.modeler.core.validation.category.override"; //$NON-NLS-1$
+
+ protected StatusList result = new StatusList();
public BPMN2ValidationConstraints() {
}
@Override
public IStatus validate(IValidationContext ctx) {
- EObject eObj = ctx.getTarget();
- EMFEventType eType = ctx.getEventType();
- String id = ctx.getCurrentConstraintId();
- if (WARNING_ID.equals(id))
- warnings = true;
- else
- warnings = false;
+ initialize();
- // In the case of batch mode.
- if (eType == EMFEventType.NULL) {
- if (eObj instanceof Definitions) {
- return validateDefinitions(ctx, (Definitions) eObj);
- }
- if (eObj instanceof BaseElement) {
- return validateBaseElement(ctx, (BaseElement) eObj);
- }
- else {
- validateEObject(ctx,eObj);
- }
- } else { // In the case of live mode.
- if (eObj instanceof BaseElement) {
- return validateBaseElementLive(ctx, (BaseElement) eObj);
- }
- else {
- validateEObject(ctx,eObj);
- }
- }
-
- return ctx.createSuccessStatus();
- }
-
- private IStatus validateDefinitions(IValidationContext ctx, Definitions def) {
- if (def.getTargetNamespace()==null || def.getTargetNamespace().isEmpty()) {
- if (warnings) {
- }
- else {
- ctx.addResult(def);
- return ctx.createFailureStatus(Messages.BPMN2ValidationConstraints_2);
- }
- }
- for (Import imp : def.getImports()) {
- IStatus status = validateEObject(ctx, imp);
- if (!status.isOK())
- return status;
- }
-
- return ctx.createSuccessStatus();
- }
-
- public IStatus createFailureStatus(IValidationContext ctx, EObject object, Object... messageArgs) {
- IStatus status = ctx.createFailureStatus(messageArgs);
- ctx.addResult(object);
- return status;
- }
-
- public IStatus createMissingFeatureStatus(IValidationContext ctx, EObject object, String featureName) {
- EStructuralFeature feature = object.eClass().getEStructuralFeature(featureName);
- // change error message slightly for connections
- String message;
- if (feature.getEType() == Bpmn2Package.eINSTANCE.getSequenceFlow())
- message = NLS.bind(Messages.BPMN2ValidationConstraints_Missing_Connection, ModelUtil.getLabel(object), ModelUtil.getLabel(object, feature));
- else
- message = NLS.bind(Messages.BPMN2ValidationConstraints_Missing_Feature, ModelUtil.getLabel(object), ModelUtil.getLabel(object, feature));
- IStatus status = ctx.createFailureStatus(message);
- ctx.addResult(object);
- return status;
- }
-
- private IStatus validateBaseElement(IValidationContext ctx, BaseElement be) {
-
- if (be instanceof Process) {
- Process process = (Process) be;
-
- if (warnings) {
- // report warnings only
- boolean foundStartEvent = false;
- boolean foundEndEvent = false;
- List<FlowElement> flowElements = process.getFlowElements();
- for (FlowElement fe : flowElements) {
- if (fe instanceof StartEvent) {
- foundStartEvent = true;
- }
- if (fe instanceof EndEvent) {
- foundEndEvent = true;
- }
- }
- if (!foundStartEvent) {
- return createFailureStatus(ctx, be, Messages.BPMN2ValidationConstraints_6);
- }
- if (!foundEndEvent) {
- return createFailureStatus(ctx, be, Messages.BPMN2ValidationConstraints_7);
- }
- if (isEmpty(process.getName())) {
- return createMissingFeatureStatus(ctx,be,"name"); //$NON-NLS-1$
- }
- }
- else {
- // see Bug 425903 - need to figure this out...
-// if (ProcessType.NONE.equals(process.getProcessType())) {
-// return createFailureStatus(ctx, be, Messages.BPMN2ValidationConstraints_0);
-// }
- // report errors only
- }
- }
- else if (be instanceof Error) {
- if (!warnings) {
- if (!isValidForExecutableProcess((BaseElement)be.eContainer(), be)) {
- return createMissingFeatureStatus(ctx,be,"structureRef"); //$NON-NLS-1$
- }
- }
- }
- else if (be instanceof Escalation) {
- if (!warnings) {
- if (!isValidForExecutableProcess((BaseElement)be.eContainer(), be)) {
- return createMissingFeatureStatus(ctx,be,"structureRef"); //$NON-NLS-1$
- }
- }
- }
- else if (be instanceof Message) {
- if (!warnings) {
- if (!isValidForExecutableProcess((BaseElement)be.eContainer(), be)) {
- return createMissingFeatureStatus(ctx,be,"itemRef"); //$NON-NLS-1$
- }
- }
- }
- else if (be instanceof Signal) {
- if (!warnings) {
- if (!isValidForExecutableProcess((BaseElement)be.eContainer(), be)) {
- return createMissingFeatureStatus(ctx,be,"structureRef"); //$NON-NLS-1$
- }
- }
- }
- else if (be instanceof ItemDefinition) {
- if (!warnings) {
- if (!isValidForExecutableProcess((BaseElement)be.eContainer(), be)) {
- return createMissingFeatureStatus(ctx,be,"structureRef"); //$NON-NLS-1$
- }
- }
- }
- else if (be instanceof StartEvent) {
- StartEvent elem = (StartEvent) be;
-
- if (!warnings) {
- if (elem.getOutgoing() == null || elem.getOutgoing().size() < 1) {
- return createMissingFeatureStatus(ctx,be,"outgoing"); //$NON-NLS-1$
- }
- }
- }
- else if (be instanceof EndEvent) {
- EndEvent elem = (EndEvent) be;
-
- if (!warnings) {
- if (elem.getIncoming() == null || elem.getIncoming().size() < 1) {
- return createMissingFeatureStatus(ctx,be,"incoming"); //$NON-NLS-1$
- }
- }
- }
- else if (be instanceof ScriptTask) {
- ScriptTask elem = (ScriptTask) be;
+ EObject object = ctx.getTarget();
+ if (doValidation(ctx, object)) {
- if (warnings) {
- if (isEmpty(elem.getScript())) {
- return createMissingFeatureStatus(ctx,be,"script"); //$NON-NLS-1$
- }
- }
- }
- else if (be instanceof SendTask) {
- SendTask elem = (SendTask) be;
-
- if (!warnings) {
- if (elem.getOperationRef() == null) {
- return createMissingFeatureStatus(ctx,be,"operationRef"); //$NON-NLS-1$
- }
- if (elem.getMessageRef() == null) {
- return createMissingFeatureStatus(ctx,be,"messageRef"); //$NON-NLS-1$
- }
- }
- }
- else if (be instanceof CatchEvent) {
- CatchEvent elem = (CatchEvent) be;
-
- if (warnings) {
- if (elem.getOutgoing() == null || elem.getOutgoing().size() < 1) {
- return createMissingFeatureStatus(ctx,be,"outgoing"); //$NON-NLS-1$
- }
- }
- else {
- IStatus status = validateEvent(ctx,(Event)be);
- if (status!=null)
- return status;
- }
- // no more validations on this
- be = null;
- }
- else if (be instanceof ThrowEvent) {
- ThrowEvent elem = (ThrowEvent) be;
-
- if (warnings) {
- if (elem.getOutgoing() == null || elem.getOutgoing().size() < 1) {
- return createMissingFeatureStatus(ctx,be,"outgoing"); //$NON-NLS-1$
- }
- }
- else {
- IStatus status = validateEvent(ctx,(Event)be);
- if (status!=null)
- return status;
- }
- // no more validations on this
- be = null;
- }
- else if (be instanceof SequenceFlow) {
- SequenceFlow elem = (SequenceFlow) be;
-
- if (!warnings) {
- if (elem.getSourceRef() == null) {
- return createMissingFeatureStatus(ctx,be,"sourceRef"); //$NON-NLS-1$
- }
- if (elem.getTargetRef() == null) {
- return createMissingFeatureStatus(ctx,be,"targetRef"); //$NON-NLS-1$
- }
- }
- }
- else if (be instanceof Association) {
- Association elem = (Association) be;
-
- if (!warnings) {
- if (elem.getSourceRef() == null) {
- return createMissingFeatureStatus(ctx,be,"sourceRef"); //$NON-NLS-1$
- }
- if (elem.getTargetRef() == null) {
- return createMissingFeatureStatus(ctx,be,"targetRef"); //$NON-NLS-1$
- }
- }
- }
- else if (be instanceof Gateway) {
- Gateway elem = (Gateway) be;
-
- if (!warnings) {
- if (elem.getGatewayDirection() == null
- || elem.getGatewayDirection().getValue() == GatewayDirection.UNSPECIFIED.getValue()) {
- ctx.addResult(Bpmn2Package.eINSTANCE.getGateway_GatewayDirection());
- return createMissingFeatureStatus(ctx,be,"gatewayDirection"); //$NON-NLS-1$
- }
- if (elem instanceof ExclusiveGateway) {
- if (elem.getGatewayDirection().getValue() != GatewayDirection.DIVERGING.getValue()
- && elem.getGatewayDirection().getValue() != GatewayDirection.CONVERGING.getValue()) {
- return createFailureStatus(ctx,be,
- Messages.BPMN2ValidationConstraints_29);
- }
- }
- if (elem instanceof EventBasedGateway) {
- if (elem.getGatewayDirection().getValue() != GatewayDirection.DIVERGING.getValue()) {
- return createFailureStatus(ctx,be,
- Messages.BPMN2ValidationConstraints_30);
- }
- }
- if (elem instanceof ParallelGateway) {
- if (elem.getGatewayDirection().getValue() != GatewayDirection.DIVERGING.getValue()
- && elem.getGatewayDirection().getValue() != GatewayDirection.CONVERGING.getValue()) {
- return createFailureStatus(ctx,be,
- Messages.BPMN2ValidationConstraints_31);
- }
- }
- if (elem instanceof InclusiveGateway) {
- if (elem.getGatewayDirection().getValue() != GatewayDirection.DIVERGING.getValue()
- && elem.getGatewayDirection().getValue() != GatewayDirection.CONVERGING.getValue()) {
- return createFailureStatus(ctx,be,
- Messages.BPMN2ValidationConstraints_32);
+ // Find a validator class to handle this object type:
+ // We want to start with the instance EClass of the object
+ // first, then work our way up the super class hierarchy
+ // all the way to BaseElement. Unfortunately, EClass#getEAllSuperTypes()
+ // returns the class hierarchy in reverse order, from BaseElement down
+ // to more specialized types, so we'll have to make a copy and reverse
+ // the list.
+ List<EClass> types = new ArrayList<EClass>();
+ types.addAll(object.eClass().getEAllSuperTypes());
+ types.add(object.eClass());
+ Collections.reverse(types);
+ IBpmn2ElementValidator baseValidator = null;
+ IBpmn2ElementValidator validator = null;
+ for (EClass eClass : types) {
+ if (baseValidator!=null)
+ validator = getValidator(baseValidator, eClass);
+ else
+ validator = getValidator(ctx, eClass);
+
+ if (validator!=null) {
+ if (baseValidator==null) {
+ baseValidator = validator;
+ if (isLiveValidation(ctx) && !validator.doLiveValidation())
+ continue;
+ addStatus(validator.validate(object));
}
- }
- if (elem instanceof ComplexGateway) {
- if (elem.getGatewayDirection().getValue() != GatewayDirection.DIVERGING.getValue()
- && elem.getGatewayDirection().getValue() != GatewayDirection.CONVERGING.getValue()) {
- return createFailureStatus(ctx,be,
- Messages.BPMN2ValidationConstraints_33);
+ else if (baseValidator.checkSuperType(eClass, object)) {
+ // The subclass validator wants to invoke the validator
+ // for this super class.
+ if (isLiveValidation(ctx) && !validator.doLiveValidation())
+ continue;
+ addStatus(validator.validate(object));
}
}
}
}
- else if (be instanceof CallActivity) {
- CallActivity elem = (CallActivity) be;
-
- if (!warnings) {
- if (elem.getCalledElementRef() == null) {
- return createMissingFeatureStatus(ctx,be,"calledElementRef"); //$NON-NLS-1$
- }
- }
- }
- else if (be instanceof DataObject) {
- DataObject elem = (DataObject) be;
-
- if (!warnings) {
- if (elem.getName() == null || elem.getName().length() < 1) {
- return createMissingFeatureStatus(ctx,be,"name"); //$NON-NLS-1$
- }
- }
- }
- else if (be instanceof Interface) {
- Interface elem = (Interface)be;
- if (warnings) {
- }
- else {
- if (isEmpty(elem.getOperations())) {
- return createMissingFeatureStatus(ctx,be,"operations"); //$NON-NLS-1$
- }
- if (isEmpty(elem.getName())) {
- return createMissingFeatureStatus(ctx,be,"name"); //$NON-NLS-1$
- }
- }
- }
- else if (be instanceof Operation) {
- Operation elem = (Operation)be;
- if (warnings) {
- }
- else {
- if (isEmpty(elem.getInMessageRef())) {
- return createMissingFeatureStatus(ctx,be,"inMessageRef"); //$NON-NLS-1$
- }
- if (isEmpty(elem.getName())) {
- return createMissingFeatureStatus(ctx,be,"name"); //$NON-NLS-1$
- }
- }
- }
- else if (be instanceof DataAssociation) {
- DataAssociation elem = (DataAssociation)be;
- if (warnings) {
- }
- else {
- if (isEmpty(elem.getTargetRef()) && elem.getAssignment().size()==0 && elem.getTransformation()==null) {
- return createMissingFeatureStatus(ctx,be,"targetRef"); //$NON-NLS-1$
- }
- }
- }
- else if (be instanceof Assignment) {
- Assignment elem = (Assignment)be;
- if (warnings) {
- }
- else {
- if (isEmpty(elem.getFrom())) {
- return createMissingFeatureStatus(ctx,be,"from"); //$NON-NLS-1$
- }
- if (isEmpty(elem.getTo())) {
- return createMissingFeatureStatus(ctx,be,"to"); //$NON-NLS-1$
- }
- }
- }
- else if (be instanceof InputOutputSpecification) {
- InputOutputSpecification elem = (InputOutputSpecification)be;
- if (warnings) {
- }
- else {
- if (isEmpty(elem.getInputSets())) {
- return createMissingFeatureStatus(ctx,be,"inputSets"); //$NON-NLS-1$
- }
- if (isEmpty(elem.getOutputSets())) {
- return createMissingFeatureStatus(ctx,be,"outputSets"); //$NON-NLS-1$
- }
- }
- }
- else if (be instanceof ChoreographyActivity) {
- ChoreographyActivity elem = (ChoreographyActivity)be;
- if (elem.getParticipantRefs().size()<2) {
- return createFailureStatus(ctx,be,Messages.BPMN2ValidationConstraints_45);
- }
- if (elem.getInitiatingParticipantRef()==null) {
- return createFailureStatus(ctx,be,Messages.BPMN2ValidationConstraints_46);
- }
- }
- else if (be instanceof Resource) {
- Resource elem = (Resource)be;
- if (isEmpty(elem.getName())) {
- return createMissingFeatureStatus(ctx,be,"name"); //$NON-NLS-1$
- }
- }
- else if (be instanceof ChoreographyTask) {
- ChoreographyTask elem = (ChoreographyTask)be;
- for (MessageFlow mf : elem.getMessageFlowRef()) {
- InteractionNode in = mf.getSourceRef();
- if (!elem.getParticipantRefs().contains(in)) {
- return createFailureStatus(ctx,be,Messages.BPMN2ValidationConstraints_48);
- }
- in = mf.getTargetRef();
- if (!elem.getParticipantRefs().contains(in)) {
- return createFailureStatus(ctx,be,Messages.BPMN2ValidationConstraints_49);
- }
- }
- }
-
-
- if (be instanceof ItemAwareElement) {
- return validateItemAwareElement(ctx, (ItemAwareElement)be);
- }
- if (be instanceof FlowNode) {
- return validateFlowNode(ctx, (FlowNode) be);
- }
-
- return ctx.createSuccessStatus();
+ return getResult(ctx);
}
- private Process findProcess(BaseElement be) {
- while (be!=null && !(be instanceof Process) && be.eContainer() instanceof BaseElement) {
- be = (BaseElement)be.eContainer();
- }
- if (be instanceof Process)
- return (Process) be;
- return null;
+ /**
+ * Initialize this Model Constraint object. Since the EMF Validation Framework
+ * only constructs a single instance of each Constraing object, we need to make sure
+ * it is properly initialized each time it is invoked. In this case, we need to clear
+ * out the "results" list every time.
+ *
+ * Subclasses should override this method for additional initialization.
+ */
+ protected void initialize() {
+ result.clear();
}
- private boolean isValidForExecutableProcess(BaseElement be, BaseElement ref) {
- Process process = findProcess(be);
- if (!warnings && process!=null && process.isIsExecutable()) {
- if (ref==null)
- return false;
- if (ref instanceof Expression) {
- // Executable processes MUST have FormalExpressions defined
- if (!(ref instanceof FormalExpression))
- return false;
- String body = ModelUtil.getExpressionBody((FormalExpression)ref);
- if (isEmpty(body))
- return false;
- }
- else if (ref instanceof Message) {
- // Messages must have complete ItemDefinitions
- Message message = (Message) ref;
- if (!isValidForExecutableProcess(message, message.getItemRef()))
- return false;
- }
- else if (ref instanceof ItemDefinition) {
- // ItemDefinitions must have non-empty structure definitions
- ItemDefinition itemDefinition = (ItemDefinition) ref;
- if (isEmpty(itemDefinition.getStructureRef()))
- return false;
- }
- else if (ref instanceof Signal) {
- Signal signal = (Signal) ref;
- if (!isValidForExecutableProcess(signal, signal.getStructureRef()))
- return false;
- }
- else if (ref instanceof Error) {
- Error error = (Error) ref;
- if (isEmpty(error.getErrorCode()))
- return false;
- if (!isValidForExecutableProcess(error, error.getStructureRef()))
- return false;
- }
- else if (ref instanceof Escalation) {
- Escalation escalation = (Escalation) ref;
- if (isEmpty(escalation.getEscalationCode()))
- return false;
- if (!isValidForExecutableProcess(escalation, escalation.getStructureRef()))
- return false;
- }
- else if (ref instanceof Activity) {
-
- }
- else
- return false;
+ /**
+ * Determine if the given object should be validated. Subclasses may override this
+ * method to test for additional conditions that enable/disable object validation.
+ *
+ * This base implementation searches for a Model Constraint for the given object
+ * type that may be defined in the current Target Runtime, and returns "false" if
+ * one is found. This means that the Target Runtime needs to override the default
+ * validations performed on the given object.
+ *
+ * @param ctx the Validation Context
+ * @param object the object to be validated
+ * @return true if the object needs to be validated, false if not.
+ */
+ protected boolean doValidation(IValidationContext ctx, EObject object) {
+ Bpmn2Preferences prefs = Bpmn2Preferences.getInstance(object);
+ if (prefs.getDoCoreValidation()) {
+ if (!deferValidationToTargetRuntime(ctx, object))
+ return true;
}
- return true;
+ return false;
}
- @SuppressWarnings("unchecked")
- private IStatus validateEvent(IValidationContext ctx, Event event) {
- Process process = findProcess(event);
- if (process!=null && process.isIsExecutable()) {
- EStructuralFeature feature = event.eClass().getEStructuralFeature("eventDefinitions"); //$NON-NLS-1$
- Assert.isNotNull(feature);
- List<EventDefinition> eventdefs = (List<EventDefinition>) event.eGet(feature);
- if (eventdefs.size()==0) {
- if (!(event instanceof StartEvent || event instanceof EndEvent))
- return createMissingFeatureStatus(ctx,event,"eventDefinitions"); //$NON-NLS-1$
- }
- for (EventDefinition ed : eventdefs) {
- IStatus status = validateEventDefinition(ctx,ed);
- if (status!=null)
- return status;
- }
- }
- return null;
- }
-
- private IStatus validateEventDefinition(IValidationContext ctx, EventDefinition ed) {
- if (ed instanceof TimerEventDefinition) {
- TimerEventDefinition ted = (TimerEventDefinition) ed;
- if (ted.getTimeDate() == null && ted.getTimeDuration() == null && ted.getTimeCycle() == null) {
- return createFailureStatus(ctx,ed,"timeCycle",Messages.BPMN2ValidationConstraints_52); //$NON-NLS-1$
- }
- } else if (ed instanceof SignalEventDefinition) {
- if (!isValidForExecutableProcess(ed, ((SignalEventDefinition) ed).getSignalRef())) {
- return createMissingFeatureStatus(ctx,ed,"signalRef"); //$NON-NLS-1$
- }
- } else if (ed instanceof ErrorEventDefinition) {
- if (!isValidForExecutableProcess(ed, ((ErrorEventDefinition) ed).getErrorRef())) {
- return createMissingFeatureStatus(ctx,ed,"errorRef"); //$NON-NLS-1$
- }
- } else if (ed instanceof ConditionalEventDefinition) {
- if (!isValidForExecutableProcess(ed, ((ConditionalEventDefinition) ed).getCondition())) {
- return createMissingFeatureStatus(ctx,ed,"condition"); //$NON-NLS-1$
- }
- } else if (ed instanceof EscalationEventDefinition) {
- if (!isValidForExecutableProcess(ed, ((EscalationEventDefinition) ed).getEscalationRef())) {
- return createMissingFeatureStatus(ctx,ed,"escalationRef"); //$NON-NLS-1$
- }
- } else if (ed instanceof MessageEventDefinition) {
- if (!isValidForExecutableProcess(ed, ((MessageEventDefinition) ed).getMessageRef())) {
- return createMissingFeatureStatus(ctx,ed,"messageRef"); //$NON-NLS-1$
- }
- } else if (ed instanceof CompensateEventDefinition) {
- if (!isValidForExecutableProcess(ed, ((CompensateEventDefinition) ed).getActivityRef())) {
- return createMissingFeatureStatus(ctx,ed,"activityRef"); //$NON-NLS-1$
- }
- }
- return null;
+ /**
+ * Search for a BPMN2 Element Validator for the given object type.
+ *
+ * @param ctx the Validation Context
+ * @param eClass the EClass (type) of the BPMN2 element
+ * @return a Validator if one has been defined, or null
+ */
+ protected IBpmn2ElementValidator<?> getValidator(IValidationContext ctx, EClass eClass) {
+ return AbstractBpmn2ElementValidator.getValidator(ctx, eClass.getInstanceClass());
}
- private IStatus validateFlowNode(IValidationContext ctx, FlowNode fn) {
- if (!warnings) {
- boolean needIncoming = true;
- boolean needOutgoing = true;
- if (fn instanceof ThrowEvent)
- needOutgoing = false;
- if (fn instanceof CatchEvent)
- needIncoming = false;
-
- if (fn.eContainer() instanceof AdHocSubProcess) {
- needIncoming = false;
- needOutgoing = false;
- }
-
- if (needOutgoing) {
- if ((fn.getOutgoing() == null || fn.getOutgoing().size() < 1)) {
- return createMissingFeatureStatus(ctx,fn,"outgoing"); //$NON-NLS-1$
- }
- }
- if (needIncoming) {
- if ((fn.getIncoming() == null || fn.getIncoming().size() < 1)) {
- return createMissingFeatureStatus(ctx,fn,"incoming"); //$NON-NLS-1$
- }
- }
- }
-
- return ctx.createSuccessStatus();
+ protected IBpmn2ElementValidator<?> getValidator(IBpmn2ElementValidator<?> parent, EClass eClass) {
+ return AbstractBpmn2ElementValidator.getValidator(parent, eClass.getInstanceClass());
}
- private IStatus validateItemAwareElement(IValidationContext ctx, ItemAwareElement elem) {
- if (!isValidForExecutableProcess(elem, elem.getItemSubjectRef())) {
- return createMissingFeatureStatus(ctx,elem,"itemSubjectRef"); //$NON-NLS-1$
- }
- return ctx.createSuccessStatus();
+ /**
+ * Add the given IStatus to our results.
+ *
+ * @param status
+ */
+ protected void addStatus(IStatus status) {
+ result.add(status);
}
-
- private IStatus validateEObject(IValidationContext ctx, EObject be) {
- if (be instanceof Import) {
- Import elem = (Import)be;
- if (warnings) {
- }
- else {
- if (isEmpty(elem.getLocation())) {
- return createMissingFeatureStatus(ctx,be,"location"); //$NON-NLS-1$
- }
- if (isEmpty(elem.getNamespace())) {
- return createMissingFeatureStatus(ctx,be,"namespace"); //$NON-NLS-1$
- }
- if (isEmpty(elem.getImportType())) {
- return createMissingFeatureStatus(ctx,be,"importType"); //$NON-NLS-1$
- }
- }
- }
-
- return ctx.createSuccessStatus();
+
+ /**
+ * Return the validation result. If no validation errors were found, this will be
+ * a single IStatus object with severity "OK".
+ *
+ * @param ctx the Validation Context
+ * @return an IStatus object
+ */
+ protected IStatus getResult(IValidationContext ctx) {
+ if (result.isEmpty())
+ return ctx.createSuccessStatus();
+ if (result.size()==1)
+ return result.get(0);
+ return ConstraintStatus.createMultiStatus(ctx, result);
}
- @SuppressWarnings("rawtypes")
- private static boolean isEmpty(Object object) {
- if (object instanceof String) {
- String str = (String) object;
- return str == null || str.isEmpty();
- }
- else if (object instanceof List) {
- return ((List)object).isEmpty();
- }
- else if (ModelUtil.isStringWrapper(object)) {
- String w = ModelUtil.getStringWrapperValue(object);
- if (w==null || w.isEmpty())
- return true;
- }
- else if (object==null)
- return true;
- return false;
+ /**
+ * Check if the Validation Context indicates a Live validation.
+ *
+ * @param ctx the Validation Context
+ * @return true if the Validation Context has a non-null EMF Event type,
+ * indicating this is a Live validation.
+ */
+ protected boolean isLiveValidation(IValidationContext ctx) {
+ return ctx.getEventType() != EMFEventType.NULL;
}
- private IStatus validateBaseElementLive(IValidationContext ctx, BaseElement be) {
-
- if (be instanceof ItemDefinition) {
- ItemDefinition itemDefinition = (ItemDefinition) be;
- final Definitions defs = ModelUtil.getDefinitions(itemDefinition);
- if (defs!=null) {
- // check for duplicate ItemDefinitions
- List<ItemDefinition> itemDefs = ModelUtil.getAllRootElements(defs, ItemDefinition.class);
- for (ItemDefinition id : itemDefs) {
- if (id == itemDefinition)
- continue;
-
- if (ModelUtil.compare(id, itemDefinition,true)) {
- Object structureRef = itemDefinition.getStructureRef();
- if (structureRef==null ||
- (ModelUtil.isStringWrapper(structureRef) &&
- ModelUtil.getStringWrapperValue(structureRef).isEmpty()))
- continue;
- return createFailureStatus(ctx,be,
- NLS.bind(
- Messages.BPMN2ValidationConstraints_Duplicate_Data_Type,
- new Object[] {
- id.getItemKind(),
- (id.isIsCollection() ? "[]" : ""), //$NON-NLS-1$ //$NON-NLS-2$
- ModelUtil.getDisplayName(id)
+ /**
+ * Check if the Target Runtime defined for the given object's Resource wants
+ * to override the default validation for the given object.
+ *
+ * To define a validation override, an extension plugin needs to define a Validation
+ * Constraint with category="org.eclipse.bpmn2.modeler.core.validation.category.override"
+ * for example:
+ *
+ * <pre>
+ * <extension point="org.eclipse.emf.validation.constraintProviders">
+ * <!-- These constraints override the ones in BPMN2 Modeler Core Validation -->
+ * <constraintProvider cache="true">
+ * <package namespaceUri="http://www.omg.org/spec/BPMN/20100524/MODEL-XMI" />
+ * <constraints categories="org.eclipse.bpmn2.modeler.core.validation.category.override">
+ * <constraint
+ * lang="Java"
+ * class="org.my.plugin.validation.ProcessConstraint"
+ * severity="ERROR"
+ * mode="Batch"
+ * name="My Plugin Process Constraint"
+ * id="org.my.plugin.validation.Process"
+ * statusCode="1">
+ * <target class="Process" />
+ * </constraint>
+ * </constraints>
+ * </constraintProvider>
+ * </extension>
+ * </pre>
+ *
+ * This will cause the default validation to be skipped, and the Validation
+ * Framework will invoke the "org.my.plugin.validation.ProcessConstraint"
+ * Model Constraint instead, whenever a Process object needs to be validated.
+ *
+ * @param ctx
+ * @param object
+ * @return
+ */
+ private boolean deferValidationToTargetRuntime(IValidationContext ctx, EObject object) {
+ TargetRuntime rt = TargetRuntime.getCurrentRuntime();
+ if (rt != TargetRuntime.getDefaultRuntime()) {
+ ClassLoader cl = rt.getRuntimeExtension().getClass().getClassLoader();
+ Bundle b = ((BundleReference)cl).getBundle();
+ String pluginId = b.getSymbolicName();
+ IConfigurationElement[] elements = Platform.getExtensionRegistry().getConfigurationElementsFor("org.eclipse.emf.validation.constraintProviders");
+ for (IConfigurationElement e : elements) {
+ if (pluginId.equals(e.getDeclaringExtension().getContributor().getName())) {
+ if ("constraintProvider".equals(e.getName())) {
+ for (IConfigurationElement e1 : e.getChildren("constraints")) {
+ String categories = e1.getAttribute("categories");
+ if (categories!=null && categories.contains(CATEGORY_ID)) {
+ for (IConfigurationElement e2 : e1.getChildren("constraint")) {
+ for (IConfigurationElement e3 : e2.getChildren("target")) {
+ String className = e3.getAttribute("class");
+ int i = className.indexOf(':');
+ if (i>0) {
+ className = className.substring(0,i);
+ }
+ if (object.eClass().getName().equals(className)) {
+ String mode = isLiveValidation(ctx) ? "Live" : "Batch";
+ String m = e2.getAttribute("mode");
+ if (m==null)
+ m = "Batch";
+ if (mode.equals(m))
+ return true;
+ }
+ }
}
- )
- );
- }
- }
- }
-
- Object structureRef = itemDefinition.getStructureRef();
- if (structureRef==null ||
- (ModelUtil.isStringWrapper(structureRef) &&
- ModelUtil.getStringWrapperValue(structureRef).isEmpty())) {
-
- return createMissingFeatureStatus(ctx,be,"structureRef"); //$NON-NLS-1$
- }
- }
- else if (be instanceof Event) {
- IStatus status = validateEvent(ctx,(Event)be);
- if (status!=null)
- return status;
- }
- else if (be instanceof EventDefinition) {
- IStatus status = validateEventDefinition(ctx,(EventDefinition)be);
- if (status!=null)
- return status;
- }
- else if (be instanceof DataInput) {
- DataInput param = (DataInput) be;
- List<DataInput> allParams = null;
- if (be.eContainer() instanceof InputOutputSpecification) {
- allParams = ((InputOutputSpecification)param.eContainer()).getDataInputs();
- }
- else if (be.eContainer() instanceof ThrowEvent) {
- allParams = ((ThrowEvent)param.eContainer()).getDataInputs();
- }
- if (allParams!=null) {
- for (DataInput i : allParams) {
- if (i!=param) {
- String n1 = param.getName();
- String n2 = i.getName();
- if (n1!=null && n2!=null && n1.equals(n2)) {
- return ctx.createFailureStatus(
- NLS.bind(
- Messages.BPMN2ValidationConstraints_Duplicate_Input,
- param.getName()
- )
- );
+ }
}
}
}
}
}
- else if (be instanceof DataOutput) {
- DataOutput param = (DataOutput) be;
- List<DataOutput> allParams = null;
- if (be.eContainer() instanceof InputOutputSpecification) {
- allParams = ((InputOutputSpecification)param.eContainer()).getDataOutputs();
- }
- else if (be.eContainer() instanceof CatchEvent) {
- allParams = ((CatchEvent)param.eContainer()).getDataOutputs();
- }
- if (allParams!=null) {
- for (DataOutput i : allParams) {
- if (i!=param) {
- String n1 = param.getName();
- String n2 = i.getName();
- if (n1!=null && n2!=null && n1.equals(n2)) {
- return ctx.createFailureStatus(
- NLS.bind(
- Messages.BPMN2ValidationConstraints_Duplicate_Output,
- param.getName()
- )
- );
- }
- }
- }
- }
- }
- return ctx.createSuccessStatus();
+ return false;
}
}
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 f698933d..eed00858 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
@@ -10,7 +10,6 @@
*******************************************************************************/
package org.eclipse.bpmn2.modeler.core.validation;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashSet;
@@ -18,14 +17,12 @@ import java.util.List;
import java.util.Set;
import org.eclipse.bpmn2.modeler.core.Activator;
+import org.eclipse.bpmn2.modeler.core.utils.MarkerUtils;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EPackage;
-import org.eclipse.emf.ecore.EStructuralFeature;
-import org.eclipse.emf.ecore.EValidator;
import org.eclipse.emf.ecore.EcorePackage;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.util.EcoreUtil;
@@ -51,7 +48,7 @@ public class BPMN2ValidationStatusLoader {
}
Set<EObject> touched = new LinkedHashSet<EObject>();
for (IMarker marker : markers) {
- for (EObject markedObject : getAllObjects(marker)) {
+ for (EObject markedObject : MarkerUtils.getAllObjects(editor.getDiagramBehavior().getResourceSet(), marker)) {
if (markedObject == null) {
continue;
}
@@ -95,40 +92,6 @@ public class BPMN2ValidationStatusLoader {
}
return touched;
}
-
- private List<EObject> getAllObjects(IMarker marker) {
- List<EObject> result = new ArrayList<EObject>();
- result.add(getTargetObject(marker));
- result.addAll(getRelatedObjects(marker));
- return result;
- }
-
- private List<EObject> getRelatedObjects(IMarker marker) {
- List<EObject> result = new ArrayList<EObject>();
- String targetUri = marker.getAttribute(EValidator.URI_ATTRIBUTE, null);
- String uriString = marker.getAttribute(EValidator.RELATED_URIS_ATTRIBUTE,null);
- if (uriString!=null) {
- String[] uris = uriString.split(" ");
- for (String s : uris) {
- if (s.equals(targetUri))
- continue;
- URI uri = URI.createURI(s);
- EObject o = editor.getEditingDomain().getResourceSet().getEObject(uri, false);
- if (!(o instanceof EStructuralFeature))
- result.add(o);
- }
- }
- return result;
- }
-
- private EObject getTargetObject(IMarker marker) {
- final String uriString = marker.getAttribute(EValidator.URI_ATTRIBUTE, null);
- final URI uri = uriString == null ? null : URI.createURI(uriString);
- if (uri == null) {
- return null;
- }
- return editor.getEditingDomain().getResourceSet().getEObject(uri, false);
- }
@SuppressWarnings("unchecked")
private IStatus convertMarker(IMarker marker, EObject target) {
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/FormalExpressionConstraint.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/FormalExpressionConstraint.java
deleted file mode 100644
index c07db5d0..00000000
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/FormalExpressionConstraint.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2012 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
- *******************************************************************************/
-package org.eclipse.bpmn2.modeler.core.validation;
-
-import org.eclipse.bpmn2.Bpmn2Package;
-import org.eclipse.bpmn2.FormalExpression;
-import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.validation.AbstractModelConstraint;
-import org.eclipse.emf.validation.EMFEventType;
-import org.eclipse.emf.validation.IValidationContext;
-
-public class FormalExpressionConstraint extends
- AbstractModelConstraint {
-
- public FormalExpressionConstraint() {
- // TODO Auto-generated constructor stub
- }
-
- @Override
- public IStatus validate(IValidationContext ctx) {
-
- EObject eObj = ctx.getTarget();
- EMFEventType eType = ctx.getEventType();
- // In the case of batch mode.
- if (eType == EMFEventType.NULL) {
- if(eObj instanceof FormalExpression){
- FormalExpression formalExpression = (FormalExpression) eObj;
- boolean error = false;
-// if(formalExpression.getLanguage() == null || formalExpression.getLanguage().length() == 0){
-// ctx.addResult(Bpmn2Package.eINSTANCE.getFormalExpression_Language());
-// error = true;
-// }
- String body = ModelUtil.getExpressionBody(formalExpression);
- if(body == null || body.isEmpty()){
- ctx.addResult(Bpmn2Package.eINSTANCE.getFormalExpression_Body());
- error = true;
- }
- if (error)
- return ctx.createFailureStatus(new Object[] {eObj.eClass().getName()});
- }
- }
- return ctx.createSuccessStatus();
- }
-
-}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/LiveValidationListener.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/LiveValidationListener.java
index 276933fe..5d7d17c0 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/LiveValidationListener.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/LiveValidationListener.java
@@ -15,20 +15,12 @@ package org.eclipse.bpmn2.modeler.core.validation;
import java.util.List;
-import org.eclipse.bpmn2.modeler.core.Activator;
import org.eclipse.bpmn2.modeler.core.utils.ErrorUtils;
-import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.emf.validation.marker.MarkerUtil;
import org.eclipse.emf.validation.model.EvaluationMode;
import org.eclipse.emf.validation.model.IConstraintStatus;
import org.eclipse.emf.validation.service.IValidationListener;
import org.eclipse.emf.validation.service.ValidationEvent;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
/**
* @author Bob Brodt
@@ -48,8 +40,6 @@ public class LiveValidationListener implements IValidationListener {
{
// fabricate a multi-errorList for the MarkerUtil to consume
List<IConstraintStatus> results = event.getValidationResults();
- MultiStatus multi = new MultiStatus(Activator.getDefault().PLUGIN_ID, 1,
- (IStatus[]) results.toArray(new IStatus[results.size()]), Messages.LiveValidationListener_Title, null);
for (IStatus s : results) {
reportError(s);
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/Messages.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/Messages.java
index 48fdba6c..a3a665b4 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/Messages.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/Messages.java
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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
+ ******************************************************************************/
package org.eclipse.bpmn2.modeler.core.validation;
import org.eclipse.osgi.util.NLS;
@@ -8,25 +18,6 @@ public class Messages extends NLS {
public static String BPMN2ProjectValidator_Dont_Ask_Again;
public static String BPMN2ProjectValidator_Invalid_File;
public static String BPMN2ProjectValidator_Title;
- public static String BPMN2ValidationConstraints_0;
- public static String BPMN2ValidationConstraints_2;
- public static String BPMN2ValidationConstraints_29;
- public static String BPMN2ValidationConstraints_Missing_Connection;
- public static String BPMN2ValidationConstraints_30;
- public static String BPMN2ValidationConstraints_31;
- public static String BPMN2ValidationConstraints_32;
- public static String BPMN2ValidationConstraints_33;
- public static String BPMN2ValidationConstraints_45;
- public static String BPMN2ValidationConstraints_46;
- public static String BPMN2ValidationConstraints_48;
- public static String BPMN2ValidationConstraints_49;
- public static String BPMN2ValidationConstraints_Missing_Feature;
- public static String BPMN2ValidationConstraints_52;
- public static String BPMN2ValidationConstraints_6;
- public static String BPMN2ValidationConstraints_7;
- public static String BPMN2ValidationConstraints_Duplicate_Data_Type;
- public static String BPMN2ValidationConstraints_Duplicate_Input;
- public static String BPMN2ValidationConstraints_Duplicate_Output;
public static String LiveValidationListener_Title;
static {
// initialize resource bundle
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/ResourcePropertyTester.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/ResourcePropertyTester.java
index fa4f94e6..70377bfa 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/ResourcePropertyTester.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/ResourcePropertyTester.java
@@ -39,8 +39,8 @@ public class ResourcePropertyTester extends PropertyTester {
if (rt != null) {
ToolPaletteDescriptor tpd = rt.getToolPalette(object);
if (tpd != null) {
- for (String profile : tpd.getProfiles()) {
- if (profile.equals(expectedValue))
+ for (String profileId : tpd.getProfiles()) {
+ if (profileId.equals(expectedValue))
return true;
}
if (expectedValue instanceof String)
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/SyntaxCheckerUtils.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/SyntaxCheckerUtils.java
index d30e7293..12a998b4 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/SyntaxCheckerUtils.java
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/SyntaxCheckerUtils.java
@@ -53,8 +53,8 @@ public class SyntaxCheckerUtils {
// Check the rest of the characters
for (int i = 1; i < nameLength; i++) {
c = name.charAt(i);
- if (Character.isWhitespace(c))
- continue;
+// if (Character.isWhitespace(c))
+// continue;
if (!isNCNameChar(c)) {
c = '_';
}
@@ -68,13 +68,73 @@ public class SyntaxCheckerUtils {
|| _isNonAsciiDigit(c) || isIdeographic(c) || isCombiningChar(c) || isExtender(c);
}
+ public static final boolean isJavaIdentifier(String name) {
+ if (name==null || name.isEmpty())
+ return false;
+
+ int nameLength = name.length();
+
+ // Check first character
+ char c = name.charAt(0);
+
+ if (Character.isJavaIdentifierStart(c)) {
+ // Check the rest of the characters
+ for (int i = 1; i < nameLength; i++) {
+ c = name.charAt(i);
+ if (!Character.isJavaIdentifierPart(c)) {
+ return false;
+ }
+ }
+
+ // All characters have been checked
+ return true;
+ }
+
+ return false;
+ }
+
+ public static final String toJavaIdentifier(String name) {
+ if (name==null || name.isEmpty())
+ return "_"; //$NON-NLS-1$
+
+ StringBuffer ncname = new StringBuffer();
+ int nameLength = name.length();
+
+ // Check first character
+ char c = name.charAt(0);
+
+ if (Character.isJavaIdentifierStart(c))
+ ncname.append(c);
+ else
+ ncname.append('_');
+ // Check the rest of the characters
+ for (int i = 1; i < nameLength; i++) {
+ c = name.charAt(i);
+ if (!Character.isJavaIdentifierPart(c)) {
+ c = '_';
+ }
+ ncname.append(c);
+ }
+ return ncname.toString();
+ }
+
+ public static boolean isJavaPackageName(String name) {
+ if (name==null || name.isEmpty())
+ return false;
+ for (String part : name.split("\\.")) {
+ if (!isJavaIdentifier(part))
+ return false;
+ }
+ return true;
+ }
+
public static final boolean isLetter(char c) {
return _isAsciiBaseChar(c) || _isNonAsciiBaseChar(c) || isIdeographic(c);
}
public static final String toXMLString(String string) {
if (string==null || string.isEmpty())
- return "";
+ return ""; //$NON-NLS-1$
StringBuffer xmlString = new StringBuffer();
int stringLength = string.length();
@@ -82,15 +142,15 @@ public class SyntaxCheckerUtils {
for (int i = 0; i < stringLength; i++) {
char c = string.charAt(i);
if (c == '"')
- xmlString.append("&quot;");
+ xmlString.append("&quot;"); //$NON-NLS-1$
else if (c == '&')
- xmlString.append("&amp;");
+ xmlString.append("&amp;"); //$NON-NLS-1$
else if (c == '\'')
- xmlString.append("&apos;");
+ xmlString.append("&apos;"); //$NON-NLS-1$
else if (c == '<')
- xmlString.append("&lt;");
+ xmlString.append("&lt;"); //$NON-NLS-1$
else if (c == '>')
- xmlString.append("&gt;");
+ xmlString.append("&gt;"); //$NON-NLS-1$
else
xmlString.append(c);
}
@@ -99,7 +159,7 @@ public class SyntaxCheckerUtils {
public static final String fromXMLString(String xmlString) {
if (xmlString==null || xmlString.isEmpty())
- return "";
+ return ""; //$NON-NLS-1$
StringBuffer string = new StringBuffer();
int stringLength = xmlString.length();
@@ -110,15 +170,15 @@ public class SyntaxCheckerUtils {
int si = xmlString.indexOf(';', i);
if (si>0) {
String ss = xmlString.substring(i, si);
- if ("&quot".equals(ss))
+ if ("&quot".equals(ss)) //$NON-NLS-1$
c = '"';
- else if ("&amp".equals(ss))
+ else if ("&amp".equals(ss)) //$NON-NLS-1$
c = '&';
- else if ("&apos".equals(ss))
+ else if ("&apos".equals(ss)) //$NON-NLS-1$
c = '\'';
- else if ("&lt".equals(ss))
+ else if ("&lt".equals(ss)) //$NON-NLS-1$
c = '<';
- else if ("&gt".equals(ss))
+ else if ("&gt".equals(ss)) //$NON-NLS-1$
c = '>';
else
si = -1;
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/TaskNameNotEmpty.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/TaskNameNotEmpty.java
deleted file mode 100644
index 7ffbcf6f..00000000
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/TaskNameNotEmpty.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2012 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
- *******************************************************************************/
-package org.eclipse.bpmn2.modeler.core.validation;
-
-import org.eclipse.bpmn2.Bpmn2Package;
-import org.eclipse.bpmn2.Task;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.validation.AbstractModelConstraint;
-import org.eclipse.emf.validation.EMFEventType;
-import org.eclipse.emf.validation.IValidationContext;
-
-public class TaskNameNotEmpty extends AbstractModelConstraint {
-
- public TaskNameNotEmpty() {
- // TODO Auto-generated constructor stub
- }
-
- @Override
- public IStatus validate(IValidationContext ctx) {
-
- EObject eObj = ctx.getTarget();
- EMFEventType eType = ctx.getEventType();
- // In the case of batch mode.
- if (eType == EMFEventType.NULL) {
- if (eObj instanceof Task) {
- Task t = (Task) eObj;
- if (t.getName() == null || t.getName().length() == 0) {
- ctx.addResult(t.eClass().getEStructuralFeature("name")); //$NON-NLS-1$
- return ctx.createFailureStatus(new Object[] { eObj.eClass().getName() });
- }
- }
- }
- return ctx.createSuccessStatus();
- }
-
-}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/ValidIdConstraint.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/ValidIdConstraint.java
deleted file mode 100644
index 20e23d42..00000000
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/ValidIdConstraint.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2012 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.validation;
-
-import java.util.HashSet;
-
-import org.eclipse.bpmn2.BaseElement;
-import org.eclipse.bpmn2.Bpmn2Package;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.ecore.EClass;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.validation.AbstractModelConstraint;
-import org.eclipse.emf.validation.EMFEventType;
-import org.eclipse.emf.validation.IValidationContext;
-
-public class ValidIdConstraint extends AbstractModelConstraint {
-
- protected static HashSet<EClass> idOptional = new HashSet<EClass>();
- static {
- idOptional.add(Bpmn2Package.eINSTANCE.getDefinitions());
- // TODO: are there other BPMN2 object types whose IDs are optional?
- }
-
- @Override
- public IStatus validate(IValidationContext ctx) {
- EObject eObj = ctx.getTarget();
- EMFEventType eType = ctx.getEventType();
-
- if (!idOptional.contains(eObj.eClass())) {
- // In the case of batch mode.
- if (eType == EMFEventType.NULL) {
- String id = null;
- if (eObj instanceof BaseElement) {
- id = ((BaseElement)eObj).getId();
- }
-
- if (!SyntaxCheckerUtils.isNCName(id)) {
- return ctx.createFailureStatus(new Object[] {eObj.eClass().getName()});
- }
- // In the case of live mode.
- } else {
- String newValue = (String) ctx.getFeatureNewValue();
-
- if (!SyntaxCheckerUtils.isNCName(newValue)) {
- return ctx.createFailureStatus(new Object[] {eObj.eClass().getName()});
- }
- }
- }
-
- return ctx.createSuccessStatus();
- }
-
-}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/messages.properties b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/messages.properties
index cc71ae1a..b86fd1c1 100644
--- a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/messages.properties
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/messages.properties
@@ -1,24 +1,15 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2011, 2012, 2013, 2014 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
+#-------------------------------------------------------------------------------
BPMN2ProjectValidator_No_Project_Nature=The project "{0}" has not been configured with the BPMN2 Project Nature.\n\nAdding the BPMN2 Project Nature will cause all BPMN2 files in this project to be validated automatically whenever the project is built.\n\nDo you want to add this Nature to the Project now?
BPMN2ProjectValidator_Dont_Ask_Again=Don't ask me again
BPMN2ProjectValidator_Invalid_File=Invalid bpmn2 file
BPMN2ProjectValidator_Title=Configure BPMN2 Project Nature
-BPMN2ValidationConstraints_0=Process type must be either "Private" or "Public"
-BPMN2ValidationConstraints_Missing_Connection={0} has no {1} Connections
-BPMN2ValidationConstraints_Missing_Feature={0} has missing or incomplete {1}
-BPMN2ValidationConstraints_Duplicate_Data_Type=The {0}{1} Data Type {2} is already defined
-BPMN2ValidationConstraints_Duplicate_Input=Input Parameter "{0}" is already defined
-BPMN2ValidationConstraints_Duplicate_Output=Output Parameter "{0}" is already defined
-BPMN2ValidationConstraints_2=No targetNamespace defined
-BPMN2ValidationConstraints_29=Invalid Gateway direction for Exclusive Gateway. It should be "Converging" or "Diverging"
-BPMN2ValidationConstraints_30=Invalid Gateway direction for EventBased Gateway. It should be "Diverging"
-BPMN2ValidationConstraints_31=Invalid Gateway direction for Parallel Gateway. It should be "Converging" or "Diverging"
-BPMN2ValidationConstraints_32=Invalid Gateway direction for Inclusive Gateway. It should be "Converging" or "Diverging"
-BPMN2ValidationConstraints_33=Invalid Gateway direction for Complex Gateway. It should be "Converging" or "Diverging"
-BPMN2ValidationConstraints_45=ChoreographyActivity must have at least two Participants
-BPMN2ValidationConstraints_46=ChoreographyActivity has no initiating Participant
-BPMN2ValidationConstraints_48=Message Flow source is not a Participant of the Choreography Task
-BPMN2ValidationConstraints_49=Message Flow target is not a Participant of the Choreography Task
-BPMN2ValidationConstraints_52=Timer Event has no Timer definition
-BPMN2ValidationConstraints_6=Process has no Start Event
-BPMN2ValidationConstraints_7=Process has no End Event
LiveValidationListener_Title=OCL validation errors found
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/AbstractBpmn2ElementValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/AbstractBpmn2ElementValidator.java
new file mode 100644
index 00000000..f7068d99
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/AbstractBpmn2ElementValidator.java
@@ -0,0 +1,255 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+import org.eclipse.bpmn2.Bpmn2Package;
+import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
+import org.eclipse.bpmn2.modeler.core.validation.StatusList;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.validation.EMFEventType;
+import org.eclipse.emf.validation.IValidationContext;
+import org.eclipse.emf.validation.model.ConstraintStatus;
+
+/**
+ *
+ */
+public abstract class AbstractBpmn2ElementValidator<T extends EObject> implements IBpmn2ElementValidator<T> {
+
+ protected AbstractBpmn2ElementValidator<?> parent;
+ protected IValidationContext ctx;
+ protected StatusList result = new StatusList();
+
+ public AbstractBpmn2ElementValidator(IValidationContext ctx) {
+ this.ctx = ctx;
+ }
+
+ public AbstractBpmn2ElementValidator(AbstractBpmn2ElementValidator<?> other) {
+ this.parent = other.getParent();
+ this.ctx = parent.ctx;
+ this.result = parent.result;
+ }
+
+ /**
+ * Factory method for creating a validator object. The names of the Java
+ * classes that implement a validator must be in the form <BPMN2 type
+ * name>Validator and must be declared public. This factory method searches
+ * for such classes in the same package as this
+ * AbstractBpmn2ElementValidator base class. If such a class is found, a new
+ * instance is constructed and returned; otherwise null is returned.
+ *
+ * @param ctx the IValidationContext used to construct the validator class
+ * @param c the BPMN2 element type. If this is an implementation class and
+ * not an interface, the trailing "Impl" is truncated to form the
+ * type name.
+ * @return a validator class if found, otherwise null.
+ */
+ public static IBpmn2ElementValidator<?> getValidator(IValidationContext ctx, Class<?> c) {
+ String className = AbstractBpmn2ElementValidator.class.getPackage().getName() + "." + c.getSimpleName();
+ if (className.endsWith("Impl")) {
+ className = className.replaceFirst("Impl$", "");
+ }
+ className += "Validator";
+ try {
+ Class<?> validatorClass = AbstractBpmn2ElementValidator.class.getClassLoader().loadClass(className);
+ if (validatorClass != null) {
+ return (AbstractBpmn2ElementValidator<?>) validatorClass.getConstructor(IValidationContext.class)
+ .newInstance(ctx);
+ }
+ } catch (Exception e) {
+ }
+ return null;
+ }
+
+ public static IBpmn2ElementValidator<?> getValidator(IBpmn2ElementValidator<?> parent, Class<?> c) {
+ String className = AbstractBpmn2ElementValidator.class.getPackage().getName() + "." + c.getSimpleName();
+ if (className.endsWith("Impl")) {
+ className = className.replaceFirst("Impl$", "");
+ }
+ className += "Validator";
+ try {
+ Class<?> validatorClass = AbstractBpmn2ElementValidator.class.getClassLoader().loadClass(className);
+ if (validatorClass != null) {
+ return (AbstractBpmn2ElementValidator<?>) validatorClass.getConstructor(AbstractBpmn2ElementValidator.class)
+ .newInstance(parent);
+ }
+ } catch (Exception e) {
+ }
+ return null;
+ }
+
+ protected AbstractBpmn2ElementValidator() {
+ }
+
+ protected void addStatus(EObject object, EObject[] resultLocus, int severity, String messagePattern, Object... messageArguments) {
+ IStatus status = ConstraintStatus.createStatus(ctx, object, Arrays.asList(resultLocus), severity, 0, messagePattern, messageArguments);
+ addStatus(status);
+ }
+
+ protected void addStatus(EObject object, int severity, String messagePattern, Object... messageArguments) {
+ IStatus status = ConstraintStatus.createStatus(ctx, object, null, severity, 0, messagePattern, messageArguments);
+ addStatus(status);
+ }
+
+ protected void addStatus(EObject object, String featureName, int severity, String messagePattern, Object... messageArguments) {
+ List<EObject> resultLocus = null;
+ resultLocus = new ArrayList<EObject>();
+ EStructuralFeature feature = object.eClass().getEStructuralFeature(featureName);
+ if (feature != null) {
+ resultLocus.add(feature);
+ }
+ IStatus status = ConstraintStatus.createStatus(ctx, object, resultLocus, severity, 0, messagePattern, messageArguments);
+ addStatus(status);
+ }
+
+ protected void addStatus(EObject object, String featureName, EObject[] resultLocus, int severity, String messagePattern, Object... messageArguments) {
+ List<EObject> rsltLocus = null;
+ rsltLocus = new ArrayList<EObject>();
+ rsltLocus.addAll(Arrays.asList(resultLocus));
+ EStructuralFeature feature = object.eClass().getEStructuralFeature(featureName);
+ if (feature != null) {
+ rsltLocus.add(feature);
+ }
+ IStatus status = ConstraintStatus.createStatus(ctx, object, rsltLocus, severity, 0, messagePattern, messageArguments);
+ addStatus(status);
+ }
+
+ protected void addMissingFeatureStatus(EObject object, String featureName, int severity) {
+ EStructuralFeature feature = object.eClass().getEStructuralFeature(featureName);
+ // change error message slightly for connections
+ String message;
+ if (feature!=null && feature.getEType() == Bpmn2Package.eINSTANCE.getSequenceFlow())
+ message = "{0} {1} has no {2} Connections";
+ else
+ message = "{0} {1} has no {2}";
+ if (feature!=null)
+ featureName = getLabel(object, feature);
+ addStatus(object, featureName, severity, message,
+ getLabel(object),
+ getName(object),
+ featureName);
+ }
+
+ protected void addMissingFeatureStatus(EObject object, String featureName, EObject[] resultLocus, int severity) {
+ EStructuralFeature feature = object.eClass().getEStructuralFeature(featureName);
+ // change error message slightly for connections
+ String message;
+ if (feature!=null && feature.getEType() == Bpmn2Package.eINSTANCE.getSequenceFlow())
+ message = "{0} {1} has no {2} Connections";
+ else
+ message = "{0} {1} has no {2}";
+ if (feature!=null)
+ featureName = getLabel(object, feature);
+ addStatus(object, featureName, resultLocus, severity, message,
+ getLabel(object),
+ getName(object),
+ featureName);
+ }
+
+ protected void addStatus(IStatus status) {
+ if (status.getSeverity()!=Status.OK)
+ result.add(status);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.IBpmn2ElementValidator#getResult()
+ */
+ public IStatus getResult() {
+ if (result.isEmpty())
+ return ctx.createSuccessStatus();
+ if (result.size() == 1)
+ return result.get(0);
+ return ConstraintStatus.createMultiStatus(ctx, result);
+ }
+
+ protected AbstractBpmn2ElementValidator<?> getParent() {
+ if (parent == null)
+ return this;
+ return parent;
+ }
+
+ protected String getLabel(EObject object) {
+ return ModelUtil.getLabel(object);
+ }
+
+ protected String getLabel(EObject object, EStructuralFeature feature) {
+ return ModelUtil.getLabel(object, feature);
+ }
+
+ protected String getName(EObject object) {
+ return ModelUtil.getDisplayName(object);
+ }
+
+ /**
+ * Convenience method for testing if a given object is null or empty.
+ * The meaning of "empty" varies depending on the object type.
+ *
+ * @param object the object to be tested
+ * @return true if the object is null or empty
+ */
+ @SuppressWarnings("rawtypes")
+ protected static boolean isEmpty(Object object) {
+ if (object == null)
+ return true;
+ else if (object instanceof String) {
+ String str = (String) object;
+ return str == null || str.isEmpty();
+ } else if (object instanceof List) {
+ return ((List<?>) object).isEmpty();
+ } else if (ModelUtil.isStringWrapper(object)) {
+ String w = ModelUtil.getStringWrapperValue(object);
+ if (w == null || w.isEmpty())
+ return true;
+ }
+
+ return false;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.IBpmn2ElementValidator#validate(java.lang.Object)
+ */
+ public abstract IStatus validate(T object);
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.IBpmn2ElementValidator#checkSuperType(org.eclipse.emf.ecore.EClass, java.lang.Object)
+ */
+ public boolean checkSuperType(EClass eClass, T object) {
+ return false;
+ }
+
+ /**
+ * Check if the Validation Context indicates a Live validation.
+ *
+ * @param ctx the Validation Context
+ * @return true if the Validation Context has a non-null EMF Event type,
+ * indicating this is a Live validation.
+ */
+ protected boolean isLiveValidation() {
+ return ctx.getEventType() != EMFEventType.NULL;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.IBpmn2ElementValidator#doLiveValidation()
+ */
+ public boolean doLiveValidation() {
+ return false;
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ActivityValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ActivityValidator.java
new file mode 100644
index 00000000..e08c96a0
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ActivityValidator.java
@@ -0,0 +1,55 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.bpmn2.Activity;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class ActivityValidator extends AbstractBpmn2ElementValidator<Activity> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public ActivityValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public ActivityValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(Activity object) {
+ return getResult();
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/AssignmentValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/AssignmentValidator.java
new file mode 100644
index 00000000..76ae7ade
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/AssignmentValidator.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.bpmn2.Assignment;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class AssignmentValidator extends AbstractBpmn2ElementValidator<Assignment> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public AssignmentValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public AssignmentValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(Assignment object) {
+ if (isEmpty(object.getFrom()))
+ addMissingFeatureStatus(object,"from",Status.ERROR);
+ if (isEmpty(object.getTo()))
+ addMissingFeatureStatus(object,"To",Status.ERROR);
+ return getResult();
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/AssociationValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/AssociationValidator.java
new file mode 100644
index 00000000..3ae11fe8
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/AssociationValidator.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.bpmn2.Association;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class AssociationValidator extends AbstractBpmn2ElementValidator<Association> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public AssociationValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public AssociationValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(Association object) {
+ if (object.getSourceRef()==null)
+ this.addStatus(object, Status.ERROR, "Association is not connected to a source element");
+ if (object.getTargetRef()==null)
+ this.addStatus(object, Status.ERROR, "Association is not connected to a target element");
+ return getResult();
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/BaseElementValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/BaseElementValidator.java
new file mode 100644
index 00000000..047725ee
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/BaseElementValidator.java
@@ -0,0 +1,99 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import java.util.HashSet;
+
+import org.eclipse.bpmn2.BaseElement;
+import org.eclipse.bpmn2.Bpmn2Package;
+import org.eclipse.bpmn2.Definitions;
+import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
+import org.eclipse.bpmn2.modeler.core.validation.SyntaxCheckerUtils;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class BaseElementValidator extends AbstractBpmn2ElementValidator<BaseElement> {
+
+ protected static HashSet<EClass> idOptional = new HashSet<EClass>();
+ static {
+ idOptional.add(Bpmn2Package.eINSTANCE.getDefinitions());
+ // TODO: are there other BPMN2 object types whose IDs are optional?
+ }
+
+ /**
+ * @param ctx
+ */
+ public BaseElementValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * @param other
+ */
+ @SuppressWarnings("rawtypes")
+ public BaseElementValidator(AbstractBpmn2ElementValidator other) {
+ super(other);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(BaseElement object) {
+ if (!idOptional.contains(object.eClass())) {
+ // In the case of batch mode.
+ String id = object.getId();
+ if (isEmpty(id)) {
+ addStatus(object, "id", Status.ERROR, "The {0} ID can not be empty", object.eClass().getName());
+ }
+ else if (!SyntaxCheckerUtils.isNCName(id)) {
+ addStatus(object, "id", Status.ERROR, "The {0} ID is invalid: {1}", object.eClass().getName(), id);
+ }
+
+ Definitions definitions = ModelUtil.getDefinitions(object);
+ TreeIterator<EObject> iter = definitions.eAllContents();
+ while (iter.hasNext()) {
+ EObject o2 = iter.next();
+ if (o2 instanceof BaseElement && object!=o2) {
+ String id2;
+ id2 = ((BaseElement)o2).getId();
+ if (id!=null && id2!=null) {
+ if (id.equals(id2)) {
+ addStatus(object, Status.ERROR,
+ "{0} and {1} have the same ID",
+ getLabel(object)+" "+getName(object), //$NON-NLS-1$
+ getLabel(o2)+" "+getName(o2) //$NON-NLS-1$
+ );
+ }
+ }
+ }
+ }
+
+ }
+
+ return getResult();
+ }
+
+ public boolean doLiveValidation() {
+ return true;
+ }
+
+}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/CallActivityValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/CallActivityValidator.java
new file mode 100644
index 00000000..16d692fb
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/CallActivityValidator.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.bpmn2.CallActivity;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class CallActivityValidator extends AbstractBpmn2ElementValidator<CallActivity> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public CallActivityValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public CallActivityValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(CallActivity object) {
+ if (object.getCalledElementRef()==null)
+ addMissingFeatureStatus(object,"calledElementRef",Status.ERROR);
+ return getResult();
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/CatchEventValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/CatchEventValidator.java
new file mode 100644
index 00000000..d5b17ced
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/CatchEventValidator.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.bpmn2.CatchEvent;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class CatchEventValidator extends AbstractBpmn2ElementValidator<CatchEvent> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public CatchEventValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public CatchEventValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(CatchEvent object) {
+ return getResult();
+ }
+
+ @Override
+ public boolean checkSuperType(EClass eClass, CatchEvent object) {
+ if ("Event".equals(eClass.getName()))
+ return true;
+ return false;
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ChoreographyActivityValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ChoreographyActivityValidator.java
new file mode 100644
index 00000000..7768e5aa
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ChoreographyActivityValidator.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.bpmn2.ChoreographyActivity;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class ChoreographyActivityValidator extends AbstractBpmn2ElementValidator<ChoreographyActivity> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public ChoreographyActivityValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public ChoreographyActivityValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(ChoreographyActivity object) {
+ if (object.getParticipantRefs().size()<2)
+ addStatus(object,"particpiantRefs",Status.ERROR,"ChoreographyActivity must have at least two Participants");
+ if (object.getInitiatingParticipantRef()==null)
+ addStatus(object,"particpiantRefs",Status.ERROR,"ChoreographyActivity has no initiating Participant");
+ return getResult();
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ChoreographyTaskValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ChoreographyTaskValidator.java
new file mode 100644
index 00000000..2442d42f
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ChoreographyTaskValidator.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.bpmn2.ChoreographyTask;
+import org.eclipse.bpmn2.InteractionNode;
+import org.eclipse.bpmn2.MessageFlow;
+import org.eclipse.bpmn2.modeler.core.validation.Messages;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class ChoreographyTaskValidator extends AbstractBpmn2ElementValidator<ChoreographyTask> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public ChoreographyTaskValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public ChoreographyTaskValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(ChoreographyTask object) {
+ for (MessageFlow mf : object.getMessageFlowRef()) {
+ InteractionNode in = mf.getSourceRef();
+ if (!object.getParticipantRefs().contains(in)) {
+ addStatus(object,"participantRefs",Status.ERROR,"Message Flow source is not a Participant of the Choreography Task");
+ }
+ in = mf.getTargetRef();
+ if (!object.getParticipantRefs().contains(in)) {
+ addStatus(object,"participantRefs",Status.ERROR,"Message Flow target is not a Participant of the Choreography Task");
+ }
+ }
+ return getResult();
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/DataAssociationValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/DataAssociationValidator.java
new file mode 100644
index 00000000..5d925714
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/DataAssociationValidator.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.bpmn2.DataAssociation;
+import org.eclipse.bpmn2.DataInputAssociation;
+import org.eclipse.bpmn2.DataOutputAssociation;
+import org.eclipse.bpmn2.Event;
+import org.eclipse.bpmn2.ItemAwareElement;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class DataAssociationValidator extends AbstractBpmn2ElementValidator<DataAssociation> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public DataAssociationValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public DataAssociationValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(DataAssociation object) {
+ if (!(object.eContainer() instanceof Event)) {
+ // Note that missing source/target of Data Associations for Events
+ // is already handled in EventDefinitionValidator
+ int severity = ProcessValidator.isContainingProcessExecutable(object) ? Status.ERROR : Status.WARNING;
+ EObject[] resultLocus = new EObject[] {object.eContainer()};
+ if (object instanceof DataOutputAssociation) {
+ if (isEmpty(object.getTargetRef()) && object.getAssignment().size()==0 && object.getTransformation()==null) {
+ ItemAwareElement source = object.getSourceRef().size()>0 ? object.getSourceRef().get(0) : null;
+ if (source!=null) {
+ addStatus(object, resultLocus, severity, "Output Parameter {0} is uninitialized",
+ getName(source));
+ }
+ else {
+ addMissingFeatureStatus(object, "targetRef", resultLocus, severity);
+ }
+ }
+ }
+ else if (object instanceof DataInputAssociation) {
+ if (isEmpty(object.getSourceRef()) && object.getAssignment().size()==0 && object.getTransformation()==null) {
+ ItemAwareElement target = object.getTargetRef();
+ if (target!=null) {
+ addStatus(object, resultLocus, severity, "Input Parameter {0} is uninitialized",
+ getName(target));
+ }
+ else {
+ addMissingFeatureStatus(object, "sourceRef", resultLocus, severity);
+ }
+ }
+ }
+ }
+ return getResult();
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/DataObjectValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/DataObjectValidator.java
new file mode 100644
index 00000000..394b3e6d
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/DataObjectValidator.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.bpmn2.DataObject;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class DataObjectValidator extends AbstractBpmn2ElementValidator<DataObject> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public DataObjectValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public DataObjectValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(DataObject object) {
+ if (isEmpty(object.getName()))
+ addMissingFeatureStatus(object,"name",Status.ERROR);
+ return getResult();
+ }
+
+ public boolean checkSuperType(EClass eClass, DataObject object) {
+ return true;
+ }
+}
+
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/DefinitionsValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/DefinitionsValidator.java
new file mode 100644
index 00000000..f93a0084
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/DefinitionsValidator.java
@@ -0,0 +1,72 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.bpmn2.BaseElement;
+import org.eclipse.bpmn2.Definitions;
+import org.eclipse.bpmn2.Import;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class DefinitionsValidator extends AbstractBpmn2ElementValidator<Definitions> {
+
+ public DefinitionsValidator(AbstractBpmn2ElementValidator<?> other) {
+ super(other);
+ }
+
+ public DefinitionsValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(Definitions object) {
+ if (object.getTargetNamespace()==null || object.getTargetNamespace().isEmpty()) {
+ addStatus(object, Status.ERROR, "No targetNamespace defined");
+ }
+ for (Import elem : object.getImports()) {
+ if (isEmpty(elem.getLocation())) {
+ addMissingFeatureStatus(elem,"location",Status.ERROR); //$NON-NLS-1$
+ }
+ if (isEmpty(elem.getNamespace())) {
+ addMissingFeatureStatus(elem,"namespace",Status.ERROR); //$NON-NLS-1$
+ }
+ if (isEmpty(elem.getImportType())) {
+ addMissingFeatureStatus(elem,"importType",Status.ERROR); //$NON-NLS-1$
+ }
+ }
+ if (isLiveValidation()) {
+ TreeIterator<EObject> iter = object.eAllContents();
+ while (iter.hasNext()) {
+ EObject o = iter.next();
+ if (o instanceof BaseElement) {
+ addStatus(new BaseElementValidator(this).validate((BaseElement)o));
+ }
+ }
+ }
+ return getResult();
+ }
+
+ public boolean doLiveValidation() {
+ return true;
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/EndEventValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/EndEventValidator.java
new file mode 100644
index 00000000..239d1f6b
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/EndEventValidator.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.bpmn2.EndEvent;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class EndEventValidator extends AbstractBpmn2ElementValidator<EndEvent> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public EndEventValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public EndEventValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(EndEvent object) {
+ return getResult();
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ErrorValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ErrorValidator.java
new file mode 100644
index 00000000..ee4ba858
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ErrorValidator.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.bpmn2.Error;
+import org.eclipse.bpmn2.ItemDefinition;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class ErrorValidator extends AbstractBpmn2ElementValidator<Error> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public ErrorValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public ErrorValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(Error object) {
+ if (ProcessValidator.isContainingProcessExecutable(object)) {
+ // Only report problems with this object one time.
+ // This same error should not be reported when validating
+ // other objects that references this object.
+ if (this.parent==null) {
+ if (isEmpty(object.getErrorCode()))
+ addMissingFeatureStatus(object,"errorCode",Status.ERROR); //$NON-NLS-1$
+
+ ItemDefinition itemDefinition = object.getStructureRef();
+ if (itemDefinition!=null) {
+ new ItemDefinitionValidator(this).validate(itemDefinition);
+ }
+ else
+ addMissingFeatureStatus(object,"structureRef",Status.ERROR); //$NON-NLS-1$
+ }
+ }
+ return getResult();
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/EscalationValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/EscalationValidator.java
new file mode 100644
index 00000000..5335d4de
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/EscalationValidator.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.bpmn2.Escalation;
+import org.eclipse.bpmn2.ItemDefinition;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class EscalationValidator extends AbstractBpmn2ElementValidator<Escalation> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public EscalationValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public EscalationValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(Escalation object) {
+ if (ProcessValidator.isContainingProcessExecutable(object)) {
+ // Only report problems with this object one time.
+ // This same error should not be reported when validating
+ // other objects that references this object.
+ if (this.parent==null) {
+ if (isEmpty(object.getEscalationCode()))
+ addMissingFeatureStatus(object,"escalationCode",Status.ERROR); //$NON-NLS-1$
+
+ ItemDefinition itemDefinition = object.getStructureRef();
+ if (itemDefinition!=null) {
+ new ItemDefinitionValidator(this).validate(itemDefinition);
+ }
+ else
+ addMissingFeatureStatus(object,"structureRef",Status.ERROR); //$NON-NLS-1$
+ }
+ }
+ return getResult();
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/EventDefinitionValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/EventDefinitionValidator.java
new file mode 100644
index 00000000..c5456139
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/EventDefinitionValidator.java
@@ -0,0 +1,141 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.bpmn2.Activity;
+import org.eclipse.bpmn2.CompensateEventDefinition;
+import org.eclipse.bpmn2.ConditionalEventDefinition;
+import org.eclipse.bpmn2.DataAssociation;
+import org.eclipse.bpmn2.DataInputAssociation;
+import org.eclipse.bpmn2.DataOutputAssociation;
+import org.eclipse.bpmn2.Error;
+import org.eclipse.bpmn2.ErrorEventDefinition;
+import org.eclipse.bpmn2.Escalation;
+import org.eclipse.bpmn2.EscalationEventDefinition;
+import org.eclipse.bpmn2.Event;
+import org.eclipse.bpmn2.EventDefinition;
+import org.eclipse.bpmn2.FormalExpression;
+import org.eclipse.bpmn2.ItemAwareElement;
+import org.eclipse.bpmn2.Message;
+import org.eclipse.bpmn2.MessageEventDefinition;
+import org.eclipse.bpmn2.Signal;
+import org.eclipse.bpmn2.SignalEventDefinition;
+import org.eclipse.bpmn2.TimerEventDefinition;
+import org.eclipse.bpmn2.modeler.core.utils.EventDefinitionsUtil;
+import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
+import org.eclipse.bpmn2.modeler.core.utils.Tuple;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class EventDefinitionValidator extends AbstractBpmn2ElementValidator<EventDefinition> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public EventDefinitionValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public EventDefinitionValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(EventDefinition ed) {
+ Event event = (Event) ed.eContainer();
+ if (ed instanceof TimerEventDefinition) {
+ TimerEventDefinition ted = (TimerEventDefinition) ed;
+ if (ted.getTimeDate() == null && ted.getTimeDuration() == null && ted.getTimeCycle() == null) {
+ addMissingFeatureStatus(event,"Timer definition", Status.ERROR);
+ }
+ } else if (ed instanceof SignalEventDefinition) {
+ Signal signal = ((SignalEventDefinition) ed).getSignalRef();
+ if (signal==null)
+ addMissingFeatureStatus(event,"Signal definition", Status.ERROR);
+ else
+ new SignalValidator(this).validate(signal);
+ } else if (ed instanceof ErrorEventDefinition) {
+ Error error = ((ErrorEventDefinition) ed).getErrorRef();
+ if (error==null)
+ addMissingFeatureStatus(event,"Error definition", Status.ERROR);
+ else
+ new ErrorValidator(this).validate(error);
+ } else if (ed instanceof ConditionalEventDefinition) {
+ FormalExpression expression = (FormalExpression) ((ConditionalEventDefinition) ed).getCondition();
+ if (expression==null || isEmpty(expression.getBody()))
+ addMissingFeatureStatus(event,"condition expression", Status.ERROR);
+ else
+ new ExpressionValidator(this).validate(expression);
+ } else if (ed instanceof EscalationEventDefinition) {
+ Escalation escalation = ((EscalationEventDefinition) ed).getEscalationRef();
+ if (escalation==null)
+ addMissingFeatureStatus(event,"Escalation definition", Status.ERROR);
+ else
+ new EscalationValidator(this).validate(escalation);
+ } else if (ed instanceof MessageEventDefinition) {
+ Message message = ((MessageEventDefinition) ed).getMessageRef();
+ if (message==null)
+ addMissingFeatureStatus(event,"Message definition", Status.ERROR);
+ else
+ new MessageValidator(this).validate(message);
+ } else if (ed instanceof CompensateEventDefinition) {
+ Activity activity = ((CompensateEventDefinition) ed).getActivityRef();
+ if (activity==null)
+ addMissingFeatureStatus(event,"Called Activity", Status.ERROR);
+ else
+ new ActivityValidator(this).validate(activity);
+ }
+
+ if (EventDefinitionsUtil.hasItemDefinition(ed)) {
+ // get Data Association and make sure both source and target are defined
+ Tuple<ItemAwareElement,DataAssociation> param = EventDefinitionsUtil.getIOParameter(event, ed);
+ DataAssociation da = param.getSecond();
+ int severity = ProcessValidator.isContainingProcessExecutable(event) ? Status.ERROR : Status.WARNING;
+ if (da instanceof DataInputAssociation) {
+ if (((DataInputAssociation)da).getSourceRef().size()==0) {
+ addStatus(event,severity,"Input to {0} defined in {1} is not mapped to a Source data item",
+ ModelUtil.getLabel(ed),
+ ModelUtil.getLabel(event));
+ }
+ }
+ else if (da instanceof DataOutputAssociation) {
+ if (((DataOutputAssociation)da).getTargetRef()==null) {
+ addStatus(event,severity,"Output from {0} is not mapped to a Target data item",
+ ModelUtil.getLabel(ed));
+ }
+ }
+ }
+
+ return getResult();
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/EventValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/EventValidator.java
new file mode 100644
index 00000000..fa98d639
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/EventValidator.java
@@ -0,0 +1,73 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import java.util.List;
+
+import org.eclipse.bpmn2.EndEvent;
+import org.eclipse.bpmn2.Event;
+import org.eclipse.bpmn2.EventDefinition;
+import org.eclipse.bpmn2.StartEvent;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class EventValidator extends AbstractBpmn2ElementValidator<Event> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public EventValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public EventValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(Event object) {
+ if (ProcessValidator.isContainingProcessExecutable(object)) {
+ EStructuralFeature feature = object.eClass().getEStructuralFeature("eventDefinitions"); //$NON-NLS-1$
+ Assert.isNotNull(feature);
+ List<EventDefinition> eventdefs = (List<EventDefinition>) object.eGet(feature);
+ if (eventdefs.size()==0) {
+ if (!(object instanceof StartEvent || object instanceof EndEvent))
+ addMissingFeatureStatus(object,"eventDefinitions",Status.ERROR); //$NON-NLS-1$
+ }
+ // Note that Event Definitions will be validated by the EventDefinitionsValidator
+ }
+ return getResult();
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ExpressionValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ExpressionValidator.java
new file mode 100644
index 00000000..8c59ea70
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ExpressionValidator.java
@@ -0,0 +1,67 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.bpmn2.Expression;
+import org.eclipse.bpmn2.FormalExpression;
+import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class ExpressionValidator extends AbstractBpmn2ElementValidator<Expression> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public ExpressionValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public ExpressionValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(Expression object) {
+ if (object instanceof FormalExpression) {
+ FormalExpression formalExpression = (FormalExpression) object;
+ if (ProcessValidator.isContainingProcessExecutable(object)) {
+ // if the Process is executable the FormalExpression body can not be empty
+ String body = ModelUtil.getExpressionBody(formalExpression);
+ if(body == null || body.isEmpty()){
+ addStatus(formalExpression, Status.ERROR, "Expression is empty");
+ }
+ }
+ }
+ return getResult();
+ }
+
+}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/FlowElementsContainerValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/FlowElementsContainerValidator.java
new file mode 100644
index 00000000..a04ca3ef
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/FlowElementsContainerValidator.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.bpmn2.FlowElement;
+import org.eclipse.bpmn2.FlowElementsContainer;
+import org.eclipse.bpmn2.FlowNode;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class FlowElementsContainerValidator extends AbstractBpmn2ElementValidator<FlowElementsContainer> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public FlowElementsContainerValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public FlowElementsContainerValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(FlowElementsContainer object) {
+ FlowNodeValidator validator = new FlowNodeValidator(this);
+ for (FlowElement fe : object.getFlowElements()) {
+ if (fe instanceof FlowNode)
+ validator.validate((FlowNode)fe);
+ }
+ return getResult();
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/FlowNodeValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/FlowNodeValidator.java
new file mode 100644
index 00000000..630010a0
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/FlowNodeValidator.java
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.bpmn2.AdHocSubProcess;
+import org.eclipse.bpmn2.CatchEvent;
+import org.eclipse.bpmn2.FlowElement;
+import org.eclipse.bpmn2.FlowNode;
+import org.eclipse.bpmn2.StartEvent;
+import org.eclipse.bpmn2.SubProcess;
+import org.eclipse.bpmn2.ThrowEvent;
+import org.eclipse.bpmn2.modeler.core.preferences.Bpmn2Preferences;
+import org.eclipse.bpmn2.modeler.core.validation.Messages;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class FlowNodeValidator extends AbstractBpmn2ElementValidator<FlowNode> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public FlowNodeValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public FlowNodeValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(FlowNode object) {
+ boolean needIncoming = true;
+ boolean needOutgoing = true;
+ if (object instanceof ThrowEvent)
+ needOutgoing = false;
+ if (object instanceof CatchEvent)
+ needIncoming = false;
+
+ if (object instanceof SubProcess) {
+ if (((SubProcess) object).isTriggeredByEvent()) {
+ // Event SubProcesses may not be connected
+ // to the rest of the Process
+ if (object.getOutgoing().size()>0) {
+ addStatus(object,"outgoing",Status.ERROR,"Event SubProcess may not have outgoing Sequence Flows");
+ }
+ if (object.getIncoming().size()>0) {
+ addStatus(object,"incoming",Status.ERROR,"Event SubProcess may not have incoming Sequence Flows");
+ }
+ needIncoming = false;
+ needOutgoing = false;
+ }
+ }
+ if (object.eContainer() instanceof AdHocSubProcess) {
+ needIncoming = false;
+ needOutgoing = false;
+ }
+
+ if (needOutgoing) {
+ if ((object.getOutgoing() == null || object.getOutgoing().size() < 1)) {
+ addMissingFeatureStatus(object,"outgoing",Status.ERROR); //$NON-NLS-1$
+ }
+ }
+ if (needIncoming) {
+ if ((object.getIncoming() == null || object.getIncoming().size() < 1)) {
+ addMissingFeatureStatus(object,"incoming",Status.ERROR); //$NON-NLS-1$
+ }
+ }
+ if (Bpmn2Preferences.getInstance(object).getAllowMultipleConnections() == false) {
+ if (object.getIncoming().size()>1)
+ addStatus(object,Status.WARNING,"{0} should have only one incoming Sequence Flow",object.eClass().getName());
+ if (object.getOutgoing().size()>1)
+ addStatus(object,Status.WARNING,"{0} should have only one outgoing Sequence Flow",object.eClass().getName());
+ }
+ return getResult();
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/GatewayValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/GatewayValidator.java
new file mode 100644
index 00000000..f4cd657a
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/GatewayValidator.java
@@ -0,0 +1,149 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.bpmn2.Bpmn2Package;
+import org.eclipse.bpmn2.ComplexGateway;
+import org.eclipse.bpmn2.EventBasedGateway;
+import org.eclipse.bpmn2.ExclusiveGateway;
+import org.eclipse.bpmn2.Gateway;
+import org.eclipse.bpmn2.GatewayDirection;
+import org.eclipse.bpmn2.InclusiveGateway;
+import org.eclipse.bpmn2.ParallelGateway;
+import org.eclipse.bpmn2.modeler.core.validation.Messages;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class GatewayValidator extends AbstractBpmn2ElementValidator<Gateway> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public GatewayValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public GatewayValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(Gateway object) {
+ GatewayDirection direction = object.getGatewayDirection();
+ int incoming = object.getIncoming().size();
+ int outgoing = object.getOutgoing().size();
+ if (direction == GatewayDirection.CONVERGING) {
+ // Converging gateways MUST have multiple incoming, and zero or one outgoing connection
+ if (incoming<1) {
+ ctx.addResult(Bpmn2Package.eINSTANCE.getGateway_GatewayDirection());
+ addStatus(object, "gatewayDirection", //$NON-NLS-1$
+ Status.ERROR, "Converging Gateway must have multiple incoming Sequence Flows");
+ }
+ if (outgoing>1) {
+ ctx.addResult(Bpmn2Package.eINSTANCE.getGateway_GatewayDirection());
+ addStatus(object, "gatewayDirection", //$NON-NLS-1$
+ Status.ERROR, "Converging Gateway must have zero or one outgoing Sequence Flow");
+ }
+ }
+ else if (direction == GatewayDirection.DIVERGING) {
+ // Diverging gateways MUST have zero or one incoming, and multiple outgoing connections
+ if (incoming>1) {
+ ctx.addResult(Bpmn2Package.eINSTANCE.getGateway_GatewayDirection());
+ addStatus(object, "gatewayDirection", //$NON-NLS-1$
+ Status.ERROR, "Diverging Gateway must have zero or one incoming Sequence Flow");
+ }
+ if (outgoing<1) {
+ ctx.addResult(Bpmn2Package.eINSTANCE.getGateway_GatewayDirection());
+ addStatus(object, "gatewayDirection", //$NON-NLS-1$
+ Status.ERROR, "Diverging Gateway must have multiple outgoing Sequence Flows");
+ }
+ }
+ else if (direction == GatewayDirection.MIXED) {
+ // Mixed gateways MUST have multiple incoming, and multiple outgoing connections
+ if (incoming<1) {
+ ctx.addResult(Bpmn2Package.eINSTANCE.getGateway_GatewayDirection());
+ addStatus(object, "gatewayDirection", //$NON-NLS-1$
+ Status.ERROR, "Mixed Gateway must have multiple incoming Sequence Flows");
+ }
+ if (outgoing<1) {
+ ctx.addResult(Bpmn2Package.eINSTANCE.getGateway_GatewayDirection());
+ addStatus(object, "gatewayDirection", //$NON-NLS-1$
+ Status.ERROR, "Mixed Gateway must have multiple outgoing Sequence Flows");
+ }
+ }
+ else {
+ // Unspecified gateways MUST have either multiple incoming, or multiple outgoing connections
+ if (outgoing<1 && incoming<1) {
+ ctx.addResult(Bpmn2Package.eINSTANCE.getGateway_GatewayDirection());
+ addStatus(object, "gatewayDirection", //$NON-NLS-1$
+ Status.ERROR, "Unspecified Gateway must have either multiple incoming or outgoing Sequence Flows");
+ }
+ }
+
+ if (object instanceof ExclusiveGateway) {
+ if (direction != GatewayDirection.DIVERGING
+ && direction != GatewayDirection.CONVERGING) {
+ addStatus(object, "gatewayDirection", //$NON-NLS-1$
+ Status.ERROR, "Exclusive Gateway should be either Converging or Diverging");
+ }
+ }
+ if (object instanceof EventBasedGateway) {
+ if (direction != GatewayDirection.DIVERGING) {
+ addStatus(object,"gatewayDirection", //$NON-NLS-1$
+ Status.ERROR, "EventBased Gateway should be Diverging");
+ }
+ }
+ if (object instanceof ParallelGateway) {
+ if (direction != GatewayDirection.DIVERGING
+ && direction != GatewayDirection.CONVERGING) {
+ addStatus(object,"gatewayDirection", //$NON-NLS-1$
+ Status.ERROR, "Parallel Gateway should be either Converging or Diverging");
+ }
+ }
+ if (object instanceof InclusiveGateway) {
+ if (direction != GatewayDirection.DIVERGING
+ && direction != GatewayDirection.CONVERGING) {
+ addStatus(object,"gatewayDirection", //$NON-NLS-1$
+ Status.ERROR, "Inclusive Gateway should be either Converging or Diverging");
+ }
+ }
+ if (object instanceof ComplexGateway) {
+ if (direction != GatewayDirection.DIVERGING
+ && direction != GatewayDirection.CONVERGING) {
+ addStatus(object,"gatewayDirection", //$NON-NLS-1$
+ Status.ERROR, "Complex Gateway should be either Converging or Diverging");
+ }
+ }
+ return getResult();
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/IBpmn2ElementValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/IBpmn2ElementValidator.java
new file mode 100644
index 00000000..129bf2c6
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/IBpmn2ElementValidator.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.ecore.EClass;
+
+/**
+ * Interface that defines a BPMN2 Element Validator.
+ */
+public interface IBpmn2ElementValidator<T> {
+
+ /**
+ * Perform the object validation.
+ *
+ * @param object the BPMN2 element to be validated
+ * @return the results of the validation.
+ */
+ IStatus validate(T object);
+
+ /**
+ * Check if the validator for a specific super type of the given object should also
+ * be invoked.
+ *
+ * @param eClass the BPMN2 element EClass which must be a super type of the given object
+ * @param object the BPMN2 element instance object
+ * @return
+ */
+ boolean checkSuperType(EClass eClass, T object);
+
+ /**
+ * Returns true if this validator can handle Live validations.
+ *
+ * @return true if Live validations are handled, false if this validator
+ * should only be used in Batch mode.
+ */
+ boolean doLiveValidation();
+
+ /**
+ * Returns the result of the validation after validate() has been called.
+ * Note that IStatus may be a multi-Status object.
+ *
+ * @return the IStatus of the validation result. If no validation errors were
+ * detected, this will be an IStatus object with severity Status.OK
+ */
+ IStatus getResult();
+}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/InputOutputSpecificationValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/InputOutputSpecificationValidator.java
new file mode 100644
index 00000000..4b3b0e9c
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/InputOutputSpecificationValidator.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.bpmn2.InputOutputSpecification;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class InputOutputSpecificationValidator extends AbstractBpmn2ElementValidator<InputOutputSpecification> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public InputOutputSpecificationValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public InputOutputSpecificationValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(InputOutputSpecification object) {
+ if (isEmpty(object.getInputSets()))
+ addMissingFeatureStatus(object,"inputSets",Status.ERROR);
+ if (isEmpty(object.getOutputSets()))
+ addMissingFeatureStatus(object,"outputSets",Status.ERROR);
+ return getResult();
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/InterfaceValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/InterfaceValidator.java
new file mode 100644
index 00000000..16cf7b8b
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/InterfaceValidator.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.bpmn2.Interface;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class InterfaceValidator extends AbstractBpmn2ElementValidator<Interface> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public InterfaceValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public InterfaceValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(Interface object) {
+ if (isEmpty(object.getName()))
+ addMissingFeatureStatus(object,"name",Status.ERROR);
+ if (isEmpty(object.getOperations()))
+ addMissingFeatureStatus(object,"operations",Status.ERROR);
+ return getResult();
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ItemAwareElementValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ItemAwareElementValidator.java
new file mode 100644
index 00000000..22124426
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ItemAwareElementValidator.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.bpmn2.InputOutputSpecification;
+import org.eclipse.bpmn2.ItemAwareElement;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class ItemAwareElementValidator extends AbstractBpmn2ElementValidator<ItemAwareElement> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public ItemAwareElementValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public ItemAwareElementValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(ItemAwareElement object) {
+ if (ProcessValidator.isContainingProcessExecutable(object)) {
+ if (isEmpty(object.getItemSubjectRef())) {
+ EObject container = object.eContainer();
+ if (container instanceof InputOutputSpecification) {
+ container = container.eContainer();
+ }
+
+ addMissingFeatureStatus(object,"itemSubjectRef",new EObject[] {container},Status.ERROR); //$NON-NLS-1$
+ }
+ }
+ return getResult();
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ItemDefinitionValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ItemDefinitionValidator.java
new file mode 100644
index 00000000..514168e8
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ItemDefinitionValidator.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.bpmn2.ItemDefinition;
+import org.eclipse.bpmn2.Process;
+import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class ItemDefinitionValidator extends AbstractBpmn2ElementValidator<ItemDefinition> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public ItemDefinitionValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public ItemDefinitionValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(ItemDefinition object) {
+ if (ProcessValidator.isContainingProcessExecutable(object)) {
+ if (isEmpty(object.getStructureRef()))
+ addMissingFeatureStatus(object,"structureRef",Status.ERROR); //$NON-NLS-1$
+ }
+ return getResult();
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/MessageValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/MessageValidator.java
new file mode 100644
index 00000000..abae61af
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/MessageValidator.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.bpmn2.ItemDefinition;
+import org.eclipse.bpmn2.Message;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class MessageValidator extends AbstractBpmn2ElementValidator<Message> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public MessageValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public MessageValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(Message object) {
+ if (ProcessValidator.isContainingProcessExecutable(object)) {
+ // Only report problems with this object one time.
+ // This same error should not be reported when validating
+ // other objects that references this object.
+ if (this.parent==null) {
+ ItemDefinition itemDefinition = object.getItemRef();
+ if (itemDefinition!=null) {
+ new ItemDefinitionValidator(this).validate(itemDefinition);
+ }
+ else
+ addMissingFeatureStatus(object,"itemRef",Status.ERROR); //$NON-NLS-1$
+ }
+ }
+ return getResult();
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/MultiInstanceLoopCharacteristicsValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/MultiInstanceLoopCharacteristicsValidator.java
new file mode 100644
index 00000000..c4774300
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/MultiInstanceLoopCharacteristicsValidator.java
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.bpmn2.MultiInstanceLoopCharacteristics;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class MultiInstanceLoopCharacteristicsValidator extends AbstractBpmn2ElementValidator<MultiInstanceLoopCharacteristics> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public MultiInstanceLoopCharacteristicsValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public MultiInstanceLoopCharacteristicsValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(MultiInstanceLoopCharacteristics object) {
+ EObject resultLocus[] = new EObject[] {object.eContainer()};
+ if (isEmpty(object.getLoopCardinality())) {
+ if (isEmpty(object.getLoopDataInputRef())) {
+ addStatus(object,resultLocus,Status.ERROR,"Multi-Instance Loop must have either a Loop Condition or Input Data Items");
+ }
+ else if (isEmpty(object.getInputDataItem())) {
+ addStatus(object,resultLocus,Status.ERROR,"Multi-Instance Loop with Input Data Items must have an Instance Parameter");
+ }
+ }
+ else {
+ if (!isEmpty(object.getLoopDataInputRef())) {
+ addStatus(object,resultLocus,Status.ERROR,"Multi-Instance Loop can not have both Loop Condition and Input Data Items");
+ }
+ }
+ if (!isEmpty(object.getLoopDataOutputRef())) {
+ if (isEmpty(object.getOutputDataItem())) {
+ addStatus(object,resultLocus,Status.ERROR,"Multi-Instance Loop with Output Data must have an Instance Parameter");
+ }
+ }
+ return getResult();
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/OperationValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/OperationValidator.java
new file mode 100644
index 00000000..209bba63
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/OperationValidator.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.bpmn2.Operation;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class OperationValidator extends AbstractBpmn2ElementValidator<Operation> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public OperationValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public OperationValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(Operation object) {
+ if (isEmpty(object.getName()))
+ addMissingFeatureStatus(object,"name",Status.ERROR);
+ if (isEmpty(object.getInMessageRef()))
+ addMissingFeatureStatus(object,"inMessageRef",Status.ERROR);
+ return getResult();
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ProcessValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ProcessValidator.java
new file mode 100644
index 00000000..3982f3dd
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ProcessValidator.java
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import java.util.List;
+
+import org.eclipse.bpmn2.Definitions;
+import org.eclipse.bpmn2.EndEvent;
+import org.eclipse.bpmn2.FlowElement;
+import org.eclipse.bpmn2.Process;
+import org.eclipse.bpmn2.RootElement;
+import org.eclipse.bpmn2.StartEvent;
+import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class ProcessValidator extends AbstractBpmn2ElementValidator<Process> {
+
+ /**
+ * @param ctx
+ */
+ public ProcessValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(Process process) {
+ boolean foundStartEvent = false;
+ boolean foundEndEvent = false;
+ List<FlowElement> flowElements = process.getFlowElements();
+ for (FlowElement fe : flowElements) {
+ if (fe instanceof StartEvent) {
+ foundStartEvent = true;
+ }
+ if (fe instanceof EndEvent) {
+ foundEndEvent = true;
+ }
+ }
+ if (!foundStartEvent) {
+ addStatus(process, Status.WARNING, "Process has no Start Event");
+ }
+ if (!foundEndEvent) {
+ addStatus(process, Status.WARNING, "Process has no End Event");
+ }
+
+ if (isEmpty(process.getName())) {
+ addStatus(process, "name", Status.WARNING, "Process {0} has no name", process.getId());
+ }
+
+ return getResult();
+ }
+
+ @Override
+ public boolean checkSuperType(EClass eClass, Process object) {
+ if ("FlowElementsContainer".equals(eClass.getName()))
+ return true;
+ if ("BaseElement".equals(eClass.getName()))
+ return true;
+ return false;
+ }
+
+ public static boolean isContainingProcessExecutable(EObject object) {
+ Process process = null;
+ if (object instanceof Process)
+ process = (Process) object;
+ else if (object instanceof RootElement) {
+ Definitions definitions = ModelUtil.getDefinitions(object);
+ if (definitions!=null) {
+ // return the first Process element found
+ for (RootElement re : definitions.getRootElements()) {
+ if (re instanceof Process) {
+ process = (Process) re;
+ break;
+ }
+ }
+ }
+ }
+ else
+ process = (Process) ModelUtil.findNearestAncestor(object, new Class[] { Process.class });
+ return process!=null && process.isIsExecutable();
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ResourceValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ResourceValidator.java
new file mode 100644
index 00000000..138957b3
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ResourceValidator.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.bpmn2.Resource;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class ResourceValidator extends AbstractBpmn2ElementValidator<Resource> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public ResourceValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public ResourceValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(Resource object) {
+ if (isEmpty(object.getName()))
+ addMissingFeatureStatus(object,"name",Status.ERROR);
+ return getResult();
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ScriptTaskValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ScriptTaskValidator.java
new file mode 100644
index 00000000..20264f3e
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ScriptTaskValidator.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.bpmn2.ScriptTask;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class ScriptTaskValidator extends AbstractBpmn2ElementValidator<ScriptTask> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public ScriptTaskValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public ScriptTaskValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(ScriptTask object) {
+ if (ProcessValidator.isContainingProcessExecutable(object)) {
+ if (isEmpty(object.getScript()))
+ addMissingFeatureStatus(object,"script",Status.ERROR); //$NON-NLS-1$
+ }
+ return getResult();
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/SendTaskValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/SendTaskValidator.java
new file mode 100644
index 00000000..09220160
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/SendTaskValidator.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.bpmn2.SendTask;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class SendTaskValidator extends AbstractBpmn2ElementValidator<SendTask> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public SendTaskValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public SendTaskValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(SendTask object) {
+ if (ProcessValidator.isContainingProcessExecutable(object)) {
+ if (object.getOperationRef()==null)
+ addMissingFeatureStatus(object,"operationRef",Status.ERROR); //$NON-NLS-1$
+ if (object.getMessageRef()==null)
+ addMissingFeatureStatus(object,"messageRef",Status.ERROR); //$NON-NLS-1$
+ }
+ return getResult();
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/SequenceFlowValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/SequenceFlowValidator.java
new file mode 100644
index 00000000..0f311a4d
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/SequenceFlowValidator.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.bpmn2.SequenceFlow;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class SequenceFlowValidator extends AbstractBpmn2ElementValidator<SequenceFlow> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public SequenceFlowValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public SequenceFlowValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(SequenceFlow object) {
+ if (object.getSourceRef()==null)
+ this.addStatus(object, Status.ERROR, "Sequence Flow is not connected to a source element");
+ if (object.getTargetRef()==null)
+ this.addStatus(object, Status.ERROR, "Sequence Flow is not connected to a target element");
+ return getResult();
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/SignalValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/SignalValidator.java
new file mode 100644
index 00000000..29281183
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/SignalValidator.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.bpmn2.ItemDefinition;
+import org.eclipse.bpmn2.Signal;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class SignalValidator extends AbstractBpmn2ElementValidator<Signal> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public SignalValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public SignalValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(Signal object) {
+ if (ProcessValidator.isContainingProcessExecutable(object)) {
+ // Only report problems with this object one time.
+ // This same error should not be reported when validating
+ // other objects that references this object.
+ if (this.parent==null) {
+ ItemDefinition itemDefinition = object.getStructureRef();
+ if (itemDefinition!=null) {
+ new ItemDefinitionValidator(this).validate(itemDefinition);
+ }
+ else
+ addMissingFeatureStatus(object,"structureRef",Status.ERROR); //$NON-NLS-1$
+ }
+ }
+ return getResult();
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/StandardLoopCharacteristicsValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/StandardLoopCharacteristicsValidator.java
new file mode 100644
index 00000000..4fdb8409
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/StandardLoopCharacteristicsValidator.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.bpmn2.StandardLoopCharacteristics;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class StandardLoopCharacteristicsValidator extends AbstractBpmn2ElementValidator<StandardLoopCharacteristics> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public StandardLoopCharacteristicsValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public StandardLoopCharacteristicsValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(StandardLoopCharacteristics object) {
+ EObject resultLocus[] = new EObject[] {object.eContainer()};
+ if (isEmpty(object.getLoopCondition())) {
+ addStatus(object,resultLocus,Status.ERROR,"Loop Condition is undefined");
+ }
+ return getResult();
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/StartEventValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/StartEventValidator.java
new file mode 100644
index 00000000..ea6b15fb
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/StartEventValidator.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.bpmn2.StartEvent;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class StartEventValidator extends AbstractBpmn2ElementValidator<StartEvent> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public StartEventValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public StartEventValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(StartEvent object) {
+ return getResult();
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/SubProcessValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/SubProcessValidator.java
new file mode 100644
index 00000000..321c5e91
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/SubProcessValidator.java
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.bpmn2.AdHocSubProcess;
+import org.eclipse.bpmn2.FlowElement;
+import org.eclipse.bpmn2.StartEvent;
+import org.eclipse.bpmn2.SubProcess;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class SubProcessValidator extends AbstractBpmn2ElementValidator<SubProcess> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public SubProcessValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public SubProcessValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(SubProcess object) {
+ if (object.isTriggeredByEvent()) {
+ StartEvent start = null;
+ for (FlowElement fe : object.getFlowElements()) {
+ if (fe instanceof StartEvent) {
+ if (start!=null) {
+ addStatus(object,Status.ERROR,"Event SubProcess has multiple Start Events");
+ }
+ start = (StartEvent) fe;
+ }
+ }
+ if (start!=null) {
+ if (start.getEventDefinitions().size()==0) {
+ addStatus(object,Status.ERROR,"Start Event of Event SubProcess has no Event Definitions");
+ }
+ }
+ else {
+ addStatus(object,Status.ERROR,"Event SubProcess has no Start Event");
+ }
+ }
+ return getResult();
+ }
+
+ @Override
+ public boolean checkSuperType(EClass eClass, SubProcess object) {
+ if ("FlowElementsContainer".equals(eClass.getName())) {
+ if (!(object instanceof AdHocSubProcess))
+ return true;
+ }
+ return false;
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ThrowEventValidator.java b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ThrowEventValidator.java
new file mode 100644
index 00000000..4fbd39b9
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.core/src/org/eclipse/bpmn2/modeler/core/validation/validators/ThrowEventValidator.java
@@ -0,0 +1,64 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.validation.validators;
+
+import org.eclipse.bpmn2.CatchEvent;
+import org.eclipse.bpmn2.ThrowEvent;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.ecore.EClass;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class ThrowEventValidator extends AbstractBpmn2ElementValidator<ThrowEvent> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public ThrowEventValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public ThrowEventValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(ThrowEvent object) {
+ return getResult();
+ }
+
+ @Override
+ public boolean checkSuperType(EClass eClass, ThrowEvent object) {
+ if ("Event".equals(eClass.getName()))
+ return true;
+ return false;
+ }
+}
+
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/plugin.xml b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/plugin.xml
index 6164c6c5..24acb54e 100644
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/plugin.xml
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/plugin.xml
@@ -5,7 +5,7 @@
<extension point="org.eclipse.emf.ecore.generated_package">
<package
class="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.drools.DroolsPackage"
- genModel="model/jBPM5Extensions.genmodel"
+ genModel="model/drools.genmodel"
uri="http://www.jboss.org/drools">
</package>
</extension>
@@ -216,6 +216,16 @@
label="%propertyTab.label.Simulation">
</propertyTab>
+ <propertyTab
+ id="org.jboss.runtime.jbpm5.globaltype.tab"
+ replaceTab="org.eclipse.bpmn2.modeler.itemawareelement.tab"
+ afterTab="org.eclipse.bpmn2.modeler.description.tab"
+ class="default"
+ features="identifier type"
+ label="Global Variable"
+ type="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.drools.GlobalType">
+ </propertyTab>
+
<!-- Property Extension Adapters -->
<propertyExtension
@@ -347,6 +357,13 @@
class="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.property.adapters.JbpmSignalPropertiesAdapter">
</propertyExtension>
+ <propertyExtension
+ id="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.propertyExtension.MultiInstanceLoopCharacteristics"
+ runtimeId="org.jboss.runtime.jbpm5"
+ type="org.eclipse.bpmn2.MultiInstanceLoopCharacteristics"
+ class="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.property.adapters.JbpmMultiInstanceLoopCharacteristicsPropertiesAdapter">
+ </propertyExtension>
+
<!-- Graphiti Feature Container Overrides -->
<featureContainer
@@ -991,7 +1008,7 @@
<enable object="DataInput" feature="name"/>
<enable object="DataOutput" feature="name"/>
<enable object="EndEvent" feature="eventDefinitions"/>
- <enable object="EndEvent" feature="inputSet"/>
+ <enable object="EndEvent" feature="name"/>
<enable object="ExclusiveGateway" feature="default"/>
<enable object="ExclusiveGateway" feature="gatewayDirection"/>
<enable object="ExclusiveGateway" feature="id"/>
@@ -1211,6 +1228,7 @@
<serviceImplementation name="Java" uri="Java"/>
<serviceImplementation name="SwitchYard Service" uri="##SwitchYard"/>
<serviceImplementation name="Web Service" uri="##WebService"/>
+ <serviceImplementation name="Unspecified" uri="##unspecified"/>
</extension>
@@ -1222,126 +1240,151 @@
</imageProvider>
</extension>
- <extension
- point="org.eclipse.emf.validation.constraintProviders">
- <category
- name="%category.name.20"
- id="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validationCategory"/>
+ <extension point="org.eclipse.emf.validation.constraintProviders">
+ <!-- These constraints override the ones in BPMN2 Modeler Core Validation -->
<constraintProvider cache="true">
<package namespaceUri="http://www.omg.org/spec/BPMN/20100524/MODEL-XMI"/>
- <constraints categories="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validationCategory">
+ <constraints categories="org.eclipse.bpmn2.modeler.core.validation.category.override">
+
+ <!-- Live Validation Constraints -->
+ <constraint
+ lang="Java"
+ class="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.JbpmModelConstraint"
+ severity="ERROR"
+ mode="Live"
+ name="Definitions"
+ id="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.Definitions"
+ statusCode="1">
+ <message>{0}</message>
+ <target class="Definitions"/>
+ </constraint>
+
+ <!-- Batch Validation Constraints -->
<constraint
lang="Java"
- class="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.ProcessConstraint"
+ class="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.JbpmModelConstraint"
severity="ERROR"
mode="Batch"
- name="%constraint.name"
+ name="Process"
id="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.Process"
statusCode="1">
- <description>
- %constraint.description
- </description>
- <message>
- %constraint.message
- </message>
+ <message>{0}</message>
<target class="Process"/>
</constraint>
<constraint
lang="Java"
- class="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.BusinessRuleTaskConstraint"
+ class="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.JbpmModelConstraint"
severity="ERROR"
mode="Batch"
- name="%constraint.name.0"
- id="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.BusinessRuleTask"
+ name="Signal"
+ id="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.Signal"
statusCode="1">
- <description>
- %constraint.description.0
- </description>
- <message>
- %constraint.message.0
- </message>
- <target class="BusinessRuleTask"/>
+ <message>{0}</message>
+ <target class="Signal"/>
</constraint>
<constraint
lang="Java"
- class="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.UserTaskConstraint"
- severity="WARNING"
+ class="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.JbpmModelConstraint"
+ severity="ERROR"
mode="Batch"
- name="%constraint.name.1"
- id="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.UserTask"
+ name="Escalation"
+ id="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.Escalation"
statusCode="1">
- <description>
- %constraint.description.1
- </description>
- <message>
- %constraint.message.1
- </message>
- <target class="UserTask"/>
+ <message>{0}</message>
+ <target class="Escalation"/>
</constraint>
<constraint
lang="Java"
- class="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.TaskConstraint"
- severity="WARNING"
+ class="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.JbpmModelConstraint"
+ severity="ERROR"
mode="Batch"
- name="%constraint.name.2"
- id="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.Task"
+ name="Global Type"
+ id="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.GlobalType"
statusCode="1">
- <description>
- %constraint.description.2
- </description>
- <message>
- %constraint.message.2
- </message>
- <target class="Task"/>
+ <message>{0}</message>
+ <!-- Note use of namespace URI to qualify GlobalType -->
+ <target class="GlobalType:http://www.jboss.org/drools"/>
</constraint>
<constraint
lang="Java"
- class="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.GatewayConstraint"
- severity="WARNING"
+ class="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.JbpmModelConstraint"
+ severity="ERROR"
mode="Batch"
- name="%constraint.name.3"
- id="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.Gateway"
+ name="Data Input Association"
+ id="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.DataInputAssociation"
statusCode="1">
- <description>
- %constraint.description.3
- </description>
- <message>
- %constraint.message.3
- </message>
- <target class="Gateway"/>
+ <message>{0}</message>
+ <target class="DataInputAssociation"/>
</constraint>
<constraint
lang="Java"
- class="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.CallActivityConstraint"
- severity="WARNING"
+ class="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.JbpmModelConstraint"
+ severity="ERROR"
mode="Batch"
- name="%constraint.name.4"
- id="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.CallActivity"
+ name="Data Output Association"
+ id="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.DataOutputAssociation"
statusCode="1">
- <description>
- %constraint.description.4
- </description>
- <message>
- %constraint.message.4
- </message>
- <target class="CallActivity"/>
+ <message>{0}</message>
+ <target class="DataOutputAssociation"/>
</constraint>
+ </constraints>
+ </constraintProvider>
+
+ <category
+ name="%category.name.20"
+ id="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.category"/>
+ <!-- These constraints are in addition to the ones in BPMN2 Modeler Core Validation -->
+ <constraintProvider cache="true">
+ <package namespaceUri="http://www.omg.org/spec/BPMN/20100524/MODEL-XMI"/>
+ <constraints categories="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.category">
+
+ <!-- Live Validation Constraints -->
<constraint
class="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.ProcessVariableNameConstraint"
id="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.VariableName"
- isEnabledByDefault="true"
lang="Java"
mode="Live"
- name="%constraint.name.5"
- severity="INFO"
+ name="Variable Name"
+ severity="ERROR"
statusCode="1">
- <message>%constraint.message.5</message>
- <description>%constraint.description.5</description>
+ <message>{0}</message>
<target class="BaseElement"/>
- <target class="Property"/>
- <target class="Message"/>
- <target class="DataObject"/>
</constraint>
+
+ <!-- Batch Validation Constraints -->
+ <constraint
+ lang="Java"
+ class="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.JbpmModelConstraint"
+ severity="ERROR"
+ mode="Batch"
+ name="Business Rule Task"
+ id="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.BusinessRuleTask"
+ statusCode="1">
+ <message>{0}</message>
+ <target class="BusinessRuleTask"/>
+ </constraint>
+ <constraint
+ lang="Java"
+ class="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.JbpmModelConstraint"
+ severity="ERROR"
+ mode="Batch"
+ name="User Task"
+ id="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.UserTask"
+ statusCode="1">
+ <message>{0}</message>
+ <target class="UserTask"/>
+ </constraint>
+ <constraint
+ lang="Java"
+ class="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.JbpmModelConstraint"
+ severity="ERROR"
+ mode="Batch"
+ name="Call Activity"
+ id="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.CallActivity"
+ statusCode="1">
+ <message>{0}</message>
+ <target class="CallActivity"/>
+ </constraint>
</constraints>
</constraintProvider>
</extension>
@@ -1350,7 +1393,7 @@
point="org.eclipse.emf.validation.constraintBindings">
<clientContext
default="false"
- id="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validationContext">
+ id="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.context">
<enablement>
<test
property="org.eclipse.bpmn2.modeler.property.targetRuntimeId"
@@ -1358,8 +1401,8 @@
</enablement>
</clientContext>
<binding
- context="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validationContext"
- category="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validationCategory">
+ context="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.context"
+ category="org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.category">
</binding>
</extension>
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/ProcessVariableNameChangeAdapter.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/ProcessVariableNameChangeAdapter.java
index b50d7de7..cfdb3813 100644
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/ProcessVariableNameChangeAdapter.java
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/ProcessVariableNameChangeAdapter.java
@@ -65,7 +65,8 @@ public class ProcessVariableNameChangeAdapter implements Adapter {
if (newValue!=null && !newValue.equals(oldValue))
{
if (idFeature!=null) {
- newValue = SyntaxCheckerUtils.toNCName((String)newValue);
+ if (!SyntaxCheckerUtils.isJavaIdentifier((String)newValue))
+ newValue = SyntaxCheckerUtils.toJavaIdentifier((String)newValue);
boolean deliver = object.eDeliver();
try {
if (deliver)
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/JbpmCustomTaskPropertySection.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/JbpmCustomTaskPropertySection.java
index b0bc311b..8422c975 100644
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/JbpmCustomTaskPropertySection.java
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/JbpmCustomTaskPropertySection.java
@@ -64,7 +64,7 @@ public class JbpmCustomTaskPropertySection extends JbpmTaskPropertySection imple
}
@Override
- protected EObject getBusinessObjectForSelection(ISelection selection) {
+ public EObject getBusinessObjectForSelection(ISelection selection) {
EObject be = super.getBusinessObjectForSelection(selection);
if (be instanceof Task)
return be;
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/JbpmIoParametersPropertySection.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/JbpmIoParametersPropertySection.java
index 5aac09a0..72b0e4ce 100644
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/JbpmIoParametersPropertySection.java
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/JbpmIoParametersPropertySection.java
@@ -32,7 +32,7 @@ public class JbpmIoParametersPropertySection extends IoParametersPropertySection
}
@Override
- protected EObject getBusinessObjectForSelection(ISelection selection) {
+ public EObject getBusinessObjectForSelection(ISelection selection) {
EObject be = super.getBusinessObjectForSelection(selection);
if (be instanceof ScriptTask || be==null)
return null;
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/JbpmProcessDiagramPropertySection.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/JbpmProcessDiagramPropertySection.java
index d58d9a3b..110c33af 100644
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/JbpmProcessDiagramPropertySection.java
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/JbpmProcessDiagramPropertySection.java
@@ -15,8 +15,8 @@ package org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.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.dialogs.NCNameObjectEditor;
import org.eclipse.bpmn2.modeler.core.merrimac.dialogs.ObjectEditor;
-import org.eclipse.bpmn2.modeler.core.merrimac.dialogs.TextObjectEditor;
import org.eclipse.bpmn2.modeler.ui.property.diagrams.ProcessDiagramDetailComposite;
import org.eclipse.bpmn2.modeler.ui.property.diagrams.ProcessDiagramPropertySection;
import org.eclipse.emf.ecore.EAttribute;
@@ -58,8 +58,11 @@ public class JbpmProcessDiagramPropertySection extends ProcessDiagramPropertySec
@Override
protected void bindAttribute(Composite parent, EObject object, EAttribute attribute, String label) {
+ if (label==null)
+ label = getPropertiesProvider().getLabel(object, attribute);
+
if ("id".equals(attribute.getName())) {
- ObjectEditor editor = new TextObjectEditor(this,object,attribute);
+ ObjectEditor editor = new NCNameObjectEditor(this,object,attribute);
editor.createControl(parent,label);
}
else
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmDataInputPropertiesAdapter.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmDataInputPropertiesAdapter.java
index 1762567d..b0fcd4bf 100644
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmDataInputPropertiesAdapter.java
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmDataInputPropertiesAdapter.java
@@ -14,6 +14,7 @@ import java.util.Hashtable;
import org.eclipse.bpmn2.Bpmn2Package;
import org.eclipse.bpmn2.DataInput;
+import org.eclipse.bpmn2.modeler.core.merrimac.dialogs.JavaVariableNameObjectEditor;
import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.util.JbpmModelUtil;
import org.eclipse.bpmn2.modeler.ui.adapters.properties.DataInputPropertiesAdapter;
import org.eclipse.bpmn2.modeler.ui.adapters.properties.ItemDefinitionRefFeatureDescriptor;
@@ -60,6 +61,9 @@ public class JbpmDataInputPropertiesAdapter extends DataInputPropertiesAdapter {
}
}
);
+
+ feature = Bpmn2Package.eINSTANCE.getDataInput_Name();
+ setProperty(feature, UI_OBJECT_EDITOR_CLASS, JavaVariableNameObjectEditor.class);
}
}
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmErrorPropertiesAdapter.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmErrorPropertiesAdapter.java
index 11793719..2c46d292 100644
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmErrorPropertiesAdapter.java
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmErrorPropertiesAdapter.java
@@ -14,6 +14,7 @@ import java.util.Hashtable;
import org.eclipse.bpmn2.Bpmn2Package;
import org.eclipse.bpmn2.Error;
+import org.eclipse.bpmn2.modeler.core.merrimac.dialogs.JavaVariableNameObjectEditor;
import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.util.JbpmModelUtil;
import org.eclipse.bpmn2.modeler.ui.adapters.properties.ErrorPropertiesAdapter;
import org.eclipse.bpmn2.modeler.ui.adapters.properties.ItemDefinitionRefFeatureDescriptor;
@@ -35,6 +36,9 @@ public class JbpmErrorPropertiesAdapter extends ErrorPropertiesAdapter {
}
});
+
+ feature = Bpmn2Package.eINSTANCE.getError_Name();
+ setProperty(feature, UI_OBJECT_EDITOR_CLASS, JavaVariableNameObjectEditor.class);
}
}
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmEscalationPropertiesAdapter.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmEscalationPropertiesAdapter.java
index 702a111b..10321652 100644
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmEscalationPropertiesAdapter.java
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmEscalationPropertiesAdapter.java
@@ -14,6 +14,7 @@ import java.util.Hashtable;
import org.eclipse.bpmn2.Bpmn2Package;
import org.eclipse.bpmn2.Escalation;
+import org.eclipse.bpmn2.modeler.core.merrimac.dialogs.JavaVariableNameObjectEditor;
import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.util.JbpmModelUtil;
import org.eclipse.bpmn2.modeler.ui.adapters.properties.EscalationPropertiesAdapter;
import org.eclipse.bpmn2.modeler.ui.adapters.properties.ItemDefinitionRefFeatureDescriptor;
@@ -35,6 +36,9 @@ public class JbpmEscalationPropertiesAdapter extends EscalationPropertiesAdapter
}
});
+
+ feature = Bpmn2Package.eINSTANCE.getEscalation_Name();
+ setProperty(feature, UI_OBJECT_EDITOR_CLASS, JavaVariableNameObjectEditor.class);
}
}
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmGlobalTypePropertiesAdapter.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmGlobalTypePropertiesAdapter.java
index 99743415..c6dbaa5c 100644
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmGlobalTypePropertiesAdapter.java
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmGlobalTypePropertiesAdapter.java
@@ -18,6 +18,7 @@ import java.util.Hashtable;
import org.eclipse.bpmn2.modeler.core.adapters.ExtendedPropertiesAdapter;
import org.eclipse.bpmn2.modeler.core.adapters.FeatureDescriptor;
import org.eclipse.bpmn2.modeler.core.adapters.ObjectDescriptor;
+import org.eclipse.bpmn2.modeler.core.merrimac.dialogs.JavaVariableNameObjectEditor;
import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.drools.DroolsPackage;
import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.drools.GlobalType;
import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.util.JbpmModelUtil;
@@ -47,6 +48,7 @@ public class JbpmGlobalTypePropertiesAdapter extends ExtendedPropertiesAdapter<G
return Messages.JbpmGlobalTypePropertiesAdapter_Name;
}
});
+ setProperty(feature, UI_OBJECT_EDITOR_CLASS, JavaVariableNameObjectEditor.class);
feature = DroolsPackage.eINSTANCE.getGlobalType_Type();
setProperty(feature, UI_CAN_CREATE_NEW, Boolean.TRUE);
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmMessagePropertiesAdapter.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmMessagePropertiesAdapter.java
index 81dd1f60..d8b1b127 100644
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmMessagePropertiesAdapter.java
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmMessagePropertiesAdapter.java
@@ -14,9 +14,10 @@ import java.util.Hashtable;
import org.eclipse.bpmn2.Bpmn2Package;
import org.eclipse.bpmn2.Message;
+import org.eclipse.bpmn2.modeler.core.merrimac.dialogs.JavaVariableNameObjectEditor;
import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.util.JbpmModelUtil;
-import org.eclipse.bpmn2.modeler.ui.adapters.properties.MessagePropertiesAdapter;
import org.eclipse.bpmn2.modeler.ui.adapters.properties.ItemDefinitionRefFeatureDescriptor;
+import org.eclipse.bpmn2.modeler.ui.adapters.properties.MessagePropertiesAdapter;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.ecore.EStructuralFeature;
@@ -41,6 +42,9 @@ public class JbpmMessagePropertiesAdapter extends MessagePropertiesAdapter {
}
});
+
+ feature = Bpmn2Package.eINSTANCE.getMessage_Name();
+ setProperty(feature, UI_OBJECT_EDITOR_CLASS, JavaVariableNameObjectEditor.class);
}
}
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmMultiInstanceLoopCharacteristicsPropertiesAdapter.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmMultiInstanceLoopCharacteristicsPropertiesAdapter.java
new file mode 100644
index 00000000..7fe7caa5
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmMultiInstanceLoopCharacteristicsPropertiesAdapter.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013 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
+ ******************************************************************************/
+package org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.property.adapters;
+
+import org.eclipse.bpmn2.Bpmn2Package;
+import org.eclipse.bpmn2.MultiInstanceLoopCharacteristics;
+import org.eclipse.bpmn2.modeler.core.merrimac.dialogs.JavaVariableNameObjectEditor;
+import org.eclipse.bpmn2.modeler.ui.adapters.properties.MultiInstanceLoopCharacteristicsPropertiesAdapter;
+import org.eclipse.emf.common.notify.AdapterFactory;
+import org.eclipse.emf.ecore.EStructuralFeature;
+
+public class JbpmMultiInstanceLoopCharacteristicsPropertiesAdapter extends MultiInstanceLoopCharacteristicsPropertiesAdapter {
+
+ public JbpmMultiInstanceLoopCharacteristicsPropertiesAdapter(AdapterFactory adapterFactory, MultiInstanceLoopCharacteristics object) {
+ super(adapterFactory, object);
+
+ EStructuralFeature feature = Bpmn2Package.eINSTANCE.getMultiInstanceLoopCharacteristics_InputDataItem();
+ setProperty(feature, UI_OBJECT_EDITOR_CLASS, JavaVariableNameObjectEditor.class);
+
+ feature = Bpmn2Package.eINSTANCE.getMultiInstanceLoopCharacteristics_OutputDataItem();
+ setProperty(feature, UI_OBJECT_EDITOR_CLASS, JavaVariableNameObjectEditor.class);
+ }
+
+}
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmPropertyPropertiesAdapter.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmPropertyPropertiesAdapter.java
index f39704a4..56233357 100644
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmPropertyPropertiesAdapter.java
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmPropertyPropertiesAdapter.java
@@ -18,6 +18,7 @@ import java.util.Hashtable;
import org.eclipse.bpmn2.Bpmn2Package;
import org.eclipse.bpmn2.Property;
import org.eclipse.bpmn2.modeler.core.adapters.ObjectDescriptor;
+import org.eclipse.bpmn2.modeler.core.merrimac.dialogs.JavaVariableNameObjectEditor;
import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.property.Messages;
import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.util.JbpmModelUtil;
import org.eclipse.bpmn2.modeler.ui.adapters.properties.ItemDefinitionRefFeatureDescriptor;
@@ -79,6 +80,9 @@ public class JbpmPropertyPropertiesAdapter extends PropertyPropertiesAdapter {
}
}
);
+
+ feature = Bpmn2Package.eINSTANCE.getProperty_Name();
+ setProperty(feature, UI_OBJECT_EDITOR_CLASS, JavaVariableNameObjectEditor.class);
setObjectDescriptor(new ObjectDescriptor<Property>(adapterFactory,object) {
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmSignalPropertiesAdapter.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmSignalPropertiesAdapter.java
index dfd6de42..1c699974 100644
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmSignalPropertiesAdapter.java
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/property/adapters/JbpmSignalPropertiesAdapter.java
@@ -14,9 +14,10 @@ import java.util.Hashtable;
import org.eclipse.bpmn2.Bpmn2Package;
import org.eclipse.bpmn2.Signal;
+import org.eclipse.bpmn2.modeler.core.merrimac.dialogs.JavaVariableNameObjectEditor;
import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.util.JbpmModelUtil;
-import org.eclipse.bpmn2.modeler.ui.adapters.properties.SignalPropertiesAdapter;
import org.eclipse.bpmn2.modeler.ui.adapters.properties.ItemDefinitionRefFeatureDescriptor;
+import org.eclipse.bpmn2.modeler.ui.adapters.properties.SignalPropertiesAdapter;
import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.ecore.EStructuralFeature;
@@ -35,6 +36,9 @@ public class JbpmSignalPropertiesAdapter extends SignalPropertiesAdapter {
}
});
+
+ feature = Bpmn2Package.eINSTANCE.getSignal_Name();
+ setProperty(feature, UI_OBJECT_EDITOR_CLASS, JavaVariableNameObjectEditor.class);
}
}
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/BusinessRuleTaskConstraint.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/BusinessRuleTaskConstraint.java
deleted file mode 100644
index db0e8c5c..00000000
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/BusinessRuleTaskConstraint.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2012 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
- *******************************************************************************/
-package org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation;
-
-import java.util.Iterator;
-
-import org.eclipse.bpmn2.BusinessRuleTask;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.util.FeatureMap;
-import org.eclipse.emf.validation.AbstractModelConstraint;
-import org.eclipse.emf.validation.IValidationContext;
-
-public class BusinessRuleTaskConstraint extends AbstractModelConstraint {
-
- @Override
- public IStatus validate(IValidationContext ctx) {
- EObject eObj = ctx.getTarget();
- if (eObj instanceof BusinessRuleTask) {
- BusinessRuleTask bt = (BusinessRuleTask)eObj;
-
- Iterator<FeatureMap.Entry> biter = bt.getAnyAttribute().iterator();
- boolean foundRuleflowGroup = false;
- while (biter.hasNext()) {
- FeatureMap.Entry entry = biter.next();
- if (entry.getEStructuralFeature().getName().equals("ruleFlowGroup")) { //$NON-NLS-1$
- foundRuleflowGroup = true;
- String ruleflowGroup = (String) entry.getValue();
- if (ruleflowGroup==null || ruleflowGroup.isEmpty()) {
- return ctx.createFailureStatus(Messages.BusinessRuleTaskConstraint_No_Ruleflow_Group);
- }
- }
- }
- if (!foundRuleflowGroup) {
- return ctx.createFailureStatus(Messages.BusinessRuleTaskConstraint_No_Ruleflow_Group);
- }
- }
- return ctx.createSuccessStatus();
- }
-
-}
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
deleted file mode 100644
index 3fb5979c..00000000
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/CallActivityConstraint.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2012 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
- *******************************************************************************/
-package org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation;
-
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.bpmn2.CallActivity;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.validation.AbstractModelConstraint;
-import org.eclipse.emf.validation.IValidationContext;
-import org.eclipse.osgi.util.NLS;
-
-public class CallActivityConstraint extends AbstractModelConstraint {
- private IDiagramProfile profile;
- private String uuid = "uuid"; //$NON-NLS-1$
-
- @Override
- public IStatus validate(IValidationContext ctx) {
- EObject eObj = ctx.getTarget();
- if (eObj instanceof CallActivity) {
- CallActivity ca = (CallActivity) eObj;
- if (ca.getCalledElementRef() == null) {
- ctx.createFailureStatus(Messages.CallActivityConstraint_No_Called_Element);
- } else {
- String[] packageAssetInfo = ServletUtil.findPackageAndAssetInfo(uuid, profile);
- String packageName = packageAssetInfo[0];
- List<String> allProcessesInPackage = ServletUtil.getAllProcessesInPackage(packageName, profile);
- boolean foundCalledElementProcess = false;
- for (String p : allProcessesInPackage) {
- String processContent = ServletUtil.getProcessSourceContent(packageName, p, profile);
- Pattern pattern = Pattern.compile("<\\S*process[\\s\\S]*id=\"" + ca.getCalledElementRef() + "\"", //$NON-NLS-1$ //$NON-NLS-2$
- Pattern.MULTILINE);
- Matcher m = pattern.matcher(processContent);
- if (m.find()) {
- foundCalledElementProcess = true;
- break;
- }
- }
- foundCalledElementProcess = true; // TODO: remove this
- if (!foundCalledElementProcess) {
- ctx.createFailureStatus(
- NLS.bind(
- Messages.CallActivityConstraint_No_Process,
- ca.getCalledElementRef()
- )
- );
- }
- }
- }
- return ctx.createSuccessStatus();
- }
-
-}
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
deleted file mode 100644
index ff8d1cda..00000000
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/GatewayConstraint.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2012 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
- *******************************************************************************/
-package org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation;
-
-import java.util.List;
-
-import org.eclipse.bpmn2.ExtensionAttributeValue;
-import org.eclipse.bpmn2.Gateway;
-import org.eclipse.bpmn2.ParallelGateway;
-import org.eclipse.bpmn2.SequenceFlow;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.util.FeatureMap;
-import org.eclipse.emf.validation.AbstractModelConstraint;
-import org.eclipse.emf.validation.IValidationContext;
-
-public class GatewayConstraint extends AbstractModelConstraint {
-
- @Override
- public IStatus validate(IValidationContext ctx) {
- EObject eObj = ctx.getTarget();
-
- if (!(eObj instanceof ParallelGateway)) {
- Gateway gw = (Gateway) eObj;
-
- List<SequenceFlow> outgoingGwSequenceFlows = gw.getOutgoing();
- if (outgoingGwSequenceFlows != null && outgoingGwSequenceFlows.size() > 0) {
- // TODO: fix this
- /*
- int sum = 0;
- for (SequenceFlow sf : outgoingGwSequenceFlows) {
- // simulation validation
- if (sf.getExtensionValues() != null && sf.getExtensionValues().size() > 0) {
- boolean foundProbability = false;
- for (ExtensionAttributeValue extattrval : sf.getExtensionValues()) {
- FeatureMap extensionElements = extattrval.getValue();
- @SuppressWarnings("unchecked")
- List<MetadataType> metadataTypeExtensions = (List<MetadataType>) extensionElements.get(
- DroolsPackage.Literals.DOCUMENT_ROOT__METADATA, true);
- if (metadataTypeExtensions != null && metadataTypeExtensions.size() > 0) {
- MetadataType metaType = metadataTypeExtensions.get(0);
- for (Object metaEntryObj : metaType.getMetaentry()) {
- MetaentryType entry = (MetaentryType) metaEntryObj;
- if (entry.getName() != null && entry.getName().equals("probability")) {
- Integer i = new Integer(entry.getValue());
- if (i < 0) {
- ctx.addResult(sf);
- ctx.createFailureStatus("Probability value must be positive.");
- } else {
- sum += i;
- }
- foundProbability = true;
- }
- }
- }
- }
- if (!foundProbability) {
- ctx.addResult(sf);
- ctx.createFailureStatus("Sequence Flow has no probability defined.");
- }
- }
- }
- if (sum != 100) {
- ctx.createFailureStatus("The sum of probability values of all outgoing Sequence Flows must be equal 100.");
- }
- */
- }
- }
- return ctx.createSuccessStatus();
- }
-
-}
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/JbpmModelConstraint.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/JbpmModelConstraint.java
new file mode 100644
index 00000000..40fb361f
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/JbpmModelConstraint.java
@@ -0,0 +1,71 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012 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
+ *******************************************************************************/
+package org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation;
+
+import org.eclipse.bpmn2.BusinessRuleTask;
+import org.eclipse.bpmn2.CallActivity;
+import org.eclipse.bpmn2.DataAssociation;
+import org.eclipse.bpmn2.Definitions;
+import org.eclipse.bpmn2.Escalation;
+import org.eclipse.bpmn2.Process;
+import org.eclipse.bpmn2.Signal;
+import org.eclipse.bpmn2.UserTask;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.drools.GlobalType;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.validators.BusinessRuleTaskValidator;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.validators.CallActivityValidator;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.validators.DataAssociationValidator;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.validators.DefinitionsValidator;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.validators.EscalationValidator;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.validators.GlobalTypeValidator;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.validators.ProcessValidator;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.validators.SignalValidator;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.validators.UserTaskValidator;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.validation.AbstractModelConstraint;
+import org.eclipse.emf.validation.IValidationContext;
+
+public class JbpmModelConstraint extends AbstractModelConstraint {
+
+ @Override
+ public IStatus validate(IValidationContext ctx) {
+ EObject object = ctx.getTarget();
+ if (object instanceof BusinessRuleTask) {
+ return new BusinessRuleTaskValidator(ctx).validate((BusinessRuleTask) object);
+ }
+ if (object instanceof CallActivity) {
+ return new CallActivityValidator(ctx).validate((CallActivity) object);
+ }
+ if (object instanceof UserTask) {
+ return new UserTaskValidator(ctx).validate((UserTask)object);
+ }
+ if (object instanceof Process) {
+ return new ProcessValidator(ctx).validate((Process)object);
+ }
+ if (object instanceof Signal) {
+ return new SignalValidator(ctx).validate((Signal)object);
+ }
+ if (object instanceof Escalation) {
+ return new EscalationValidator(ctx).validate((Escalation)object);
+ }
+ if (object instanceof GlobalType) {
+ return new GlobalTypeValidator(ctx).validate((GlobalType)object);
+ }
+ if (object instanceof DataAssociation) {
+ return new DataAssociationValidator(ctx).validate((DataAssociation)object);
+ }
+ if (object instanceof Definitions) {
+ return new DefinitionsValidator(ctx).validate((Definitions)object);
+ }
+ return ctx.createSuccessStatus();
+ }
+
+}
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/Messages.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/Messages.java
index b962fcd6..010cb930 100644
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/Messages.java
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/Messages.java
@@ -1,3 +1,13 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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
+ ******************************************************************************/
package org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation;
import org.eclipse.osgi.util.NLS;
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/ProcessConstraint.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/ProcessConstraint.java
deleted file mode 100644
index 6724ea9e..00000000
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/ProcessConstraint.java
+++ /dev/null
@@ -1,51 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2012 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
- *******************************************************************************/
-package org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation;
-
-import java.util.Iterator;
-
-import org.eclipse.bpmn2.Process;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.util.FeatureMap;
-import org.eclipse.emf.validation.AbstractModelConstraint;
-import org.eclipse.emf.validation.IValidationContext;
-
-public class ProcessConstraint extends AbstractModelConstraint {
-
- @Override
- public IStatus validate(IValidationContext ctx) {
- EObject eObj = ctx.getTarget();
- if (eObj instanceof Process) {
- Process process = (Process)eObj;
-
- String name = null;
- Iterator<FeatureMap.Entry> iter = process.getAnyAttribute().iterator();
- while (iter.hasNext()) {
- FeatureMap.Entry entry = iter.next();
- if (entry.getEStructuralFeature().getName().equals("packageName")) { //$NON-NLS-1$
- name = (String) entry.getValue();
- if (name==null || name.isEmpty()) {
- ctx.addResult(entry.getEStructuralFeature());
- return ctx.createFailureStatus(Messages.ProcessConstraint_No_Package_Name);
- }
- }
- }
-
- name = process.getName();
- if (name==null || name.isEmpty()) {
- ctx.addResult(process.eClass().getEStructuralFeature("name")); //$NON-NLS-1$
- return ctx.createFailureStatus(Messages.ProcessConstraint_No_Process_Name);
- }
- }
- return ctx.createSuccessStatus();
- }
-}
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/ProcessVariableNameConstraint.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/ProcessVariableNameConstraint.java
index 820009fa..353397ab 100644
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/ProcessVariableNameConstraint.java
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/ProcessVariableNameConstraint.java
@@ -11,56 +11,24 @@
package org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation;
import org.eclipse.bpmn2.BaseElement;
-import org.eclipse.bpmn2.DataObject;
-import org.eclipse.bpmn2.Definitions;
-import org.eclipse.bpmn2.Message;
-import org.eclipse.bpmn2.Property;
-import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
-import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.drools.GlobalType;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.validators.ProcessVariableNameValidator;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.validation.AbstractModelConstraint;
import org.eclipse.emf.validation.IValidationContext;
-import org.eclipse.osgi.util.NLS;
public class ProcessVariableNameConstraint extends AbstractModelConstraint {
@Override
public IStatus validate(IValidationContext ctx) {
- EObject o1 = ctx.getTarget();
- String id1 = null;
- if (o1 instanceof GlobalType)
- id1 = ((GlobalType)o1).getIdentifier();
- else if (o1 instanceof Property)
- id1 = ((Property)o1).getId();
- else if (o1 instanceof Message)
- id1 = ((Message)o1).getId();
- else if (o1 instanceof DataObject)
- id1 = ((DataObject)o1).getId();
-
- Definitions definitions = ModelUtil.getDefinitions(o1);
- TreeIterator<EObject> iter = definitions.eAllContents();
- while (iter.hasNext()) {
- EObject o2 = iter.next();
- if (o2 instanceof BaseElement && o1!=o2) {
- String id2;
- if (o2 instanceof GlobalType)
- id2 = ((GlobalType)o2).getIdentifier();
- else
- id2 = ((BaseElement)o2).getId();
- if (id1!=null && id2!=null) {
- if (id1.equals(id2)) {
- String msg = NLS.bind(
- Messages.ProcessVariableNameConstraint_Duplicate_ID,
- ModelUtil.getLabel(o1)+" "+ModelUtil.getDisplayName(o1), //$NON-NLS-1$
- ModelUtil.getLabel(o2)+" "+ModelUtil.getDisplayName(o2)); //$NON-NLS-1$
- return ctx.createFailureStatus(msg);
- }
- }
- }
+ EObject object = ctx.getTarget();
+ if (object instanceof BaseElement) {
+ return new ProcessVariableNameValidator(ctx).validate((BaseElement) object);
}
return ctx.createSuccessStatus();
}
+ public boolean doLiveValidation() {
+ return true;
+ }
}
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
deleted file mode 100644
index 60227315..00000000
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/TaskConstraint.java
+++ /dev/null
@@ -1,123 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2012 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
- *******************************************************************************/
-package org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation;
-
-import java.util.List;
-
-import org.eclipse.bpmn2.ExtensionAttributeValue;
-import org.eclipse.bpmn2.Task;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.util.FeatureMap;
-import org.eclipse.emf.validation.AbstractModelConstraint;
-import org.eclipse.emf.validation.IValidationContext;
-
-public class TaskConstraint extends AbstractModelConstraint {
-
- @Override
- public IStatus validate(IValidationContext ctx) {
- EObject eObj = ctx.getTarget();
- if (eObj instanceof Task) {
- Task ta = (Task) eObj;
-
- // TODO: fix this
- /*
- if (ta.getExtensionValues() != null && ta.getExtensionValues().size() > 0) {
- boolean foundDistributionType = false;
- String distributionTypeValue = "";
- boolean foundDuration = false;
- boolean foundTimeUnits = false;
- boolean foundRange = false;
- boolean foundStandardDeviation = false;
- for (ExtensionAttributeValue extattrval : ta.getExtensionValues()) {
- FeatureMap extensionElements = extattrval.getValue();
- if (extensionElements == null) {
- continue;
- }
- @SuppressWarnings("unchecked")
- List<MetadataType> metadataTypeExtensions = null;
- try {
- metadataTypeExtensions = (List<MetadataType>) extensionElements.get(
- DroolsPackage.Literals.DOCUMENT_ROOT__METADATA, true);
- }
- catch (Exception e) {
- continue;
- }
-
- if (metadataTypeExtensions != null && metadataTypeExtensions.size() > 0) {
- MetadataType metaType = metadataTypeExtensions.get(0);
- for (Object metaEntryObj : metaType.getMetaentry()) {
- MetaentryType entry = (MetaentryType) metaEntryObj;
- 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");
- }
- }
- if (entry.getName() != null && entry.getName().equals("distributiontype")) {
- foundDistributionType = true;
- distributionTypeValue = entry.getValue();
- }
- 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");
- }
- foundDuration = true;
- }
- if (entry.getName() != null && entry.getName().equals("timeunit")) {
- foundTimeUnits = true;
- }
- 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");
- }
- }
- 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");
- }
- foundRange = true;
- }
- if (entry.getName() != null && entry.getName().equals("standarddeviation")) {
- foundStandardDeviation = true;
- }
- }
- }
-
- }
- if (!foundDistributionType) {
- ctx.createFailureStatus("Task has no distribution type defined");
- }
- if (!foundDuration) {
- ctx.createFailureStatus("Task has no duration defined");
- }
- if (!foundTimeUnits) {
- ctx.createFailureStatus("Task has no Time Units defined");
- }
- if (foundDistributionType) {
- if ((distributionTypeValue.equals("random") || distributionTypeValue.equals("uniform"))
- && !foundRange) {
- ctx.createFailureStatus("Task has no Range defined");
- }
- if (distributionTypeValue.equals("normal") && !foundStandardDeviation) {
- ctx.createFailureStatus("Task has no Standard Deviation defined");
- }
- }
- }
- */
- }
- return ctx.createSuccessStatus();
- }
-
-}
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
deleted file mode 100644
index b30a620f..00000000
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/UserTaskConstraint.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2011, 2012 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
- *******************************************************************************/
-package org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation;
-
-import java.util.Iterator;
-import java.util.List;
-
-import org.eclipse.bpmn2.Assignment;
-import org.eclipse.bpmn2.DataInput;
-import org.eclipse.bpmn2.DataInputAssociation;
-import org.eclipse.bpmn2.ExtensionAttributeValue;
-import org.eclipse.bpmn2.FormalExpression;
-import org.eclipse.bpmn2.ItemAwareElement;
-import org.eclipse.bpmn2.UserTask;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.emf.ecore.EObject;
-import org.eclipse.emf.ecore.util.FeatureMap;
-import org.eclipse.emf.validation.AbstractModelConstraint;
-import org.eclipse.emf.validation.IValidationContext;
-
-public class UserTaskConstraint extends AbstractModelConstraint {
- private IDiagramProfile profile;
- private String uuid = "uuid"; //$NON-NLS-1$
-
- @Override
- public IStatus validate(IValidationContext ctx) {
- EObject eObj = ctx.getTarget();
- if (eObj instanceof UserTask) {
- UserTask ut = (UserTask)eObj;
-
- try {
- String taskName = null;
- if (ut.getIoSpecification()!=null) {
- Iterator<FeatureMap.Entry> utiter = ut.getAnyAttribute().iterator();
- for (DataInput di : ut.getIoSpecification().getDataInputs()) {
- if ("TaskName".equalsIgnoreCase(di.getName())) { //$NON-NLS-1$
- for (DataInputAssociation dia : ut.getDataInputAssociations()) {
- if (dia.getTargetRef() == di) {
- if (dia.getAssignment().size()!=0) {
- Assignment a = dia.getAssignment().get(0);
- if (a.getFrom() instanceof FormalExpression) {
- String body = ((FormalExpression)a.getFrom()).getBody();
- if (body!=null && !body.isEmpty()) {
- taskName = body;
- break;
- }
- }
- }
- }
- }
- }
- }
- }
- if (taskName==null) {
- return ctx.createFailureStatus(Messages.UserTaskConstraint_No_Name);
- }
- else {
- // TODO:
- if (taskName != null) {
- String[] packageAssetInfo = ServletUtil.findPackageAndAssetInfo(uuid, profile);
- String taskFormName = taskName + "-taskform"; //$NON-NLS-1$
- if (!ServletUtil.assetExistsInGuvnor(packageAssetInfo[0], taskFormName, profile)) {
- ctx.createFailureStatus(Messages.UserTaskConstraint_No_Form);
- }
- }
- }
-
- // simulation validation
- // TODO: fix this
- /*
- if (ut.getExtensionValues() != null && ut.getExtensionValues().size() > 0) {
- boolean foundStaffAvailability = false;
- for (ExtensionAttributeValue extattrval : ut.getExtensionValues()) {
- FeatureMap extensionElements = extattrval.getValue();
- if (extensionElements!=null) {
- @SuppressWarnings("unchecked")
- List<MetadataType> metadataTypeExtensions = (List<MetadataType>) extensionElements.get(
- DroolsPackage.Literals.DOCUMENT_ROOT__METADATA, true);
- if (metadataTypeExtensions != null && metadataTypeExtensions.size() > 0) {
- MetadataType metaType = metadataTypeExtensions.get(0);
- for (Object metaEntryObj : metaType.getMetaentry()) {
- MetaentryType entry = (MetaentryType) metaEntryObj;
- if (entry.getName() != null && entry.getName().equals("staffavailability")) {
- Float f = new Float(entry.getValue());
- if (f.floatValue() < 0) {
- ctx.createFailureStatus("User Task Simulation Parameter \"Staff Availability\" must be positive");
- }
- foundStaffAvailability = true;
- }
- }
- }
- if (!foundStaffAvailability) {
- return ctx.createFailureStatus("User Task Simulation Parameter \"Staff Availability\" is not defined");
- }
- }
- }
- }
- */
- }
- catch (Exception e) {
- e.printStackTrace();
- return ctx.createFailureStatus(Messages.UserTaskConstraint_Internal_Error+e.getMessage());
- }
- }
- return ctx.createSuccessStatus();
- }
-
-}
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/messages.properties b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/messages.properties
index 9e79363e..4790576d 100644
--- a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/messages.properties
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/messages.properties
@@ -1,8 +1,18 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2011, 2012, 2013, 2014 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
+#-------------------------------------------------------------------------------
BusinessRuleTaskConstraint_No_Ruleflow_Group=Business Rule Task has no ruleflow group
CallActivityConstraint_No_Called_Element=Reusable Subprocess has no called element specified.
CallActivityConstraint_No_Process=No existing process exists with ID {0}
-ProcessConstraint_No_Package_Name=Process has no package name
-ProcessConstraint_No_Process_Name=Process has no name
+ProcessConstraint_No_Package_Name=Process {0} (ID={1}) has no package name
+ProcessConstraint_No_Process_Name=Process with ID={1} has no name
ProcessVariableNameConstraint_Duplicate_ID={0} and {1} have the same ID
UserTaskConstraint_Internal_Error=Internal Validation Error for User Task: {0}
UserTaskConstraint_No_Form=User Task has no task form defined
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/BusinessRuleTaskValidator.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/BusinessRuleTaskValidator.java
new file mode 100644
index 00000000..4f078c56
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/BusinessRuleTaskValidator.java
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.runtime.jboss.jbpm5.validation.validators;
+
+import java.util.Iterator;
+
+import org.eclipse.bpmn2.BusinessRuleTask;
+import org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.ecore.util.FeatureMap;
+import org.eclipse.emf.ecore.util.FeatureMap.Entry;
+import org.eclipse.emf.validation.IValidationContext;
+
+public class BusinessRuleTaskValidator extends AbstractBpmn2ElementValidator<BusinessRuleTask> {
+
+ /**
+ * @param ctx
+ */
+ public BusinessRuleTaskValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(BusinessRuleTask object) {
+
+ Iterator<FeatureMap.Entry> iter = object.getAnyAttribute().iterator();
+ boolean hasRuleflowGroup = false;
+ while (iter.hasNext()) {
+ FeatureMap.Entry entry = iter.next();
+ if (entry.getEStructuralFeature().getName().equals("ruleFlowGroup")) { //$NON-NLS-1$
+ String ruleflowGroup = (String) entry.getValue();
+ if (ruleflowGroup!=null && !ruleflowGroup.isEmpty()) {
+ hasRuleflowGroup = true;
+ break;
+ }
+ }
+ }
+ if (!hasRuleflowGroup) {
+ addMissingFeatureStatus(object,"ruleFlowGroup",Status.ERROR);
+ }
+ return getResult();
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/CallActivityValidator.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/CallActivityValidator.java
new file mode 100644
index 00000000..cb0ede37
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/CallActivityValidator.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.runtime.jboss.jbpm5.validation.validators;
+
+import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
+import org.eclipse.bpmn2.CallActivity;
+import org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.IDiagramProfile;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.Messages;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.ServletUtil;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.validation.IValidationContext;
+
+public class CallActivityValidator extends AbstractBpmn2ElementValidator<CallActivity> {
+
+ // TODO: Link the ServletUtil to guvnor db somehow so that we can look up
+ // external Processes and Packages and whatnot.
+ private IDiagramProfile profile;
+ private String uuid = "uuid"; //$NON-NLS-1$
+
+ /**
+ * @param ctx
+ */
+ public CallActivityValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ @Override
+ public IStatus validate(CallActivity object) {
+ if (object.getCalledElementRef() == null) {
+ addStatus(object, Status.ERROR, Messages.CallActivityConstraint_No_Called_Element);
+ } else {
+ String[] packageAssetInfo = ServletUtil.findPackageAndAssetInfo(uuid, profile);
+ String packageName = packageAssetInfo[0];
+ List<String> allProcessesInPackage = ServletUtil.getAllProcessesInPackage(packageName, profile);
+ boolean foundCalledElementProcess = false;
+ for (String p : allProcessesInPackage) {
+ String processContent = ServletUtil.getProcessSourceContent(packageName, p, profile);
+ Pattern pattern = Pattern.compile("<\\S*process[\\s\\S]*id=\"" + object.getCalledElementRef() + "\"", //$NON-NLS-1$ //$NON-NLS-2$
+ Pattern.MULTILINE);
+ Matcher m = pattern.matcher(processContent);
+ if (m.find()) {
+ foundCalledElementProcess = true;
+ break;
+ }
+ }
+ foundCalledElementProcess = true; // TODO: remove this
+ if (!foundCalledElementProcess) {
+ addStatus(object, Status.ERROR, Messages.CallActivityConstraint_No_Process, object.getCalledElementRef());
+ }
+ }
+ return getResult();
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/DataAssociationValidator.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/DataAssociationValidator.java
new file mode 100644
index 00000000..639e9240
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/DataAssociationValidator.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.runtime.jboss.jbpm5.validation.validators;
+
+import org.eclipse.bpmn2.DataAssociation;
+import org.eclipse.bpmn2.UserTask;
+import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
+import org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class DataAssociationValidator extends org.eclipse.bpmn2.modeler.core.validation.validators.DataAssociationValidator {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public DataAssociationValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public DataAssociationValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(DataAssociation object) {
+ EObject container = object.eContainer();
+ if (container!=null) {
+ if (ModelUtil.getAnyAttribute(container, "taskName")!=null)
+ return getResult();
+ }
+ if (!(container instanceof UserTask)) {
+ // Ignore missing Sources for User Task parameters.
+ super.validate(object);
+ }
+ return getResult();
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/DefinitionsValidator.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/DefinitionsValidator.java
new file mode 100644
index 00000000..114ea865
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/DefinitionsValidator.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.runtime.jboss.jbpm5.validation.validators;
+
+import org.eclipse.bpmn2.BaseElement;
+import org.eclipse.bpmn2.Definitions;
+import org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.validation.IValidationContext;
+
+
+/**
+ *
+ */
+public class DefinitionsValidator extends org.eclipse.bpmn2.modeler.core.validation.validators.DefinitionsValidator {
+
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public DefinitionsValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ public DefinitionsValidator(AbstractBpmn2ElementValidator<?> other) {
+ super(other);
+ }
+
+ @Override
+ public IStatus validate(Definitions object) {
+ if (object.getTargetNamespace()==null || object.getTargetNamespace().isEmpty()) {
+ addStatus(object, Status.ERROR, "No targetNamespace defined");
+ }
+ if (isLiveValidation()) {
+ TreeIterator<EObject> iter = object.eAllContents();
+ while (iter.hasNext()) {
+ EObject o = iter.next();
+ if (o instanceof BaseElement) {
+ addStatus(new ProcessVariableNameValidator(this).validate((BaseElement)o));
+ }
+ }
+ }
+ return getResult();
+ }
+}
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/EscalationValidator.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/EscalationValidator.java
new file mode 100644
index 00000000..7aa65251
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/EscalationValidator.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.runtime.jboss.jbpm5.validation.validators;
+
+import org.eclipse.bpmn2.Escalation;
+import org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class EscalationValidator extends AbstractBpmn2ElementValidator<Escalation> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public EscalationValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public EscalationValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(Escalation object) {
+ // jBPM Escalation definitions do not have an ItemDefinition
+ if (isEmpty(object.getEscalationCode()))
+ addMissingFeatureStatus(object,"escalationCode",Status.ERROR); //$NON-NLS-1$
+ return getResult();
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/GlobalTypeValidator.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/GlobalTypeValidator.java
new file mode 100644
index 00000000..fda2a0e8
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/GlobalTypeValidator.java
@@ -0,0 +1,66 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.runtime.jboss.jbpm5.validation.validators;
+
+import org.eclipse.bpmn2.ItemAwareElement;
+import org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator;
+import org.eclipse.bpmn2.modeler.core.validation.validators.BaseElementValidator;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.drools.GlobalType;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class GlobalTypeValidator extends org.eclipse.bpmn2.modeler.core.validation.validators.ItemAwareElementValidator {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public GlobalTypeValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public GlobalTypeValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(ItemAwareElement object) {
+ // make sure ID is valid
+ new BaseElementValidator(ctx).validate(object);
+ GlobalType globalType = (GlobalType) object;
+ if (isEmpty(globalType.getType())) {
+ addMissingFeatureStatus(object,"type",Status.ERROR); //$NON-NLS-1$
+ }
+
+ return getResult();
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/ProcessValidator.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/ProcessValidator.java
new file mode 100644
index 00000000..a3b21819
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/ProcessValidator.java
@@ -0,0 +1,111 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.runtime.jboss.jbpm5.validation.validators;
+
+import java.util.List;
+
+import org.eclipse.bpmn2.EndEvent;
+import org.eclipse.bpmn2.FlowElement;
+import org.eclipse.bpmn2.Process;
+import org.eclipse.bpmn2.StartEvent;
+import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
+import org.eclipse.bpmn2.modeler.core.validation.SyntaxCheckerUtils;
+import org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator;
+import org.eclipse.bpmn2.modeler.core.validation.validators.BaseElementValidator;
+import org.eclipse.bpmn2.modeler.core.validation.validators.FlowElementsContainerValidator;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.Messages;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.ecore.EStructuralFeature;
+import org.eclipse.emf.validation.IValidationContext;
+
+public class ProcessValidator extends AbstractBpmn2ElementValidator<Process> {
+
+ /**
+ * @param ctx
+ */
+ public ProcessValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(Process object) {
+ boolean foundStartEvent = false;
+ boolean foundEndEvent = false;
+ List<FlowElement> flowElements = object.getFlowElements();
+ for (FlowElement fe : flowElements) {
+ if (fe instanceof StartEvent) {
+ foundStartEvent = true;
+ }
+ if (fe instanceof EndEvent) {
+ foundEndEvent = true;
+ }
+ }
+ if (!foundStartEvent) {
+ addStatus(object, Status.WARNING, "Process has no Start Event");
+ }
+ if (!foundEndEvent) {
+ addStatus(object, Status.WARNING, "Process has no End Event");
+ }
+
+ if (isEmpty(object.getName())) {
+ addStatus(object, "name", Status.WARNING, "Process {0} has no name", object.getId());
+ }
+
+ EStructuralFeature feature;
+ feature = ModelUtil.getAnyAttribute(object, "packageName"); //$NON-NLS-1$
+ String name = null;
+ if (feature!=null) {
+ name = (String) object.eGet(feature);
+ }
+ if (name==null || name.isEmpty()) {
+ addStatus(object, "packageName", Status.ERROR, Messages.ProcessConstraint_No_Package_Name, object.getName(), object.getId());
+ }
+ else if (!SyntaxCheckerUtils.isJavaPackageName(name)) {
+ addStatus(object, "packageName", Status.ERROR, "Package name is invalid: {0}", name);
+ }
+
+ name = object.getName();
+ if (name==null || name.isEmpty()) {
+ addStatus(object, "name", Status.ERROR, Messages.ProcessConstraint_No_Process_Name, object.getId());
+ }
+
+ feature = ModelUtil.getAnyAttribute(object, "adHoc"); //$NON-NLS-1$
+ if (feature!=null) {
+ Object v = object.eGet(feature);
+ Boolean adHoc = false;
+ if (v instanceof String)
+ adHoc = Boolean.parseBoolean((String)v);
+ else if (v instanceof Boolean)
+ adHoc = (Boolean)v;
+ if (!adHoc.booleanValue()) {
+ // This is not an ad-hoc process:
+ // need to make sure all nodes are connected,
+ // same as core BPMN2
+ new FlowElementsContainerValidator(this).validate(object);
+ }
+ }
+ else {
+ // Default value for missing "adHoc" attribute is "false"
+ new FlowElementsContainerValidator(this).validate(object);
+ }
+
+ new BaseElementValidator(this).validate(object);
+
+ return getResult();
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/ProcessVariableNameValidator.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/ProcessVariableNameValidator.java
new file mode 100644
index 00000000..69513d36
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/ProcessVariableNameValidator.java
@@ -0,0 +1,110 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.runtime.jboss.jbpm5.validation.validators;
+
+import org.eclipse.bpmn2.BaseElement;
+import org.eclipse.bpmn2.Definitions;
+import org.eclipse.bpmn2.Process;
+import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
+import org.eclipse.bpmn2.modeler.core.validation.SyntaxCheckerUtils;
+import org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.drools.ExternalProcess;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.model.drools.GlobalType;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.Messages;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.util.TreeIterator;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.validation.IValidationContext;
+
+public class ProcessVariableNameValidator extends AbstractBpmn2ElementValidator<BaseElement> {
+
+ /**
+ * @param ctx
+ */
+ public ProcessVariableNameValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ public ProcessVariableNameValidator(AbstractBpmn2ElementValidator<?> other) {
+ super(other);
+ }
+
+ /*
+ * (non-Javadoc)
+ *
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.
+ * AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(BaseElement object) {
+ String id = null;
+ String featureName = null;
+ if (object instanceof GlobalType) {
+ id = ((GlobalType) object).getIdentifier();
+ featureName = "identifier";
+ }
+ else if (object instanceof BaseElement) {
+ id = ((BaseElement) object).getId();
+ featureName = "id";
+ }
+
+ if (isEmpty(id)) {
+ addStatus(object, featureName, Status.ERROR, "The {0} ID can not be empty", object.eClass().getName());
+ }
+ else {
+ if (object instanceof Process || object instanceof ExternalProcess) {
+ if (!SyntaxCheckerUtils.isJavaPackageName(id)) {
+ addStatus(object, featureName, Status.ERROR, "The {0} ID is invalid: {1}", object.eClass().getName(), id);
+ }
+ }
+ else {
+ if (!SyntaxCheckerUtils.isJavaIdentifier(id)) {
+ addStatus(object, featureName, Status.ERROR, "The {0} ID is invalid: {1}", object.eClass().getName(), id);
+ }
+ }
+ }
+
+ Definitions definitions = ModelUtil.getDefinitions(object);
+ TreeIterator<EObject> iter = definitions.eAllContents();
+ while (iter.hasNext()) {
+ EObject o2 = iter.next();
+ if (o2 instanceof BaseElement && object!=o2) {
+ String id2;
+ if (o2 instanceof GlobalType)
+ id2 = ((GlobalType) o2).getIdentifier();
+ else
+ id2 = ((BaseElement) o2).getId();
+ if (id != null && id2 != null) {
+ if (id.equals(id2)) {
+ addStatus(object, featureName, Status.ERROR,
+ Messages.ProcessVariableNameConstraint_Duplicate_ID,
+ getLabel(object)
+ + " " + getName(object), //$NON-NLS-1$
+ getLabel(o2)
+ + " " + getName(o2)); //$NON-NLS-1$
+ }
+ }
+ }
+ }
+ return getResult();
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/SignalValidator.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/SignalValidator.java
new file mode 100644
index 00000000..dedac70e
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/SignalValidator.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.runtime.jboss.jbpm5.validation.validators;
+
+import org.eclipse.bpmn2.Signal;
+import org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.emf.validation.IValidationContext;
+
+/**
+ *
+ */
+public class SignalValidator extends AbstractBpmn2ElementValidator<Signal> {
+
+ /**
+ * Construct a BPMN2 Element Validator from a Validation Context.
+ *
+ * @param ctx
+ */
+ public SignalValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /**
+ * Construct a BPMN2 Element Validator with the given Validator as the parent.
+ * The parent is responsible for collecting all of the validation Status objects
+ * and reporting them back to the Validation Constraint.
+ *
+ * @param parent a parent Validator class
+ */
+ @SuppressWarnings("rawtypes")
+ public SignalValidator(AbstractBpmn2ElementValidator parent) {
+ super(parent);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(Signal object) {
+ // jBPM Signal definitions do not have an ItemDefinition
+ return getResult();
+ }
+
+}
+
diff --git a/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/UserTaskValidator.java b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/UserTaskValidator.java
new file mode 100644
index 00000000..df042225
--- /dev/null
+++ b/org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5/src/org/eclipse/bpmn2/modeler/runtime/jboss/jbpm5/validation/validators/UserTaskValidator.java
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * Copyright (c) 2011, 2012, 2013, 2014 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.runtime.jboss.jbpm5.validation.validators;
+
+import org.eclipse.bpmn2.Assignment;
+import org.eclipse.bpmn2.DataInput;
+import org.eclipse.bpmn2.DataInputAssociation;
+import org.eclipse.bpmn2.FormalExpression;
+import org.eclipse.bpmn2.UserTask;
+import org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.IDiagramProfile;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.Messages;
+import org.eclipse.bpmn2.modeler.runtime.jboss.jbpm5.validation.ServletUtil;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.validation.IValidationContext;
+
+public class UserTaskValidator extends AbstractBpmn2ElementValidator<UserTask> {
+
+ // TODO: Link the ServletUtil to guvnor db somehow so that we can look up
+ // external Processes and Packages and whatnot.
+ private IDiagramProfile profile;
+ private String uuid = "uuid"; //$NON-NLS-1$
+
+ /**
+ * @param ctx
+ */
+ public UserTaskValidator(IValidationContext ctx) {
+ super(ctx);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.bpmn2.modeler.core.validation.validators.AbstractBpmn2ElementValidator#validate(org.eclipse.bpmn2.BaseElement)
+ */
+ @Override
+ public IStatus validate(UserTask object) {
+ String taskName = null;
+ if (object.getIoSpecification()!=null) {
+ for (DataInput di : object.getIoSpecification().getDataInputs()) {
+ if ("TaskName".equalsIgnoreCase(di.getName())) { //$NON-NLS-1$
+ for (DataInputAssociation dia : object.getDataInputAssociations()) {
+ if (dia.getTargetRef() == di) {
+ if (dia.getAssignment().size()!=0) {
+ Assignment a = dia.getAssignment().get(0);
+ if (a.getFrom() instanceof FormalExpression) {
+ String body = ((FormalExpression)a.getFrom()).getBody();
+ if (body!=null && !body.isEmpty()) {
+ taskName = body;
+ break;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ if (taskName==null) {
+ addStatus(object, Status.ERROR, Messages.UserTaskConstraint_No_Name);
+ }
+ else {
+ // TODO:
+ if (taskName != null) {
+ String[] packageAssetInfo = ServletUtil.findPackageAndAssetInfo(uuid, profile);
+ String taskFormName = taskName + "-taskform"; //$NON-NLS-1$
+ if (!ServletUtil.assetExistsInGuvnor(packageAssetInfo[0], taskFormName, profile)) {
+ addStatus(object, Status.ERROR, Messages.UserTaskConstraint_No_Form);
+ }
+ }
+ }
+
+ // simulation validation
+ // TODO: fix this
+ /*
+ if (ut.getExtensionValues() != null && ut.getExtensionValues().size() > 0) {
+ boolean foundStaffAvailability = false;
+ for (ExtensionAttributeValue extattrval : ut.getExtensionValues()) {
+ Bpmn2FeatureMap extensionElements = extattrval.getValue();
+ if (extensionElements!=null) {
+ @SuppressWarnings("unchecked")
+ List<MetadataType> metadataTypeExtensions = (List<MetadataType>) extensionElements.get(
+ DroolsPackage.Literals.DOCUMENT_ROOT__METADATA, true);
+ if (metadataTypeExtensions != null && metadataTypeExtensions.size() > 0) {
+ MetadataType metaType = metadataTypeExtensions.get(0);
+ for (Object metaEntryObj : metaType.getMetaentry()) {
+ MetaentryType entry = (MetaentryType) metaEntryObj;
+ if (entry.getName() != null && entry.getName().equals("staffavailability")) {
+ Float f = new Float(entry.getValue());
+ if (f.floatValue() < 0) {
+ ctx.createFailureStatus("User Task Simulation Parameter \"Staff Availability\" must be positive");
+ }
+ foundStaffAvailability = true;
+ }
+ }
+ }
+ if (!foundStaffAvailability) {
+ return ctx.createFailureStatus("User Task Simulation Parameter \"Staff Availability\" is not defined");
+ }
+ }
+ }
+ }
+ */
+ return getResult();
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.bpmn2.modeler.ui/plugin.xml b/org.eclipse.bpmn2.modeler.ui/plugin.xml
index 059ad424..d1a4803c 100644
--- a/org.eclipse.bpmn2.modeler.ui/plugin.xml
+++ b/org.eclipse.bpmn2.modeler.ui/plugin.xml
@@ -703,6 +703,15 @@
class="org.eclipse.bpmn2.modeler.ui.property.tasks.IoParametersPropertySection"
label="%propertyTab.label.57">
</propertyTab>
+
+ <propertyTab
+ id="org.eclipse.bpmn2.modeler.property.tab"
+ afterTab="org.eclipse.bpmn2.modeler.description.tab"
+ class="default"
+ features="itemSubjectRef dataState"
+ label="Local Variable"
+ type="org.eclipse.bpmn2.Property">
+ </propertyTab>
<propertyTab
id="org.eclipse.bpmn2.modeler.advanced.tab"
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 7ca0e8e6..4194eb7e 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
@@ -89,6 +89,7 @@ import org.eclipse.bpmn2.modeler.core.merrimac.clad.DefaultDetailComposite;
import org.eclipse.bpmn2.modeler.core.merrimac.clad.DefaultDialogComposite;
import org.eclipse.bpmn2.modeler.core.merrimac.clad.DefaultListComposite;
import org.eclipse.bpmn2.modeler.core.merrimac.clad.PropertiesCompositeFactory;
+import org.eclipse.bpmn2.modeler.core.merrimac.dialogs.ObjectEditingDialog;
import org.eclipse.bpmn2.modeler.core.model.Bpmn2ModelerResourceImpl;
import org.eclipse.bpmn2.modeler.core.preferences.Bpmn2Preferences;
import org.eclipse.bpmn2.modeler.core.preferences.ModelEnablements;
@@ -99,6 +100,7 @@ import org.eclipse.bpmn2.modeler.core.utils.DiagramEditorAdapter;
import org.eclipse.bpmn2.modeler.core.utils.ErrorUtils;
import org.eclipse.bpmn2.modeler.core.utils.FeatureSupport;
import org.eclipse.bpmn2.modeler.core.utils.GraphicsUtil;
+import org.eclipse.bpmn2.modeler.core.utils.MarkerUtils;
import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
import org.eclipse.bpmn2.modeler.core.utils.ModelUtil.Bpmn2DiagramType;
import org.eclipse.bpmn2.modeler.core.utils.StyleUtil;
@@ -153,6 +155,7 @@ import org.eclipse.bpmn2.modeler.ui.property.tasks.MultiInstanceLoopCharacterist
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.util.PropertyUtil;
import org.eclipse.bpmn2.modeler.ui.views.outline.BPMN2EditorOutlinePage;
import org.eclipse.bpmn2.modeler.ui.views.outline.BPMN2EditorSelectionSynchronizer;
import org.eclipse.bpmn2.modeler.ui.wizards.BPMN2DiagramCreator;
@@ -182,7 +185,6 @@ import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EReference;
-import org.eclipse.emf.ecore.EValidator;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.transaction.NotificationFilter;
@@ -220,6 +222,7 @@ import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IEditorReference;
import org.eclipse.ui.IEditorSite;
import org.eclipse.ui.IPartListener2;
+import org.eclipse.ui.IViewReference;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchListener;
import org.eclipse.ui.IWorkbenchPage;
@@ -693,16 +696,20 @@ public class BPMN2Editor extends DiagramEditor implements IPreferenceChangeListe
@Override
public void gotoMarker(IMarker marker) {
- final EObject target = getTargetObject(marker);
+ ResourceSet rs = getEditingDomain().getResourceSet();
+ EObject target = MarkerUtils.getTargetObject(rs, marker);
if (target == null) {
return;
}
- final PictogramElement pe = getDiagramTypeProvider().getFeatureProvider().getPictogramElementForBusinessObject(
- target);
- if (pe == null) {
- return;
+ IFeatureProvider fp = getDiagramTypeProvider().getFeatureProvider();
+ PictogramElement pe = MarkerUtils.getContainerShape(fp, marker);
+
+ if (pe!=null)
+ selectPictogramElements(new PictogramElement[] {pe});
+ if (pe == null || PropertyUtil.getPropertySheetView() == null) {
+ ObjectEditingDialog dialog = new ObjectEditingDialog(this, target);
+ ObjectEditingDialog.openWithTransaction(dialog);
}
- selectPictogramElements(new PictogramElement[] {pe });
}
private void loadMarkers() {
@@ -717,15 +724,6 @@ public class BPMN2Editor extends DiagramEditor implements IPreferenceChangeListe
}
}
}
-
- private EObject getTargetObject(IMarker marker) {
- final String uriString = marker.getAttribute(EValidator.URI_ATTRIBUTE, null);
- final URI uri = uriString == null ? null : URI.createURI(uriString);
- if (uri == null) {
- return null;
- }
- return getEditingDomain().getResourceSet().getEObject(uri, false);
- }
private void removeWorkbenchListener()
{
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2EditorDiagramBehavior.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2EditorDiagramBehavior.java
index 087fc28b..6de025a5 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2EditorDiagramBehavior.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2EditorDiagramBehavior.java
@@ -78,6 +78,10 @@ public class BPMN2EditorDiagramBehavior extends DiagramBehavior {
action.setEnabled(action.isEnabled());
manager.add(action);
}
+
+ action = getDiagramContainer().getActionRegistry().getAction("show.property.view"); //$NON-NLS-1$
+ action.setText(action.getText());
+ manager.add(action);
}
};
}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2EditorUpdateBehavior.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2EditorUpdateBehavior.java
index 060b75a3..12d4e732 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2EditorUpdateBehavior.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2EditorUpdateBehavior.java
@@ -13,28 +13,37 @@
package org.eclipse.bpmn2.modeler.ui.editor;
+import java.util.Map;
+
+import org.eclipse.bpmn2.modeler.core.LifecycleEvent;
+import org.eclipse.bpmn2.modeler.core.LifecycleEvent.EventType;
import org.eclipse.bpmn2.modeler.core.model.Bpmn2ModelerResourceSetImpl;
-import org.eclipse.bpmn2.modeler.core.validation.ValidationStatusAdapterFactory;
+import org.eclipse.bpmn2.modeler.core.runtime.TargetRuntime;
import org.eclipse.core.commands.operations.DefaultOperationHistory;
-import org.eclipse.core.resources.IFile;
+import org.eclipse.core.commands.operations.OperationHistoryEvent;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
+import org.eclipse.emf.transaction.RollbackException;
+import org.eclipse.emf.transaction.Transaction;
import org.eclipse.emf.transaction.TransactionalEditingDomain;
+import org.eclipse.emf.transaction.impl.EMFCommandTransaction;
import org.eclipse.emf.transaction.impl.TransactionalEditingDomainImpl;
+import org.eclipse.emf.transaction.impl.TriggerCommandTransaction;
+import org.eclipse.emf.transaction.util.TriggerCommand;
import org.eclipse.emf.workspace.IWorkspaceCommandStack;
import org.eclipse.emf.workspace.WorkspaceEditingDomainFactory;
+import org.eclipse.emf.workspace.impl.EMFOperationTransaction;
+import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
import org.eclipse.graphiti.platform.IDiagramContainer;
import org.eclipse.graphiti.ui.editor.DefaultUpdateBehavior;
import org.eclipse.graphiti.ui.editor.DiagramBehavior;
-import org.eclipse.graphiti.ui.editor.DiagramEditor;
import org.eclipse.graphiti.ui.editor.IDiagramContainerUI;
-import org.eclipse.graphiti.ui.editor.IDiagramEditorInput;
-import org.eclipse.graphiti.ui.internal.editor.DomainModelWorkspaceSynchronizerDelegate;
import org.eclipse.graphiti.ui.internal.editor.GFWorkspaceCommandStackImpl;
-import org.eclipse.ui.IEditorInput;
-import org.eclipse.emf.workspace.util.WorkspaceSynchronizer;
/**
* This overrides the DefaultUpdateBehavior provider class from Graphiti. This
@@ -109,16 +118,81 @@ public class BPMN2EditorUpdateBehavior extends DefaultUpdateBehavior {
// the Graphiti EMF Service. Here we want to substitute our own
// Bpmn2ModelerResourceSetImpl instead of using a ResourceSetImpl.
final ResourceSet resourceSet = new Bpmn2ModelerResourceSetImpl();
- final IWorkspaceCommandStack workspaceCommandStack = new GFWorkspaceCommandStackImpl(
- new DefaultOperationHistory());
-
+ final IWorkspaceCommandStack workspaceCommandStack = new BPMN2EditorWorkspaceCommandStack();
+ final ComposedAdapterFactory adapterFactory = new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE);
final TransactionalEditingDomainImpl editingDomain = new TransactionalEditingDomainImpl(
- new ComposedAdapterFactory(ComposedAdapterFactory.Descriptor.Registry.INSTANCE),
- workspaceCommandStack, resourceSet);
+ adapterFactory, workspaceCommandStack, resourceSet);
WorkspaceEditingDomainFactory.INSTANCE.mapResourceSet(editingDomain);
return editingDomain;
}
+ public class BPMN2EditorWorkspaceCommandStack extends GFWorkspaceCommandStackImpl {
+
+ /**
+ * @param history
+ */
+ public BPMN2EditorWorkspaceCommandStack() {
+ super(new DefaultOperationHistory());
+ }
+
+ @Override
+ public EMFCommandTransaction createTransaction(Command command, Map<?, ?> options) throws InterruptedException {
+ /*
+ * We need to disable Live Validation after a CreateFeature
+ * because some of the {@link CompoundCreateFeature} actions
+ * will construct elements that are not valid until fleshed out
+ * by the user. These errors will still be reported during Batch
+ * Validation once the Create operation is complete.
+ *
+ * If this is not done, the Create action will fail
+ * validation and will be rolled back by Graphiti.
+ */
+ ((Map<Object,Object>)options).put(Transaction.OPTION_NO_VALIDATION, Boolean.TRUE);
+
+ EMFCommandTransaction result;
+
+ if (command instanceof TriggerCommand) {
+ result = new TriggerCommandTransaction((TriggerCommand) command,
+ getDomain(), options);
+ } else {
+ result = new EMFOperationTransaction(command, getDomain(), options) {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.emf.transaction.impl.TransactionImpl#commit()
+ * There is no easy way of causing a transaction rollback
+ * in Graphiti, so we have to override the Transaction's
+ * commit() method. An operation can set the Transaction's
+ * status severity to {@code Status.CANCEL} anywhere along the
+ * execution path, and the transaction will be rolled back
+ * instead of committed (which is kinda what I had hoped to
+ * expect anyway).
+ */
+ @Override
+ public void commit() throws RollbackException {
+ IStatus status = getStatus();
+ if (status!=null && status.getSeverity() == Status.CANCEL) {
+ throw new RollbackException(status);
+ }
+ else
+ super.commit();
+ }
+
+ };
+ }
+
+ result.start();
+
+ return result;
+ }
+
+ @Override
+ protected void handleError(Exception exception) {
+ if (!(exception instanceof RollbackException))
+ super.handleError(exception);
+ }
+
+ }
+
protected WorkspaceSynchronizer.Delegate createWorkspaceSynchronizerDelegate() {
return new BPMN2EditorWorkspaceSynchronizerDelegate(diagramBehavior.getDiagramContainer());
}
@@ -151,4 +225,19 @@ public class BPMN2EditorUpdateBehavior extends DefaultUpdateBehavior {
return bpmnEditor.handleResourceMoved(resource, newURI);
}
- }} \ No newline at end of file
+ }
+
+ @Override
+ public void historyNotification(OperationHistoryEvent event) {
+ super.historyNotification(event);
+
+ switch (event.getEventType()) {
+ case OperationHistoryEvent.REDONE:
+ TargetRuntime.getCurrentRuntime().notify(new LifecycleEvent(EventType.COMMAND_REDO, event.getOperation()));
+ break;
+ case OperationHistoryEvent.UNDONE:
+ TargetRuntime.getCurrentRuntime().notify(new LifecycleEvent(EventType.COMMAND_UNDO, event.getOperation()));
+ break;
+ }
+ }
+} \ No newline at end of file
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2MarkerChangeListener.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2MarkerChangeListener.java
index 350a3397..362f41f7 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2MarkerChangeListener.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/BPMN2MarkerChangeListener.java
@@ -28,7 +28,6 @@ import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.EValidator;
import org.eclipse.emf.ecore.util.EcoreUtil;
-import org.eclipse.graphiti.mm.pictograms.PictogramElement;
import org.eclipse.ui.IViewReference;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.part.IPage;
@@ -67,16 +66,22 @@ public class BPMN2MarkerChangeListener implements IResourceChangeListener {
// fall through
case IResourceDelta.REMOVED:
final String uri = markerDelta.getAttribute(EValidator.URI_ATTRIBUTE, null);
+ String relatedUris = markerDelta.getAttribute(EValidator.RELATED_URIS_ATTRIBUTE,null);
if (uri != null) {
deletedMarkers.add(uri);
}
+ if (relatedUris!=null) {
+ for (String relatedUri : relatedUris.split(" ")) {
+ if (!deletedMarkers.contains(relatedUri))
+ deletedMarkers.add(relatedUri);
+ }
+ }
}
}
final Set<EObject> updatedObjects = new LinkedHashSet<EObject>();
for (String uri : deletedMarkers) {
- final EObject eobject = editor.getEditingDomain().getResourceSet().getEObject(URI.createURI(uri),
- false);
+ final EObject eobject = editor.getEditingDomain().getResourceSet().getEObject(URI.createURI(uri), false);
if (eobject == null) {
continue;
}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/DesignEditor.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/DesignEditor.java
index 7f9900ab..268f83eb 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/DesignEditor.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/DesignEditor.java
@@ -29,6 +29,7 @@ import org.eclipse.bpmn2.modeler.core.di.DIUtils;
import org.eclipse.bpmn2.modeler.core.utils.BusinessObjectUtil;
import org.eclipse.bpmn2.modeler.core.utils.ModelUtil;
import org.eclipse.bpmn2.modeler.ui.Activator;
+import org.eclipse.bpmn2.modeler.ui.util.PropertyUtil;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.TreeIterator;
@@ -434,6 +435,30 @@ public class DesignEditor extends BPMN2Editor {
}
};
registry.registerAction(action);
+
+ action = new WorkbenchPartAction(multipageEditor.getDesignEditor()) {
+
+ @Override
+ protected void init() {
+ super.init();
+ setId("show.property.view"); //$NON-NLS-1$
+ }
+
+ @Override
+ public String getText() {
+ return Messages.DesignEditor_Show_Property_View_Action;
+ }
+
+ @Override
+ protected boolean calculateEnabled() {
+ return true;
+ }
+
+ public void run() {
+ PropertyUtil.showPropertySheetView();
+ }
+ };
+ registry.registerAction(action);
}
public class AddRemoveDiagramListener implements ResourceSetListener {
@@ -524,12 +549,14 @@ public class DesignEditor extends BPMN2Editor {
}
for (int i=0; i<multipageEditor.getPageCount(); ++i) {
BPMNDiagram bpmnDiagram = multipageEditor.getBpmnDiagram(i);
- if (bpmnDiagram == notifier) {
+ if (bpmnDiagram!=null) {
+ if (bpmnDiagram==notifier || bpmnDiagram.getPlane().getBpmnElement() == notifier) {
CTabItem item = multipageEditor.getTabItem(i);
String text = n.getNewStringValue();
if (text==null || text.isEmpty())
text = "Unnamed"; //$NON-NLS-1$
item.setText(text);
+ }
}
}
}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/Messages.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/Messages.java
index 9be09e76..ab39b418 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/Messages.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/Messages.java
@@ -13,6 +13,7 @@ public class Messages extends NLS {
public static String DesignEditor_Diagram_Tab;
public static String DesignEditor_Hide_Source_View_Action;
public static String DesignEditor_Show_Source_View_Action;
+ public static String DesignEditor_Show_Property_View_Action;
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/messages.properties b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/messages.properties
index 73d10a97..b7d2d15a 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/messages.properties
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/editor/messages.properties
@@ -7,3 +7,4 @@ DesignEditor_DeletePage_Message=Are you sure you want to delete the page {0}?
DesignEditor_Diagram_Tab=Diagram
DesignEditor_Hide_Source_View_Action=Hide Source View
DesignEditor_Show_Source_View_Action=Show Source View
+DesignEditor_Show_Property_View_Action=Show Property View
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/AdvancedPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/AdvancedPropertySection.java
index eba85d65..eb1cfc68 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/AdvancedPropertySection.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/AdvancedPropertySection.java
@@ -42,7 +42,7 @@ public class AdvancedPropertySection extends DefaultPropertySection {
}
@Override
- protected EObject getBusinessObjectForSelection(ISelection selection) {
+ public EObject getBusinessObjectForSelection(ISelection selection) {
EObject be = super.getBusinessObjectForSelection(selection);
// if (be==null) {
// // maybe it's the Diagram (editor canvas)?
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 eb571a14..caa6ebaa 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
@@ -35,7 +35,7 @@ public class TextAnnotationPropertySection extends DefaultPropertySection implem
}
@Override
- protected EObject getBusinessObjectForSelection(ISelection selection) {
+ public EObject getBusinessObjectForSelection(ISelection selection) {
EObject be = super.getBusinessObjectForSelection(selection);
if (be instanceof TextAnnotation)
return be;
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
index 7ed58b30..fa465fbd 100644
--- 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
@@ -35,7 +35,7 @@ public class MessageFlowPropertySection extends DefaultPropertySection {
}
@Override
- protected EObject getBusinessObjectForSelection(ISelection selection) {
+ public EObject getBusinessObjectForSelection(ISelection selection) {
EObject be = super.getBusinessObjectForSelection(selection);
if (be instanceof MessageFlow) {
return be;
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 71469240..8e259749 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
@@ -35,7 +35,7 @@ public class SequenceFlowPropertySection extends DefaultPropertySection {
}
@Override
- protected EObject getBusinessObjectForSelection(ISelection selection) {
+ public EObject getBusinessObjectForSelection(ISelection selection) {
EObject be = super.getBusinessObjectForSelection(selection);
if (be instanceof SequenceFlow)
return be;
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/DataInputPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/DataInputPropertySection.java
index ff358cac..97ce8630 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/DataInputPropertySection.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/DataInputPropertySection.java
@@ -35,7 +35,7 @@ public class DataInputPropertySection extends DefaultPropertySection implements
}
@Override
- protected EObject getBusinessObjectForSelection(ISelection selection) {
+ public EObject getBusinessObjectForSelection(ISelection selection) {
EObject be = super.getBusinessObjectForSelection(selection);
if (be instanceof DataInput)
return be;
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 33d4dc29..0a73ca54 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
@@ -52,7 +52,7 @@ public class DataObjectPropertySection extends DefaultPropertySection {
}
@Override
- protected EObject getBusinessObjectForSelection(ISelection selection) {
+ public EObject getBusinessObjectForSelection(ISelection selection) {
EObject bo = super.getBusinessObjectForSelection(selection);
if (bo instanceof DataObject) {
return bo;
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 1ba1a82a..8bd24d6e 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
@@ -44,7 +44,7 @@ public class DataObjectReferencePropertySection extends DefaultPropertySection {
}
@Override
- protected EObject getBusinessObjectForSelection(ISelection selection) {
+ public EObject getBusinessObjectForSelection(ISelection selection) {
EObject bo = super.getBusinessObjectForSelection(selection);
if (bo instanceof DataObjectReference) {
return bo;
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/DataOutputPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/DataOutputPropertySection.java
index aa67d79b..c4c71b13 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/DataOutputPropertySection.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/data/DataOutputPropertySection.java
@@ -35,7 +35,7 @@ public class DataOutputPropertySection extends DefaultPropertySection implements
}
@Override
- protected EObject getBusinessObjectForSelection(ISelection selection) {
+ public EObject getBusinessObjectForSelection(ISelection selection) {
EObject be = super.getBusinessObjectForSelection(selection);
if (be instanceof DataOutput)
return be;
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 3428c687..cb8f9b60 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
@@ -45,7 +45,7 @@ public class DataStorePropertySection extends DefaultPropertySection {
}
@Override
- protected EObject getBusinessObjectForSelection(ISelection selection) {
+ public EObject getBusinessObjectForSelection(ISelection selection) {
EObject bo = super.getBusinessObjectForSelection(selection);
if (bo instanceof DataStoreReference) {
return ((DataStoreReference) bo).getDataStoreRef();
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 dde5ed15..33582088 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
@@ -45,7 +45,7 @@ public class DataStoreReferencePropertySection extends DefaultPropertySection {
@Override
- protected EObject getBusinessObjectForSelection(ISelection selection) {
+ public EObject getBusinessObjectForSelection(ISelection selection) {
EObject bo = super.getBusinessObjectForSelection(selection);
if (bo instanceof DataStoreReference) {
return bo;
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 b869c63b..c099b777 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
@@ -71,7 +71,7 @@ public class InterfacePropertySection extends DefaultPropertySection {
}
@Override
- protected EObject getBusinessObjectForSelection(ISelection selection) {
+ public EObject getBusinessObjectForSelection(ISelection selection) {
EObject bo = super.getBusinessObjectForSelection(selection);
if (bo instanceof BPMNDiagram) {
BaseElement be = ((BPMNDiagram)bo).getPlane().getBpmnElement();
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 77a84564..49b9323c 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
@@ -38,7 +38,7 @@ public class DataItemsPropertySection extends DefaultPropertySection {
}
@Override
- protected EObject getBusinessObjectForSelection(ISelection selection) {
+ public EObject getBusinessObjectForSelection(ISelection selection) {
EObject be = super.getBusinessObjectForSelection(selection);
if (be instanceof Process || ModelUtil.getDiagramType(be)==Bpmn2DiagramType.PROCESS)
return ModelUtil.getDefinitions(be);
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 0506c98e..cf5671d7 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
@@ -33,7 +33,7 @@ public class DefinitionsPropertySection extends DefaultPropertySection {
}
@Override
- protected EObject getBusinessObjectForSelection(ISelection selection) {
+ public EObject getBusinessObjectForSelection(ISelection selection) {
EObject be = super.getBusinessObjectForSelection(selection);
return ModelUtil.getDefinitions(be);
}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/diagrams/ParticipantPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/diagrams/ParticipantPropertySection.java
index b7767e80..6e76897a 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/diagrams/ParticipantPropertySection.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/diagrams/ParticipantPropertySection.java
@@ -27,7 +27,7 @@ public class ParticipantPropertySection extends DefaultPropertySection {
}
@Override
- protected EObject getBusinessObjectForSelection(ISelection selection) {
+ public EObject getBusinessObjectForSelection(ISelection selection) {
EObject be = super.getBusinessObjectForSelection(selection);
return be;
}
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 b1288da6..23266aa2 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
@@ -39,7 +39,7 @@ public class ProcessDiagramPropertySection extends DefaultPropertySection {
}
@Override
- protected EObject getBusinessObjectForSelection(ISelection selection) {
+ public EObject getBusinessObjectForSelection(ISelection selection) {
EObject bo = super.getBusinessObjectForSelection(selection);
if (bo instanceof BPMNDiagram) {
BaseElement be = ((BPMNDiagram)bo).getPlane().getBpmnElement();
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/events/BoundaryEventPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/events/BoundaryEventPropertySection.java
index 0004c683..4c0759fe 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/events/BoundaryEventPropertySection.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/events/BoundaryEventPropertySection.java
@@ -35,7 +35,7 @@ public class BoundaryEventPropertySection extends DefaultPropertySection {
}
@Override
- protected EObject getBusinessObjectForSelection(ISelection selection) {
+ public EObject getBusinessObjectForSelection(ISelection selection) {
EObject be = super.getBusinessObjectForSelection(selection);
if (be instanceof BoundaryEvent)
return be;
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 e42fb224..309eab3f 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
@@ -38,7 +38,7 @@ public class CommonEventPropertySection extends DefaultPropertySection implement
}
@Override
- protected EObject getBusinessObjectForSelection(ISelection selection) {
+ public EObject getBusinessObjectForSelection(ISelection selection) {
EObject be = super.getBusinessObjectForSelection(selection);
if (be instanceof Event)
return be;
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/events/ConditionalEventDefinitionPropertySection.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/events/ConditionalEventDefinitionPropertySection.java
index 7145600e..bd9e689a 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/events/ConditionalEventDefinitionPropertySection.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/events/ConditionalEventDefinitionPropertySection.java
@@ -36,7 +36,7 @@ public class ConditionalEventDefinitionPropertySection extends DefaultPropertySe
}
@Override
- protected EObject getBusinessObjectForSelection(ISelection selection) {
+ public EObject getBusinessObjectForSelection(ISelection selection) {
EObject be = super.getBusinessObjectForSelection(selection);
if (be instanceof EventDefinition)
return be;
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 426a5c06..13901d59 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
@@ -36,7 +36,7 @@ public class GatewayPropertySection extends DefaultPropertySection implements IT
}
@Override
- protected EObject getBusinessObjectForSelection(ISelection selection) {
+ public EObject getBusinessObjectForSelection(ISelection selection) {
EObject be = super.getBusinessObjectForSelection(selection);
if (be instanceof Gateway)
return be;
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 0a9eb9ec..0b667c4b 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
@@ -50,7 +50,7 @@ public class IoParametersPropertySection extends DefaultPropertySection {
}
@Override
- protected EObject getBusinessObjectForSelection(ISelection selection) {
+ public EObject getBusinessObjectForSelection(ISelection selection) {
EObject be = super.getBusinessObjectForSelection(selection);
if (be instanceof SubProcess) {
// Section 10, P211 of the BPMN 2.0 spec:
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 e261df68..370dc12b 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
@@ -36,7 +36,7 @@ public class ManualTaskPropertySection extends DefaultPropertySection implements
}
@Override
- protected EObject getBusinessObjectForSelection(ISelection selection) {
+ public EObject getBusinessObjectForSelection(ISelection selection) {
EObject be = super.getBusinessObjectForSelection(selection);
if (be instanceof ManualTask)
return be;
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/MultiInstanceLoopCharacteristicsDetailComposite.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/MultiInstanceLoopCharacteristicsDetailComposite.java
index 25530471..e775a9ab 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/MultiInstanceLoopCharacteristicsDetailComposite.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/property/tasks/MultiInstanceLoopCharacteristicsDetailComposite.java
@@ -11,6 +11,8 @@
package org.eclipse.bpmn2.modeler.ui.property.tasks;
import org.eclipse.bpmn2.Activity;
+import org.eclipse.bpmn2.DataInput;
+import org.eclipse.bpmn2.DataOutput;
import org.eclipse.bpmn2.Expression;
import org.eclipse.bpmn2.FormalExpression;
import org.eclipse.bpmn2.MultiInstanceBehavior;
@@ -634,9 +636,12 @@ public class MultiInstanceLoopCharacteristicsDetailComposite extends DefaultDeta
public void createBindings(EObject be) {
ObjectEditor editor = new ComboObjectEditor(this,object,reference, PACKAGE.getDataInput());
editor.createControl(getAttributesParent(), Messages.MultiInstanceLoopCharacteristicsDetailComposite_Input_Data_Label);
- EStructuralFeature f = PACKAGE.getMultiInstanceLoopCharacteristics_InputDataItem();
- editor = new DataInputOutputItemEditor(lc,f);
- editor.createControl(getAttributesParent(), Messages.MultiInstanceLoopCharacteristicsDetailComposite_Input_Parameter_Label);
+ DataInput input = lc.getInputDataItem();
+ if (input==null) {
+ input = (DataInput) createModelObject(DataInput.class);
+ InsertionAdapter.add(lc, PACKAGE.getMultiInstanceLoopCharacteristics_InputDataItem(), input);
+ }
+ bindAttribute(getAttributesParent(), input, PACKAGE.getDataInput_Name(), Messages.MultiInstanceLoopCharacteristicsDetailComposite_Input_Parameter_Label);
}
};
}
@@ -653,9 +658,12 @@ public class MultiInstanceLoopCharacteristicsDetailComposite extends DefaultDeta
public void createBindings(EObject be) {
ObjectEditor editor = new ComboObjectEditor(this,object,reference);
editor.createControl(getAttributesParent(), Messages.MultiInstanceLoopCharacteristicsDetailComposite_Output_Data_Label);
- EStructuralFeature f = PACKAGE.getMultiInstanceLoopCharacteristics_OutputDataItem();
- editor = new DataInputOutputItemEditor(lc,f);
- editor.createControl(getAttributesParent(), Messages.MultiInstanceLoopCharacteristicsDetailComposite_Output_Parameter_Label);
+ DataOutput output = lc.getOutputDataItem();
+ if (output==null) {
+ output = (DataOutput) createModelObject(DataOutput.class);
+ InsertionAdapter.add(lc, PACKAGE.getMultiInstanceLoopCharacteristics_OutputDataItem(), output);
+ }
+ bindAttribute(getAttributesParent(), output, PACKAGE.getDataOutput_Name(), Messages.MultiInstanceLoopCharacteristicsDetailComposite_Output_Parameter_Label);
}
};
}
@@ -753,36 +761,4 @@ public class MultiInstanceLoopCharacteristicsDetailComposite extends DefaultDeta
return content;
}
}
-
- public class DataInputOutputItemEditor extends TextObjectEditor {
-
- MultiInstanceLoopCharacteristics milc;
- boolean isInput;
-
- public DataInputOutputItemEditor(MultiInstanceLoopCharacteristics milc, EStructuralFeature feature) {
- super(MultiInstanceLoopCharacteristicsDetailComposite.this, milc, feature);
-
- // The object passed in to this constructor is a MultiInstanceLoopCharacteristics
- // but what we really want as the target for this text editor is the "name" feature
- // of either the InputDataItem or OutputDataItem it contains (depending on @param feature).
- // If the target object does not yet exist, create it and attach it to the MILC
- // using an InsertionAdapter.
- if (feature == PACKAGE.getMultiInstanceLoopCharacteristics_InputDataItem()) {
- object = milc.getInputDataItem();
- if (object==null) {
- object = FACTORY.create(PACKAGE.getDataInput());
- InsertionAdapter.add(milc, feature, object);
- }
- this.feature = PACKAGE.getDataInput_Name();
- }
- else {
- object = milc.getOutputDataItem();
- if (object==null) {
- object = FACTORY.create(PACKAGE.getDataOutput());
- InsertionAdapter.add(milc, feature, object);
- }
- this.feature = PACKAGE.getDataOutput_Name();
- }
- }
- }
}
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 497921de..90b16cfa 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
@@ -36,7 +36,7 @@ public class ScriptTaskPropertySection extends DefaultPropertySection implements
}
@Override
- protected EObject getBusinessObjectForSelection(ISelection selection) {
+ public EObject getBusinessObjectForSelection(ISelection selection) {
EObject be = super.getBusinessObjectForSelection(selection);
if (be instanceof ScriptTask)
return be;
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 6dd5eaba..d1e1a3d7 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
@@ -39,7 +39,7 @@ public class TaskPropertySection extends DefaultPropertySection {
}
@Override
- protected EObject getBusinessObjectForSelection(ISelection selection) {
+ public EObject getBusinessObjectForSelection(ISelection selection) {
EObject be = super.getBusinessObjectForSelection(selection);
if (be instanceof Task)
return be;
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/util/PropertyUtil.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/util/PropertyUtil.java
index d0ea044b..593e7c57 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/util/PropertyUtil.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/util/PropertyUtil.java
@@ -17,14 +17,19 @@ import java.lang.reflect.Field;
import org.eclipse.bpmn2.modeler.ui.Activator;
import org.eclipse.bpmn2.modeler.ui.IConstants;
import org.eclipse.emf.ecore.EObject;
-import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.IViewReference;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.IWorkbenchPage;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.PlatformUI;
public class PropertyUtil {
+
+ private static String PROPERTY_SHEET_VIEW_ID = "org.eclipse.ui.views.PropertySheet"; //$NON-NLS-1$
public static String deCamelCase(String string) {
return string.replaceAll("([A-Z][a-z])", " $0").substring(1); //$NON-NLS-1$ //$NON-NLS-2$
@@ -104,4 +109,37 @@ public class PropertyUtil {
}
return null;
}
+
+ public static IViewReference getPropertySheetView() {
+ IWorkbench wb = PlatformUI.getWorkbench();
+ IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
+ if (win==null)
+ return null;
+ IWorkbenchPage page = win.getActivePage();
+ if (page==null)
+ return null;
+ for (IViewReference vr : page.getViewReferences()) {
+ if (PROPERTY_SHEET_VIEW_ID.equals(vr.getId())) {
+ return vr;
+ }
+ }
+ return null;
+ }
+
+ public static boolean showPropertySheetView() {
+ IWorkbench wb = PlatformUI.getWorkbench();
+ IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
+ if (win==null)
+ return false;
+ IWorkbenchPage page = win.getActivePage();
+ if (page==null)
+ return false;
+ try {
+ page.showView(PROPERTY_SHEET_VIEW_ID, null, IWorkbenchPage.VIEW_CREATE);
+ page.showView(PROPERTY_SHEET_VIEW_ID, null, IWorkbenchPage.VIEW_ACTIVATE);
+ return true;
+ }
+ catch (Exception e) {}
+ return false;
+ }
}
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/views/outline/BPMN2EditorOutlinePage.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/views/outline/BPMN2EditorOutlinePage.java
index 916c9816..62060266 100644
--- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/views/outline/BPMN2EditorOutlinePage.java
+++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/views/outline/BPMN2EditorOutlinePage.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.bpmn2.modeler.ui.views.outline;
+import org.eclipse.bpmn2.modeler.core.merrimac.dialogs.ObjectEditingDialog;
import org.eclipse.bpmn2.modeler.help.IHelpContexts;
import org.eclipse.bpmn2.modeler.ui.Activator;
import org.eclipse.bpmn2.modeler.ui.IConstants;
@@ -18,6 +19,7 @@ import org.eclipse.core.runtime.IAdaptable;
import org.eclipse.draw2d.LightweightSystem;
import org.eclipse.draw2d.MarginBorder;
import org.eclipse.draw2d.Viewport;
+import org.eclipse.emf.ecore.EObject;
import org.eclipse.gef.ContextMenuProvider;
import org.eclipse.gef.EditDomain;
import org.eclipse.gef.EditPart;
@@ -35,16 +37,24 @@ import org.eclipse.graphiti.ui.editor.DiagramEditor;
import org.eclipse.graphiti.ui.internal.fixed.FixedScrollableThumbnail;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
+import org.eclipse.jface.action.IMenuListener;
+import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.IToolBarManager;
+import org.eclipse.jface.action.MenuManager;
+import org.eclipse.jface.action.Separator;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.events.MouseListener;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Listener;
+import org.eclipse.swt.widgets.Menu;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IPropertyListener;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.internal.about.AboutAction;
import org.eclipse.ui.part.IPageSite;
import org.eclipse.ui.part.PageBook;
@@ -123,7 +133,7 @@ public class BPMN2EditorOutlinePage extends ContentOutlinePage implements IPrope
// ========================= standard behavior ===========================
/**
- * Is used to register several global action handlers (UNDO, REDO, COPY,
+ * Is used to register several global action handlers (COMMAND_UNDO, COMMAND_REDO, COPY,
* PASTE, ...) on initialization of this outline page. This activates for
* example the undo-action in the central Eclipse-Menu.
*
@@ -136,7 +146,7 @@ public class BPMN2EditorOutlinePage extends ContentOutlinePage implements IPrope
public void init(IPageSite pageSite) {
super.init(pageSite);
// TODO: implement editing actions in Outline
- IActionBars actionBars = pageSite.getActionBars();
+// IActionBars actionBars = pageSite.getActionBars();
// registerGlobalActionHandler(actionBars, ActionFactory.UNDO.getId());
// registerGlobalActionHandler(actionBars, ActionFactory.REDO.getId());
// registerGlobalActionHandler(actionBars, ActionFactory.COPY.getId());
@@ -168,9 +178,53 @@ public class BPMN2EditorOutlinePage extends ContentOutlinePage implements IPrope
selectionSynchronizer.addViewer(getViewer());
diagramEditor.addPropertyListener(this);
+ addContextMenu(getViewer());
+
PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IHelpContexts.Outline_View);
}
+ private void addContextMenu(final EditPartViewer viewer) {
+ // add a double-click listener to show the Property Dialog for the selected item
+ viewer.getControl().addMouseListener(new MouseListener() {
+ @Override
+ public void mouseDoubleClick(MouseEvent e) {
+ for (Object p : viewer.getSelectedEditParts()) {
+ if (p instanceof AbstractGraphicsTreeEditPart) {
+ Object model = ((AbstractGraphicsTreeEditPart)p).getModel();
+ if (model instanceof EObject) {
+ ObjectEditingDialog dialog = new ObjectEditingDialog(diagramEditor, (EObject) model);
+ ObjectEditingDialog.openWithTransaction(dialog);
+ }
+ }
+ }
+ }
+
+ @Override
+ public void mouseDown(MouseEvent e) {
+ }
+
+ @Override
+ public void mouseUp(MouseEvent e) {
+ }
+ });
+
+ // Add a context menu for editing actions
+ final MenuManager contextMenu = new MenuManager("#PopUp");
+ contextMenu.add(new Separator("additions"));
+ contextMenu.setRemoveAllWhenShown(true);
+ contextMenu.addMenuListener(new IMenuListener() {
+
+ @Override
+ public void menuAboutToShow(IMenuManager manager) {
+ contextMenu.add(new AboutAction(diagramEditor.getSite().getWorkbenchWindow()));
+ }
+ });
+
+ Menu menu = contextMenu.createContextMenu(viewer.getControl());
+ viewer.getControl().setMenu(menu);
+ getSite().registerContextMenu(Activator.PLUGIN_ID+".outline", contextMenu, viewer);
+ }
+
private void removeKeyListeners(Tree tree) {
for (Listener l : tree.getListeners(SWT.KeyUp)) {
tree.removeListener(SWT.KeyUp, l);
@@ -217,9 +271,10 @@ public class BPMN2EditorOutlinePage extends ContentOutlinePage implements IPrope
}
public Object getAdapter(Class key) {
- if (key==BPMN2Editor.class) {
+ if (key==BPMN2Editor.class)
return diagramEditor;
- }
+ else if (diagramEditor!=null)
+ return diagramEditor.getAdapter(key);
return null;
}

Back to the top