Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » Adding Drop Support To Ecore Editor
icon6.gif  Adding Drop Support To Ecore Editor [message #1710267] Mon, 05 October 2015 15:29 Go to next message
Anil Ozturk is currently offline Anil OzturkFriend
Messages: 6
Registered: July 2015
Junior Member
Hi everyone,

I just want to know if i can add drop support to ecore editor. I am trying to something like :

int operations = DND.DROP_COPY | DND.DROP_MOVE;
    Transfer transfers[] = new Transfer[] {TextTransfer.getInstance()};
    StructuredViewer viewer = (StructuredViewer) eEditor.getViewer();
    viewer.addDropSupport(operations, transfers,
        new MyDropAdapter(eEditor.getEditingDomain(), viewer));


But in MyDropAdapter constructor when it calls super method like this:

public class MyDropAdapter extends EditingDomainViewerDropAdapter {
.....
public MyDropAdapter(EditingDomain domain, Viewer viewer) {
    super(domain, viewer);
  }
.....
}


I am get an error : Unhandled event loop exception, Cannot initialize Drop

Also i tried same at debug mode and i realized the program throws an error when it trying to create on org.eclipse.swt.dnd.DropTarget:

public DropTarget(Control control, int style) {
.....
if (control.getData(DND.DROP_TARGET_KEY) != null) {
		DND.error(DND.ERROR_CANNOT_INIT_DROP);
}
......
}


Any help would be so grateful.

Thanks,

Anil Ozturk.
  • Attachment: error.png
    (Size: 4.36KB, Downloaded 158 times)
  • Attachment: code.png
    (Size: 10.49KB, Downloaded 122 times)

[Updated on: Mon, 05 October 2015 15:33]

Report message to a moderator

Re: Adding Drop Support To Ecore Editor [message #1710271 is a reply to message #1710267] Mon, 05 October 2015 16:12 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Anil,

The generated editor already has support for drag and drop support.

On 05/10/2015 5:29 PM, Anil Ozturk wrote:
> Hi everyone,
>
> I just want to know if i can add drop support to ecore editor. I am trying to something like :
>
>
> int operations = DND.DROP_COPY | DND.DROP_MOVE;
> Transfer transfers[] = new Transfer[] {TextTransfer.getInstance()};
> StructuredViewer viewer = (StructuredViewer) eEditor.getViewer();
> viewer.addDropSupport(operations, transfers,
> new MyDropAdapter(eEditor.getEditingDomain(), viewer));
>
>
> But in MyDropAdapter constructor when it calls super method like this:
>
>
> public ReqifDropAdapter(EditingDomain domain, Viewer viewer) {
> super(domain, viewer);
> }
>
>
> I am get an error : Unhandled event loop exception, Cannot initialize Drop
>
> Also i tried same at debug mode and i realized the program throws an error when it trying to create on org.eclipse.swt.dnd.DropTarget:
>
>
> public DropTarget(Control control, int style) {
> ....
> if (control.getData(DND.DROP_TARGET_KEY) != null) {
> DND.error(DND.ERROR_CANNOT_INIT_DROP);
> }
> .....
> }
>
>
> Any help would be so grateful.
>
> Thanks,
>
> Anil Ozturk.


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: Adding Drop Support To Ecore Editor [message #1710275 is a reply to message #1710271] Mon, 05 October 2015 16:20 Go to previous messageGo to next message
Anil Ozturk is currently offline Anil OzturkFriend
Messages: 6
Registered: July 2015
Junior Member
Ok i know it.

But is there any way i can add another drop support for TextTransfer to generated editor?

Ecore has its own drag and drop support , but i want to add my own transfer to generated editor.

Ecore editor just have LocalTransfer, LocalSelectionTransfer and FileTransfer...
Re: Adding Drop Support To Ecore Editor [message #1710294 is a reply to message #1710275] Mon, 05 October 2015 19:05 Go to previous message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Anil,

Yes, it's possible, but I can't help you debug that.


On 05/10/2015 6:20 PM, Anil Ozturk wrote:
> Ok i know it.
>
> But is there any way i can add another drop support for TextTransfer
> to generated editor?
> Ecore has its own drag and drop support , but i want to add my own
> transfer to generated editor.
>
> Ecore editor just have LocalTransfer, LocalSelectionTransfer and
> FileTransfer...


Ed Merks
Professional Support: https://www.macromodeling.com/
Previous Topic:static model from xml
Next Topic:Split Generated Model in multiple files
Goto Forum:
  


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

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

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

Back to the top