Internationalization Cookbook
This is my personal blog. The views expressed on these pages are mine alone and not those of my employer.

Eclipse plugin – External Filter

This is a plugin that allows you to take text content from an Eclipse document, process it through an external tool,
and the make the result available in Eclipse at the end (see the Features section for complete info).
The text is “feed” to the tool as standard input and the standard output becomes the result.

This is something I have missed for a while, and I am amazed that there is nothing out there already. Or maybe it is, and I could not find it…

So in a week-end or two I have put something together.
Some of the inspiration cames from gedit.

It should be able to run anything that you can normally execute on your machine (native applications, Perl/Python/shell scripts, Java, Groovy, etc.)


Configuration dialog

Sample output

Installation

To install the plugin in Eclipse select Help -> Install New Software… and click “Add…” to add the following URL:
http://www.mihai-nita.net/eclipse

You can then select the site in the “Work with” list and continue the installation like with any other plugin.

Features

The input text can be the whole content of a document, or the current selection selection.
The result can be displayed in the Eclipse console, or a message box, in clipboard,
can replace the current selection, or the whole document, can be appended to the document or at the insertion point,
or create a new document.

This is what I would like to add to it, although it should be usable already:

  • Specify the charset for the input / output (right now it is UTF-8, but there might bee tools that can’t handle it)
  • Allowing “replacement macros” in the command line (for things like document/project path, home folder, environment, Eclipse variables, prompt for input, etc.
  • The ability to include a short script in the tool configuration itself (so that you don’t need an external script)
  • The ability to ask for a command to execute
  • Specify how to deal with standard-error (merge with standard input, ignore, take it instead of standard input, etc.
  • Handle nicely text from column selections.
  • Whatever cool ideas you might sugest :-)

Sources

On GitHub, at https://github.com/mihnita/external-filter.

License

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License.

You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

5 Comments to “Eclipse plugin – External Filter”

  1. Rusty says:

    Mihai, you are my FAVORITE PERSON IN THE WORLD today. I’ve only been using this plugin for five minutes, but I love it so much; it’s exactly what I was looking for.

    (What I *was* doing was saving my file, opening it in NEdit, using its Shell -> Filter Selection, reloading it in Eclipse. Ugh! Now I just need to you make a plugin which lets you drag rectangular selections like NEdit; thanks in advance.)

  2. Harold Bamford says:

    I don’t see the External Filter plugin in git. Was it removed? Is it part of some other plugin? Is there a better implementation I should be using?

    Thanks for getting back to me on this.

    — Harold Bamford

Leave a comment