Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » UML2 » Component removal.
Component removal. [message #615869] Tue, 15 May 2007 13:05
Guillaume is currently offline GuillaumeFriend
Messages: 20
Registered: July 2009
Junior Member
Hi,

I'm having troubles using the Package element in your implementation of
UML2.
Below a code snippet that is showing my issue :

------------------------------------------------------------ -----------------
// Create container package.
Package container = UMLFactory.eINSTANCE.createPackage();
container.setName("Container"); //$NON-NLS-1$
// Create sub-package package1.
container.createNestedPackage("Package1"); //$NON-NLS-1$
// Create component mdsyse.
Component component = (Component) container.createOwnedType("mdsyse",
UMLPackage.Literals.COMPONENT); //$NON-NLS-1$
// Create sub-package package2.
container.createNestedPackage("Package2"); //$NON-NLS-1$

// Before deletion, display nested packages.
StringBuilder outMessage = new StringBuilder("BEFORE DELETION _
Container nested packages ="); //$NON-NLS-1$
outMessage.append("\n").append(container.getNestedPackages());
//$NON-NLS-1$
System.out.println(outMessage.toString());
// Before deletion, display owned types.
outMessage = new StringBuilder("BEFORE DELETION _ Container owned
types ="); //$NON-NLS-1$
outMessage.append("\n").append(container.getOwnedTypes());
//$NON-NLS-1$
System.out.println(outMessage.toString());

// Remove mdsyse component from container package.
container.getOwnedTypes().remove(component);

// After deletion, display nested packages.
outMessage = new StringBuilder("AFTER DELETION _ Container nested
packages ="); //$NON-NLS-1$
outMessage.append("\n").append(container.getNestedPackages());
//$NON-NLS-1$
System.out.println(outMessage.toString());
// Before deletion, display owned types.
outMessage = new StringBuilder("AFTER DELETION _ Container owned types
="); //$NON-NLS-1$
outMessage.append("\n").append(container.getOwnedTypes());
//$NON-NLS-1$
System.out.println(outMessage.toString());
------------------------------------------------------------ -----------------

So, I am creating a Package named "container" that is indeed containing
two other packages, "Package1" and "Package2", and a Component, named
"mdsyse".

Now I'm trying to remove "mdsyse" from "container" owned types.
As a result, "mdsyse" is still known as an owned type, and worst I have
lost "Package2" from nested packages.

I can cope with the fact that "mdsyse" is not removed but why should
"Package2" disappear from nested packages ? Isn't it a bug ?

Trying to remove "mdsyse" from packaged elements does solve this issue.
What am I missing about owned types ?

Thanks in advance,
Guillaume.

PS : I don't want "mdsyse" to be destroyed, just not longer linked to
"container".
Previous Topic:Retrieving a Profile through a ProfileApplication
Next Topic:Problem creating LinkEndData and LinkEndDestructionData
Goto Forum:
  


Current Time: Thu Apr 25 14:16:15 GMT 2024

Powered by FUDForum. Page generated in 0.02968 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top