The Tapestry Palette plugin for Eclipse
provides for browsing and inspection of Tapestry components in a Tapestry web-application
project
Update:
10/14/2004: A new version is available, drag
and drop now supports 2 modes, see the notice elsewhere on this
blog.
I've been adding new features
since my original
posting . Thanks to Geoff Longman, the Spindle
developer, I've been able to add much better visual feedback to the drag and
drop of components onto a template. The component editing now inserts tags with
only the jwcid attribute into the template and the component definition is added
to the specification file.
The new
features include:
1. Appropriate HTML
tags for components dropped onto the template, e.g. <input> tags for form
elements, like TextField. 2. Editing of
template and specification files when components from the Palette are dropped
onto a template 3. Visual highlighting of
the range affected by a drop operation in the template
editor. 4. A custom property-sheet for
Tapestry templates, double click a jwcid attribute value to see the component
properties without switching to
the specification editor.
The image
below show both the Palette view on the left and the property sheet with a
component's properties displayed on the right. Click on the image to view a
larger version in a new window.
In addition the Palette is much
improved in it's handling of non-Tapestry projects and switching between
Tapestry projects. It should behave properly and even maintains the expanded
state of the tree as you switch from project to
project.
To open the Palette view use
Window > Show View > Other > Tapestry >
Palette.
To open the Property Sheet use
Window > Show View > Other > Basic >
Properties
To edit templates via drag
and drop you must have the template and specification editors open for the page
or component you wish to edit (This will change in a future release so that only
the template editor need be open). Drag a component out of the palette tree onto
the template. If you have a range of text selected, drop the component on the
range and it is wrapped by the component definition. If you have no range
selected the editor will highlight the range of the template to be wrapped by
the dropped component. If the specification editor is not open or has unsaved
changes the drop will fail with a warning message indicating the reason. If the
dragged component discards it's body at render time (allow-body="no" in the
component specification) and the affected range contains Tapestry component
references the drop will fail with a warning
message.
It may take several seconds
after a successful drop, while the Spindle incremental builder incorporates the
changes, before the component parameters are available in the Property
Sheet.
If you want to try out the
Palette you will need to:
I have created an Eclipse
update site at http://www.mjhenderson.com/updates so that the Tapestry Palette
can be installed from within Eclipse. You will have to uninstall, or manually
delete the previous version of the Palette plugin before installing from the
update site.
It looks for now like Mac
OS X drag and drop is broken in SWT so I'll continue working and testing with
Linux and Windows versions of
Eclipse.
My next step is to make the
Property Sheet editable so that component parameters can be edited directly
without opening the Specification file and to come up with a way during drag
and drop to edit an existing tag, rather than always inserting a new tag for a
dropped component.
If you are using
Tapestry, or want to try out Tapestry I'd like your feedback on this plugin. I
believe being able to inspect the available components with descriptions of
components and their parameters as well as inspecting components in place with
the custom property sheet will aid comprehension and reduce the oft-quoted steep
learning curve for Tapestry.
If you
have graphic design skills I would certainly appreciate a logo for the
plugin.
As far as my experiences with
Eclipse plugin development. I'm not much for RTFM, but in this case you can't
avoid it, the number of extension points and classes and interfaces available
boggles the mind but does allow creating new features with little coding.
Several issues caused me particular
hardship:
Class-loader boundaries. I
could not cast Eclipse interfaces to Spindle plugin classes without class cast
exceptions. I had to resort to reflection to invoke methods on the Spindle
classes which were not declared in the Eclipse interfaces. If this is due to a
misconception on my part I would appreciate a description of the solution or a
link to a solution.
Eclipse text editor
methods. The text editor classes are not designed to allow subclasses to readily
affect the visual feedback to the user. I had to submit modifications to the
Spindle Editor base class to convert mouse position to text position, change
text foreground and background colors and restore syntax highlighting. Many of
the methods in the Eclipse base classes for this behavior are protected which
means only a direct subclass can access
them.
Listener methods. Almost every
action initiated by the user triggers the selectionChanged() method in the
ISelectionListener interface. Winnowing these events down to the absolute
minimum took lots of trial and
error.
Threading. Moving processing
tasks into background threads, especially using IRunnableWithProgress, was
something I had to be shown by example (Thanks Geoff).