Skip to main content



      Home
Home » Archived » 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
Eclipse UserFriend
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
Eclipse UserFriend
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
Eclipse UserFriend
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
Eclipse UserFriend
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 messageGo to next message
Eclipse UserFriend
Hey Konstantin,

I added an enhancement request.

Thank you.

Kon
Re: Drag and Drop support for a list of string items [message #1702656 is a reply to message #1063163] Thu, 23 July 2015 14:59 Go to previous messageGo to next message
Eclipse UserFriend
Hello -

I am also interested in using drag and drop to populate lists. My use case however is for a list of files. So, let the user D&D one or more files at a time from the Eclipse workspace into the file list UI as an alternative to pressing the '+' button, then the browse button for each file one at a time.
index.php/fa/22637/0/
Its actually even more complicated for us as we have our own "Resources" and are not using org.eclipse.core.resources.IResource, but using the adapter framework this shouldn't be a problem. Would this functionality be very difficult to add to Sapphire if we were to attempt to implement it ourselves? Or is there an alternative UI that might already exist in Sapphire that lets users easily add multiple files at a time?

Thanks,
Zoe
  • Attachment: Capture.PNG
    (Size: 31.57KB, Downloaded 640 times)
Re: Drag and Drop support for a list of string items [message #1703321 is a reply to message #1702656] Thu, 30 July 2015 11:43 Go to previous message
Eclipse UserFriend
You can implement an action for the list property editor that will appear as a button on the right side of the list. The action can bring up a multi-select file dialog and modify the model/list accordingly.
Previous Topic:Documentation tag not working for Property
Next Topic:How to get the current caret position of a field
Goto Forum:
  


Current Time: Sat Jul 19 22:42:17 EDT 2025

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

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

Back to the top