Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » DND create EObject while dragging
DND create EObject while dragging [message #907220] Mon, 03 September 2012 14:57 Go to next message
John M. is currently offline John M.
Messages: 198
Registered: July 2010
Senior Member
Hello,

I want to support DND into the generated emf editor from a rcp view.
The rcp view contains a table viewer with a DragSource, works so far.

In the dragStart method I use the generated Factory classes to create an object and the cursor changes correct. In general I can add the element.

There are two things I don't understand. I only want a copy and no link, why doesn't show the cursor a copy cross?
The other thing is after dropping the element the editor tab shows that the file was changed, but there is no change visible.

Here my dragSource code:
final DragSource source = new DragSource(commandTable, SequenceEditor.DRAG_OPERATIONS);
source.setTransfer(SequenceEditor.DRAG_TYPES);
source.addDragListener(new DragSourceAdapter() {
	@Override
	public void dragStart(DragSourceEvent event) {
		event.doit = commandTable.getSelectionCount() == 1 ? true : false;
	}

	@Override
	public void dragSetData(DragSourceEvent event) {
		StructuredSelection s = (StructuredSelection) tableViewer.getSelection();
		Object firstElement = s.getFirstElement();
		
		if (firstElement != null && firstElement instanceof CommandDefinition) {
			Command command = DataFactoryImpl.eINSTANCE.createCommand();
			CommandData data = DataFactoryImpl.eINSTANCE.createCommandData();
			data.setDefinition((CommandDefinition) firstElement);
			command.setCommandData(data);
			
			event.data = command;
		}
	}
});


Thanks for any advices. Smile
Re: DND create EObject while dragging [message #907231 is a reply to message #907220] Mon, 03 September 2012 15:22 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26141
Registered: July 2009
Senior Member
In generated editors we normally just do this and the rest takes care of
itself...

int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance() };
viewer.addDragSupport(dndOperations, transfers, new
ViewerDragAdapter(viewer));
viewer.addDropSupport(dndOperations, transfers, new
EditingDomainViewerDropAdapter(editingDomain, viewer));

I don't expect the drag source should create new objects. If views
don't update, it's likely that your item provider isn't producing viewer
update notifications for whatever feature you're modifying. You can
enable that via a GenFeature property.

Typically you'd specialize drag and drop behavior by specializing the
item providers createDragAndDropCommand to produces a specialized
command that does whatever you want it to do...


On 03/09/2012 4:57 PM, Missing name Mising name wrote:
> Hello,
>
> I want to support DND into the generated emf editor from a rcp view.
> The rcp view contains a table viewer with a DragSource, works so far.
>
> In the dragStart method I use the generated Factory classes to create
> an object and the cursor changes correct. In general I can add the
> element.
>
> There are two things I don't understand. I only want a copy and no
> link, why doesn't show the cursor a copy cross?
> The other thing is after dropping the element the editor tab shows
> that the file was changed, but there is no change visible.
>
> Here my dragSource code:
> final DragSource source = new DragSource(commandTable,
> SequenceEditor.DRAG_OPERATIONS);
> source.setTransfer(SequenceEditor.DRAG_TYPES);
> source.addDragListener(new DragSourceAdapter() {
> @Override
> public void dragStart(DragSourceEvent event) {
> event.doit = commandTable.getSelectionCount() == 1 ? true :
> false;
> }
>
> @Override
> public void dragSetData(DragSourceEvent event) {
> StructuredSelection s = (StructuredSelection)
> tableViewer.getSelection();
> Object firstElement = s.getFirstElement();
>
> if (firstElement != null && firstElement instanceof
> CommandDefinition) {
> Command command = DataFactoryImpl.eINSTANCE.createCommand();
> CommandData data =
> DataFactoryImpl.eINSTANCE.createCommandData();
> data.setDefinition((CommandDefinition) firstElement);
> command.setCommandData(data);
>
> event.data = command;
> }
> }
> });
>
> Thanks for any advices. :)
Re: DND create EObject while dragging [message #907237 is a reply to message #907231] Mon, 03 September 2012 15:38 Go to previous messageGo to next message
John M. is currently offline John M.
Messages: 198
Registered: July 2010
Senior Member
Thanks for your fast answer.

> In generated editors we normally just do this and the rest takes care of
> itself...
> [Code removed]
Yeah I found that, after getting some errors installing a own drop listener.

> I don't expect the drag source should create new objects. If views
> don't update, it's likely that your item provider isn't producing viewer
> update notifications for whatever feature you're modifying. You can
> enable that via a GenFeature property.
Could that the reason, why there is no chance saved?

> Typically you'd specialize drag and drop behavior by specializing the
> item providers createDragAndDropCommand to produces a specialized
> command that does whatever you want it to do...
I don't get which item providers I shall specialize.
Re: DND create EObject while dragging [message #907244 is a reply to message #907237] Mon, 03 September 2012 15:49 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26141
Registered: July 2009
Senior Member
Comments below.

On 03/09/2012 5:38 PM, Missing name Mising name wrote:
> Thanks for your fast answer.
>
>> In generated editors we normally just do this and the rest takes care
>> of itself...
>> [Code removed]
> Yeah I found that, after getting some errors installing a own drop
> listener.
>
>> I don't expect the drag source should create new objects. If views
>> don't update, it's likely that your item provider isn't producing
>> viewer update notifications for whatever feature you're modifying.
>> You can enable that via a GenFeature property.
> Could that the reason, why there is no chance saved?
Not likely. If the editor shows dirty that means a command has been
executed. So most likely it's an update problem.
>
>> Typically you'd specialize drag and drop behavior by specializing the
>> item providers createDragAndDropCommand to produces a specialized
>> command that does whatever you want it to do...
> I don't get which item providers I shall specialize.
Generally the one that will become the owner/container for the thing
you're dropping. It's often easier to understand things if you set
breakpoints and look what happens at runtime. E.g., set a breakpoint
ItemProviderAdapter.createDragAndDropCommand and see when it gets
called, and for which objects.
Re: DND create EObject while dragging [message #907251 is a reply to message #907244] Mon, 03 September 2012 16:05 Go to previous messageGo to next message
John M. is currently offline John M.
Messages: 198
Registered: July 2010
Senior Member
>>> I don't expect the drag source should create new objects. If views
>>> don't update, it's likely that your item provider isn't producing
>>> viewer update notifications for whatever feature you're modifying.
>>> You can enable that via a GenFeature property.
>> Could that the reason, why there is no chance saved?
> Not likely. If the editor shows dirty that means a command has been
> executed. So most likely it's an update problem.
I will investigate that.

>>> Typically you'd specialize drag and drop behavior by specializing the
>>> item providers createDragAndDropCommand to produces a specialized
>>> command that does whatever you want it to do...
>> I don't get which item providers I shall specialize.
> Generally the one that will become the owner/container for the thing
> you're dropping. It's often easier to understand things if you set
> breakpoints and look what happens at runtime. E.g., set a breakpoint
> ItemProviderAdapter.createDragAndDropCommand and see when it gets
> called, and for which objects.[/quote]
Alright, I found the corresponding one.
Can I overwrite it basically and return for example an AddCommand?
Because there is no real drag source, which is modified.
Re: DND create EObject while dragging [message #907255 is a reply to message #907251] Mon, 03 September 2012 16:16 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26141
Registered: July 2009
Senior Member
Yes, in general, the methods that create a command can create any
command. But, look closely at what DragAndDropCommand does. In
particular, note that it implements DragAndDropFeedback. That will be
important for giving the feedback you want. Probably you're better to
create a specialized DragAndDropCommand, typically done by specializing
things like prepareDropMoveOn and methods of that form.


On 03/09/2012 6:05 PM, Missing name Mising name wrote:
>>>> I don't expect the drag source should create new objects. If views
>>>> don't update, it's likely that your item provider isn't producing
>>>> viewer update notifications for whatever feature you're modifying.
>>>> You can enable that via a GenFeature property.
>>> Could that the reason, why there is no chance saved?
>> Not likely. If the editor shows dirty that means a command has been
>> executed. So most likely it's an update problem.
> I will investigate that.
>
>>>> Typically you'd specialize drag and drop behavior by specializing
>>>> the item providers createDragAndDropCommand to produces a
>>>> specialized command that does whatever you want it to do...
>>> I don't get which item providers I shall specialize.
>> Generally the one that will become the owner/container for the thing
>> you're dropping. It's often easier to understand things if you set
>> breakpoints and look what happens at runtime. E.g., set a breakpoint
>> ItemProviderAdapter.createDragAndDropCommand and see when it gets
>> called, and for which objects.[/quote]
> Alright, I found the corresponding one.
> Can I overwrite it basically and return for example an AddCommand?
> Because there is no real drag source, which is modified.
Re: DND create EObject while dragging [message #907257 is a reply to message #907251] Mon, 03 September 2012 16:18 Go to previous messageGo to next message
John M. is currently offline John M.
Messages: 198
Registered: July 2010
Senior Member
I have observed the method createDragAndDropCommand several times, but there is no data transferred in the collection argument.
What could be wrong?
Re: DND create EObject while dragging [message #907258 is a reply to message #907251] Mon, 03 September 2012 16:16 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26141
Registered: July 2009
Senior Member
Yes, in general, the methods that create a command can create any
command. But, look closely at what DragAndDropCommand does. In
particular, note that it implements DragAndDropFeedback. That will be
important for giving the feedback you want. Probably you're better to
create a specialized DragAndDropCommand, typically done by specializing
things like prepareDropMoveOn and methods of that form.


On 03/09/2012 6:05 PM, Missing name Mising name wrote:
>>>> I don't expect the drag source should create new objects. If views
>>>> don't update, it's likely that your item provider isn't producing
>>>> viewer update notifications for whatever feature you're modifying.
>>>> You can enable that via a GenFeature property.
>>> Could that the reason, why there is no chance saved?
>> Not likely. If the editor shows dirty that means a command has been
>> executed. So most likely it's an update problem.
> I will investigate that.
>
>>>> Typically you'd specialize drag and drop behavior by specializing
>>>> the item providers createDragAndDropCommand to produces a
>>>> specialized command that does whatever you want it to do...
>>> I don't get which item providers I shall specialize.
>> Generally the one that will become the owner/container for the thing
>> you're dropping. It's often easier to understand things if you set
>> breakpoints and look what happens at runtime. E.g., set a breakpoint
>> ItemProviderAdapter.createDragAndDropCommand and see when it gets
>> called, and for which objects.[/quote]
> Alright, I found the corresponding one.
> Can I overwrite it basically and return for example an AddCommand?
> Because there is no real drag source, which is modified.
Re: DND create EObject while dragging [message #907264 is a reply to message #907251] Mon, 03 September 2012 16:16 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26141
Registered: July 2009
Senior Member
Yes, in general, the methods that create a command can create any
command. But, look closely at what DragAndDropCommand does. In
particular, note that it implements DragAndDropFeedback. That will be
important for giving the feedback you want. Probably you're better to
create a specialized DragAndDropCommand, typically done by specializing
things like prepareDropMoveOn and methods of that form.


On 03/09/2012 6:05 PM, Missing name Mising name wrote:
>>>> I don't expect the drag source should create new objects. If views
>>>> don't update, it's likely that your item provider isn't producing
>>>> viewer update notifications for whatever feature you're modifying.
>>>> You can enable that via a GenFeature property.
>>> Could that the reason, why there is no chance saved?
>> Not likely. If the editor shows dirty that means a command has been
>> executed. So most likely it's an update problem.
> I will investigate that.
>
>>>> Typically you'd specialize drag and drop behavior by specializing
>>>> the item providers createDragAndDropCommand to produces a
>>>> specialized command that does whatever you want it to do...
>>> I don't get which item providers I shall specialize.
>> Generally the one that will become the owner/container for the thing
>> you're dropping. It's often easier to understand things if you set
>> breakpoints and look what happens at runtime. E.g., set a breakpoint
>> ItemProviderAdapter.createDragAndDropCommand and see when it gets
>> called, and for which objects.[/quote]
> Alright, I found the corresponding one.
> Can I overwrite it basically and return for example an AddCommand?
> Because there is no real drag source, which is modified.
Re: DND create EObject while dragging [message #907265 is a reply to message #907251] Mon, 03 September 2012 16:18 Go to previous messageGo to next message
Missing name Missing name is currently offline Missing name Missing name
Messages: 59
Registered: July 2009
Member
I have observed the method createDragAndDropCommand several times, but there is no data transferred in the collection argument.
What could be wrong?
Re: DND create EObject while dragging [message #907280 is a reply to message #907265] Mon, 03 September 2012 16:45 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26141
Registered: July 2009
Senior Member
Drag and drop is very hard to debug because the debugger takes focus
away and that tends to mess things up. You can see that the generated
editor supports drag and drop well, so perhaps you can learn from that
what you need to understand.

Are you now using org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter now? You
can look at what happens in
org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter.getDragSource(DropTargetEvent).


On 03/09/2012 6:18 PM, Missing name Mising name wrote:
> I have observed the method createDragAndDropCommand several times, but
> there is no data transferred in the collection argument.
> What could be wrong?
Re: DND create EObject while dragging [message #907289 is a reply to message #907280] Mon, 03 September 2012 17:12 Go to previous messageGo to next message
John M. is currently offline John M.
Messages: 198
Registered: July 2010
Senior Member
Yeah that is true.

Thanks for the advice. My mistake was that I don't transfer an IStructuredSelection object. I had read the description yesterday, but I have forgotten it again.

Ed Merks wrote on Mon, 03 September 2012 12:45
Drag and drop is very hard to debug because the debugger takes focus
away and that tends to mess things up. You can see that the generated
editor supports drag and drop well, so perhaps you can learn from that
what you need to understand.

Are you now using org.eclipse.emf.edit.ui.dnd.ViewerDragAdapter now? You
can look at what happens in
org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter.getDragSource(DropTargetEvent).


On 03/09/2012 6:18 PM, Missing name Mising name wrote:
> I have observed the method createDragAndDropCommand several times, but
> there is no data transferred in the collection argument.
> What could be wrong?
Re: DND create EObject while dragging [message #907938 is a reply to message #907289] Tue, 04 September 2012 12:58 Go to previous messageGo to next message
John M. is currently offline John M.
Messages: 198
Registered: July 2010
Senior Member
At the moment I am facing the problem, that I need to create a new Command or something similar.
The object I drag is not the object which can be inserted. The object which would be inserted contains the dragged object.
What would be the best way to do that?

I have analysed the DragAndDropCommand, but I don't know where to start.
Re: DND create EObject while dragging [message #908016 is a reply to message #907938] Tue, 04 September 2012 14:47 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26141
Registered: July 2009
Senior Member
Comments below.

On 04/09/2012 2:58 PM, Missing name Mising name wrote:
> At the moment I am facing the problem, that I need to create a new
> Command or something similar.
Most likely a derived DragAndDropCommand.
> The object I drag is not the object which can be inserted. The object
> which would be inserted contains the dragged object.
So as part of creating the command, you can create that object, or you
can do it as part of executing the command.
> What would be the best way to do that?
>
> I have analysed the DragAndDropCommand, but I don't know where to start.
Create a derived one, add some print statements to the methods I
mentioned previously, and see how this all works in the normal generated
editor.
Re: DND create EObject while dragging [message #908027 is a reply to message #908016] Tue, 04 September 2012 15:06 Go to previous messageGo to next message
John M. is currently offline John M.
Messages: 198
Registered: July 2010
Senior Member
Thanks I have analyzed most of them, but my question is where shall I create for example the new object?
In the execute method? I only want to do it "right".
Re: DND create EObject while dragging [message #908038 is a reply to message #908027] Tue, 04 September 2012 15:22 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26141
Registered: July 2009
Senior Member
Depending on whether you want to make it look like a move, a copy, or a
link, you should specialize the corresponding prepare command and ensure
that any that are tried first return an unexecutable command. You can
create your new object, add a reference (assuming it's not a
bidirectional or containment reference) to the object being dragged, and
then make an add command based on that. It doesn't matter so much where
you do it because it doesn't need to be undone so can be done outside of
command execution.


On 04/09/2012 5:06 PM, Missing name Mising name wrote:
> Thanks I have analyzed most of them, but my question is where shall I
> create for example the new object?
> In the execute method? I only want to do it "right".
Re: DND create EObject while dragging [message #910709 is a reply to message #908038] Mon, 10 September 2012 08:58 Go to previous messageGo to next message
John M. is currently offline John M.
Messages: 198
Registered: July 2010
Senior Member
Hello Ed,

it will be a containment reference, where the drag shall be inserted.
For activating a copy drag and drop without pressing ctrl I have to call the copy methods from the move methods, right?
Re: DND create EObject while dragging [message #910747 is a reply to message #910709] Mon, 10 September 2012 10:21 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26141
Registered: July 2009
Senior Member
Comments below.

On 10/09/2012 10:58 AM, Missing name Mising name wrote:
> Hello Ed,
>
> it will be a containment reference, where the drag shall be inserted.
Yes, but the new object your created and added a reference to the
original object you started dragging, that reference is presumably not a
containment.
> For activating a copy drag and drop without pressing ctrl I have to
> call the copy methods from the move methods, right?

Depending on which prepareDrop* method from which you return an
executable command, the feedback will correspond, so if you want it to
appear like creating a link, then specialize that one to return an
executable command. It doesn't sound like you need to copy anything.
You just need to add the object you created to the containment reference.
Re: DND create EObject while dragging [message #911250 is a reply to message #910747] Tue, 11 September 2012 08:35 Go to previous messageGo to next message
John M. is currently offline John M.
Messages: 198
Registered: July 2010
Senior Member
Okay I have now specialized the createDragAndDropCommand and the specified prepareDropMoveInsert and prepareCopyMoveInsert.

On the attached picture you can see the editor content. There is now the possibility to move the commands around and add them from a sperate list.
index.php/fa/11453/0/
But I don't want that is possibility to edit the content of a included sequence. It is a own class.
index.php/fa/11454/0/
Re: DND create EObject while dragging [message #911273 is a reply to message #911250] Tue, 11 September 2012 09:22 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26141
Registered: July 2009
Senior Member
Comments below.

On 11/09/2012 10:35 AM, Missing name Mising name wrote:
> Okay I have now specialized the createDragAndDropCommand and the specified prepareDropMoveInsert and prepareCopyMoveInsert.
That sounds good, you might have to specialize the others to return
unexecutable command so it gets to these in the logic...
>
> On the attached picture you can see the editor content. There is now the possibility to move the commands around and add them from a sperate list.
>
> But I don't want that is possibility to edit the content of a included sequence. It is a own class.
Is that a question? You can disable commands by specializing the item
providers...
>
Re: DND create EObject while dragging [message #911290 is a reply to message #911273] Tue, 11 September 2012 09:54 Go to previous messageGo to next message
John M. is currently offline John M.
Messages: 198
Registered: July 2010
Senior Member
The ReferenceContent using the normal ItemProviders, so I don't know how to disable.
For example here the getChildren method to emphasize my point:
@Override
public Collection<?> getChildren(Object object) {
	if (object instanceof ReferenceContentImpl && ((ReferenceContentImpl) object).getReference() != null) {
		return ((ReferenceContentImpl) object).getReference().getCommands();
	}

	return super.getChildren(object);
}


I want to disable the edit of the command only if they are displayed under the reference (Sequence element in the picture)
Re: DND create EObject while dragging [message #911319 is a reply to message #911290] Tue, 11 September 2012 10:48 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26141
Registered: July 2009
Senior Member
Comments below.

On 11/09/2012 11:54 AM, Missing name Mising name wrote:
> The ReferenceContent using the normal ItemProviders, so I don't know
> how to disable.
> For example here the getChildren method to emphasize my point:
>
> @Override
> public Collection<?> getChildren(Object object) {
> if (object instanceof ReferenceContentImpl &&
> ((ReferenceContentImpl) object).getReference() != null) {
You should never need to cast to an Impl. Use the interface in the API.
> return ((ReferenceContentImpl) object).getReference().getCommands();
> }
>
> return super.getChildren(object);
> }
>
>
> I want to disable the edit of the command only if they are displayed
> under the reference (Sequence element in the picture)
If you show non-containment references as children, you can make use of
the creation of wrappers. You'd need to specialize this to return true
on the object with the non-containment child

protected boolean isWrappingNeeded(Object object)
{
if (wrappingNeeded == null)
{
wrappingNeeded = Boolean.FALSE;

for (EStructuralFeature f : getAnyChildrenFeatures(object))
{
if (f instanceof EAttribute)
{
wrappingNeeded = Boolean.TRUE;
}
}
}
return wrappingNeeded;


And then this should create a delegating wrapper which you can then
specialize so that there are things you can't do for the wrapper that
you normally could via delegation.



protected Object createWrapper(EObject object, EStructuralFeature
feature, Object value, int index)
{
if (!isWrappingNeeded(object)) return value;

if (FeatureMapUtil.isFeatureMap(feature))
{
value = new
FeatureMapEntryWrapperItemProvider((FeatureMap.Entry)value, object,
(EAttribute)feature, index, adapterFactory, getResourceLocator());
}
else if (feature instanceof EAttribute)
{
value = new AttributeValueWrapperItemProvider(value, object,
(EAttribute)feature, index, adapterFactory, getResourceLocator());
}
else if (!((EReference)feature).isContainment())
{
value = new DelegatingWrapperItemProvider(value, object, feature,
index, adapterFactory);
}

return value;
}
Re: DND create EObject while dragging [message #912439 is a reply to message #911319] Thu, 13 September 2012 15:35 Go to previous messageGo to next message
John M. is currently offline John M.
Messages: 198
Registered: July 2010
Senior Member
Thanks for your advice, but I don't get how I shall pass the information that wrapping is needed to the second ItemProvider.
I have one for the ReferenceContent and one for the Commands.
Re: DND create EObject while dragging [message #912478 is a reply to message #912439] Thu, 13 September 2012 16:36 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26141
Registered: July 2009
Senior Member
ReferenceContent is the thing with non-containment references to things
you're display as children, right? You do it there. Once you have a
wrapper as the child, that wrapper itself will create wrappers for the
children of the thing its wrapping.

On 13/09/2012 5:35 PM, Missing name Mising name wrote:
> Thanks for your advice, but I don't get how I shall pass the
> information that wrapping is needed to the second ItemProvider.
> I have one for the ReferenceContent and one for the Commands.
Re: DND create EObject while dragging [message #912847 is a reply to message #912478] Fri, 14 September 2012 09:29 Go to previous messageGo to next message
John M. is currently offline John M.
Messages: 198
Registered: July 2010
Senior Member
Okay perhaps it is time for a new topic, because the topic gets really special.

Now back to the main topic, I want to support file drop into the editor with creating an object.
So I adjusted the supported transfers and added FileTransfer, but I only can drop the file on an object, not between.
My first approach was to check the method createDragAndDropCommand, but it is only called, when I drop the file and not before.

Before I can allow dropping the file I have to check if the file is compatible and so on. Where is the right entry point for such stuff?
Re: DND create EObject while dragging [message #912881 is a reply to message #912847] Fri, 14 September 2012 10:31 Go to previous messageGo to next message
Ed Merks is currently offline Ed Merks
Messages: 26141
Registered: July 2009
Senior Member
Comments below.

On 14/09/2012 11:29 AM, Missing name Mising name wrote:
> Okay perhaps it is time for a new topic, because the topic gets really
> special.
>
> Now back to the main topic, I want to support file drop into the
> editor with creating an object.
> So I adjusted the supported transfers and added FileTransfer, but I
> only can drop the file on an object, not between.
That depends on the feedback that the command creation gives.
> My first approach was to check the method createDragAndDropCommand,
> but it is only called, when I drop the file and not before.
Doesn't
org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter.helper(DropTargetEvent)
get called while still dragging?
>
> Before I can allow dropping the file I have to check if the file is
> compatible and so on. Where is the right entry point for such stuff?
I think a command is still created, or at least there's an attempt to
create one in the method I mentioned above.
Re: DND create EObject while dragging [message #912927 is a reply to message #912881] Fri, 14 September 2012 12:20 Go to previous messageGo to next message
John M. is currently offline John M.
Messages: 198
Registered: July 2010
Senior Member
>> Now back to the main topic, I want to support file drop into the
>> editor with creating an object.
>> So I adjusted the supported transfers and added FileTransfer, but I
>> only can drop the file on an object, not between.
> That depends on the feedback that the command creation gives.
Yeah that is the problem. I think I have to overwrite something so I get a normal Sequence AddCommand.
So I want to return an executable version of the AddCommand and I think the behaviour will be like I expect.

>> My first approach was to check the method createDragAndDropCommand,
>> but it is only called, when I drop the file and not before.
> Doesn't
> org.eclipse.emf.edit.ui.dnd.EditingDomainViewerDropAdapter.helper(DropTargetEvent)
> get called while still dragging?
Yeah it is called. But I hoped there is perhaps an easier way otherwise I will facing the creation of a specialized adapter.
Re: DND create EObject while dragging [message #912928 is a reply to message #912927] Fri, 14 September 2012 12:23 Go to previous message
John M. is currently offline John M.
Messages: 198
Registered: July 2010
Senior Member
But it never extracts a valid source. I think there is a problem.
Previous Topic:[Teneo][Error generating mapping for bpmn2]
Next Topic:Editing columns in "Tree with Columns" view
Goto Forum:
  


Current Time: Fri Oct 24 18:09:32 GMT 2014

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

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