Improving the UI

To provide a better experience to the user of the SmallJava editor and tooling, we customize the appearance of SmallJava members (fields and methods) in several places of the UI.

First of all, we give a better string representation of members by also showing their type feature; thus, the string representation of a member is its name and its type's name separated by a colon :. Moreover, for methods, we also show the type of each parameter. We mimic the representation of Java members as implemented by Eclipse JDT. We then implement the methods for string representation in SmallJavaModelUtil:

def memberAsString(SJMember m) {
  m.name +
  if (m instanceof SJMethod)
    "(" + m.params.map[type.name].join(", ") + ")"
  else ""
}

def memberAsStringWithType(SJMember ...

Get Implementing Domain-Specific Languages with Xtext and Xtend - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.