Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Sapphire » Drag and Drop support for a list of string items
Drag and Drop support for a list of string items [message #1063163] Wed, 12 June 2013 10:05 Go to next message
kon f is currently offline kon f
Messages: 112
Registered: March 2012
Senior Member
Hey,

the Drag&Drop support for simple text fields works out of the box. So if I drag a simple string around, it can be dropped into a text field. This is nice! Smile

I also would like to implement D&D for a simple list of strings.

http://img600.imageshack.us/img600/2127/itemlistq.png

I implemented the abstract class DragAndDropService, but it does not get called.

import org.eclipse.sapphire.ui.DragAndDropService;

public class ItemListDragAndDropService extends DragAndDropService {

    @Override
    public boolean droppable(DropContext context) {
        System.out.println("droppable");
        return false;
    }

    @Override
    public void drop(DropContext context) {
        System.out.println("drop");
    }
}


...
<case>
	<model-element-type>Itemlist</model-element-type>
	<label>[Itemlist] ... </label>
	<section>
		<label>Itemlist</label>
		<content>
                           <property-editor>
                               <service>
                                   <implementation>ItemListDragAndDropService</implementation>
                               </service>
                               <property>Item</property>
                           </property-editor>
		</content>
	</section>
</case>
...


Is this the right approach?

Thank you!

Kon
Re: Drag and Drop support for a list of string items [message #1063873 is a reply to message #1063163] Fri, 14 June 2013 11:49 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin Komissarchik
Messages: 940
Registered: July 2009
Senior Member
I am not entirely clear on what you are trying to achieve. The list property editor has DND support to allow you to re-arrange items in the list. DragAndDropService API is presently only used by the diagram editor.
Re: Drag and Drop support for a list of string items [message #1063879 is a reply to message #1063873] Fri, 14 June 2013 12:46 Go to previous messageGo to next message
kon f is currently offline kon f
Messages: 112
Registered: March 2012
Senior Member
Hey Konstantin,

I use DND to fill my editor with values. One certain part of my application provides string values that can be dragged and already dropped into string fields of the sapphire editor. The dropped string value is appended at the end of the text field. This use case works perfect for plain text fields. The same behavior would be really nice for my list property. Basically dragging some string value from a different part of my application and drop it into the list. My list property just keeps simple string values.

I noticed when the list is filled with some elements, DND can be used to arrange them.

Thank you!

kon
Re: Drag and Drop support for a list of string items [message #1063897 is a reply to message #1063879] Fri, 14 June 2013 16:28 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin Komissarchik
Messages: 940
Registered: July 2009
Senior Member
Please open an enhancement request detailing this need.
Re: Drag and Drop support for a list of string items [message #1064084 is a reply to message #1063897] Mon, 17 June 2013 10:34 Go to previous message
kon f is currently offline kon f
Messages: 112
Registered: March 2012
Senior Member
Hey Konstantin,

I added an enhancement request.

Thank you.

Kon
Previous Topic:Error indication for list
Next Topic:Ideas to reduce memory usage
Goto Forum:
  


Current Time: Wed Aug 27 21:22:46 EDT 2014

Powered by FUDForum. Page generated in 0.02794 seconds