diff options
author | vhemery | 2011-03-10 16:13:52 +0000 |
---|---|---|
committer | vhemery | 2011-03-10 16:13:52 +0000 |
commit | 04923dd39c8f189d103bc71bbde7226f0d61bf24 (patch) | |
tree | ada4593dd8be899f61050fbd0d6f7d76fc6bfe50 | |
parent | b415eb636ae73f8126ddd0bfed36a9faa2e8c191 (diff) | |
download | org.eclipse.papyrus-04923dd39c8f189d103bc71bbde7226f0d61bf24.tar.gz org.eclipse.papyrus-04923dd39c8f189d103bc71bbde7226f0d61bf24.tar.xz org.eclipse.papyrus-04923dd39c8f189d103bc71bbde7226f0d61bf24.zip |
NEW - bug 309798: [Control Mode] Manage UML profiles with control mode
https://bugs.eclipse.org/bugs/show_bug.cgi?id=309798
Prevent removing a duplicated profile application when a controlled resource is opened
3 files changed, 14 insertions, 6 deletions
diff --git a/plugins/uml/org.eclipse.papyrus.controlmode.umlprofiles/src/org/eclipse/papyrus/controlmode/umlprofiles/Messages.java b/plugins/uml/org.eclipse.papyrus.controlmode.umlprofiles/src/org/eclipse/papyrus/controlmode/umlprofiles/Messages.java index 77aff64add1..98107ce3533 100644 --- a/plugins/uml/org.eclipse.papyrus.controlmode.umlprofiles/src/org/eclipse/papyrus/controlmode/umlprofiles/Messages.java +++ b/plugins/uml/org.eclipse.papyrus.controlmode.umlprofiles/src/org/eclipse/papyrus/controlmode/umlprofiles/Messages.java @@ -36,6 +36,9 @@ public class Messages extends NLS { /** Error message when trying to delete a duplicated profile application */
public static String warning_cannot_delete_duplicated;
+ /** Error message when trying to delete a duplicated profile application */
+ public static String warning_cannot_delete_duplicated_alt;
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/plugins/uml/org.eclipse.papyrus.controlmode.umlprofiles/src/org/eclipse/papyrus/controlmode/umlprofiles/messages.properties b/plugins/uml/org.eclipse.papyrus.controlmode.umlprofiles/src/org/eclipse/papyrus/controlmode/umlprofiles/messages.properties index 9e9c8df736a..be9e8936ff9 100644 --- a/plugins/uml/org.eclipse.papyrus.controlmode.umlprofiles/src/org/eclipse/papyrus/controlmode/umlprofiles/messages.properties +++ b/plugins/uml/org.eclipse.papyrus.controlmode.umlprofiles/src/org/eclipse/papyrus/controlmode/umlprofiles/messages.properties @@ -2,3 +2,4 @@ switch_loading_strategy=<form>The following controlled packages are not loaded : error_readonly=<form>The following packages are in a read-only resource :{0}You can not change profile application without updating them. Please ensure the containing resource is writeable before trying again.</form>
error_during_validation=An unexpected exception occurred during profile application duplication check.
warning_cannot_delete_duplicated=The profile application on {0} has not be deleted since it has been copied from {1} during controlling. Delete this one's instead.
+warning_cannot_delete_duplicated_alt=The profile application on {0} has not be deleted since it has been copied from a package in main resource during controlling. Delete this one's instead.
diff --git a/plugins/uml/org.eclipse.papyrus.controlmode.umlprofiles/src/org/eclipse/papyrus/controlmode/umlprofiles/validation/ProfileApplicationDuplicationChecker.java b/plugins/uml/org.eclipse.papyrus.controlmode.umlprofiles/src/org/eclipse/papyrus/controlmode/umlprofiles/validation/ProfileApplicationDuplicationChecker.java index 5fd40058a5c..b521d7e48e5 100644 --- a/plugins/uml/org.eclipse.papyrus.controlmode.umlprofiles/src/org/eclipse/papyrus/controlmode/umlprofiles/validation/ProfileApplicationDuplicationChecker.java +++ b/plugins/uml/org.eclipse.papyrus.controlmode.umlprofiles/src/org/eclipse/papyrus/controlmode/umlprofiles/validation/ProfileApplicationDuplicationChecker.java @@ -198,14 +198,18 @@ public class ProfileApplicationDuplicationChecker extends AbstractModelConstrain //Forbid direct removal of a duplicated profile application (with eAnnotation)
if(ProfileApplicationHelper.isDuplicatedProfileApplication(profileAppl)) {
Package parentPack = ProfileApplicationHelper.getParentPackageWithProfile(packageElement, profile, true);
+ // restore stereotype application when it is called from parent intermediate package
+ ProfileApplicationHelper.duplicateProfileApplication(packageElement, profile);
+ String msg;
if(parentPack != null) {
- // restore stereotype application when it is called from parent intermediate package
- ProfileApplicationHelper.duplicateProfileApplication(packageElement, profile);
- String msg = NLS.bind(Messages.warning_cannot_delete_duplicated, EMFCoreUtil.getQualifiedName(packageElement, true), EMFCoreUtil.getQualifiedName(parentPack, true));
- NotificationBuilder notifBuild = NotificationBuilder.createAsyncPopup(msg);
- notifBuild.run();
- return true;
+ msg = NLS.bind(Messages.warning_cannot_delete_duplicated, EMFCoreUtil.getQualifiedName(packageElement, true), EMFCoreUtil.getQualifiedName(parentPack, true));
+ } else {
+ // parent package can not be reached as it is in a different maybe not accessible resource (working on controlled resource)
+ msg = NLS.bind(Messages.warning_cannot_delete_duplicated_alt, EMFCoreUtil.getQualifiedName(packageElement, true));
}
+ NotificationBuilder notifBuild = NotificationBuilder.createAsyncPopup(msg);
+ notifBuild.run();
+ return true;
}
//Inspect controlled sub-packages
Set<Package> controlledPack = getControlledSubPackages(packageElement);
|