Skip to content
Snippets Groups Projects
Commit 1e33363e authored by Alberto Debiasi's avatar Alberto Debiasi
Browse files

Added a check in the PapyrusListener


Change-Id: I73ac2c5c046d8420fa4031042c06f52544760a2b
Signed-off-by: default avatarAlberto Debiasi <adebiasi@fbk.eu>
parent b3a95b55
No related branches found
No related tags found
No related merge requests found
......@@ -65,34 +65,37 @@ public class PapyrusListener implements IPapyrusListener {
if (eventType == StereotypeExtensionNotification.STEREOTYPE_APPLIED_TO_ELEMENT) {
Property umlProperty = (Property) notifier;
if (contractEntityUtil.isContractProperty(umlProperty)) {
if (notification.getNewValue() instanceof ContractProperty) {
ContractProperty newContractProperty = (ContractProperty) notification.getNewValue();
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
if (newContractProperty.getBase_Property().getType() == null) {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
boolean res = MessageDialog.openQuestion(shell, "Question",
"Do you want to create a new contract or instantiate an existing one?");
boolean res = MessageDialog.openQuestion(shell, "Question",
"Do you want to create a new contract or instantiate an existing one?");
Class contract;
Class contract;
if (res) {
String contractName = newContractProperty.getBase_Property().getName().replace("Property",
"") + "Type";
// create the class that will be converted as
if (res) {
String contractName = newContractProperty.getBase_Property().getName()
.replace("Property", "") + "Type";
// create the class that will be converted as
// contract
contract = createContract((Class) umlProperty.getOwner(), contractName);
} else {
// assign as type of the new contract property
// the
// selected contract
contract = selectContract(umlProperty);
}
// assign to the type of the contractproperty the
// contract
contract = createContract((Class) umlProperty.getOwner(), contractName);
} else {
// assign as type of the new contract property the
// selected contract
contract = selectContract(umlProperty);
newContractProperty.getBase_Property().setType((Type) contract);
}
// assign to the type of the contractproperty the
// contract
newContractProperty.getBase_Property().setType((Type) contract);
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment