Design smell: Must run the app to configure the app

The prevailing method of configuring an application is to run the application and then select various configuration screens or preferences. This is fine, until it is not.

Sometimes you cannot run the application, so can’t configure it. An example would be the Eclipse IDE. It is possible to break Eclipse by loading a misbehaving plug-in or other means. If Eclipse cannot start, one can’t remove the offending plug-in or make other required changes.

This brings up the main problem with relying on in-app configuration. Without its use, one must be skilled in the underlying configuration storage used by the app. Further, this storage may be minimally documented, complex, or in multiple places. In worse cases, this storage is non-textual. For instance, referring to Eclipse example above, I have yet to find via a web search how to easily use the OSGi Equinox run-time (that Eclipse builds upon) to remove a recently installed feature or plug-in. I’m sure it is possible, and probably minor if you know Equinox. But, how many users of Eclipse IDE have even heard of Equinox or OSGi?


  • The app may be compromised or broken.
  • Configuring via configuration files or other apps requires a different skill set.
  • Attempts to repair via non-app UI can make things worse.


  • Allow a subset of an application to be used for configuration use.
  • Allow the running of the app in “safe” modes. Example, Browser without plugins.
  • Create a separate configuration application.
  • Allow easier means to roll back to previous configuration.

The best solution is to create a secure application that can use the target application’s configuration storage systems. If the in-app configuration support can be modularized, this is optimal.

Drawing Hands” by M. C. Escher, accessed at WikiPaintings
© This artwork may be protected by copyright. It is posted on the site in accordance with fair use principles

Unable to dock detached Eclipse Console window

When the Eclipse IDE ‘breaks’ it seems to be unfixable. Like right now. I detached the Console view window via dragging onto another monitor. Done with it. Now I can’t dock the Console again inside the Java Perspective.

The top left widget just shows a ‘close’ action. I tried closing projects, restarting Eclipse with “-clean”, and of course doing a search to see if this has been addressed by someone before. Sometimes it will go away and another docked Console will be used. But then it pops up again in float mode, and duplicating the output in the already docked Console, i.e., now two Consoles are showing the same thing.

Reinstall Eclipse again????? Arrrrrrrrrrrrrr. Let me reboot Windoze first.

I rebooted PC, rearranged Eclipse on the multi-monitor location, and the issue has not returned.


  1. The issue started again. I looked in the JUnit run configuration’s common tab for the test causing this. The “Launch in background” setting was checked. hmmm.
  2. Still not working. Second console window popup still appearing.
  3. Now trying the suggestion found here.
  4. Doh!!!!! I was dragging the window via the title bar. You have to drag via the tab title.

I guess working in different environment made me lose my muscle memory gesture.
Number 3 above fixed the popup reappearing.


  • Eclipse 4.3 (Kepler)
  • Windows 7 Professional 64bit
  • Java 1.6 and 1.7
  • Dual monitor
  • UltraMon utility

GUI piping instead of screen shots

Currently I have to share info via capturing screen shots of various tools. An example of where this is required is in Eclipse’s Java developers environment.

The Eclipse IDE via the various added plugins and features captures a lot of metadata about a project and its various assets. For example, in the outline view you can see various listings with applied filters. Now try to share that in an email or document. You have to take a snap shot of the screen. This is not a very practical example, it’s just to show the issue. This issue comes in various other plugins like Team providers. Note, I’m not singling out Eclipse on this; all tools and applications have this problem.

While screenshots can convey the original purpose of sharing a particular view of data, they are very difficult to reuse in diverse ways. For example, we may want to sort or filter a listing of data. Or we we may want to reuse that data with external reporting or metric applications. With a GUI screen shot this is not possible.

Graphical tools should allow piping of information. As in Unix piping, a tool should allow re purposing of its generated data. This is not just a developers geeky need; many times error pop ups and other types of displays do not allow the end user to copy the actual ASCII textual information.

There are many ways of doing this. At root, the two options are textual piping, as used in *nix systems, and object piping, as used in PowerShell.

The ideal solution would allow a drag&drop functionality. This is already used in many apps via OS or application level support. For example, right click on the browser and you can copy stuff. Yet, even in the browser scenario, the data result is not semantic (based on the information context), it’s just text or via the contextual menu a set of standard objects.

One possibility is that a drag&drop sets up a pipe line and a standard markup of the data is transferred.


In Eclipse, search for all text in current file?

Many good editors, especially graphical based ones, allow the user to search the current file for all occurrences of a text string. Some will offer to highlight the text, others will use a search output window to show the search results. Note that this is automatically performed for the currently edited file. This is required to make an unimpeded grasp of a code base, to keep up with the thought process. Opening up dialogs and clicking and clacking breaks the flow.

Eclipse can’t do this!
Yup, its been around so long, and it still can’t do this simple thing. I could be missing something, an obscure magical key binding, a buried preference, but I’ve looked.

Current Options
Lets be more accurate. The Eclipse IDE has powerful search capability and it could find all text within a file and put the results into the search result window. However, invoking this for ONLY the current edit window is a user experience failure. What are the options? Using the default key bindings:

  1. Ctrl-H: brings up a modal dialog window that has a plethora of options, but germane to this blog rant, nothing in the file path input.
  2. Ctrl-F: Another window, which is the above window lite. At least it is targeted for the current file. But, it won’t show all matches; turning off incremental just turns off searching per each keystroke into the text input field.
  3. Alt-F: This one will find all occurrences of text in the current file. Awesome!!! But, only for the currently highlighted text string in the editor. Sheesh, first I have to find it in order to find it. Que “The Three Stooges” theme song.

Note: Alt-F is not a default Eclipse key mapping. To map it bind the “Find Text in File” command to Alt+F in ‘In Windows’ at Category ‘Search’ for User ‘CU’.

What To Do?
Enhance Eclipse so that when the user does an Alt-F keystroke, check if text is highlighted in the current edit window. If there is, do the above. It there is no highlighted text, then put up a version of the simple search dialog that Ctrl-F would have created, but this dialog would have a new “All Occurrences” select box already checked. That was easy!

I would even do it myself except, learning the Eclipse internals and all associated devadministrivia would be a career in itself. So in the meantime lets just warm up our fingers in the morning cause they’ll have to be limber; a lot of dialogs will have to open and close just to find what your after.


Eclipse IDE 4.2 UI is austere

Some people don’t like the new Eclipse Juno release default L&F. Its kind of underwhelming.

I don’t think it is so bad. For use on a large monitor (and what company tortures their developers with small monitors?) the earlier UI is much better. On laptops and smaller monitors, the new UI makes sense.

If you rather have the 3.x appearance go into Window -> Preferences -> General -> Appearance. There you will find a drop down to select the Theme. When I installed the new version the default was “Windows 7″. Change to “Classic”, then restart Eclipse.

The result should be more like Eclipse 3.8.

What is worse is the the changes to UI behavior. For example, I tried to put the Outline view on top of the Navigator view. The UI would attempt to arrange them every which way but stacked. Finally on a guess I dragged a view to the actual tab area, not the view’s work area (as in version 3.8) and it worked.

Further Reading

Eclipse 3.8 vs 4.2


"" issue model was not being managed.

Problems occurred when invoking code from plug-in: “”.

I ran a file search (ctrl-h) and got the search results. Double clicked on one of the hits and get an exception in Eclipse. See below.

What I did to fix? Reran the MyEclipse install and chose ‘fix current install’. Then I changed the command line that starts Eclipse to:

“C:\java\MyEclipse 9\myeclipse.exe” -clean -vm C:\java\jdk1.6.0_25\bin\javaw.exe -Xms512m -XX:PermSize=256M -XX:ReservedCodeCacheSize=64m

Haven’t seen the issue today.

5/9/2011: Still happening.
5/9/2011: Now made a change in the search preferences. Do not reuse editors. Lets see.
5/12/2011: That fixed it. Sounds like a concurrency issue in Eclipse.

org.eclipse.wst.sse.core.internal.util.Assert$AssertionFailedException: release was requested on a model that was not being managed
at org.eclipse.wst.sse.core.internal.util.Assert.isNotNull(
at org.eclipse.wst.sse.core.internal.model.ModelManagerImpl.releaseFromEdit(
at org.eclipse.wst.sse.core.internal.model.ModelManagerImpl.releaseFromEdit(
at org.eclipse.wst.sse.core.internal.model.AbstractStructuredModel.releaseFromEdit(
at org.eclipse.wst.xml.core.internal.document.DOMModelImpl.releaseFromEdit(
at org.eclipse.wst.html.core.internal.document.DOMStyleModelImpl.releaseFromEdit(
at org.eclipse.wst.sse.ui.StructuredTextEditor.doSetInput(

java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Framework arguments: -Xms512m -XX:PermSize=256M -XX:ReservedCodeCacheSize=64m
Command-line arguments: -os win32 -ws win32 -arch x86 -Xms512m -XX:PermSize=256M -XX:ReservedCodeCacheSize=64m

MyEclipse Version 9.0.

Eclipse regex search for (.*) doesn't work repeatably?

On a file in MyEclipse search for (.*) in regexp mode. It will find the first match sometimes. Search again, it will state no match found. However, use (.+) and it will find each line.

On a file in MyEclipse search for (.*) in regexp mode. It will find the first match sometimes. Search again, it will state no match found. However, use (.+) and it will find each line.

That is weird behavior. Same thing happens in Eclipse Helios. Tried it in an editor, GVim. Works fine. Must be a Preferences setting, or a built in limit to avoid runaway regexps.

Tried (.*?), won’t even find one match.

10-23-2012: You have to use \R as the terminator. That is very nonstandard.

See also
The Incredible Suckiness of Text Editors

The incredible suckiness of text editors

This should be simple, find every instance of “txtXXXX”, where XXXX can be any string, and you want the search to be non-greedy. Hah.

This should be simple, find every instance of “txtXXXX”, where XXXX can be any string, and you want the search to be non-greedy. Hah.

I needed to find these strings so I can insert them into a new file, then apply a regexp to create a bunch of source code. This is just a very elementary regular expression use: “txt.*?”

  • Notepad++: doesn’t support “?”.
  • GVim: /”txt.{-}” ugly! and how do I reuse the results (doable but hard)
  • windows notepad: lol!
  • Eclipse IDE: “txt.*?” but, you can’t find them all and reuse the results.

Long story short, I opened a command shell and did:

type page.html | egrep -o "txt.*?"

Not perfect, I still get too much of the line containing the match, but it is at least reusable. egrep is that installed with cygwin.

I, of course, am not complaining about text editors based on this one little issue. There is a long list of pain points, as with any software type.

I remember using a great editor that really knew how to optimize a developers work, SlickEdit. This task would have been a yawn.

In SlickEdit, real standard regexps are used, the output goes to a search output panel, etc., did I mention it does real columns? Alas, it is expensive, and companies probably won’t spend on it; we’re lucky we even have jobs in this age.


Java Dev Using Embedded Groovy Console in Eclipse

Embed a script engine and have new ways of analyzing and developing code.

In development, simple but powerful tools to get at the essence of a code source in order to understand, test, and extend it is essential. This is even more important in Test Driven Development (TDD). Eclipse’s Java Debugger is for most situations, powerful enough. Eclipse has an Expressions View available in the debug perspective to execute snippets of code. The Java Development Toolkit (JDT) also has a Scrapbook facility that allows the creation, storage, and running of experimental code. And, of course, all the other features of the debugger are excellent.

However, when you need it, it’s possible to embed a script engine and have new ways of analyzing and developing code. In listing 1, an app shows the use of the ConsoleWaiter class. When the code executes the at line 43, it opens the Groovy Console which allows the use Groovy shell scripting in a GUI frame, see figure 1. When the console is closed the app continues executing.

Listing 1
* File:
* @author jbetancourt
* Date: 20101213T1718-5
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

* @author jbetancourt
public class ExampleApp2 {
   static public String greeting = "Hello world!";
   private static final List<String> nodes;

   static {
        nodes = new

   private String title = "Example 2";

   public String getTitle(){
      return title;

   * @param args command line args
   public static void main(String[] args) {
      ExampleApp2 app = new ExampleApp2();

      ConsoleWaiter waiter = new ConsoleWaiter(app);

      waiter.setVar("greet", greeting);
      waiter.setVar("nodes", nodes);
      waiter.setVar("title", app.getTitle());;

screen capture of Groovy console
Console screen capture, click to view
Another screen capture, click to view

This is awesome. In one project I had to examine the contents of a Properties object. Did it have an “email” value? I was stumped when using the Eclipse debugger, it did not show all entries in the Map, at the end was “…”. Sure, I could use the Expressions window, but with the Console I could not only do a get(key), but iterate using Groovy style closures and much more.

The magic that enables this is the ConsoleWaiter.groovy class shown below in listing 2 that was written by John Green. Since a Groovy script is a Java class underneath, in Eclipse you can call Groovy from Java easily (some compiler magic).

Listing 2
 * File:  ConsoleWaiter.groovy

import groovy.lang.Binding;
import groovy.ui.Console;

 * Provides a wrapper for the console.
 * Based on source by John Green
 * Adapted from:
 * Released under the Eclipse Public License
 * I added methods to allow use from Java.
 * The run() method launches the console and causes this thread
 * to sleep until the console's window is closed.
 * Allows easy interaction with the objects alive at a given
 * point in an application's execution, like in a debugger
 * session.
 * Example 1:
<pre> * new ConsoleWaiter().run()

 * Example 2:
<pre> * def waiter = new ConsoleWaiter()
 * waiter.console.setVariable("node", node)
class ConsoleWaiter {
 Console console
 Object source
 boolean done = false;

 /** */
 public ConsoleWaiter(Console inConsole){
    this.console = inConsole

 /** */
 public ConsoleWaiter(Object source){
    console =
    new Console(getClass().classLoader,
    new Binding())
    this.source = source
    console.setVariable("source", source)

 /** */
 public void setVar(String key, Object value){
    console.setVariable(key, value)

 /** 	 */
 public void setVar(String key, List values){
    console.setVariable(key, values)

 /** 	 */
 public void setVar(String key, Object[] values){
    console.setVariable(key, values)

 /** 	 */
 public void run() {
    // I'm a little surprised that this exit() can be private.
    console.frame.windowClosing = this.&amp;exit
    console.frame.windowClosed = this.&amp;exit
    while (!done) {
       sleep 1000

 /** 	 */
 public boolean isDone(){
    return done;

 /** 	 */
 public void exit(EventObject evt = null) {
    done = true

 /** 	 */
 public Console getConsole(){
    return console;

Eclipse Integration

The disadvantage of this approach is that you have to put extraneous code inside the tests or target class. Not only is this tedious and slow, what if code is accidentally deployed like this? A better approach is to just set a breakpoint in the code, and then have the ability to open a script console at that breakpoint, in the Java Stack Frame, that has access to the execution context and classpath. Is there an Eclipse add-in that does this? If not, there should be.


Shown was a simple example of embedding a Groovy console in Java code to allow scripting. Of course, this is not a new idea. It was even mentioned in an older JVM scripting language, Beanshell. Note that it is possible to instead of using a GUI console, to use the Groovy shell, InteractiveShell class. In the reading list below this approach is taken to allow remote scripting of a server hosted application.


  • Oct 10, 2011:
    Interesting tool that could be relevant: YouDebug.
  • March 20, 2012: Not exactly same scenario, but the concept of an embedded script console is found in many products. Jenkins CI Server has one and it uses Groovy. Jenkins Script Console

Further reading

Use Eclipse project dir for Unit Test data

Use the default launch configuration of a unit test in Eclipse to access Unit Test data.

Use the default launch configuration of a unit test in Eclipse to access Unit Test data.

Best practice is to not access test data in relative or absolute paths in the file system. Instead to use classpath resources. But, maybe you have valid reasons to want to do things your own way. Thus, you want to get at test data in a folder within your project without monkeying around with adding file paths to launch configuration and all that stuff.

Ok, who am I to diminish your mojo. Just use the current directory that Eclipse creates. Example, you have this:

class FileCompareTest extends GroovyTestCase {
       /** 	 */
       public void testSomething(){
		def aFileName = 
           // use file in test.

Change it to:

class FileCompareTest extends GroovyTestCase{
       def basedir
       protected void setUp() throws Exception {
           basedir = new".").getAbsolutePath()
       /** 	 */
       public void testSomething(){			
           def aFileName = basedir + "dataalpha.txt"


17JAN11: Could basedir = System.getProperty(“user.dir”); also be used?

Related links

How to default the working directory for JUnit launch configurations in Eclipse?