The Eclipse WTP project contains a JSP editor which has trouble with the JSP quote escaping rules. As a way to learn about WTP (with the ultimate goal of replacing the piece-of-shit publishing framework in WTP) I set out to fix this. These documents serve as a set of reminders through the process, and may perhaps help other people that want to hack the source. I found some helpful documents on the internals of the WTP SSE editors here and here.
I just created my second Eclipse plugin which adds several bookmark methods to the editor. The "default" bookmark methods of Eclipse ask for a name and this is often not very useful. The code here adds bookmarks a la "Borland" and bookmarks a la "JCreator". The code has the following options which can all be bound/rebound with the keys dialog under the "Edit" category:
I'll be posting the source of the plugin later on; the plugin can be installed using the update site http://eclipse.etc.to/updates/
Getting the IWorkbench
To get the IWorkbench from a plugin use IWorkbench wb = PlatformUI.getWorkbench();
Getting the IWorkspace
The workspace can be gotten using ResourcesPlugin.getWorkspace();
Getting the "root" IResource of the workspace
This can be gotten from IWorkspace.getRoot()
Getting the "active" editor from an Action/command
public ITextEditor getTextEditor()
{
IWorkbench wb = PlatformUI.getWorkbench();
IWorkbenchWindow win = wb.getActiveWorkbenchWindow();
IWorkbenchPage page = win.getActivePage();
IEditorPart editor = page.getActiveEditor();
return (ITextEditor) editor;
}
The Java Advanced Imaging toolkit contains lots of stuff to work with images. The documentation leaves a lot to be desired though: it is often factually incorrect due to version differences, and examples for common operations are hard to come by.
I needed a way to "resize" monochrome tiffs. The default "scale" operation leaves the result as a black-and-white image, and this results in a reduced image with a lousy quality. To get a better quality the image must be converted to grayscale and then rescaled using a resampler filter.
Most examples tell you to use either the "ColorConvert" or the "BandCombine" JAI operations. But sadly all of the examples I tried threw exceptions at one part or another.
There are some common misconceptions on how tag handlers work, and what methods get called at what time and when. This document contains a collection of pitfalls you can encounter when writing tag libraries.
release()
Misconception: release() gets called at the end of a page. This is not true! Some idiot writing JSP 1.2 decided that release should only be called just before the tag handler is released to the garbage collector! This means that when a tag handler gets cached by a container (like Tomcat's Jasper engine does by default) the release() method gets called at most once(!) even if the tag gets reused many times on several pages! There is currently NO failsafe way to clean up your tag handler between invocations. The best you can do is to cleanup at your own known exit points. This clearly sucks, but what can you do..