Skip to content

Commit c751515

Browse files
committed
Formatting, whitespace, checkstyle
1 parent 5a5b929 commit c751515

26 files changed

+328
-286
lines changed

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/dialogs/NewPropertyDialog.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,7 @@ public void handleEvent(Event event) {
221221
}
222222

223223
private static String labelFor(Class<?> type) {
224-
return Util.signatureFor(type, MethodEditorFactory.UnwantedPrefixes);
224+
return Util.signatureFor(type, MethodEditorFactory.UNWANTED_PREFIXES);
225225
}
226226

227227
/**

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/preferences/br/ValueFormatter.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public void format(Object value, StringBuilder target) {
6868
if (value == null) {
6969
return;
7070
}
71-
target.append(Util.signatureFor((Method) value, MethodEditorFactory.UnwantedPrefixes));
71+
target.append(Util.signatureFor((Method) value, MethodEditorFactory.UNWANTED_PREFIXES));
7272
}
7373
};
7474

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/preferences/editors/AbstractEditorFactory.java

Lines changed: 57 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
package net.sourceforge.pmd.eclipse.ui.preferences.editors;
23

34
import org.eclipse.swt.SWT;
@@ -19,64 +20,58 @@
1920
public abstract class AbstractEditorFactory<T> implements EditorFactory<T> {
2021

2122
protected static ColourManager colourManager;
22-
// protected static Color overriddenColour;
23-
24-
25-
protected AbstractEditorFactory() { }
23+
// protected static Color overriddenColour;
2624

27-
// private static ColourManager colourManager() {
28-
//
29-
// if (colourManager != null) return colourManager;
30-
// colourManager = ColourManager.managerFor(Display.getCurrent());
31-
// return colourManager;
32-
// }
33-
34-
// private Color overriddenColour() {
35-
//
36-
// if (overriddenColour != null) return overriddenColour;
37-
//
38-
// overriddenColour = colourManager().colourFor(AbstractRulePanelManager.overridenColourValues);
39-
// return overriddenColour;
40-
// }
25+
protected AbstractEditorFactory() {
26+
}
4127

28+
// private static ColourManager colourManager() {
29+
//
30+
// if (colourManager != null) return colourManager;
31+
// colourManager = ColourManager.managerFor(Display.getCurrent());
32+
// return colourManager;
33+
// }
34+
35+
// private Color overriddenColour() {
36+
//
37+
// if (overriddenColour != null) return overriddenColour;
38+
//
39+
// overriddenColour =
40+
// colourManager().colourFor(AbstractRulePanelManager.overridenColourValues);
41+
// return overriddenColour;
42+
// }
4243

4344
/**
44-
* Generic control that provides a label/widget pair for the default value. Subclasses can override this to provide
45-
* additional labels & widgets as necessary but must be able to extract the values held by them when the property is
46-
* created.
45+
* Generic control that provides a label/widget pair for the default value.
46+
* Subclasses can override this to provide additional labels & widgets as
47+
* necessary but must be able to extract the values held by them when the
48+
* property is created.
4749
*/
4850
public Control[] createOtherControlsOn(Composite parent, PropertyDescriptor<T> desc, PropertySource source,
49-
ValueChangeListener listener, SizeChangeListener sizeListener) {
50-
return new Control[] {
51-
newLabel(parent, "Default"),
52-
newEditorOn(parent, desc, source, listener, sizeListener)
53-
};
51+
ValueChangeListener listener, SizeChangeListener sizeListener) {
52+
return new Control[] { newLabel(parent, "Default"), newEditorOn(parent, desc, source, listener, sizeListener) };
5453
}
5554

56-
5755
protected Label newLabel(Composite parent, String text) {
5856
Label label = new Label(parent, SWT.None);
5957
label.setText(text);
6058
return label;
6159
}
6260

63-
6461
protected abstract T valueFrom(Control valueControl);
6562

66-
6763
protected T valueFor(PropertySource source, PropertyDescriptor<T> desc) {
6864

69-
return source.hasDescriptor(desc) ?
70-
source.getProperty(desc) :
71-
desc.defaultValue();
65+
return source.hasDescriptor(desc) ? source.getProperty(desc) : desc.defaultValue();
7266
}
7367

74-
7568
/**
7669
* Method addLabel.
7770
*
78-
* @param parent Composite
79-
* @param desc PropertyDescriptor
71+
* @param parent
72+
* Composite
73+
* @param desc
74+
* PropertyDescriptor
8075
*
8176
* @return Label
8277
*/
@@ -86,46 +81,50 @@ public Label addLabel(Composite parent, PropertyDescriptor<T> desc) {
8681
label.setText(desc.description());
8782
GridData data = new GridData();
8883
data.horizontalAlignment = SWT.LEFT;
89-
data.verticalAlignment = SWT.CENTER; // CENTER is preferred only when showing a single row value widget...hmm
84+
// CENTER is preferred only when showing a single row value widget...hmm
85+
data.verticalAlignment = SWT.CENTER;
9086
label.setLayoutData(data);
9187
return label;
9288
}
9389

94-
9590
/**
96-
* Adjust the display of the control to denote whether it holds
97-
* onto the default value or not.
91+
* Adjust the display of the control to denote whether it holds onto the
92+
* default value or not.
9893
*
9994
* @param control
10095
* @param hasDefaultValue
10196
*/
102-
// protected void adjustRendering(Control control, boolean hasDefaultValue) {
103-
//
104-
// Display display = control.getDisplay();
105-
//
106-
// control.setBackground(
107-
// display.getSystemColor(hasDefaultValue ? SWT.COLOR_WHITE : SWT.COLOR_CYAN)
108-
// );
109-
// }
97+
// protected void adjustRendering(Control control, boolean hasDefaultValue)
98+
// {
99+
//
100+
// Display display = control.getDisplay();
101+
//
102+
// control.setBackground(
103+
// display.getSystemColor(hasDefaultValue ? SWT.COLOR_WHITE :
104+
// SWT.COLOR_CYAN)
105+
// );
106+
// }
110107
protected void adjustRendering(PropertySource source, PropertyDescriptor<?> desc, Control control) {
111108

112-
return; // don't do it...kinda irritating
113-
114-
// if (!(rule instanceof RuleReference)) return;
115-
//
116-
// boolean isOverridden = ((RuleReference)rule).hasOverriddenProperty(desc);
117-
// Display display = control.getDisplay();
118-
// Color clr = isOverridden ? overriddenColour() : display.getSystemColor(SWT.COLOR_WHITE);
119-
//
120-
// control.setBackground(clr);
109+
return; // don't do it...kinda irritating
110+
111+
// if (!(rule instanceof RuleReference)) return;
112+
//
113+
// boolean isOverridden =
114+
// ((RuleReference)rule).hasOverriddenProperty(desc);
115+
// Display display = control.getDisplay();
116+
// Color clr = isOverridden ? overriddenColour() :
117+
// display.getSystemColor(SWT.COLOR_WHITE);
118+
//
119+
// control.setBackground(clr);
121120
}
122121

123-
124122
/**
125123
* Return the value as a string that can be easily recognized and parsed
126124
* when we see it again.
127125
*
128-
* @param value Object
126+
* @param value
127+
* Object
129128
*
130129
* @return String
131130
*/

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/preferences/editors/AbstractMultiValueEditorFactory.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,9 @@
4747
*/
4848
public abstract class AbstractMultiValueEditorFactory<T> extends AbstractEditorFactory<List<T>> {
4949

50-
protected static final String delimiter = ",";
50+
protected static final String DELIMITER = ",";
5151

52-
private static final int WidgetsPerRow = 3; // numberLabel, valueWidget, +/-button
52+
private static final int WIDGETS_PER_ROW = 3; // numberLabel, valueWidget, +/-button
5353

5454

5555
protected AbstractMultiValueEditorFactory() {
@@ -92,10 +92,10 @@ public Control newEditorOn(final Composite parent, final PropertyDescriptor<List
9292
public void handleEvent(Event event) {
9393
if (itemsVisible) {
9494
hideCollection(items);
95-
sizeListener.addedRows(items.size() / -WidgetsPerRow);
95+
sizeListener.addedRows(items.size() / -WIDGETS_PER_ROW);
9696
} else {
9797
items = openCollection(panel, desc, source, textWidget, changeListener, sizeListener);
98-
sizeListener.addedRows(items.size() / WidgetsPerRow);
98+
sizeListener.addedRows(items.size() / WIDGETS_PER_ROW);
9999
}
100100
itemsVisible = !itemsVisible;
101101
textWidget.setEditable(!itemsVisible); // no raw editing when individual items are available
@@ -265,7 +265,7 @@ public void handleEvent(Event event) {
265265
protected void fillWidget(Text textWidget, PropertyDescriptor<List<T>> desc, PropertySource source) {
266266

267267
List<T> values = valueFor(source, desc);
268-
textWidget.setText(values == null ? "" : StringUtil.asString(values.toArray(), delimiter + ' '));
268+
textWidget.setText(values == null ? "" : StringUtil.asString(values.toArray(), DELIMITER + ' '));
269269
adjustRendering(source, desc, textWidget);
270270
}
271271

@@ -278,7 +278,7 @@ protected List<String> textWidgetValues(Text textWidget) {
278278
return Collections.emptyList();
279279
}
280280

281-
String[] valueSet = values.split(delimiter);
281+
String[] valueSet = values.split(DELIMITER);
282282
List<String> valueList = new ArrayList<String>(valueSet.length);
283283

284284
for (String value : valueSet) {

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/preferences/editors/AbstractNumericEditorFactory.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@
1919
*/
2020
public abstract class AbstractNumericEditorFactory<T> extends AbstractEditorFactory<T> {
2121

22-
public static final int defaultMinimum = 0;
23-
public static final int defaultMaximum = 1000;
22+
public static final int DEFAULT_MINIMUM = 0;
23+
public static final int DEFAULT_MAXIMUM = 1000;
2424

2525

2626
protected AbstractNumericEditorFactory() {
@@ -43,7 +43,7 @@ public Control[] createOtherControlsOn(Composite parent, PropertyDescriptor<T> d
4343
return new Control[] {
4444
defaultLabel, valueControl,
4545
minLabel, minWidget,
46-
maxLabel, maxWidget
46+
maxLabel, maxWidget,
4747
};
4848
}
4949

@@ -117,24 +117,24 @@ private void adjustForMax(Spinner minWidget, Spinner valueWidget, Spinner maxWid
117117

118118
protected Number defaultIn(Control[] controls) {
119119

120-
return controls == null ?
121-
Integer.valueOf(defaultMinimum) :
122-
(Number) valueFrom(controls[1]);
120+
return controls == null
121+
? Integer.valueOf(DEFAULT_MINIMUM)
122+
: (Number) valueFrom(controls[1]);
123123
}
124124

125125

126126
protected Number minimumIn(Control[] controls) {
127127

128-
return controls == null ?
129-
Integer.valueOf(0) :
130-
(Number) valueFrom(controls[3]);
128+
return controls == null
129+
? Integer.valueOf(0)
130+
: (Number) valueFrom(controls[3]);
131131
}
132132

133133

134134
protected Number maximumIn(Control[] controls) {
135135

136-
return controls == null ?
137-
Integer.valueOf(defaultMaximum) :
138-
(Number) valueFrom(controls[5]);
136+
return controls == null
137+
? Integer.valueOf(DEFAULT_MAXIMUM)
138+
: (Number) valueFrom(controls[5]);
139139
}
140140
}

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/preferences/editors/AbstractRealNumberEditor.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
*/
1212
public abstract class AbstractRealNumberEditor<T extends Number> extends AbstractNumericEditorFactory<T> {
1313

14-
protected static final int digits = 3;
14+
protected static final int DIGITS = 3;
1515

16-
protected static final double scale = Math.pow(10, digits);
16+
protected static final double SCALE = Math.pow(10, DIGITS);
1717

1818

1919
protected AbstractRealNumberEditor() {
@@ -23,15 +23,15 @@ protected AbstractRealNumberEditor() {
2323
protected final Spinner newSpinnerFor(Composite parent, PropertySource source,
2424
NumericPropertyDescriptor<T> numDesc) {
2525

26-
Spinner spinner = newSpinnerFor(parent, digits);
27-
int min = (int) (numDesc.lowerLimit().doubleValue() * scale);
28-
int max = (int) (numDesc.upperLimit().doubleValue() * scale);
26+
Spinner spinner = newSpinnerFor(parent, DIGITS);
27+
int min = (int) (numDesc.lowerLimit().doubleValue() * SCALE);
28+
int max = (int) (numDesc.upperLimit().doubleValue() * SCALE);
2929
spinner.setMinimum(min);
3030
spinner.setMaximum(max);
3131

3232
Number value = valueFor(source, numDesc);
3333
if (value != null) {
34-
int intVal = (int) (value.doubleValue() * scale);
34+
int intVal = (int) (value.doubleValue() * SCALE);
3535
spinner.setSelection(intVal);
3636
}
3737

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/preferences/editors/BooleanEditorFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
public class BooleanEditorFactory extends AbstractEditorFactory<Boolean> {
2020

21-
public static final BooleanEditorFactory instance = new BooleanEditorFactory();
21+
public static final BooleanEditorFactory INSTANCE = new BooleanEditorFactory();
2222

2323

2424
private BooleanEditorFactory() { }

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/preferences/editors/CharacterEditorFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
*/
2020
public class CharacterEditorFactory extends AbstractEditorFactory<Character> {
2121

22-
public static final CharacterEditorFactory instance = new CharacterEditorFactory();
22+
public static final CharacterEditorFactory INSTANCE = new CharacterEditorFactory();
2323

2424

2525
private CharacterEditorFactory() { }

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/preferences/editors/DoubleEditorFactory.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
*/
1919
public class DoubleEditorFactory extends AbstractRealNumberEditor<Double> {
2020

21-
public static final DoubleEditorFactory instance = new DoubleEditorFactory();
21+
public static final DoubleEditorFactory INSTANCE = new DoubleEditorFactory();
2222

2323

2424
private DoubleEditorFactory() { }
@@ -39,7 +39,7 @@ public PropertyDescriptor<Double> createDescriptor(String name, String descripti
3939

4040
protected Double valueFrom(Control valueControl) {
4141

42-
return ((Spinner) valueControl).getSelection() / scale;
42+
return ((Spinner) valueControl).getSelection() / SCALE;
4343
}
4444

4545

@@ -50,7 +50,7 @@ public Control newEditorOn(Composite parent, final PropertyDescriptor<Double> de
5050

5151
spinner.addModifyListener(new ModifyListener() {
5252
public void modifyText(ModifyEvent event) {
53-
Double newValue = spinner.getSelection() / scale;
53+
Double newValue = spinner.getSelection() / SCALE;
5454
if (newValue.equals(valueFor(source, desc))) {
5555
return;
5656
}

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/preferences/editors/EnumerationEditorFactory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
*/
2222
public class EnumerationEditorFactory extends AbstractEditorFactory<Object> {
2323

24-
public static final EnumerationEditorFactory instance = new EnumerationEditorFactory();
24+
public static final EnumerationEditorFactory INSTANCE = new EnumerationEditorFactory();
2525

2626

2727
private EnumerationEditorFactory() { }

0 commit comments

Comments
 (0)