Skip to content

Commit d34da50

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

File tree

55 files changed

+1277
-1058
lines changed

Some content is hidden

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

55 files changed

+1277
-1058
lines changed

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/filters/FilterColumnUI.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,20 @@ public Image imageFor(FilterHolder holder) {
2121
}
2222
};
2323

24-
ItemFieldAccessor<String, FilterHolder> PMD_ACCESSOR = new ItemFieldAccessorAdapter<String, FilterHolder>(Util.compStr) {
24+
ItemFieldAccessor<String, FilterHolder> PMD_ACCESSOR = new ItemFieldAccessorAdapter<String, FilterHolder>(Util.COMP_STR) {
2525
public String valueFor(FilterHolder holder) {
2626
return holder.forPMD ? "Y" : "";
2727
}
2828
};
2929

30-
ItemFieldAccessor<String, FilterHolder> CPD_ACCESSOR = new ItemFieldAccessorAdapter<String, FilterHolder>(Util.compStr) {
30+
ItemFieldAccessor<String, FilterHolder> CPD_ACCESSOR = new ItemFieldAccessorAdapter<String, FilterHolder>(Util.COMP_STR) {
3131
public String valueFor(FilterHolder holder) {
3232
return holder.forCPD ? "Y" : "";
3333
}
3434
};
3535

3636
ItemFieldAccessor<String, FilterHolder> PATTERN_ACCESSOR = new ItemFieldAccessorAdapter<String, FilterHolder>(
37-
Util.compStr) {
37+
Util.COMP_STR) {
3838
public String valueFor(FilterHolder holder) {
3939
return holder.pattern;
4040
}

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,31 +46,31 @@ public Image imageFor(IMarker marker) {
4646
}
4747
};
4848

49-
ItemFieldAccessor<Integer, IMarker> LINE_NO_ACC = new ItemFieldAccessorAdapter<Integer, IMarker>(Util.compInt) {
49+
ItemFieldAccessor<Integer, IMarker> LINE_NO_ACC = new ItemFieldAccessorAdapter<Integer, IMarker>(Util.COMP_INT) {
5050
public Integer valueFor(IMarker marker) {
5151
return (Integer) marker.getAttribute(IMarker.LINE_NUMBER, 0);
5252
}
5353
};
5454

55-
ItemFieldAccessor<Long, IMarker> CREATED_ACC = new ItemFieldAccessorAdapter<Long, IMarker>(Util.compLong) {
55+
ItemFieldAccessor<Long, IMarker> CREATED_ACC = new ItemFieldAccessorAdapter<Long, IMarker>(Util.COMP_LONG) {
5656
public Long valueFor(IMarker marker) {
5757
return MarkerUtil.createdOn(marker, -1);
5858
}
5959
};
6060

61-
ItemFieldAccessor<Boolean, IMarker> DONE_ACC = new ItemFieldAccessorAdapter<Boolean, IMarker>(Util.compBool) {
61+
ItemFieldAccessor<Boolean, IMarker> DONE_ACC = new ItemFieldAccessorAdapter<Boolean, IMarker>(Util.COMP_BOOL) {
6262
public Boolean valueFor(IMarker marker) {
6363
return MarkerUtil.doneState(marker, false);
6464
}
6565
};
6666

67-
ItemFieldAccessor<String, IMarker> RULE_NAME_ACC = new ItemFieldAccessorAdapter<String, IMarker>(Util.compStr) {
67+
ItemFieldAccessor<String, IMarker> RULE_NAME_ACC = new ItemFieldAccessorAdapter<String, IMarker>(Util.COMP_STR) {
6868
public String valueFor(IMarker marker) {
6969
return MarkerUtil.ruleNameFor(marker);
7070
}
7171
};
7272

73-
ItemFieldAccessor<String, IMarker> MESSAGE_ACC = new ItemFieldAccessorAdapter<String, IMarker>(Util.compStr) {
73+
ItemFieldAccessor<String, IMarker> MESSAGE_ACC = new ItemFieldAccessorAdapter<String, IMarker>(Util.COMP_STR) {
7474
public String valueFor(IMarker marker) {
7575
return MarkerUtil.messageFor(marker, "??");
7676
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ private void reviseMethodListFor(Class<?> cls) {
7474

7575
methodList.setEnabled(true);
7676
methods = cls.getMethods();
77-
Arrays.sort(methods, Util.MethodNameComparator);
77+
Arrays.sort(methods, Util.METHOD_NAME_COMPARATOR);
7878
String[] items = new String[methods.length];
7979
for (int i = 0; i < methods.length; i++) {
8080
items[i] = Util.signatureFor(methods[i], unwantedPrefixes);

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/views/AbstractStructureInspectorPage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ private List<ASTMethodDeclaration> getPMDMethods() {
343343
methodList.add((ASTMethodDeclaration) m);
344344
}
345345
}
346-
Collections.sort(methodList, ASTUtil.MethodComparator);
346+
Collections.sort(methodList, ASTUtil.METHOD_COMPARATOR);
347347
} catch (PMDException pmde) {
348348
logError(StringKeys.ERROR_PMD_EXCEPTION + toString(), pmde);
349349
}

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

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11

22
package net.sourceforge.pmd.eclipse.ui.views.actions;
33

4+
import org.eclipse.jface.action.Action;
5+
46
import net.sourceforge.pmd.eclipse.plugin.PMDPlugin;
57
import net.sourceforge.pmd.eclipse.runtime.preferences.IPreferences;
68
import net.sourceforge.pmd.eclipse.ui.nls.StringTable;
79

8-
import org.eclipse.jface.action.Action;
9-
1010
/**
1111
*
1212
* @author Brian Remedios
@@ -37,12 +37,14 @@ public static String getString(String messageId) {
3737
protected void setupWidget() {
3838

3939
String imageId = imageId();
40-
if (imageId != null)
40+
if (imageId != null) {
4141
setImageDescriptor(PMDPlugin.getImageDescriptor(imageId));
42+
}
4243

4344
String toolTipMsgId = tooltipMsgId();
44-
if (toolTipMsgId != null)
45+
if (toolTipMsgId != null) {
4546
setToolTipText(getString(toolTipMsgId));
47+
}
4648
}
4749

4850
protected static IPreferences loadPreferences() {

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

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@
55
import java.util.Iterator;
66
import java.util.List;
77

8-
import net.sourceforge.pmd.Rule;
9-
import net.sourceforge.pmd.eclipse.runtime.builder.MarkerUtil;
10-
118
import org.eclipse.core.resources.IMarker;
129
import org.eclipse.jface.viewers.ISelection;
1310
import org.eclipse.jface.viewers.IStructuredSelection;
1411
import org.eclipse.jface.viewers.TableViewer;
1512

13+
import net.sourceforge.pmd.Rule;
14+
import net.sourceforge.pmd.eclipse.runtime.builder.MarkerUtil;
15+
1616
/**
1717
* Base Class for Actions that need to know, which Markers are selected
1818
*
@@ -44,8 +44,9 @@ protected void setupWidget() {
4444
super.setupWidget();
4545

4646
String textId = textId();
47-
if (textId != null)
47+
if (textId != null) {
4848
setText(getString(textId));
49+
}
4950
}
5051

5152
protected boolean hasSelections() {
@@ -54,8 +55,9 @@ protected boolean hasSelections() {
5455

5556
protected List<Rule> getSelectedViolationRules() {
5657

57-
if (!hasSelections())
58+
if (!hasSelections()) {
5859
return Collections.emptyList();
60+
}
5961

6062
IMarker[] markers = getSelectedViolations();
6163
return MarkerUtil.rulesFor(markers);

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

Lines changed: 31 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,44 @@
1+
12
package net.sourceforge.pmd.eclipse.ui.views.actions;
23

34
import java.lang.reflect.InvocationTargetException;
45

5-
import net.sourceforge.pmd.eclipse.ui.PMDUiConstants;
6-
import net.sourceforge.pmd.eclipse.ui.model.AbstractPMDRecord;
7-
import net.sourceforge.pmd.eclipse.ui.model.FileRecord;
8-
import net.sourceforge.pmd.eclipse.ui.model.PackageRecord;
9-
import net.sourceforge.pmd.eclipse.ui.nls.StringKeys;
10-
import net.sourceforge.pmd.eclipse.ui.views.ViolationOverview;
11-
126
import org.eclipse.core.runtime.IProgressMonitor;
137
import org.eclipse.jface.dialogs.ProgressMonitorDialog;
148
import org.eclipse.jface.operation.IRunnableWithProgress;
159
import org.eclipse.jface.viewers.TreeViewer;
1610
import org.eclipse.swt.widgets.Display;
1711
import org.eclipse.swt.widgets.TreeItem;
1812

13+
import net.sourceforge.pmd.eclipse.ui.PMDUiConstants;
14+
import net.sourceforge.pmd.eclipse.ui.model.AbstractPMDRecord;
15+
import net.sourceforge.pmd.eclipse.ui.model.FileRecord;
16+
import net.sourceforge.pmd.eclipse.ui.model.PackageRecord;
17+
import net.sourceforge.pmd.eclipse.ui.nls.StringKeys;
18+
import net.sourceforge.pmd.eclipse.ui.views.ViolationOverview;
19+
1920
public class CalculateStatisticsAction extends AbstractPMDAction {
20-
21+
2122
public final ViolationOverview violationView;
22-
23+
2324
public CalculateStatisticsAction(ViolationOverview view) {
2425
super();
25-
26+
2627
violationView = view;
2728
}
28-
29-
protected String imageId() { return PMDUiConstants.ICON_BUTTON_CALCULATE; }
30-
31-
protected String tooltipMsgId() { return StringKeys.VIEW_TOOLTIP_CALCULATE_STATS; }
32-
29+
30+
protected String imageId() {
31+
return PMDUiConstants.ICON_BUTTON_CALCULATE;
32+
}
33+
34+
protected String tooltipMsgId() {
35+
return StringKeys.VIEW_TOOLTIP_CALCULATE_STATS;
36+
}
37+
3338
private TreeViewer getViewer() {
34-
return violationView.getViewer();
39+
return violationView.getViewer();
3540
}
36-
41+
3742
/**
3843
* Executes the Action
3944
*/
@@ -54,29 +59,30 @@ public void run(IProgressMonitor monitor) throws InvocationTargetException, Inte
5459
if (item.getData() instanceof PackageRecord) {
5560
final PackageRecord record = (PackageRecord) item.getData();
5661
final AbstractPMDRecord[] children = record.getChildren();
57-
monitor.subTask(getString(StringKeys.MONITOR_CALC_STATS_OF_PACKAGE) + ": " + record.getName());
62+
monitor.subTask(
63+
getString(StringKeys.MONITOR_CALC_STATS_OF_PACKAGE) + ": " + record.getName());
5864
for (AbstractPMDRecord kid : children) {
5965
if (kid instanceof FileRecord) {
60-
calculateFileRecord((FileRecord)kid);
66+
calculateFileRecord((FileRecord) kid);
6167
monitor.worked(1);
6268
}
6369
}
6470
} else if (item.getData() instanceof FileRecord) {
6571
calculateFileRecord((FileRecord) item.getData());
66-
monitor.worked(1);
72+
monitor.worked(1);
6773
}
6874
}
69-
75+
7076
getViewer().refresh(true);
7177
}
7278
});
7379
} catch (InvocationTargetException e) {
7480
logErrorByKey(StringKeys.ERROR_INVOCATIONTARGET_EXCEPTION, e);
7581
} catch (InterruptedException e) {
76-
logErrorByKey(StringKeys.ERROR_INTERRUPTED_EXCEPTION, e);
82+
logErrorByKey(StringKeys.ERROR_INTERRUPTED_EXCEPTION, e);
7783
}
7884
}
79-
85+
8086
private void calculateFileRecord(FileRecord fileRecord) {
8187
if (fileRecord.getLOC() == 0) {
8288
fileRecord.calculateLinesOfCode();
@@ -87,11 +93,11 @@ private void calculateFileRecord(FileRecord fileRecord) {
8793
private int calculateWorkUnits(TreeItem[] items) {
8894
int count = 0;
8995
for (TreeItem item : items) {
90-
Object data = item.getData();
96+
Object data = item.getData();
9197
if (data instanceof PackageRecord) {
9298
count += ((PackageRecord) data).getChildren().length;
9399
} else if (data instanceof FileRecord) {
94-
count++;
100+
count++;
95101
}
96102
}
97103
return count;

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@
3636

3737
package net.sourceforge.pmd.eclipse.ui.views.actions;
3838

39+
import org.eclipse.jface.viewers.TreeViewer;
40+
3941
import net.sourceforge.pmd.eclipse.ui.PMDUiConstants;
4042
import net.sourceforge.pmd.eclipse.ui.nls.StringKeys;
4143

42-
import org.eclipse.jface.viewers.TreeViewer;
43-
4444
/**
4545
* Collapses the Violation Overview Tree
4646
*

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

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,6 @@
55
import java.util.List;
66
import java.util.Set;
77

8-
import net.sourceforge.pmd.Rule;
9-
import net.sourceforge.pmd.eclipse.plugin.PMDPlugin;
10-
import net.sourceforge.pmd.eclipse.runtime.builder.MarkerUtil;
11-
import net.sourceforge.pmd.eclipse.runtime.preferences.IPreferences;
12-
import net.sourceforge.pmd.eclipse.ui.PMDUiConstants;
13-
import net.sourceforge.pmd.eclipse.ui.nls.StringKeys;
14-
158
import org.eclipse.core.resources.IMarker;
169
import org.eclipse.core.resources.IProject;
1710
import org.eclipse.core.resources.IWorkspace;
@@ -21,6 +14,13 @@
2114
import org.eclipse.core.runtime.IProgressMonitor;
2215
import org.eclipse.jface.viewers.TableViewer;
2316

17+
import net.sourceforge.pmd.Rule;
18+
import net.sourceforge.pmd.eclipse.plugin.PMDPlugin;
19+
import net.sourceforge.pmd.eclipse.runtime.builder.MarkerUtil;
20+
import net.sourceforge.pmd.eclipse.runtime.preferences.IPreferences;
21+
import net.sourceforge.pmd.eclipse.ui.PMDUiConstants;
22+
import net.sourceforge.pmd.eclipse.ui.nls.StringKeys;
23+
2424
public class DisableRuleAction extends AbstractViolationSelectionAction {
2525

2626
private final IPreferences preferences = PMDPlugin.getDefault().loadPreferences();
@@ -65,13 +65,15 @@ protected String tooltipMsgId() {
6565
public boolean hasActiveRules() {
6666

6767
final IMarker[] markers = getSelectedViolations();
68-
if (markers == null)
68+
if (markers == null) {
6969
return false;
70+
}
7071

7172
List<Rule> rules = MarkerUtil.rulesFor(markers);
7273
for (Rule rule : rules) {
73-
if (preferences.isActive(rule.getName()))
74+
if (preferences.isActive(rule.getName())) {
7475
return true;
76+
}
7577
}
7678

7779
return false;
@@ -83,8 +85,9 @@ public boolean hasActiveRules() {
8385
public void run() {
8486

8587
final IMarker[] markers = getSelectedViolations();
86-
if (markers == null)
88+
if (markers == null) {
8789
return;
90+
}
8891

8992
runWith(markers, preferences, true);
9093
}
@@ -98,8 +101,9 @@ public static void runWith(final IMarker[] markers, final IPreferences preferenc
98101
public void run(IProgressMonitor monitor) throws CoreException {
99102
Collection<Rule> rules = MarkerUtil.rulesFor(markers);
100103
disableRulesFor(rules, preferences);
101-
if (removeViolations)
104+
if (removeViolations) {
102105
removeViolationsOf(rules, MarkerUtil.commonProjectsOf(markers));
106+
}
103107
}
104108
}, null);
105109
} catch (CoreException ce) {

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@
3636

3737
package net.sourceforge.pmd.eclipse.ui.views.actions;
3838

39+
import org.eclipse.jface.viewers.TreeViewer;
40+
3941
import net.sourceforge.pmd.eclipse.ui.PMDUiConstants;
4042
import net.sourceforge.pmd.eclipse.ui.nls.StringKeys;
4143

42-
import org.eclipse.jface.viewers.TreeViewer;
43-
4444
/**
4545
* Collapses the Violation Overview Tree
4646
*

0 commit comments

Comments
 (0)