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 message
Joerg Reichert is currently offline Joerg ReichertFriend
Messages: 78
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
Previous Topic:GFPropertySection: Control TableViewer height
Next Topic:Added GA is not displayed
Goto Forum:
  


Current Time: Fri Dec 19 08:42:47 GMT 2014

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

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