On 01/14/2013 05:03 PM, sadique sanjar wrote:
> I tried your example for this and found few issues:
>
> 1.This TreeMapper API says it is not intended to be subclassed by
> client(Though this class is not final). This class plays main role as
> its handles the DND , line drawing etc
> functionality.

Why would you need to subclass it? Indeed they're not marked as final
because it's probably possible to subclass them, but there are some
methods that should not be overriden.
In any case, it was not designed to be subclassed, so maybe you should
find out some better ways to get it working as you want.

> 2. No way to remove the mapping once created between to data elements.

Removing a mapping directly from the TreeMapper is currently not
implemented. In the product which motivated the creation of this mapper,
selecting a link did open a "Details" view for the mapping and it was
possible to remove the mapping from here. We were happy with this and
did not get the idea of handling direct deletion.

We could think of adding a "suppressMapping" method to
ISemanticTreeMapperSupport and add the listeners to have it called on
DELETE or SUPPRESS key events. This method should be implemented by
clients in order to process validation, optionally confirmation of
deletion, and return true or false to tell the mapper whether the
deletion should occur or not.
This is a good idea of feature request, you should report it to the bug
tracker: https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Nebula and
if you want this to happen soon, you should think about providing a
patch: http://wiki.eclipse.org/Nebula#Developer_resources .

> 3. I am able to drop data element in its own tree(which is not correct).

> 4. I am able to drop data element on single pair multiple times and
> this creates multiple mapping across the same two data elements.

The tree has the necessary methods that you have to implement in your
listener to prevent this.
A TreeMapper is built using a ISemanticTreeMapperSupport, that you have
to implement. Your
ISemanticTreeMapperSupport.createSemanticMappingObject method
implementation has to make the necessary checks before creating a
mapping, and can return null if you don't want a mapping to be created.

> As its already mentioned, this project is in Alpha stage so might
> require changes.
> If you could suggest some implementation to remove the above anomalies.

I suggested here some better ways to use it, but you did spot some
limitations. Those limitations have to be turned into improvement
requests and then code. Unfortunately, I'm not working any longer on the
project that motivated the creation of the TreeMapper, so I won't be
very reactive on it (I'll try to do my best, but I've an infinite
TODO-list with things that are more important to me right now).
That's why I highly welcome you to report improvement requests and bugs
on https://bugs.eclipse.org/bugs/enter_bug.cgi?product=Nebula . As
Nebula is an open-source project, you could suggest patches to get this
fixed.
Get started by getting the code here: http://git.eclipse.org/c/nebula/org.eclipse.nebula.git and try to change
what you want to get it working better. When you think it's good enough
to be contributed, create a patch and put it on the bug tracker. I'd be
glad to review it and integrate it into Nebula code.
If you make huge improvements on this widget usability, we could think
of creating a new Nebula incubation maintenance release to make it more
widely usable to you and others.

> I know it can be resolved if I subclass this TreeMapper class.

Eclipse has the power of being EPL permissive license. I think it's
easier for you if you embed directly the plugin in your code, with some
modifications; and even better if you contribute back your improvements
to the project so everyone can benefit from your experience.