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!
I also would like to implement D&D for a simple list of strings.
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");
}
}
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.
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.