Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Drag & Drop IFile object from Project Explorer into Graphiti Editor(Drag & Drop IFile object from Project Explorer into Graphiti Editor)
Drag & Drop IFile object from Project Explorer into Graphiti Editor [message #755321] Tue, 08 November 2011 06:32 Go to next message
Kunal Prasad is currently offline Kunal PrasadFriend
Messages: 18
Registered: September 2009
Junior Member
Hi,

I wish to drag & drop a IFile [ actually a XML file ] object from project explorer onto Graphiti Editor, which results in creation of a new Node with properties taken from the XML file. I thought of using getDragandDropFeatures in the FeatureProvider class, but it doesn't work.

Please suggest with an example how a file object can be dragged & dropped into Graphiti editor which results in any custom action.

Thanks,
Kunal
Re: Drag & Drop IFile object from Project Explorer into Graphiti Editor [message #755363 is a reply to message #755321] Tue, 08 November 2011 09:35 Go to previous messageGo to next message
Joerg Reichert is currently offline Joerg ReichertFriend
Messages: 80
Registered: July 2009
Location: Leipzig
Member
Hi Kunal,

if you DnD a IFile into a Graphiti editor, this calls the getAddFeature in your feature provider implementation. There you can handle the case, that the new object is of type IFile and then load its contents as EMF resource to be able to query the model objects. The getDragAndDropFeatures have not to be overridden, this is just used for DnD connection lines.

	@Override
	public IAddFeature getAddFeature(IAddContext context) {
		IAddFeature feature = null;
		if (context.getNewObject() instanceof IFile) {
                   ...
                }
        }



Regards,
Joerg


--
Need professional support for Xtext and EMF?
Go to: http://xtext.itemis.com
Re: Drag & Drop IFile object from Project Explorer into Graphiti Editor [message #1780908 is a reply to message #755363] Mon, 29 January 2018 21:34 Go to previous message
Alex Kravets is currently offline Alex KravetsFriend
Messages: 561
Registered: November 2009
Senior Member
Looks like I am resurrecting an old discussion...

I am trying to DND an file from a view onto a Graphiti Editor. This works if the view is a Package Explorer - I DND a file and getAddFeature() method gets called, but does not work when I try to DND from a View, class of which extends ResourceNavigator. Is there something that should be done on View side in order for DND to work? An extension point that needs to be implemented?
Previous Topic:How to modify the default behavior of draw connection?
Next Topic:Graphiti and RAP
Goto Forum:
  


Current Time: Thu Apr 25 00:51:35 GMT 2024

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

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

Back to the top