Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: for the plan.

Jump to: navigation, search

Scout/HowTo/3.8/Drag and drop support

< Scout‎ | HowTo‎ | 3.8

The Scout documentation has been moved to

This how-to describes how to add support for drag and drop to your tables.


  • Select the table
  • In the Scout Object Properties under Advanced Operations add the following methods:
    If you want to also add support for copying using Ctrl-C, you can also add execCopy()
  • Click on one of the newly added methods to open the source code at the correct position.
  • Add two new methods
    to define what type of objects your drag and drop handlers support.
    protected int getConfiguredDragType() {
      return TYPE_TEXT_TRANSFER;
    protected int getConfiguredDropType() {
  • Add code to execDrag() to create an appropriate TransferObject
    protected TransferObject execDrag(ITableRow[] rows) throws ProcessingException {
      StringBuilder result = new StringBuilder();
      for (ITableRow row : rows) {
        if (!result.toString().equals("")) {
          result.append("; ");
        result.append(getTable().getShortNameColumn().getValue(row) + " " + getTable().getNameColumn().getValue(row));
      return new TextTransferObject(result.toString());
  • Add code to execDrop() to handle the appropriate TransferObjects. You need to treat each TransferObject type that getConfiguredDropType() returns
    protected void execDrop(ITableRow row, TransferObject t) throws ProcessingException {
      if (t.isText() && (t instanceof TextTransferObject)) {
        String text = ((TextTransferObject) t).getPlainText();
        // split text at "; " to get seperate lines
        // treat each line according to business logic
        System.out.println("Dropped text: " + text);
      else if (t.isFileList()) {
        File[] o = ((FileListTransferObject) t).getFiles();
        for (int i = 0; i < o.length; ++i) {
          // handle content of o[i]
          System.out.println("Dropped file: " + o[i].getName());
      else if (t.isImage()) {
        System.out.println("Dropped image");
      else if (t.isLocalObject()) {
        System.out.println("Dropped local object");
      else {
        System.out.println("Dropped other stuff");
  • If you added execCopy(), the easiest way to implement this is probably to just forward it to execDrag()
    protected TransferObject execCopy(ITableRow[] rows) throws ProcessingException {
      return execDrag(rows);

Copyright © Eclipse Foundation, Inc. All Rights Reserved.