how to hide some containment references of a model in EMF editor [message #769761] |
Thu, 22 December 2011 16:36 |
Wang Messages: 1 Registered: December 2011 |
Junior Member |
|
|
hi everyone,
i have a problem now,it likes this:
a model A has a containment reference B , and B mustn't be removed or changed, B is created in the Aimpl constructor as like below:
protected EList<B> bs;
....
@generated NOT
Aimpl()
{
super();
getBs.add(new Bimpl());
....
}
as bs mustn't be removed or changed,so i want to hide it in the editor,that means when i click A, the children Bs will be hided not displayed as child nodes of A.
i try to override the AItemProvider's getChildren method,just like below:
Collection<?> getChildren(Object object)
{
Collection<?> collection = super.getChildren(object);
/// traversal collection,if the element in collection is
/// instance of B, remove it...
return collection;
}
but it seems doesn't work,i dont know how to do...
i need your help,thanks
best regards
wang xy
[Updated on: Thu, 22 December 2011 16:48] Report message to a moderator
|
|
|
Re: how to hide some containment references of a model in EMF editor [message #770024 is a reply to message #769761] |
Fri, 23 December 2011 05:47 |
Ed Merks Messages: 33216 Registered: July 2009 |
Senior Member |
|
|
Comments below.
On 22/12/2011 5:36 PM, Wang wrote:
> hi everyone,
>
> i have a problem now,it likes this:
>
> a model A has a containment reference B , and B mustn't be removed or
> changed, B is created in the Aimpl constructor as like below:
That's already sounding bad. I suppose you have this marked as
transient and derived.
>
>
> protected EList<B> bs;
>
> ...
>
> @generated NOT
> Aimpl()
> {
> super();
> getBs.add(new Bimpl());
Of course you're changing it here...
> ....
> }
>
> as bs mustn't be removed or changed,so i want to hide it in the
> editor,that means when i click A, the children Bs will be hided not
> displayed as child nodes of A.
You can do this via the GenFeature property in the GenModel; you'd
likely want to turn off notification, children, and child creation.
>
> i try to override the AItemProvider's getChildren method,just like below:
>
> Collection<?> getChildren(Object object)
> {
> Collection<?> collection = super.getChildren(object);
>
> /// traversal collection,if the element in collection is
> /// instance of B, remove it...
>
> return collection;
> }
>
> but it seems doesn't work,i dont know how to do...
>
> i need your help,
> best regards
> thanks
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03163 seconds