-
Notifications
You must be signed in to change notification settings - Fork 14
Home
Wicket-source shows wicket component origin locations in source code, in an html attribute, speeding the modification of existing wicket pages.
It lets you Inspect-Element from your web browser, click on a link in a Firebug sidebar, and then Eclipse opens the Java source code to the location of that wicket component. It is meant primarily as a wicket developer tool.
There are three parts.
- Wicket Module "wicket-source" - records where in the code each component is constructed. Adds an HTML attribute.
- Firebug Extension "WicketSource" - displays html attribute and lets you click to open.
- Eclipse plugin "Source Opener" - listens for clicks from Firefox and opens the file to that line.
A Chrome extension is "in the works" but it relies on experimental devtool extension APIs, so it will not be ready until Chrome makes those APIs standard instead of experimental.
Versioning of everything is based off of Wicket version ala wicketstuff's recommendations. So, the following resources are matched to the 1.5.x version of Wicket.
The module wicket-source plugs in to your Wicket application to record the class and line number where each component is created. It produces an html attribute on each dom node, like so: wicketsource="net.ftlines.wicketsource.demo:HomePage.java:59"
Maven dependency:
<dependency>
<groupId>net.ftlines.wicket-source</groupId>
<artifactId>wicket-source</artifactId>
<version>1.5.0_06</version>
</dependency>
Usage, inside a debug flag check in your WicketApplication:
WicketSource.configure(this);
Obviously, whatever debug check you do, ensure that the matching debug flag is set to true in your dev environment or you won't see any useful output. The process used to discover instantiation locations is a bit slow and should not be used in a production environment.
There is also a wicket-source-demo
web application available via maven central. It's a wicket quick start app modified to show what wicket-source can do. It's a great way to test out your Firefox plugin and Eclipse drop-in setups.
This is a Firebug extension, so yes, you need Firebug as well.
The WicketSource (click to install) firebug extension lets you inspect an element and request that the file be opened in Eclipse.
Inspect an element with Firebug, and then flip over to the WicketSource tab to see where in the Java code its Wicket component was created. Click the hyperlink to send a request to Eclipse to open the file (you'll need the Eclipse plug-in below for that to work).
The SourceOpener plugin for Eclipse is the final step.
To install, copy the jar from the Downloads area of this github project, into your \eclipse\dropins\ folder and restart Eclipse.
Then go to the menu "Window", "Show View", "Other", "Source Opener", "Recent File Locations", and put the resulting tab wherever you like.
The listener starts up by default, so it should be usable immediately. The first open-file click from Firefox will be briefly slow while the search engine initializes; the rest should be quite fast.
Double-click any item in the "Recent File Locations" tab, to reopen to that same line.
WicketSource for Firebug and SourceOpener for Eclipse communicate across a port. You can set a different port through the preferences (make sure they both match!) and optionally require a password as well.
You can also stop and start the listener in Eclipse (red square to stop, green play button to start). It will pick up preference changes automatically, so you may never need to manually stop or start it.
Enjoy!