Aru Díaz
Aru Díaz

Reputation: 51

Apply regex in Eclipse formatter

I'm using JBoss Developer Studio 8.1.0.GA and I have a specific type of class that has a static aggreggator like method for configuring an object.
While I want any other type of method wrapped in the usual way (wrap when necessary in the formatter) I want this kind of objects to wrap using a keyword, so I was thinking that maybe there could be a way to apply rules based in regexps?

Obj obj1 = new Obj();
Obj obj2 = new Obj();
Obj obj3 = new Obj();
Obj obj4 = new Obj();

// Wrap would be the starting point for configuring this objects
// It structures some objects in a tree-like structure with different heights
// which I'd like to reflect with indentation
wrap(1, obj1).with().config().stuff()
  .wrap(2, obj2).with().other().things() // obj1 child
  .wrap(2, obj3).with().whatever()       // obj2 sibling
    .wrap(3, obj4).last().config();      // obj4 is obj3 child

While I realize this is not Java-like at all, it's what the project requires, and it would be very helpful to be able to indent those like this.

I tried to make it work with Checkstyle but it's quite obsolete and it would break upon running a build, even when using the rules that come as default to see if I made some kind of mistake.

I'm open to plug ins if I can make them work.

Upvotes: 1

Views: 67

Answers (0)

Related Questions