reformatting issue...

I use the latest rearranger and tabifier plugins and the reformat plug in. However when I use ctrl-alt-R to reformat the following class, it misaligns the method bodies that aren't just a simple return statement. However, if I use reformat from the menu, instead of using the shortcut, then it works fine. Ctrl-alt-L also gives the faulty alignment...

package ops.server.workflow;

import ops.server.dac.OpsWorkflowRoutingExt;

import java.util.Iterator;

public class OpsWorkflowResult {

private OpsWorkflowRoutingExt workflowRouting;
private OpsWorkflowStatus workflowStatus;
private Iterator it;


public OpsWorkflowResult(OpsWorkflowRoutingExt workflowRouting,
OpsWorkflowStatus workflowStatus) {
this.workflowRouting = workflowRouting;
this.workflowStatus = workflowStatus;
}


public final OpsWorkflowRoutingExt getWorkflowRouting() {
return this.workflowRouting;
}


public final OpsWorkflowStatus getWorkflowStatus() {
return this.workflowStatus;
}


public final void setNotificationEmails(Iterator it) {
this.it = it;
}


public final Iterator getNotificationEmails() {
return this.it;
}
}

4 comments
Comment actions Permalink

I think it's the 'this' keyword that's causing the trouble.

0
Comment actions Permalink

also, in the following code, I would have hoped that everything after the assignment would be wrapped onto the next line, or at least that the 'new' keywords would all be aligned, but neither is happening. the lines are getting wrapped at a relatively arbitrary point. (you'll probably have to widen your browser to see the result of the reformatting)

public final static OpsWorkflowRequestTypeObj OPS_CREATE_ORDER_WORKFLOW = new OpsWorkflowRequestTypeObj(
"CREATE_ORDER", "1");
public final static OpsWorkflowRequestTypeObj OPS_CREATE_INVOICE_WORKFLOW = new OpsWorkflowRequestTypeObj(
"CREATE_INVOICE", "2");
public final static OpsWorkflowRequestTypeObj OPS_APPROVE_ORDER_WORKFLOW = new OpsWorkflowRequestTypeObj(
"APPROVE_ORDER", "3");
public final static OpsWorkflowRequestTypeObj OPS_APPROVE_INVOICE_WORKFLOW = new OpsWorkflowRequestTypeObj(
"APPROVE_INVOICE", "4");
public final static OpsWorkflowRequestTypeObj OPS_REJECT_ORDER_WORKFLOW = new OpsWorkflowRequestTypeObj(
"REJECT_ORDER", "5");
public final static OpsWorkflowRequestTypeObj OPS_REJECT_INVOICE_WORKFLOW = new OpsWorkflowRequestTypeObj(
"REJECT_INVOICE", "6");
public final static OpsWorkflowRequestTypeObj OPS_ENDORSE_ORDER_WORKFLOW = new OpsWorkflowRequestTypeObj(
"ENDORSE_ORDER", "7");
public final static OpsWorkflowRequestTypeObj OPS_ENDORSE_INVOICE_WORKFLOW = new OpsWorkflowRequestTypeObj(
"ENDORSE_INVOICE", "8");
public final static OpsWorkflowRequestTypeObj OPS_SYSTEM_ENDORSE_ORDER_WORKFLOW = new OpsWorkflowRequestTypeObj(
"SYSTEM_ENDORSE_ORDER", "9");
public final static OpsWorkflowRequestTypeObj OPS_SYSTEM_ENDORSE_INVOICE_WORKFLOW = new OpsWorkflowRequestTypeObj(
"SYSTEM_ENDORSE_INVOICE", "10");

0
Comment actions Permalink

There's a difference between using Ctrl-Alt-L and invoking Reformat Code from the Tools menu when you have the Reformat plugin installed. Ctrl-Alt-L and Ctrl-Alt-R are intercepted by the Reformat plugin and cause a chain of plugins to run: reformat, then whatever is chained to it (tabifier & rearranger, in arbitrary order it appears).
But the Tools...Reformat Code menu item only runs IDEA's code reformatter.

Try running Tools...Reformat Code, then Edit...Rearranger and Edit...Tabifier (all from the menu). If the results are what you expect, I would guess that Reformat plugin is affecting the output somehow.

-Dave

0
Comment actions Permalink

Joe,

I've added your code examples to my test suite for tabifier. But one thing the tabifier doesn't do (on purpose) is break up lines (i.e. inserting newline characters to make a single line multiline, or for that matter joining multiple lines into one line). I assume that the Tools...Reformat Code feature implemented by IDEA itself does that better than I could. (I'm not trying to replace that feature, just augment it.)

First thing I will try is manually moving the initializer expressions to the next line, then running tabifier on the result. I'll take responsibility to make sure that all the 'new' keywords, method names, parentheses, and parameters (and parameter commas) align if so configured.

I don't think that IDEA will break the lines the way you'd like, even with the Work In Progress features. Might just have to do it manually.

-Dave

0

Please sign in to leave a comment.