Skip to content

Commit e4acb84

Browse files
Perform clean code of ds/org.eclipse.pde.ds.core
1 parent cbc3b1b commit e4acb84

File tree

4 files changed

+28
-14
lines changed

4 files changed

+28
-14
lines changed

ds/org.eclipse.pde.ds.core/src/org/eclipse/pde/internal/ds/core/Activator.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,9 @@ public static void log(IStatus status) {
6363
}
6464

6565
public static void log(Throwable e) {
66-
if (e instanceof InvocationTargetException)
66+
if (e instanceof InvocationTargetException) {
6767
e = ((InvocationTargetException) e).getTargetException();
68+
}
6869
IStatus status = null;
6970
if (e instanceof CoreException) {
7071
status = ((CoreException) e).getStatus();

ds/org.eclipse.pde.ds.core/src/org/eclipse/pde/internal/ds/core/builders/DSBuilder.java

+6-3
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,9 @@ public boolean visit(IResourceDelta delta) {
9999
protected IProject[] build(int kind, Map<String, String> args, IProgressMonitor monitor)
100100
throws CoreException {
101101
IResourceDelta delta = null;
102-
if (kind != FULL_BUILD)
102+
if (kind != FULL_BUILD) {
103103
delta = getDelta(getProject());
104+
}
104105

105106
if (delta == null || kind == FULL_BUILD) {
106107
// Full build
@@ -122,8 +123,9 @@ protected void clean(IProgressMonitor monitor) throws CoreException {
122123
private boolean isDSFile(IFile candidate) {
123124
try {
124125
IContentDescription description = candidate.getContentDescription();
125-
if (description == null)
126+
if (description == null) {
126127
return false;
128+
}
127129
IContentType type = description.getContentType();
128130
return Activator.CONTENT_TYPE_ID.equals(type.getId());
129131
} catch (CoreException e) {
@@ -132,8 +134,9 @@ private boolean isDSFile(IFile candidate) {
132134
}
133135

134136
private void checkFile(IFile file, IProgressMonitor monitor) {
135-
if (monitor.isCanceled())
137+
if (monitor.isCanceled()) {
136138
return;
139+
}
137140
String message = NLS.bind(Messages.DSBuilder_verifying, file
138141
.getFullPath().toString());
139142
monitor.subTask(message);

ds/org.eclipse.pde.ds.core/src/org/eclipse/pde/internal/ds/core/builders/DSErrorReporter.java

+18-9
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,16 @@ public void validate(IProgressMonitor monitor) {
8585
private void validateBoolean(Element element, Attr attr) {
8686
if (attr != null) {
8787
String value = attr.getValue();
88-
if (!value.equalsIgnoreCase("true") && !value.equalsIgnoreCase("false")) //$NON-NLS-1$ //$NON-NLS-2$
88+
if (!value.equalsIgnoreCase("true") && !value.equalsIgnoreCase("false")) { //$NON-NLS-1$ //$NON-NLS-2$
8989
reportIllegalAttributeValue(element, attr);
90+
}
9091
}
9192
}
9293

9394
private void reportIllegalAttributeValue(Element element, Attr attr) {
94-
if (attr == null || attr.getValue() == null || attr.getName() == null)
95+
if (attr == null || attr.getValue() == null || attr.getName() == null) {
9596
return;
97+
}
9698
String message = NLS.bind(Messages.DSErrorReporter_attrValue, attr
9799
.getValue(), attr.getName());
98100
report(message, getLine(element, attr.getName()), ERROR,
@@ -168,8 +170,9 @@ private void reportDuplicateReferenceElementName(Element element,
168170
String name) {
169171
Attr attr = element
170172
.getAttributeNode(IDSConstants.ATTRIBUTE_REFERENCE_NAME);
171-
if (attr == null || attr.getValue() == null || attr.getName() == null)
173+
if (attr == null || attr.getValue() == null || attr.getName() == null) {
172174
return;
175+
}
173176
String message = NLS.bind(
174177
Messages.DSErrorReporter_duplicateReferenceName, name);
175178
report(message,
@@ -198,9 +201,10 @@ private void validateReferencePolicy(Element element) {
198201
private void reportIllegalPolicy(Element element, String policy) {
199202
String name = element
200203
.getAttribute(IDSConstants.ATTRIBUTE_REFERENCE_NAME);
201-
if (name == null)
204+
if (name == null) {
202205
name = element
203206
.getAttribute(IDSConstants.ATTRIBUTE_REFERENCE_INTERFACE);
207+
}
204208
String message = NLS.bind(Messages.DSErrorReporter_invalidPolicyValue,
205209
name, policy);
206210
Attr attr = element
@@ -242,8 +246,9 @@ private void reportIllegalCardinality(Element element, String cardinality) {
242246
cardinality);
243247
Attr attr = element
244248
.getAttributeNode(IDSConstants.ATTRIBUTE_REFERENCE_CARDINALITY);
245-
if (attr == null || attr.getValue() == null || attr.getName() == null)
249+
if (attr == null || attr.getValue() == null || attr.getName() == null) {
246250
return;
251+
}
247252
report(message, getLine(element, attr.getName()), ERROR,
248253
PDEMarkerFactory.CAT_OTHER);
249254
}
@@ -316,8 +321,9 @@ private void validatePropertySpecificTypeBody(String type, String body,
316321
while (st.hasMoreTokens()) {
317322
String token = st.nextToken();
318323
token = token.trim();
319-
if (token.length() > 0)
324+
if (token.length() > 0) {
320325
validatePropertySpecificTypeValue(type, token, element);
326+
}
321327
}
322328
}
323329

@@ -395,8 +401,9 @@ private void validatePropertyAttrValueAndBody(Element element,
395401
String propertyType = property.getPropertyType();
396402
if (propertyType == null
397403
|| propertyType
398-
.equals(IDSConstants.VALUE_PROPERTY_TYPE_STRING))
404+
.equals(IDSConstants.VALUE_PROPERTY_TYPE_STRING)) {
399405
return; // It's OK for a property of type "String" to have a
406+
}
400407
// value of "".
401408
if (property.getPropertyValue().equals("")) { //$NON-NLS-1$
402409
String propertyName = property.getPropertyName();
@@ -601,14 +608,16 @@ private void reportInvalidImmediate(Element element) {
601608
private void validateEmpty(Element element, Attr attr) {
602609
if (attr != null) {
603610
String value = attr.getValue();
604-
if (value.equalsIgnoreCase("")) //$NON-NLS-1$
611+
if (value.equalsIgnoreCase("")) { //$NON-NLS-1$
605612
reportIllegalEmptyAttributeValue(element, attr);
613+
}
606614
}
607615
}
608616

609617
private void reportIllegalEmptyAttributeValue(Element element, Attr attr) {
610-
if (attr == null || attr.getValue() == null || attr.getName() == null)
618+
if (attr == null || attr.getValue() == null || attr.getName() == null) {
611619
return;
620+
}
612621
String message = NLS.bind(Messages.DSErrorReporter_emptyAttrValue, attr
613622
.getName());
614623
report(message, getLine(element, attr.getName()), ERROR,

ds/org.eclipse.pde.ds.core/src/org/eclipse/pde/internal/ds/core/builders/DSJavaHelper.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,9 @@ public class DSJavaHelper {
2525

2626
public static boolean isOnClasspath(String fullyQualifiedName,
2727
IJavaProject project) {
28-
if (fullyQualifiedName.indexOf('$') != -1)
28+
if (fullyQualifiedName.indexOf('$') != -1) {
2929
fullyQualifiedName = fullyQualifiedName.replace('$', '.');
30+
}
3031
try {
3132
IType type = project.findType(fullyQualifiedName);
3233
return type != null && type.exists();

0 commit comments

Comments
 (0)