When I lay down a new control, a Text for example, I immediately tell it to span 4 columns.
- Code: Select all
{
final Text text = new Text(parent, SWT.BORDER);
final GridData gridData = new GridData();
gridData.horizontalSpan = 4;
text.setLayoutData(gridData);
}
Then, I decide I want a better name for the GridData object. Using the designer, I change the name to "gdCommandFlags".
But, oops, it has just reset my hSpan property and the code still includes the old variable reference.
- Code: Select all
{
final Text text = new Text(parent, SWT.BORDER);
final GridData gdCommandFlags = new GridData();
>>error>>gridData.horizontalSpan = 4;<<error<<
text.setLayoutData(gdCommandFlags);
}
Even after using the Designer to specify an hSpan of 4 again, the old reference still hangs around.
- Code: Select all
{
final Text text = new Text(parent, SWT.BORDER);
final GridData gdCommandFlags = new GridData();
gdCommandFlags.horizontalSpan = 4;
>>error>>gridData.horizontalSpan = 4;<<error<<
text.setLayoutData(gdCommandFlags);
}
I would expect renaming the GridData variable to perform a refactor instead of simply creating a new variable (and not even cleaning up after the old completely).
Thanks for your support.