diff options
author | Ansgar Radermacher | 2015-07-09 11:08:59 +0000 |
---|---|---|
committer | Ansgar Radermacher | 2015-07-09 11:08:59 +0000 |
commit | 9cf6d01b6a420c40e94598854a397bae09e759ff (patch) | |
tree | d4ed9d11986c63bccf6a9a82dcedd7b2e62e3532 /extraplugins | |
parent | e09552b476da52cbc59a2271fae9d6a9efe9bbfc (diff) | |
download | org.eclipse.papyrus-9cf6d01b6a420c40e94598854a397bae09e759ff.tar.gz org.eclipse.papyrus-9cf6d01b6a420c40e94598854a397bae09e759ff.tar.xz org.eclipse.papyrus-9cf6d01b6a420c40e94598854a397bae09e759ff.zip |
472272 - [CDT integration] Opening a CDT editor on a transition without effect will cause an NPE
Diffstat (limited to 'extraplugins')
4 files changed, 64 insertions, 45 deletions
diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.examples/models/examples/HelloWorldOO.notation b/extraplugins/codegen/org.eclipse.papyrus.cpp.examples/models/examples/HelloWorldOO.notation index 09d8f4ed84c..067d9d92b25 100644 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.examples/models/examples/HelloWorldOO.notation +++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.examples/models/examples/HelloWorldOO.notation @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/viewpoints/policy/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_4fWAcMpkEeOpmd7vWBVZJQ" type="PapyrusUMLClassDiagram" name="HelloWorld" measurementUnit="Pixel"> +<notation:Diagram xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:notation="http://www.eclipse.org/gmf/runtime/1.0.2/notation" xmlns:style="http://www.eclipse.org/papyrus/infra/viewpoints/policy/style" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML" xmi:id="_4fWAcMpkEeOpmd7vWBVZJQ" type="PapyrusUMLClassDiagram" name="HelloWorld" measurementUnit="Pixel"> <children xmi:type="notation:Shape" xmi:id="_7IaUcMpkEeOpmd7vWBVZJQ" type="2008"> <children xmi:type="notation:DecorationNode" xmi:id="_7IcwsMpkEeOpmd7vWBVZJQ" type="5029"/> <children xmi:type="notation:BasicCompartment" xmi:id="_7IcwscpkEeOpmd7vWBVZJQ" type="7017"> @@ -24,6 +24,9 @@ <styles xmi:type="notation:FilteringStyle" xmi:id="_7IdXyMpkEeOpmd7vWBVZJQ"/> <layoutConstraint xmi:type="notation:Bounds" xmi:id="_7IdXycpkEeOpmd7vWBVZJQ"/> </children> + <children xmi:type="notation:DecorationNode" xmi:id="_gysYQCHNEeWwIcUD6ApW1Q" type="8510"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_gysYQSHNEeWwIcUD6ApW1Q" y="5"/> + </children> <element xmi:type="uml:Class" href="HelloWorldOO.uml#_tyiqsc__Ed-TP80eVS-2Rg"/> <layoutConstraint xmi:type="notation:Bounds" xmi:id="_7IaUccpkEeOpmd7vWBVZJQ" x="60" y="40" width="161" height="81"/> </children> @@ -33,13 +36,6 @@ <layoutConstraint xmi:type="notation:Bounds" xmi:id="_B_JiwcplEeOpmd7vWBVZJQ" x="340" y="51" width="301" height="51"/> </children> <children xmi:type="notation:Shape" xmi:id="_l7o-oMq6EeOpmd7vWBVZJQ" type="2008"> - <eAnnotations xmi:type="ecore:EAnnotation" xmi:id="_KTuEwMrYEeOpmd7vWBVZJQ" source="Stereotype_Annotation"> - <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_KTuEwcrYEeOpmd7vWBVZJQ" key="StereotypeWithQualifiedNameList" value=""/> - <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_KTuEwsrYEeOpmd7vWBVZJQ" key="StereotypeList" value=""/> - <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_KTuEw8rYEeOpmd7vWBVZJQ" key="Stereotype_Presentation_Kind" value="HorizontalStereo"/> - <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_KTuExMrYEeOpmd7vWBVZJQ" key="PropStereoDisplay" value=""/> - <details xmi:type="ecore:EStringToStringMapEntry" xmi:id="_KTur0MrYEeOpmd7vWBVZJQ" key="StereotypePropertyLocation" value="Compartment"/> - </eAnnotations> <children xmi:type="notation:DecorationNode" xmi:id="_l7o-osq6EeOpmd7vWBVZJQ" type="5029"/> <children xmi:type="notation:BasicCompartment" xmi:id="_l7o-o8q6EeOpmd7vWBVZJQ" type="7017"> <styles xmi:type="notation:TitleStyle" xmi:id="_l7o-pMq6EeOpmd7vWBVZJQ"/> @@ -59,6 +55,14 @@ <styles xmi:type="notation:FilteringStyle" xmi:id="_l7pluMq6EeOpmd7vWBVZJQ"/> <layoutConstraint xmi:type="notation:Bounds" xmi:id="_l7plucq6EeOpmd7vWBVZJQ"/> </children> + <children xmi:type="notation:DecorationNode" xmi:id="_gywpsCHNEeWwIcUD6ApW1Q" type="8510"> + <layoutConstraint xmi:type="notation:Location" xmi:id="_gywpsSHNEeWwIcUD6ApW1Q" y="5"/> + </children> + <children xmi:type="notation:DecorationNode" xmi:id="_hU4fUCHNEeWwIcUD6ApW1Q" visible="false" type="StereotypeLabel"> + <styles xmi:type="notation:StringValueStyle" xmi:id="_hU4fUSHNEeWwIcUD6ApW1Q" name="stereotype" stringValue="C_Cpp::Include"/> + <element xmi:type="uml:Stereotype" href="pathmap://PapyrusC_Cpp_PROFILES/C_Cpp.profile.uml#_RwTdQByJEduN1bTiWJ0lyw"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hU4fUiHNEeWwIcUD6ApW1Q"/> + </children> <element xmi:type="uml:Class" href="HelloWorldOO.uml#_l7i4AMq6EeOpmd7vWBVZJQ"/> <layoutConstraint xmi:type="notation:Bounds" xmi:id="_l7o-ocq6EeOpmd7vWBVZJQ" x="58" y="201" width="163" height="80"/> </children> @@ -86,10 +90,27 @@ <element xmi:type="uml:Comment" href="HelloWorldOO.uml#_9oJc4MuOEeOR-ZT-tu0VTw"/> <layoutConstraint xmi:type="notation:Bounds" xmi:id="_9oKrAcuOEeOR-ZT-tu0VTw" x="340" y="380" width="301" height="81"/> </children> + <children xmi:type="notation:Shape" xmi:id="_hUGcMCHNEeWwIcUD6ApW1Q" type="StereotypeComment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_hUGcMSHNEeWwIcUD6ApW1Q" showTitle="true"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_hUHqUCHNEeWwIcUD6ApW1Q" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Class" href="HelloWorldOO.uml#_tyiqsc__Ed-TP80eVS-2Rg"/> + </styles> + <element xsi:nil="true"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hUGcMiHNEeWwIcUD6ApW1Q" x="260" y="40"/> + </children> + <children xmi:type="notation:Shape" xmi:id="_hVXngCHNEeWwIcUD6ApW1Q" type="StereotypeComment"> + <styles xmi:type="notation:TitleStyle" xmi:id="_hVXngSHNEeWwIcUD6ApW1Q" showTitle="true"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_hVYOkCHNEeWwIcUD6ApW1Q" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Class" href="HelloWorldOO.uml#_l7i4AMq6EeOpmd7vWBVZJQ"/> + </styles> + <element xsi:nil="true"/> + <layoutConstraint xmi:type="notation:Bounds" xmi:id="_hVXngiHNEeWwIcUD6ApW1Q" x="258" y="201"/> + </children> <styles xmi:type="notation:DiagramStyle" xmi:id="_4fWngMpkEeOpmd7vWBVZJQ"/> <styles xmi:type="style:PapyrusViewStyle" xmi:id="_4fWngcpkEeOpmd7vWBVZJQ"> <owner xmi:type="uml:Package" href="HelloWorldOO.uml#_LOqIEDLaEd2qeKRLMdIx_A"/> </styles> + <styles xmi:type="notation:StringValueStyle" xmi:id="_gyx30CHNEeWwIcUD6ApW1Q" name="diagram_compatibility_version" stringValue="1.1.0"/> <element xmi:type="uml:Package" href="HelloWorldOO.uml#_LOqIEDLaEd2qeKRLMdIx_A"/> <edges xmi:type="notation:Connector" xmi:id="_z440MMuMEeOR-ZT-tu0VTw" type="4008" source="_l7o-oMq6EeOpmd7vWBVZJQ" target="_7IaUcMpkEeOpmd7vWBVZJQ"> <children xmi:type="notation:DecorationNode" xmi:id="_z47QcMuMEeOR-ZT-tu0VTw" visible="false" type="6026"> @@ -132,4 +153,24 @@ <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_ChIlEMuPEeOR-ZT-tu0VTw" id="(0.0,0.38271604938271603)"/> <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_ChJMIMuPEeOR-ZT-tu0VTw" id="(1.0,0.51)"/> </edges> + <edges xmi:type="notation:Connector" xmi:id="_hUJfgCHNEeWwIcUD6ApW1Q" type="StereotypeCommentLink" source="_7IaUcMpkEeOpmd7vWBVZJQ" target="_hUGcMCHNEeWwIcUD6ApW1Q"> + <styles xmi:type="notation:FontStyle" xmi:id="_hUJfgSHNEeWwIcUD6ApW1Q"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_hUKGkiHNEeWwIcUD6ApW1Q" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Class" href="HelloWorldOO.uml#_tyiqsc__Ed-TP80eVS-2Rg"/> + </styles> + <element xsi:nil="true"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_hUJfgiHNEeWwIcUD6ApW1Q" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hUKGkCHNEeWwIcUD6ApW1Q"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hUKGkSHNEeWwIcUD6ApW1Q"/> + </edges> + <edges xmi:type="notation:Connector" xmi:id="_hVYOkSHNEeWwIcUD6ApW1Q" type="StereotypeCommentLink" source="_l7o-oMq6EeOpmd7vWBVZJQ" target="_hVXngCHNEeWwIcUD6ApW1Q"> + <styles xmi:type="notation:FontStyle" xmi:id="_hVYOkiHNEeWwIcUD6ApW1Q"/> + <styles xmi:type="notation:EObjectValueStyle" xmi:id="_hVYOliHNEeWwIcUD6ApW1Q" name="BASE_ELEMENT"> + <eObjectValue xmi:type="uml:Class" href="HelloWorldOO.uml#_l7i4AMq6EeOpmd7vWBVZJQ"/> + </styles> + <element xsi:nil="true"/> + <bendpoints xmi:type="notation:RelativeBendpoints" xmi:id="_hVYOkyHNEeWwIcUD6ApW1Q" points="[0, 0, 0, 0]$[0, 0, 0, 0]"/> + <sourceAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hVYOlCHNEeWwIcUD6ApW1Q"/> + <targetAnchor xmi:type="notation:IdentityAnchor" xmi:id="_hVYOlSHNEeWwIcUD6ApW1Q"/> + </edges> </notation:Diagram> diff --git a/extraplugins/codegen/org.eclipse.papyrus.cpp.examples/models/examples/HelloWorldOO.uml b/extraplugins/codegen/org.eclipse.papyrus.cpp.examples/models/examples/HelloWorldOO.uml index 45d01db05bd..958d08604a8 100644 --- a/extraplugins/codegen/org.eclipse.papyrus.cpp.examples/models/examples/HelloWorldOO.uml +++ b/extraplugins/codegen/org.eclipse.papyrus.cpp.examples/models/examples/HelloWorldOO.uml @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:C_Cpp="http://www.eclipse.org/papyrus/C_Cpp/1" xmlns:FCM="http://www.eclipse.org/papyrus/FCM/1" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML"> +<xmi:XMI xmi:version="20131001" xmlns:xmi="http://www.omg.org/spec/XMI/20131001" xmlns:C_Cpp="http://www.eclipse.org/papyrus/C_Cpp/1" xmlns:FCM="http://www.eclipse.org/papyrus/FCM/1" xmlns:ecore="http://www.eclipse.org/emf/2002/Ecore" xmlns:uml="http://www.eclipse.org/uml2/5.0.0/UML"> <uml:Model xmi:id="_O6TiIDLUEd26WNosUASSSw" name="HelloWorld"> <packagedElement xmi:type="uml:Package" xmi:id="_LOqIEDLaEd2qeKRLMdIx_A" name="classes"> <ownedComment xmi:type="uml:Comment" xmi:id="_-Hd2MDecEeGPyrZ5I3hMlA" annotatedElement="_tyiqsc__Ed-TP80eVS-2Rg"> @@ -23,9 +23,6 @@ <type xmi:type="uml:PrimitiveType" href="pathmap://UML_LIBRARIES/UMLPrimitiveTypes.library.uml#String"/> <lowerValue xmi:type="uml:LiteralInteger" xmi:id="__HwK8FTzEeKvFeqt5Q_lqw" value="1"/> <upperValue xmi:type="uml:LiteralUnlimitedNatural" xmi:id="__HwyAFTzEeKvFeqt5Q_lqw" value="1"/> - <defaultValue xmi:type="uml:LiteralString" xmi:id="__HynMFTzEeKvFeqt5Q_lqw"> - <value xsi:nil="true"/> - </defaultValue> </ownedAttribute> <ownedBehavior xmi:type="uml:OpaqueBehavior" xmi:id="_tyjRwc__Ed-TP80eVS-2Rg" name="run" specification="_UtCt0FTzEeKvFeqt5Q_lqw"> <language>C/C++</language> @@ -73,37 +70,7 @@ <appliedProfile xmi:type="uml:Profile" href="pathmap://Papyrus_PROFILES/MARTE.profile.uml#_ar8OsAPMEdyuUt-4qHuVvQ"/> </profileApplication> </uml:Model> - <FCM:DerivedElement xmi:id="_RwGb8P6_Ed6Zw96O-tCw7A"/> - <FCM:DerivedElement xmi:id="_RxVyEP6_Ed6Zw96O-tCw7A"/> - <FCM:DerivedElement xmi:id="_RoIMoP94Ed6628OhKk_dpg"/> - <FCM:DerivedElement xmi:id="_IFlIEARJEd--t-uhRn9OBA"/> - <FCM:ContainerRule xmi:id="_b-TmAARJEd--t-uhRn9OBA"> - <portSet href="pathmap://QML_CORE/core.uml#__SL-kNtxEd6nqsBVkgJEEA"/> - </FCM:ContainerRule> - <FCM:DerivedElement xmi:id="_bmwhUARMEd-OidZzGKCpzg"/> - <FCM:DerivedElement xmi:id="_xjNC4ATuEd-Zc_RSu20WjA"/> - <FCM:DerivedElement xmi:id="_LZoQ4AVIEd-rcKh6R_xjRQ"/> - <FCM:DerivedElement xmi:id="_oMpYkAWxEd-jrvNV_WQOlA"/> - <FCM:DerivedElement xmi:id="_Fd6d0AnREd-co_m_wv4b6A"/> - <FCM:DerivedElement xmi:id="_uLARMBGVEd-rfYlCjUOxJQ"/> - <FCM:DerivedElement xmi:id="_qdjxQBGkEd-Jq_XWT8Mhpg"/> - <FCM:DerivedElement xmi:id="_VOzfEBGlEd-Jq_XWT8Mhpg"/> - <FCM:DerivedElement xmi:id="_N8BrMBI4Ed-3zOZ0RGapGA"/> - <FCM:DerivedElement xmi:id="_jIS30BI8Ed-XjYZ05V-9-Q"/> - <FCM:DerivedElement xmi:id="_E5UhUBJIEd-XjYZ05V-9-Q"/> - <FCM:DerivedElement xmi:id="_THoRwBJWEd-QgZm_R1AKbA"/> - <FCM:DerivedElement xmi:id="_z0CVcBQ2Ed-_dI0JopJMvQ"/> - <FCM:DerivedElement xmi:id="_Ke_UsBb7Ed-u0pMEAnvpEQ"/> - <FCM:DerivedElement xmi:id="_uOkD4D15Ed-qiK1VZWszhA"> - <source xmi:type="uml:Operation" href="pathmap://QML_CORE//sysinterfaces.uml#_C9IK4JsqEd61Eo3nmu3JhQ"/> - </FCM:DerivedElement> - <FCM:DerivedElement xmi:id="_a4LokD16Ed-qiK1VZWszhA"> - <source xmi:type="uml:Operation" href="pathmap://QML_CORE//sysinterfaces.uml#_C9IK4JsqEd61Eo3nmu3JhQ"/> - </FCM:DerivedElement> <C_Cpp:Include xmi:id="_11OtwPcaEd-KM6l7lmIPkw" body="#include <iostream>
using namespace std;" base_class="_tyiqsc__Ed-TP80eVS-2Rg"/> - <FCM:Connector xmi:id="_iADdkE2rEeGl8qrc8BM7vA"> - <ic xmi:type="FCM:InteractionComponent" href="pathmap://QML_CORE/fifo.uml#_xQ_ccHUuEd6R5tffIPrlPg"/> - </FCM:Connector> <FCM:DerivedElement xmi:id="_UtTMgFTzEeKvFeqt5Q_lqw" base_Element="_UtCt0FTzEeKvFeqt5Q_lqw"> <source xmi:type="uml:Operation" href="pathmap://QML_CORE/sysinterfaces.uml#_C9IK4JsqEd61Eo3nmu3JhQ"/> </FCM:DerivedElement> diff --git a/extraplugins/codegen/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/handler/PapyrusCDTEditorHandler.java b/extraplugins/codegen/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/handler/PapyrusCDTEditorHandler.java index bc41a32fa9d..1cfabc105ae 100644 --- a/extraplugins/codegen/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/handler/PapyrusCDTEditorHandler.java +++ b/extraplugins/codegen/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/handler/PapyrusCDTEditorHandler.java @@ -52,10 +52,12 @@ import org.eclipse.papyrus.texteditor.model.texteditormodel.TextEditorModelFacto import org.eclipse.papyrus.uml.diagram.common.handlers.CmdHandler;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Display;
+import org.eclipse.uml2.uml.Behavior;
import org.eclipse.uml2.uml.Class;
import org.eclipse.uml2.uml.Classifier;
import org.eclipse.uml2.uml.Operation;
import org.eclipse.uml2.uml.Transition;
+import org.eclipse.uml2.uml.UMLPackage;
/**
@@ -159,6 +161,13 @@ public class PapyrusCDTEditorHandler extends CmdHandler { return;
}
}
+
+ if (selectedEObject instanceof Transition) {
+ Transition transition = (Transition) selectedEObject;
+ if (transition.getEffect() == null) {
+ Behavior effect = transition.createEffect("effectOf" + transition.getName(), UMLPackage.eINSTANCE.getOpaqueBehavior());
+ }
+ }
// add the new editor model to the sash.
editorModel.setSelectedObject(selectedEObject);
diff --git a/extraplugins/codegen/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/sync/ObtainICElement.java b/extraplugins/codegen/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/sync/ObtainICElement.java index 6860d56d241..00dc5e74103 100644 --- a/extraplugins/codegen/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/sync/ObtainICElement.java +++ b/extraplugins/codegen/org.eclipse.papyrus.texteditor.cdt/src/org/eclipse/papyrus/texteditor/cdt/sync/ObtainICElement.java @@ -52,9 +52,11 @@ public class ObtainICElement { } else if (element instanceof Transition) { Transition transition = (Transition) element; - if (child.getElementName().endsWith(NamedElement.SEPARATOR + transition.getEffect().getName())) { - if (function.getNumberOfParameters() == countParameters(transition.getEffect().getOwnedParameters())) { - return child; + if (transition.getEffect() != null) { + if (child.getElementName().endsWith(NamedElement.SEPARATOR + transition.getEffect().getName())) { + if (function.getNumberOfParameters() == countParameters(transition.getEffect().getOwnedParameters())) { + return child; + } } } } |