Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 14:05 Go to next message
kon f is currently offline kon fFriend
Messages: 152
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 15:49 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
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 16:46 Go to previous messageGo to next message
kon f is currently offline kon fFriend
Messages: 152
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 20:28 Go to previous messageGo to next message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
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 14:34 Go to previous messageGo to next message
kon f is currently offline kon fFriend
Messages: 152
Registered: March 2012
Senior Member
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 18:59 Go to previous messageGo to next message
Zoe Guillen is currently offline Zoe GuillenFriend
Messages: 6
Registered: May 2015
Junior Member
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 580 times)
Re: Drag and Drop support for a list of string items [message #1703321 is a reply to message #1702656] Thu, 30 July 2015 15:43 Go to previous message
Konstantin Komissarchik is currently offline Konstantin KomissarchikFriend
Messages: 1077
Registered: July 2009
Senior Member
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: Wed Oct 09 01:39:45 GMT 2024

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

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

Back to the top