Skip to content

Commit 5a5b929

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

File tree

77 files changed

+5480
-4965
lines changed

Some content is hidden

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

77 files changed

+5480
-4965
lines changed

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/runtime/cmd/AbstractDefaultCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ protected void beginTask(String name, int totalWork) {
236236
/**
237237
* delegate method to monitor.done()
238238
*
239-
* @see org.eclipse.core.runtime.IProgressMonitor#done
239+
* @see org.eclipse.core.runtime.IProgressMonitor#DONE
240240
*/
241241
protected void done() {
242242
if (monitor != null) {

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/runtime/cmd/BuildProjectCommand.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public class BuildProjectCommand extends AbstractProjectCommand {
5454
private static final long serialVersionUID = 1L;
5555

5656
/**
57-
* @param name
57+
* @param NAME
5858
*/
5959
public BuildProjectCommand() {
6060
super("BuildProject", "Rebuild a project.");

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/runtime/cmd/DetectCutAndPasteCmd.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public void reset() {
163163
}
164164

165165
/**
166-
* @param language
166+
* @param LANGUAGE
167167
* The language to set.
168168
*/
169169
public void setLanguage(String theLanguage) {

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/runtime/preferences/impl/PreferenceUIStore.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ public class PreferenceUIStore {
3737
private static final char STRING_SEPARATOR = ',';
3838

3939
private static final RuleColumnDescriptor[] DEFAULT_HIDDEN_COLUMNS = new RuleColumnDescriptor[] {
40-
RuleTableColumns.externalURL, RuleTableColumns.minLangVers, RuleTableColumns.fixCount,
41-
RuleTableColumns.exampleCount, RuleTableColumns.maxLangVers, RuleTableColumns.since,
42-
RuleTableColumns.modCount };
40+
RuleTableColumns.EXTERNAL_URL, RuleTableColumns.MIN_LANGUAGE_VERSION, RuleTableColumns.FIX_COUNT,
41+
RuleTableColumns.EXAMPLE_COUNT, RuleTableColumns.MAX_LANGUAGE_VERSION, RuleTableColumns.SINCE,
42+
RuleTableColumns.MOD_COUNT };
4343

4444
private static final boolean DEFAULT_SORT_UP = false;
4545

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ private Text buildNameText(Composite parent) {
175175
final Text text = new Text(parent, SWT.SINGLE | SWT.BORDER);
176176
setFieldLayoutData(text);
177177

178-
text.addVerifyListener(RuleUIUtil.RuleNameVerifier);
178+
text.addVerifyListener(RuleUIUtil.RULE_NAME_VERIFIER);
179179

180180
text.addListener(SWT.Modify, new Listener() {
181181
public void handleEvent(Event event) {
@@ -209,7 +209,7 @@ private Text buildLabelField(Composite parent) {
209209
final Text text = new Text(parent, SWT.SINGLE | SWT.BORDER);
210210
setFieldLayoutData(text);
211211

212-
text.addVerifyListener(RuleUIUtil.RuleLabelVerifier);
212+
text.addVerifyListener(RuleUIUtil.RULE_LABEL_VERIFIER);
213213

214214
text.addListener(SWT.Modify, new Listener() {
215215
public void handleEvent(Event event) {

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/model/AbstractPMDRecord.java

Lines changed: 37 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ public abstract class AbstractPMDRecord {
6060
public static final int TYPE_MARKER = 16;
6161

6262
public static final AbstractPMDRecord[] EMPTY_RECORDS = new AbstractPMDRecord[0];
63+
6364
/**
6465
* @return the Name of the Element
6566
*/
@@ -108,7 +109,8 @@ public List<AbstractPMDRecord> getChildrenAsList() {
108109
/**
109110
* Adds a Resource to the Model and returns a new AbstractPMDRecord for it.
110111
*
111-
* @param resource, the Element to insert
112+
* @param resource,
113+
* the Element to insert
112114
* @return a new AbstractPMDRecord with the given Element in it or null if
113115
* the Resource does not exist
114116
*/
@@ -118,7 +120,8 @@ public List<AbstractPMDRecord> getChildrenAsList() {
118120
* Removes a Resource and also deletes the Record for it. Returns the
119121
* removed Record.
120122
*
121-
* @param resource, the Resource to remove
123+
* @param resource,
124+
* the Resource to remove
122125
* @return the Record for the Resource or null if the Resource does not
123126
* exist
124127
*/
@@ -127,22 +130,21 @@ public List<AbstractPMDRecord> getChildrenAsList() {
127130
/**
128131
* Gets the number of violations (markers) that belong to a priority.
129132
*
130-
* @param prio priority to search for
133+
* @param prio
134+
* priority to search for
131135
* @return number of found violations
132136
*/
133137
public abstract int getNumberOfViolationsToPriority(int prio, boolean invertMarkerAndFileRecords);
134138

135139
/**
136-
* Gets the counted lines of code (loc).
137-
* This works recursive.
140+
* Gets the counted lines of code (loc). This works recursive.
138141
*
139142
* @return loc lines of code
140143
*/
141144
public abstract int getLOC();
142145

143146
/**
144-
* Gets the number of methods.
145-
* This works recursive.
147+
* Gets the number of methods. This works recursive.
146148
*
147149
* @return number of counted methods
148150
*/
@@ -200,15 +202,17 @@ public IMarker[] findMarkers() {
200202
}
201203
}
202204

203-
return markerList.isEmpty() ? null : markerList.toArray(new IMarker[markerList.size()]); // NOPMD by Herlin on 07/10/06 15:51
205+
return markerList.isEmpty() ? null : markerList.toArray(new IMarker[0]);
204206
}
205207

206208
/**
207209
* Finds Markers that have a given Attribute with a given Value. Finds
208210
* children Markers recursively (needs to be stopped by overwriting).
209211
*
210-
* @param attributeName, the Name of the Attribute to search for
211-
* @param value, the Value, the Attribute should have
212+
* @param attributeName,
213+
* the Name of the Attribute to search for
214+
* @param value,
215+
* the Value, the Attribute should have
212216
* @return a List of Markers that have the given attribute and Value or
213217
* null, if no Markers were found
214218
*/
@@ -228,10 +232,11 @@ public IMarker[] findMarkersByAttribute(String attributeName, Object value) {
228232
}
229233

230234
/**
231-
* Finds a Resource and returns the corresponding Record. Recursively searches
232-
* the children, needs to be stopped by overwriting.
235+
* Finds a Resource and returns the corresponding Record. Recursively
236+
* searches the children, needs to be stopped by overwriting.
233237
*
234-
* @param resource, the Resource to search for
238+
* @param resource,
239+
* the Resource to search for
235240
* @return the corresponding AbstractPMDRecord for the Resource or null, if
236241
* the Resource could not be found
237242
*/
@@ -245,12 +250,10 @@ public AbstractPMDRecord findResource(IResource resource) {
245250
// check the children if the Resource exists
246251
if (thisChild.getResource().equals(resource)) {
247252
record = thisChild;
248-
}
249-
250-
// if it is not the current children, but the Type are different
251-
// it could be one of the grand children
252-
// check this childs children recursively
253-
else if (thisChild.getResourceType() != resource.getType()) {
253+
} else if (thisChild.getResourceType() != resource.getType()) {
254+
// if it is not the current children, but the Type are different
255+
// it could be one of the grand children
256+
// check this childs children recursively
254257
final AbstractPMDRecord grandChild = thisChild.findResource(resource);
255258
if (grandChild != null) {
256259
record = grandChild;
@@ -265,8 +268,10 @@ record = grandChild;
265268
* Finds a Resource with a given Name and Type. Checks children recursively
266269
* (needs to be stopped by overwriting).
267270
*
268-
* @param name, the Name of the Resource
269-
* @param type, the Type, one of ROOT, PROJECT, PACKAGE or FILE
271+
* @param name,
272+
* the Name of the Resource
273+
* @param type,
274+
* the Type, one of ROOT, PROJECT, PACKAGE or FILE
270275
* @return the Record for the Resource or null, if the Resource could not be
271276
* found
272277
*/
@@ -280,10 +285,8 @@ public AbstractPMDRecord findResourceByName(String name, int type) {
280285
// If type and name are equals, then the record is the one we search
281286
if (thisChild.getResourceType() == type && thisChild.getName().equalsIgnoreCase(name)) {
282287
record = thisChild;
283-
}
284-
285-
// else we check the child's children the same way
286-
else {
288+
} else {
289+
// else we check the child's children the same way
287290
final AbstractPMDRecord grandChild = thisChild.findResourceByName(name, type);
288291
if (grandChild != null) {
289292
record = grandChild;
@@ -295,26 +298,26 @@ record = grandChild;
295298
}
296299

297300
/**
298-
* Finds all Resources with a given Name and Type. Checks children recursively
299-
* (needs to be stopped by overwriting).
301+
* Finds all Resources with a given Name and Type. Checks children
302+
* recursively (needs to be stopped by overwriting).
300303
*
301-
* @param name, the Name of the Resource
302-
* @param type, the Type, one of ROOT, PROJECT, PACKAGE or FILE
304+
* @param name,
305+
* the Name of the Resource
306+
* @param type,
307+
* the Type, one of ROOT, PROJECT, PACKAGE or FILE
303308
* @return all resources that match the name and type
304309
*/
305310
public List<AbstractPMDRecord> findResourcesByName(String name, int type) {
306311
final List<AbstractPMDRecord> records = new ArrayList<AbstractPMDRecord>();
307312
final List<AbstractPMDRecord> thisChildren = getChildrenAsList();
308313

309314
for (AbstractPMDRecord thisChild : thisChildren) {
310-
315+
311316
// If type and name are equals, then the record is the one we search
312317
if (thisChild.getResourceType() == type && thisChild.getName().equalsIgnoreCase(name)) {
313318
records.add(thisChild);
314-
}
315-
316-
// else we check the child's children the same way
317-
else {
319+
} else {
320+
// else we check the child's children the same way
318321
final List<AbstractPMDRecord> grandChilds = thisChild.findResourcesByName(name, type);
319322
records.addAll(grandChilds);
320323
}

net.sourceforge.pmd.eclipse.plugin/src/main/java/net/sourceforge/pmd/eclipse/ui/model/DataflowMethodRecord.java

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,19 @@
3939
import java.util.ArrayList;
4040
import java.util.List;
4141

42-
import net.sourceforge.pmd.lang.ast.Node;
43-
import net.sourceforge.pmd.util.StringUtil;
44-
import net.sourceforge.pmd.eclipse.runtime.PMDRuntimeConstants;
45-
import net.sourceforge.pmd.eclipse.runtime.builder.MarkerUtil;
46-
import net.sourceforge.pmd.eclipse.ui.PMDUiConstants;
47-
import net.sourceforge.pmd.eclipse.plugin.PMDPlugin;
48-
import net.sourceforge.pmd.eclipse.ui.nls.StringKeys;
49-
5042
import org.eclipse.core.resources.IMarker;
5143
import org.eclipse.core.resources.IResource;
5244
import org.eclipse.core.runtime.CoreException;
5345
import org.eclipse.jdt.core.IMethod;
5446

47+
import net.sourceforge.pmd.eclipse.plugin.PMDPlugin;
48+
import net.sourceforge.pmd.eclipse.runtime.PMDRuntimeConstants;
49+
import net.sourceforge.pmd.eclipse.runtime.builder.MarkerUtil;
50+
import net.sourceforge.pmd.eclipse.ui.PMDUiConstants;
51+
import net.sourceforge.pmd.eclipse.ui.nls.StringKeys;
52+
import net.sourceforge.pmd.lang.ast.Node;
53+
import net.sourceforge.pmd.util.StringUtil;
54+
5555
/**
5656
* This class holds information for use with the dataflow view. It contains a
5757
* Java-Method and the corresponding PMD-Method (SimpleNode) and can return
@@ -67,8 +67,10 @@ public class DataflowMethodRecord {
6767
/**
6868
* Constructor
6969
*
70-
* @param javaMethod, the Method of the JavaModel
71-
* @param pmdMethod, the corresponding PMD-SimpleNode / ASTMethodDeclaration
70+
* @param javaMethod,
71+
* the Method of the JavaModel
72+
* @param pmdMethod,
73+
* the corresponding PMD-SimpleNode / ASTMethodDeclaration
7274
*/
7375
public DataflowMethodRecord(IMethod javaMethod, Node pmdMethod) {
7476
if (javaMethod == null) {
@@ -110,14 +112,15 @@ public IResource getResource() {
110112
* @return a List of Anomalies
111113
*/
112114
public IMarker[] getMarkers() {
113-
// TODO optimize this to avoid creation when no results found
115+
// TODO optimize this to avoid creation when no results found
114116
final List<IMarker> markers = new ArrayList<IMarker>();
115117
try {
116118
if (method.getResource().isAccessible()) {
117119

118120
// we can only find Markers for a file
119121
// we use the DFA-Marker-ID set for Dataflow Anomalies
120-
final IMarker[] allMarkers = MarkerUtil.findMarkers(method.getResource(), PMDRuntimeConstants.PMD_DFA_MARKER);
122+
final IMarker[] allMarkers = MarkerUtil.findMarkers(method.getResource(),
123+
PMDRuntimeConstants.PMD_DFA_MARKER);
121124

122125
// we only want to get the Markers for this Method,
123126
// so we need to "extract" them from the whole List
@@ -197,13 +200,11 @@ private boolean markerIsValid(IMarker marker) {
197200

198201
// if it is a String, it has to be the Variable
199202
// or Message, which shouldn't be empty
200-
if (values[k] instanceof String && StringUtil.isEmpty((String)values[k])) {
203+
if (values[k] instanceof String && StringUtil.isEmpty((String) values[k])) {
201204
isValid = false;
202-
}
203-
204-
// else it is one of the Lines (Line, Line2)
205-
// and they also should not be 0
206-
else if (values[k] instanceof Number && ((Number) values[k]).intValue() == 0) {
205+
} else if (values[k] instanceof Number && ((Number) values[k]).intValue() == 0) {
206+
// else it is one of the Lines (Line, Line2)
207+
// and they also should not be 0
207208
isValid = false;
208209
}
209210
}
@@ -237,11 +238,10 @@ private boolean markerIsInList(IMarker marker, List<IMarker> list) {
237238
boolean markersAreEqual = true;
238239
for (int j = 0; j < listAttr.length; j++) {
239240
// compare the String- and Integer-Values
240-
if (markerAttr[j] instanceof String && !((String) markerAttr[j]).equalsIgnoreCase((String) listAttr[j])) {
241+
if (markerAttr[j] instanceof String
242+
&& !((String) markerAttr[j]).equalsIgnoreCase((String) listAttr[j])) {
241243
markersAreEqual = false;
242-
}
243-
244-
else if (markerAttr[j] instanceof Integer && !((Integer) markerAttr[j]).equals(listAttr[j])) {
244+
} else if (markerAttr[j] instanceof Integer && !((Integer) markerAttr[j]).equals(listAttr[j])) {
245245
markersAreEqual = false;
246246
}
247247
}

0 commit comments

Comments
 (0)