Bug 52281

Summary: Support for file Drag and Drop
Product: JMeter Reporter: Dan Corneanu <cdan>
Component: MainAssignee: JMeter issues mailing list <issues>
Status: RESOLVED FIXED    
Severity: enhancement CC: cdan, p.mouawad
Priority: P2    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   
Attachments: Dragging and Dropping files to JMeter

Description Dan Corneanu 2011-12-03 21:20:43 UTC
I find myself many times, browsing for a test plan (jmx file) using the system's file browser, then in order to load it into JMeter, I do the same thing once again from the JMeter's file browser.

I would very much appreciate to have support for Draging and Dropping files from the system's file browser directly into JMeter.

The implementation could be as simple as:
1. accepting only single file selectionis
2. accepting only *.jmx files
3. always performing a Load action (not a Merge action)
Comment 1 Dan Corneanu 2011-12-04 08:08:57 UTC
Created attachment 28021 [details]
Dragging and Dropping files to JMeter

This is a quick hack that adds support for Dragging and Dropping files to JMeter.
The  patch adds a TopLevelTransferHandler to the MainFrame. The transfer handler handles file drops.
Comment 2 Dan Corneanu 2011-12-04 08:18:06 UTC
(In reply to comment #1)
> Created attachment 28021 [details]
> Dragging and Dropping files to JMeter
> 
> This is a quick hack that adds support for Dragging and Dropping files to
> JMeter.
> The  patch adds a TopLevelTransferHandler to the MainFrame. The transfer
> handler handles file drops.

The new class org.apache.jmeter.gui.action.LoadDraggedFile is a big hack. It was added to this package just to open up access to the Close and Load Command(s). How can this be implemented in a clean way, reusing the Close and Load command?

1. would it be better to add a new Command for handling file drops? kind of like LoadRecentProject.
2. How can the Transferable object from the TopLevelTransferHandler be passed to the new command?
Comment 3 Philippe Mouawad 2012-01-15 15:07:05 UTC
Thanks for the patch.
Applied with minor changes:
- Javadocs
- Apache Headers
- Added check for Dnd file to ensure it's a JMX Plan

Date: Sun Jan 15 15:05:30 2012
New Revision: 1231684

URL: http://svn.apache.org/viewvc?rev=1231684&view=rev
Log:
Bug 52281 - Support for file Drag and Drop

Added:
   jmeter/trunk/src/core/org/apache/jmeter/gui/TopLevelTransferHandler.java   (with props)
   jmeter/trunk/src/core/org/apache/jmeter/gui/action/LoadDraggedFile.java   (with props)
Modified:
   jmeter/trunk/src/core/org/apache/jmeter/gui/MainFrame.java
   jmeter/trunk/xdocs/changes.xml
Comment 4 Philippe Mouawad 2012-01-15 21:16:32 UTC
Date: Sun Jan 15 21:06:49 2012
New Revision: 1231754

URL: http://svn.apache.org/viewvc?rev=1231754&view=rev
Log:
Bug 52281 - Support for file Drag and Drop
Had to find an alternate implementation as TransferHandler.TransferSupport  is not supported in JDK5

Removed:
   jmeter/trunk/src/core/org/apache/jmeter/gui/TopLevelTransferHandler.java
Modified:
   jmeter/trunk/src/core/org/apache/jmeter/gui/MainFrame.java