This has been said before: Protected variables are evil. But apparently as I've been doing some debugging into the Eclipse code I'm reminded it needs saying again.
Let's suppose we write a base class
public class SimpleBase {
protected Object value = new Integer(10);
public printValue() {
system.out.println(value.toString());
}
}
public class Derived extends SimpleBase
{
public Derived() {
value = null;
}
}
...
main() {
new SimpleBase().printNumber();
new Derived().printNumber();
}
Continue reading "Protected variables cause subtle bugs - don't use them" »
MS has a rule about this in FxCop. PMD has a rule:
ConstructorCallsOverridableMethod. In both cases the point is to discourage the following weird behaviour. From Eclipse:
public abstract class CellEditor {
protected CellEditor(Composite parent, int style) {
this.style = style;
System.out.println("CellEditor constructor");
create(parent);
}
public void create(Composite parent) {
Assert.isTrue(control == null);
control = createControl(parent);
}
protected abstract Control createControl(Composite parent)
}
Continue reading "Don't call overridable methods in constructors" »
In my last post I promised a post about something other than Eclipse for my next post. I'm sorry I lied, I had the best of intentions. However the problem of acceptance testing and Rich Client applications has been rattling around in my head for some years now. A couple of years ago I tried this in .NET and didn't have any great success. This time driven by the needs of several projects in my group and reading Bret Pettichord's excellent seminar "Homebrew Test Automation" (PDF) I'm inspired to try again.
Continue reading "Acceptance Testing and Eclipse Rich Client Applications - How to do it?" »
If you don't do development work in Eclipse - stop reading this post now, come back tomorrow I promise that I will write about something else.
We’re writing our test plugins as fragments to be hosted inside the plugin they’re testing. Most of the time this works without a hitch and gives the benefit of being able to test classes and methods with package (default) visibility. We have several of these plugins that work with no problem both in my Eclipse IDE and our PDE builds. However for one developer one fragment plugin suffers the problem: Host bundle 'xxx.xxx.xxx.common' exists but is unresolved.
What does this mean? What is Eclipse saying? How on Earth do I debug this?
Continue reading "Eclipse Madness - Why do fragment plugins work for some Developers and not others?" »
Most of you aren't developing GEF applications on top of Eclipse RCP - in your case move along there's nothing to see here. However if you're one of the three people out doing GEF development, sit down I have story to tell.
I wanted a label attached to my figures that was wider than the parent figure. The label should be tied to the parent - but not be included in the parents grab handle. The previously suggested solution that I found was to stack the original figure and label in a composite (using a Flow/Toolbar Layout to position the children). Sadly that just created the Ugly Duckling (left figure) and not the Elegant one (see right).
After some more digging I discovered an interface HandleBounds (dig the crazy name), its tailor made for this situation:
HandleBounds Identifies figures which use an alternative rectangle to place their handles. Normally, handles will appear around a GraphicalEditPart's figure's bounds. However, if that figure has an irregular shape, it may implement this interface to indicate that some rectangle other than its bounding rectangle should be used to place handles.
If you ignore the word irregular this solution is tailor made for our problem.
Continue reading "Narrow Figures - Wide Labels - More GEF discoveries" »