Wednesday, May 13, 2009

Providing custom images for the outline view in Xtext/TMF pt 2

I recently installed the M7 build of Xtext and had to make some minor tweaks to get my code running. Doing that, I discovered a simpler way to achieve what I described in

The API either changed slightly, or it make a mistake, but the correct version now looks like this:

public class AnalysisLabelProvider extends DefaultLabelProvider {

 public String image(Actor actor) {
  String image = (actor.isSystem() ? "Node.gif" : "Actor.gif");
  return image;

 public String image(UseCase useCase) {
  return "UseCase.gif";

 public String image(Information information) {
  return "Class.gif";

 public String image(Analysis analysis) {
  return "Model.gif";

 public String image(Issue issue) {
  return "Comment.gif";

 public String image(Step step) {
  return "StructuredActivityNode.gif";

The path to the directory "/icons/ vanished. It is now a default, which can also be configured using guice. BTW, another very nice feature of the new milestone release is the new template mechanism. Read about it in the documentation, it is really easy to use.

No comments:

Post a Comment