Skip to content

Commit 011aef5

Browse files
committed
Formatting, whitespace, checkstyle
1 parent c751515 commit 011aef5

File tree

60 files changed

+2871
-2555
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+2871
-2555
lines changed

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/plugin/UISettings.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public static void createRuleMarkerIcons(Display display) {
140140

141141
ImageLoader loader = new ImageLoader();
142142

143-
PriorityDescriptorCache pdc = PriorityDescriptorCache.instance;
143+
PriorityDescriptorCache pdc = PriorityDescriptorCache.INSTANCE;
144144

145145
for (RulePriority priority : currentPriorities(true)) {
146146
Image image = pdc.descriptorFor(priority).getImage(display, MAX_MARKER_DIMENSION);

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/actions/GenerateReportAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ private void registerRenderers(RenderReportsCmd cmd) {
3737

3838
ReportManager.loadReportProperties();
3939

40-
for (Renderer renderer : ReportManager.instance.activeRenderers()) {
40+
for (Renderer renderer : ReportManager.INSTANCE.activeRenderers()) {
4141
cmd.registerRenderer(renderer, DEFAULT_REPORT_NAME + "." + renderer.defaultFileExtension());
4242
}
4343
}
4444

4545
private boolean checkRenderers() {
4646

47-
List<Renderer> renderers = ReportManager.instance.activeRenderers();
47+
List<Renderer> renderers = ReportManager.INSTANCE.activeRenderers();
4848

4949
if (renderers.isEmpty()) {
5050
PMDPlugin.getDefault().showUserError("No report renderers selected");

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -201,8 +201,8 @@ public void widgetSelected(SelectionEvent se) {
201201

202202
private void useCustomPriorityNames(boolean flag) {
203203

204-
priorityTableMgr.visible(PriorityColumnUI.name, flag);
205-
priorityTableMgr.visible(PriorityColumnUI.pmdName, !flag);
204+
priorityTableMgr.visible(PriorityColumnUI.NAME, flag);
205+
priorityTableMgr.visible(PriorityColumnUI.PMD_NAME, !flag);
206206

207207
UISettings.useCustomPriorityLabels(flag);
208208
for (Control field : nameFields) {
@@ -242,11 +242,11 @@ public Object[] getElements(Object inputElement) {
242242
return (RulePriority[]) inputElement;
243243
}
244244
};
245-
BasicTableLabelProvider labelProvider = new BasicTableLabelProvider(PriorityColumnUI.VisibleColumns);
245+
BasicTableLabelProvider labelProvider = new BasicTableLabelProvider(PriorityColumnUI.VISIBLE_COLUMNS);
246246

247-
priorityTableMgr = new BasicTableManager("prio", null, PriorityColumnUI.VisibleColumns);
247+
priorityTableMgr = new BasicTableManager("prio", null, PriorityColumnUI.VISIBLE_COLUMNS);
248248
tableViewer = priorityTableMgr.buildTableViewer(group);
249-
priorityTableMgr.setupColumns(PriorityColumnUI.VisibleColumns);
249+
priorityTableMgr.setupColumns(PriorityColumnUI.VISIBLE_COLUMNS);
250250

251251
Table table = tableViewer.getTable();
252252
table.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, true, 2, 1));
@@ -369,7 +369,7 @@ private PriorityDescriptor[] selectedDescriptors() {
369369
Object[] items = ((IStructuredSelection) tableViewer.getSelection()).toArray();
370370
PriorityDescriptor[] descs = new PriorityDescriptor[items.length];
371371
for (int i = 0; i < descs.length; i++) {
372-
descs[i] = PriorityDescriptorCache.instance.descriptorFor((RulePriority) items[i]);
372+
descs[i] = PriorityDescriptorCache.INSTANCE.descriptorFor((RulePriority) items[i]);
373373
}
374374
return descs;
375375
}
@@ -384,7 +384,7 @@ private static void selectedPriorities(List<RulePriority> items, ShapePicker<Sha
384384
}
385385

386386
RulePriority priority = items.get(0);
387-
PriorityDescriptor desc = PriorityDescriptorCache.instance.descriptorFor(priority);
387+
PriorityDescriptor desc = PriorityDescriptorCache.INSTANCE.descriptorFor(priority);
388388

389389
ssc.setSelection(desc.shape.shape);
390390
nameField.setText(desc.label);
@@ -761,15 +761,15 @@ protected void browseLogFile() {
761761

762762
private void updateMarkerIcons() {
763763

764-
if (!PriorityDescriptorCache.instance.hasChanges()) {
764+
if (!PriorityDescriptorCache.INSTANCE.hasChanges()) {
765765
return;
766766
}
767767

768768
// TODO show in UI...could take a while to update
769769

770770
System.out.println("updating icons");
771771

772-
PriorityDescriptorCache.instance.storeInPreferences();
772+
PriorityDescriptorCache.INSTANCE.storeInPreferences();
773773
UISettings.createRuleMarkerIcons(getShell().getDisplay());
774774
UISettings.reloadPriorities();
775775

@@ -786,7 +786,7 @@ private void updateMarkerIcons() {
786786

787787
public boolean performCancel() {
788788
// clear out any changes for next possible usage
789-
PriorityDescriptorCache.instance.loadFromPreferences();
789+
PriorityDescriptorCache.INSTANCE.loadFromPreferences();
790790
return true;
791791
}
792792

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public RulePriority valueFor(IMarker marker) {
4242

4343
public Image imageFor(IMarker marker) {
4444
RulePriority rp = PRIORITY_ACC.valueFor(marker);
45-
return PriorityDescriptorCache.instance.descriptorFor(rp).getImage(display);
45+
return PriorityDescriptorCache.INSTANCE.descriptorFor(rp).getImage(display);
4646
}
4747
};
4848

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/preferences/panelmanagers/AbstractRulePanelManager.java

Lines changed: 20 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import java.util.Collections;
55
import java.util.List;
66

7+
import org.apache.commons.lang3.StringUtils;
78
import org.eclipse.jface.wizard.WizardPage;
89
import org.eclipse.swt.SWT;
910
import org.eclipse.swt.custom.CCombo;
@@ -51,10 +52,9 @@ public abstract class AbstractRulePanelManager extends WizardPage implements Rul
5152
protected static Color disabledColour;
5253
protected static Color overridenColour;
5354

54-
private static final String disabledTabText = "-------";
55+
private static final String DISABLED_TAB_TEXT = "-------";
5556

56-
public static final RGB overridenColourValues = new RGB(236, 236, 255); // light
57-
// blue
57+
public static final RGB OVERRIDDEN_COLOR_VALUES = new RGB(236, 236, 255); // light blue
5858

5959
public AbstractRulePanelManager(String theId, String theTitle, EditorUsageMode theMode,
6060
ValueChangeListener theListener) {
@@ -97,8 +97,9 @@ public boolean isActive() {
9797
}
9898

9999
protected String asCleanString(String original) {
100-
if (original == null)
100+
if (original == null) {
101101
return "";
102+
}
102103
return original.trim();
103104
}
104105

@@ -110,8 +111,9 @@ public void manage(RuleSelection theRules) {
110111
|| (rules.hasMultipleRules() && canManageMultipleRules());
111112

112113
showControls(isActive);
113-
if (tab != null)
114-
tab.setText(isActive ? tabText : disabledTabText);
114+
if (tab != null) {
115+
tab.setText(isActive ? tabText : DISABLED_TAB_TEXT);
116+
}
115117

116118
if (isActive) {
117119
adapt();
@@ -130,8 +132,9 @@ protected void valueChanged(PropertyDescriptor<?> optionalDesc, Object newValue)
130132
protected void updateUI() {
131133
List<String> warnings = fieldWarnings();
132134
List<String> errors = fieldErrors();
133-
if (tab != null)
135+
if (tab != null) {
134136
updateTabUI(warnings, errors);
137+
}
135138
updateOverridenFields();
136139
disableIrrelevantFields();
137140
}
@@ -183,8 +186,9 @@ protected void updateTabUI(List<String> warnings, List<String> errors) {
183186
}
184187

185188
boolean hasIssues = updateTab(errors, PMDUiConstants.ICON_ERROR);
186-
if (hasIssues)
189+
if (hasIssues) {
187190
return;
191+
}
188192

189193
updateTab(fieldWarnings(), PMDUiConstants.ICON_WARN);
190194
}
@@ -236,8 +240,9 @@ public void loadValues() {
236240

237241
protected void initializeOn(Composite parent) {
238242

239-
if (errorColour != null)
243+
if (errorColour != null) {
240244
return;
245+
}
241246

242247
ColourManager clrMgr = ColourManager.managerFor(parent.getDisplay());
243248
errorColour = clrMgr.colourFor(new RGB(255, 0, 0)); // red
@@ -258,14 +263,16 @@ protected void initializeOn(Composite parent) {
258263
*/
259264
protected void changed(StringProperty property, String newValue) {
260265

261-
if (rules == null)
266+
if (rules == null) {
262267
return;
268+
}
263269

264270
String cleanValue = newValue.trim();
265271
String existingValue = rules.commonStringValue(property);
266272

267-
if (StringUtil.areSemanticEquals(existingValue, cleanValue))
273+
if (StringUtil.areSemanticEquals(existingValue, cleanValue)) {
268274
return;
275+
}
269276

270277
rules.setValue(property, cleanValue);
271278
valueChanged(property, newValue);
@@ -310,7 +317,7 @@ protected void show(Combo control, String value) {
310317

311318
// control.setEnabled(usageMode == EditorUsageMode.CreateNew);
312319

313-
if (StringUtil.isEmpty(value)) {
320+
if (StringUtils.isBlank(value)) {
314321
control.deselectAll();
315322
return;
316323
}
@@ -336,7 +343,7 @@ protected void show(CCombo control, String value) {
336343

337344
// control.setEnabled(usageMode == EditorUsageMode.CreateNew);
338345

339-
if (StringUtil.isEmpty(value)) {
346+
if (StringUtils.isBlank(value)) {
340347
control.deselectAll();
341348
return;
342349
}
Lines changed: 14 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
package net.sourceforge.pmd.eclipse.ui.preferences.panelmanagers;
23

34
import java.util.Map;
@@ -7,30 +8,27 @@
78
import net.sourceforge.pmd.lang.rule.stat.StatisticalRule;
89
import net.sourceforge.pmd.properties.PropertyDescriptor;
910
import net.sourceforge.pmd.properties.PropertySource;
11+
1012
/**
1113
*
1214
* @author Brian Remedios
1315
*/
1416
public class Configuration {
17+
private Configuration() { }
1518

16-
// properties that should not be shown in the PerRuleProperty page
17-
public static final PropertyDescriptor<?>[] excludedRuleProperties = new PropertyDescriptor<?>[] {
18-
Rule.VIOLATION_SUPPRESS_REGEX_DESCRIPTOR,
19-
Rule.VIOLATION_SUPPRESS_XPATH_DESCRIPTOR,
20-
XPathRule.XPATH_DESCRIPTOR,
21-
XPathRule.VERSION_DESCRIPTOR,
22-
StatisticalRule.SIGMA_DESCRIPTOR,
23-
StatisticalRule.TOP_SCORE_DESCRIPTOR
24-
};
19+
// properties that should not be shown in the PerRuleProperty page
20+
public static final PropertyDescriptor<?>[] EXCLUDED_RULE_PROPERTIES = new PropertyDescriptor<?>[] {
21+
Rule.VIOLATION_SUPPRESS_REGEX_DESCRIPTOR, Rule.VIOLATION_SUPPRESS_XPATH_DESCRIPTOR, XPathRule.XPATH_DESCRIPTOR,
22+
XPathRule.VERSION_DESCRIPTOR, StatisticalRule.SIGMA_DESCRIPTOR, StatisticalRule.TOP_SCORE_DESCRIPTOR };
2523

26-
public static Map<PropertyDescriptor<?>, Object> filteredPropertiesOf(PropertySource source) {
24+
public static Map<PropertyDescriptor<?>, Object> filteredPropertiesOf(PropertySource source) {
2725

28-
Map<PropertyDescriptor<?>, Object> valuesByProp = source.getPropertiesByPropertyDescriptor();
26+
Map<PropertyDescriptor<?>, Object> valuesByProp = source.getPropertiesByPropertyDescriptor();
2927

30-
for (PropertyDescriptor<?> excludedRuleProperty : excludedRuleProperties) {
31-
valuesByProp.remove(excludedRuleProperty);
32-
}
28+
for (PropertyDescriptor<?> excludedRuleProperty : EXCLUDED_RULE_PROPERTIES) {
29+
valuesByProp.remove(excludedRuleProperty);
30+
}
3331

34-
return valuesByProp;
35-
}
32+
return valuesByProp;
33+
}
3634
}

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/preferences/panelmanagers/CreateRuleWizard.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11

22
package net.sourceforge.pmd.eclipse.ui.preferences.panelmanagers;
33

4+
import org.apache.commons.lang3.StringUtils;
45
import org.eclipse.jface.wizard.IWizardPage;
56
import org.eclipse.jface.wizard.Wizard;
67
import org.eclipse.jface.wizard.WizardDialog;
@@ -11,7 +12,6 @@
1112
import net.sourceforge.pmd.eclipse.ui.preferences.br.ValueChangeListener;
1213
import net.sourceforge.pmd.properties.PropertyDescriptor;
1314
import net.sourceforge.pmd.properties.PropertySource;
14-
import net.sourceforge.pmd.util.StringUtil;
1515

1616
/**
1717
* A wizard that encapsulates a succession of rule panel managers to collect the
@@ -83,8 +83,9 @@ public IWizardPage getNextPage(IWizardPage currentPage) {
8383
return getAndPrepare(DescriptionPanelManager.ID);
8484
}
8585
if (currentPage instanceof DescriptionPanelManager) {
86-
if (StringUtil.isEmpty(rule.getDescription()))
86+
if (StringUtils.isBlank(rule.getDescription())) {
8787
return null;
88+
}
8889
return getAndPrepare(PerRulePropertyPanelManager.ID);
8990
}
9091
if (currentPage instanceof PerRulePropertyPanelManager) {

0 commit comments

Comments
 (0)