Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 220108 Details for
Bug 387704
[Control Mode] Controlling a package leaves the stereotypes applied to the package in the parent files
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Patch to fix the issue.
patch-387704.diff (text/plain), 2.99 KB, created by
Alain Le Guennec
on 2012-08-21 11:37:55 EDT
(
hide
)
Description:
Patch to fix the issue.
Filename:
MIME Type:
Creator:
Alain Le Guennec
Created:
2012-08-21 11:37:55 EDT
Size:
2.99 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.papyrus.uml.controlmode.profile >Index: src/org/eclipse/papyrus/uml/controlmode/profile/helpers/ProfileApplicationHelper.java >=================================================================== >--- src/org/eclipse/papyrus/uml/controlmode/profile/helpers/ProfileApplicationHelper.java (revision 8614) >+++ src/org/eclipse/papyrus/uml/controlmode/profile/helpers/ProfileApplicationHelper.java (working copy) >@@ -109,26 +109,45 @@ > /** > * Relocate stereotype applications for the nested elements of the selection in the controlled resource > * >- * @param pack >- * the package for which stereotype application must be relocated >+ * @param root >+ * the root element for which stereotype applications must be relocated > * @param target > * the target controlled resource > */ >- public static void relocateStereotypeApplications(Package pack, Resource target) { >- for(Iterator<EObject> i = EcoreUtil.getAllProperContents(pack, false); i.hasNext();) { >+ public static void relocateStereotypeApplications(Element root, Resource target) { >+ // Relocate stereotype applications of the root element itself. >+ for(EObject stereotypeApplication : root.getStereotypeApplications()) { >+ relocateStereotypeApplication(root, stereotypeApplication); >+ } >+ // Relocate stereotype applications of the root's child elements. >+ for(Iterator<EObject> i = EcoreUtil.getAllProperContents(root, false); i.hasNext();) { > EObject current = i.next(); > if(current instanceof Element) { > Element element = (Element)current; >- EList<EObject> stereotypeApplications = element.getStereotypeApplications(); >- if(!stereotypeApplications.isEmpty()) { >- for(EObject e : stereotypeApplications) { >- int size = target.getContents().size(); >- target.getContents().add(size, e); >- } >+ for(EObject stereotypeApplication : element.getStereotypeApplications()) { >+ relocateStereotypeApplication(element, stereotypeApplication); > } > } > } > } >+ >+ /** >+ * Relocate one stereotype application of the given element. >+ * >+ * @param element >+ * the element holding the stereotype application to be relocated >+ * @param stereotypeApplication >+ * the stereotype application to be relocated >+ */ >+ public static void relocateStereotypeApplication(Element element, EObject stereotypeApplication) { >+ // Too bad that StereotypeApplicationHelper.getContainmentList is not public, it would have allowed a completely generic heuristic. >+ EList<EObject> containmentList; // = StereotypeApplicationHelper.INSTANCE.getContainmentList(element, stereotypeApplication.eClass()); >+ Resource resource = element.eResource(); >+ containmentList = resource != null ? resource.getContents() : null; // Default heuristic of StereotypeApplicationHelper. >+ if (containmentList != null) { >+ containmentList.add(stereotypeApplication); >+ } >+ } > > /** > * Check if the profile application is a duplicated one
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
vincent.lorenzo
:
iplog+
vincent.lorenzo
:
review+
Actions:
View
|
Diff
Attachments on
bug 387704
: 220108