Skip to content
jennybrown8 edited this page Aug 16, 2012 · 53 revisions

About Wicket-Source and SourceOpener

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.

  1. Maven Module for wicket called "wicket-source" - records where in the code each component is constructed. Adds an HTML attribute.
  2. Browser Extension "WicketSource" - displays html attribute and lets you click to open. Available for Firefox+Firebug and for Chrome.
  3. Eclipse plugin "Source Opener" - listens for clicks from browser and opens the file to that line.

Wicket Module wicket-source

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.7</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.

If you need to track a snapshot release for bug fixes, the snapshot repo is:

 https://oss.sonatype.org/content/repositories/snapshots/

and the current snapshot version as of Feb 2012 is 1.5.0.8-SNAPSHOT

WicketSource Firebug Extension for Firefox 7+

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 go to the WicketSource sidebar pane 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).

Firefox with WicketSource demo open

WicketSource Chrome Extension

Chrome extension is compatible with Chrome 18 and later. Just like the FireBug extension, the Chrome extension hangs off of "inspect element" and adds its own panel to the tool area.

Chrome with WicketSource demo open

SourceOpener Eclipse Plug-in for Eclipse Indigo

The SourceOpener plugin for Eclipse is the final step.

To install, copy the net.ftlines.wicketsource.sourceopener_VERSION.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 slow while the Eclipse search engine initializes; the rest should be quite fast.

Eclipse will open directly to the line in the Java file when it receives the click from Firefox. To reopen a line, double-click any item in the "Recent File Locations" tab.

Eclipse Screenshot with WicketSource demo open

WicketSource for browsers 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!

IDE port for Intellij

George Armhold ported the IDE plugin. Thanks!! He says:

I just whipped up a plugin for Intellij. It might not be publicly available until they have a chance to review it, but here's the link: http://plugins.intellij.net/plugin/?idea&id=6846

You can https://github.com/armhold/wicket-source-intellij/tree/master/artifacts install the jar manually if you don't feel like waiting for it to show up in the public repo.

In the mean time source is on github: https://github.com/armhold/wicket-source-intellij.

Clone this wiki locally