[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [sirius-dev] Questions regarding a first contribution
|
On 18/06/2019 01:37, Emmanuel Chebbi wrote:
Thank you, please keep me in touch in you find something!
About a year ago I asked for a way to drag and drop external objects
from custom views into a Sirius diagram [1, 2] and I still need this
feature.
That would indeed be an interesting addition.
Concretely, I would like to be able to handle the drop freely.
For instance, being able to register the following method so that it is
called each time a drop is made and not handled:
public void handleDrop(Object droppedElement, Object dropSource, Object
modelShownInDiagram) {
EObject newElement = asEObject(droppedElement);
modelShownInDiagram.addChildren(newElement); // updates the model
with the dropped element, thus updating the diagram
}
This could work, but only if "newElement" is really (after the call to
asEObject) part of one of the session's semantic models (managed by the
ResourceSet). Otherwise it would make parts of the session's model
reference model elements from external resources, which will cause all
kinds of troubles. In addition, requires working at the Java level,
using extension points etc.
As much as possible, we try for new features to be
available/configurable directly inside the .odesign file. This is what I
had in mind with my comment here [1]: we already support dropping files
and folders on the diagram. They are not EObjects, but a Drop Tool
defined in the odesign file can declare it supports them (see
org.eclipse.sirius.viewpoint.description.tool.DragSource), and will get
instances of DFile and DFolder (which are EObject types we define in
Sirius's own metamodel) at runtime. It's then up to the tool to decide
how it want to react to this.
The idea would be to support a new type of DragSource, representing an
"external EObject", which is not part of the Sirius session. The tool
(if it declares it supports this kind of drop source) would be given a
descriptor for this external element, and again it's up to the
specifiier of the tool to decide what to do (including, if he decides
to, to import the whole resource the dropped element is part of as a new
semantic resource).
We can discuss this further on the bugzilla if you are interested to
work on this.
Regards,
Pierre-Charles David
[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=514645#c4