Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Drag-n-drop from Project Explorer - invoking Create Feature
Drag-n-drop from Project Explorer - invoking Create Feature [message #1400634] Mon, 14 July 2014 13:37 Go to next message
Nicholas Loulloudes is currently offline Nicholas LoulloudesFriend
Messages: 54
Registered: July 2009
Location: Cyprus
Member

Hi all,

I am trying to implement a drag-n-drop functionality from the Project Explorer to the Graphiti diagram. I would like when dragging an IFile to create the respective object in the diagram.

As per the link here, I have made the necessary changes in getAddFeature of myfeature provider implementation. So far the drop action is able to add the pictorial element (addFeature), however the addition is not reflected in the business model, since the the respective CreateFeature method is not called.

Can you give me some insights on the correct way of invoking the CreateFeature method while drag-n-drop from the Project Explorer.

Regards,
Nicholas.
Re: Drag-n-drop from Project Explorer - invoking Create Feature [message #1401293 is a reply to message #1400634] Tue, 15 July 2014 11:59 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Hi Nocholas,

usually, when you use drag&drop to add something to a diagram, the
"something" already exists. Why would you need to create an object in the
business model for the dragged object? I think that is the base question
here.

Michael
Re: Drag-n-drop from Project Explorer - invoking Create Feature [message #1401332 is a reply to message #1401293] Tue, 15 July 2014 13:01 Go to previous messageGo to next message
Nicholas Loulloudes is currently offline Nicholas LoulloudesFriend
Messages: 54
Registered: July 2009
Location: Cyprus
Member

Hi Michael,

Thanks for the reply.

In essence the business model I am working with, captures application workflows. Thereby, my diagram visualizes such workflows and the "dragged" IFile (from project explorer)
denotes a workflow dependency.

So upon creation of an empty diagram, the business model behind does not yet include a dependency object. That particular object is created upon a drag'n'drop operation.

What I am trying to achieve is a similar functionality with drag'n'drop of an entry from a palette compartment, however the drag source is the project explorer.

Nicholas

[Updated on: Tue, 15 July 2014 13:01]

Report message to a moderator

Re: Drag-n-drop from Project Explorer - invoking Create Feature [message #1402603 is a reply to message #1400634] Thu, 17 July 2014 08:07 Go to previous messageGo to next message
Nicholas Loulloudes is currently offline Nicholas LoulloudesFriend
Messages: 54
Registered: July 2009
Location: Cyprus
Member

Any suggestions/comments are highly welcome!

Thanks!
Re: Drag-n-drop from Project Explorer - invoking Create Feature [message #1402733 is a reply to message #1402603] Thu, 17 July 2014 12:06 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Well, you could simply create the business object in the add feature,
possibly guarded by a check if it does not yet exist in case the add can be
triggered also on existing objects.

Michael
Re: Drag-n-drop from Project Explorer - invoking Create Feature [message #1402739 is a reply to message #1402733] Thu, 17 July 2014 12:16 Go to previous messageGo to next message
Nicholas Loulloudes is currently offline Nicholas LoulloudesFriend
Messages: 54
Registered: July 2009
Location: Cyprus
Member

Thanks. So how do I invoke the necessary createFeature method (for the particular BO)
from the add feature? So far my experience of is to use the standard way (as per the tutorial examples) - that is implement the create/add classes for the BO, which are called upon DnD from the pallete.

Can you point me to such an example/code snippet?

Thanks,
Nicholas
Re: Drag-n-drop from Project Explorer - invoking Create Feature [message #1403703 is a reply to message #1402739] Fri, 25 July 2014 12:55 Go to previous message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1931
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Since normally the delegation happens the other way around (create feature
delegates to add feature) Graphiti offers no special way to call a create
feature from the add feature.

I would suggest to call the features provider's getCreateFeature method to
find your create feature (directly instatiating your create feature would be
an option, but I would not recomend that) and then simply delegate by
calling create (check if possible by calling canCreate before).

Something like:
IFeatureProvider featureProvider = getFeatureProvider();
ICreateFeature[] createFeatures = featureProvider.getCreateFeatures();
ICreateFeature createFeature // Choose any appropriate from the array


ICreateContext context // Create an appropriate context instance
if (createFeature.canCreate(context)) {
createFeature.create(context);
}

Michael
Previous Topic:How to achieve floating/attached labels?
Next Topic:Confusion about usage of generated model
Goto Forum:
  


Current Time: Fri Apr 26 20:10:13 GMT 2024

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

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

Back to the top