~ubuntu-branches/ubuntu/trusty/jabref/trusty

« back to all changes in this revision

Viewing changes to src/java/net/sf/jabref/groups/EntryTableTransferHandler.java

  • Committer: Bazaar Package Importer
  • Author(s): gregor herrmann
  • Date: 2009-12-01 18:52:51 UTC
  • mfrom: (1.1.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20091201185251-08e2unpn1jl8ijq8
Tags: 2.6~beta2-1
* Remove alternative dependency on sun-java5-jre which was removed from the
  archive. Also adjust README.Debian and /usr/bin/jabref.
* New upstream beta release:
  - fixes "allow to disable (re)storing of current tab for entries"
    (closes: #447767)
  - thanks again to Philip Rinn for his help with the upgrade
* debian/copyright: add new developer.
* Refresh patches 01_free_javac.patch and 06_BibtexEntry.patch.
* Adjust debian/jabref.links and debian/jabref.install to new jar file.
* Simplify debian/jabref.dirs.
* Add a presubj fragment for reportbug.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
 
23
23
package net.sf.jabref.groups;
24
24
 
25
 
import java.awt.datatransfer.Clipboard;
26
 
import java.awt.datatransfer.DataFlavor;
27
 
import java.awt.datatransfer.Transferable;
28
 
import java.awt.datatransfer.UnsupportedFlavorException;
 
25
import java.awt.datatransfer.*;
29
26
import java.awt.dnd.DnDConstants;
30
27
import java.awt.event.InputEvent;
 
28
import java.awt.event.MouseEvent;
31
29
import java.io.File;
32
30
import java.io.FileWriter;
33
31
import java.io.IOException;
47
45
import net.sf.jabref.JabRefFrame;
48
46
import net.sf.jabref.external.DroppedFileHandler;
49
47
import net.sf.jabref.external.ExternalFileType;
 
48
import net.sf.jabref.external.TransferableFileLinkSelection;
50
49
import net.sf.jabref.gui.MainTable;
 
50
import net.sf.jabref.gui.MainTableFormat;
51
51
import net.sf.jabref.imports.ImportMenuItem;
52
52
import net.sf.jabref.imports.OpenDatabaseAction;
53
53
import net.sf.jabref.imports.ParserResult;
107
107
         * This method is called when dragging stuff *from* the table.
108
108
         */
109
109
        public Transferable createTransferable(JComponent c) {
110
 
                /* so we can assume it will never be called if entryTable==null: */
111
 
                return new TransferableEntrySelection(entryTable.getSelectedEntries());
 
110
        if (!draggingFile) {
 
111
            /* so we can assume it will never be called if entryTable==null: */
 
112
            return new TransferableEntrySelection(entryTable.getSelectedEntries());
 
113
        }
 
114
        else {
 
115
            draggingFile = false;
 
116
            return (new TransferableFileLinkSelection
 
117
                    (panel, entryTable.getSelectedEntries()));//.getTransferable();
 
118
        }
112
119
        }
113
120
 
114
121
        /**
189
196
                // nope, never heard of this type
190
197
                return false;
191
198
        }
 
199
    boolean draggingFile = false;
192
200
 
193
201
        public void exportAsDrag(JComponent comp, InputEvent e, int action) {
194
 
                // action is always LINK
195
 
        /* TODO: add support for dragging file link from table icon into other apps
 
202
                /* TODO: add support for dragging file link from table icon into other apps */
196
203
        if (e instanceof MouseEvent) {
197
204
            MouseEvent me = (MouseEvent)e;
198
205
            int col = entryTable.columnAtPoint(me.getPoint());
204
211
            // We have an icon column:
205
212
            if (res == MainTableFormat.FILE) {
206
213
                System.out.println("dragging file");
 
214
                draggingFile = true;
207
215
            }
208
 
        }*/
 
216
        }
209
217
        super.exportAsDrag(comp, e, DnDConstants.ACTION_LINK);
210
218
        }
211
219
 
222
230
        // add-ons -----------------------
223
231
 
224
232
        protected boolean handleDropTransfer(String dropStr, final int dropRow) throws IOException {
225
 
                if (dropStr.startsWith("file:")) {
 
233
        if (dropStr.startsWith("file:")) {
226
234
                        // This appears to be a dragged file link and not a reference
227
235
                        // format. Check if we can map this to a set of files:
228
236
                        if (handleDraggedFilenames(dropStr, dropRow))