Can I create scripts that I can run inside the Eclipse Editor? [message #1457640] |
Fri, 31 October 2014 14:49 |
Chris Gage Messages: 74 Registered: July 2009 |
Member |
|
|
I have been waiting and hoping for a Scripting capability in Eclipse since I first started using it in 2001 (IBM WSAD4). I am now retired (from IBM WebSphere development) and my chosen retirement activity is working on many files which are raw OCR text from a bookscanner. These files usually have many errors in them. I use the eclipse Editor to remove as many of these errors as possible before I move the files to MS Word. I do this because I can use real regular expressions to make complex edits -- MS Word's wildcard syntax is a weak subset of regex.
Each of these regex edits has to be typed in again for every file.
I have EASE installed on Luna from the lastest nightly build, and I can create an empty script and run it.
So:
Does EASE have the ability to let me store these regex edits as scripts and run them inside the editor as if they were part of it?
Can I interact with, for example, the find/replace dialog from a script?
Can I capture them from keystrokes, as in MS Word's record macro function?
Any plans to allow scripts to be written in java? Personally I'd prefer it.
Help me get started and I'll gladly contribute examples.
Chris Gage
www.ibiblio.org/britishRaj
[Updated on: Fri, 31 October 2014 20:35] Report message to a moderator
|
|
|
Re: Can I create scripts that I can run inside the Eclipse Editor? [message #1460638 is a reply to message #1457640] |
Mon, 03 November 2014 19:44 |
Christian Pontesegger Messages: 250 Registered: July 2009 Location: Graz, Austria |
Senior Member |
|
|
Hi Chris,
always glad to see people using the project. Lets see about your questions:
Quote:Any plans to allow scripts to be written in java? Personally I'd prefer it.
I'll take this one first as it helps answering some of the other questions.
You may already mix Java code with JS. Only drawback: you have to provide FQN eg:
var file = new java.io.File("C:\\")
if (file.exists())
print("found...")
As JS runs on the JRE currently executing eclipse you may interact with the whole java class library along with any public eclipse API.
Quote:Does EASE have the ability to let me store these regex edits as scripts and run them inside the editor as if they were part of it?
You may create a script in your workspace (or anywhere on your file system) that contains your regEx, which processes a certain file containing your text data. So you cannot mix script code and your sample data in the same file very well. (In fact you could by quoting your whole data content as a string literal resulting in a huge script file modifying itself, but that's not a real world use case I think.)
Look at the Resources module which allows to read/write files. Mix it with an open dialog (also from the resources module) and add some java code for your regexp parsing.
Quote:Can I interact with, for example, the find/replace dialog from a script?
Yes, definitely. But you need to look at the find/replace API from eclipse for that. Currently EASE has no convenience methods for that.
Quote:Can I capture them from keystrokes, as in MS Word's record macro function?
No, not to my knowledge. The script shell view allows to record commands you type into it (use rightmost toolbar button), but this will not capture any keyboard shortcuts or whatever data you provide in dialogs or other views.
Quote:Help me get started and I'll gladly contribute examples.
There exists an (currently empty) git repository for examples. Feel free to push example scripts there!
come back if you have further questions
Christian
[Updated on: Mon, 03 November 2014 19:45] Report message to a moderator
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05656 seconds