Skip to content
Yevgen Kulik edited this page May 6, 2015 · 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 for Wicket 6:

 <dependency>
      <groupId>net.ftlines.wicket-source</groupId>
      <artifactId>wicket-source</artifactId>
      <version>6.0.0.8</version>
 </dependency>

or for Wicket 1.5:

 <dependency>
      <groupId>net.ftlines.wicket-source</groupId>
      <artifactId>wicket-source</artifactId>
      <version>1.5.0.7</version>
 </dependency>

For Wicket 7 use

compile "net.ftlines.wicket-source:wicket-source:7.0.0"

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

The BEST way to install is through the Chrome Web Store, here:

https://chrome.google.com/webstore/search/WicketSource

Uninstall/delete your existing version of the plugin before installing from the web store.


If for some reason that is taken down, or you want the older version of the plugin, you can still install from the Downloads area. But Chrome has recently changed their extension installation options. You can no longer install directly from a web page on github (or any third party website), for security reasons. If you choose to use it, here's how.

  1. Download the crx file from my github Downloads area. Save it to your local computer as a file.
  2. In Chrome, open the Settings / Extensions page.
  3. Drag and drop the crx file onto the Extensions page.
  4. Grant it access to read your web sites, and then it will work.

That last step is the security checker. WicketSource plugin reads the web page to scan for wicketsource="*" in html tags. Assuming you have the valid plugin from me, that's the only thing it actually uses. If you have doubts, you can unpack the extension and examine the javascript source.

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.