Drag and Drop support for Script Console

As part of my scripting lab at JavaOne, I've dusted off one of my first NetBeans plugin and have updated it. The lab requires the participants to write code snippets and try them out in a scripting environment.

My original scripting plugin provides a scripting plugin has a console but it requires you to type in at the console. If you make a mistake you have to type again.

To make it more convenient for the user, I made the console accept drop items; you can either drop a script file or a code snippet on to the console. First open the console Script -> Script Console -> <select your favourite script console>; then you can do one of the following
  1. Drag a script file from the Project window onto the opened script console. The console will now execute the script. Note that if you are dropping a JavaScript file onto the console, it stands to reason that the console should be a JavaScript console. (An idea just occured to me while I am writing this; I can open a 'stem cell console' (SCC) where the console is not affiliated with any particular script language. Just drop a file on it and the SCC will try to execute it with an appropriate engine.)
  2. Highlight and select any text from NetBeans editor. The drag and drop the selected text onto the console. The console will now execute the text.
  3. Finally you can perform the above 2 operations on files outside of NetBeans. So if you drag files from say Konqueror or from a text editor and drop that onto the console, the console will know what to do with it.  

I am sure that I've not covered all the possible MIME types so let me know if you you find something that does not work. I've tested on Solaris and Linux but not on Windows and Mac. You can find the MIME type either from the terminal that you started NetBeans or from NetBeans' log files.

One final thing; the plugin requires JDK 6 so NetBeans must be running on JDK 6. Otherwise it will not work.

The binaries can found here. I'm going to try to check the sources into http://scripting.dev.java.net site.


I was at St Petersburg this week for Sun's Techdays. This is my first trip to Russia. The city is beautiful. However it is a bit cold for me; in Singapore, any thing below 28C is consider cold. I did however get to see snowfall for the first time in my life. Unfortunately I was not able to get a picture of me frolicking in it as I was working.
Comments:

Post a Comment:
Comments are closed for this entry.
About

Random thought at random intervals

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today