Skip to content

Commit 402625d

Browse files
eclipse-pde-botlaeubi
authored andcommitted
Perform clean code of ua/org.eclipse.pde.ua.ui
1 parent cf3a7dc commit 402625d

17 files changed

+52
-28
lines changed

ua/org.eclipse.pde.ua.ui/src/org/eclipse/pde/internal/ua/ui/PDEUserAssistanceUIPlugin.java

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,15 @@ public static void logException(Throwable e, final String title,
8787
e = ((InvocationTargetException) e).getTargetException();
8888
}
8989
IStatus status = null;
90-
if (e instanceof CoreException)
90+
if (e instanceof CoreException) {
9191
status = ((CoreException) e).getStatus();
92-
else {
93-
if (message == null)
92+
} else {
93+
if (message == null) {
9494
message = e.getMessage();
95-
if (message == null)
95+
}
96+
if (message == null) {
9697
message = e.toString();
98+
}
9799
status = Status.error(message, e);
98100
}
99101
ResourcesPlugin.getPlugin().getLog().log(status);
@@ -112,8 +114,9 @@ public static IWorkbenchPage getActivePage() {
112114
}
113115

114116
public PDEUserAssistanceLabelProvider getLabelProvider() {
115-
if (fLabelProvider == null)
117+
if (fLabelProvider == null) {
116118
fLabelProvider = new PDEUserAssistanceLabelProvider();
119+
}
117120
return fLabelProvider;
118121
}
119122
}

ua/org.eclipse.pde.ua.ui/src/org/eclipse/pde/internal/ua/ui/PDEUserAssistanceUIPluginImages.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,9 @@ private static ImageDescriptor create(String prefix, String name) {
7070
}
7171

7272
public static Image get(String key) {
73-
if (PLUGIN_REGISTRY == null)
73+
if (PLUGIN_REGISTRY == null) {
7474
initialize();
75+
}
7576
return PLUGIN_REGISTRY.get(key);
7677
}
7778

ua/org.eclipse.pde.ua.ui/src/org/eclipse/pde/internal/ua/ui/editor/cheatsheet/CSAbstractEditor.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,9 @@ public abstract class CSAbstractEditor extends MultiSourceEditor {
3939
public void contributeToToolbar(IToolBarManager manager) {
4040
// Add the register cheat sheet link to the form title area
4141
if (WorkspaceModelManager.isPluginProject(getCommonProject())
42-
&& getAggregateModel().isEditable())
42+
&& getAggregateModel().isEditable()) {
4343
manager.add(createUIControlConRegisterCS());
44+
}
4445
}
4546

4647
private ControlContribution createUIControlConRegisterCS() {

ua/org.eclipse.pde.ua.ui/src/org/eclipse/pde/internal/ua/ui/editor/ctxhelp/details/CtxHelpAbstractDetails.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ public void createContents(Composite parent) {
6666
public void createDetails(Composite parent) { // Create the main section
6767
int style = ExpandableComposite.TITLE_BAR;
6868

69-
if (getDetailsDescription() != null)
69+
if (getDetailsDescription() != null) {
7070
style |= Section.DESCRIPTION;
71+
}
7172

7273
fMainSection = getPage().createUISection(parent, getDetailsTitle(), getDetailsDescription(), style);
7374
// Align the master and details section headers (misalignment caused

ua/org.eclipse.pde.ua.ui/src/org/eclipse/pde/internal/ua/ui/editor/ctxhelp/details/CtxHelpRemoveAction.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ public void setToRemove(CtxHelpObject[] objects) {
4545

4646
@Override
4747
public void run() {
48-
if (fObjects == null)
48+
if (fObjects == null) {
4949
return;
50+
}
5051

5152
for (int i = 0; i < fObjects.length; ++i) {
5253
if (fObjects[i] != null && fObjects[i].canBeRemoved()) {

ua/org.eclipse.pde.ua.ui/src/org/eclipse/pde/internal/ua/ui/editor/toc/HelpEditorUtil.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,9 @@ private static boolean hasValidTocExtension(IPath path) {
6666
}
6767

6868
public static boolean isTOCFile(IPath path) {
69-
if (!hasValidTocExtension(path))
69+
if (!hasValidTocExtension(path)) {
7070
return false;
71+
}
7172

7273
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
7374

ua/org.eclipse.pde.ua.ui/src/org/eclipse/pde/internal/ua/ui/editor/toc/TocEditor.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,10 +121,12 @@ private boolean isShowInApplicable() {
121121
IStructuredSelection selection = (IStructuredSelection) getSelection();
122122
for (Iterator<?> iter = selection.iterator(); iter.hasNext();) {
123123
Object obj = iter.next();
124-
if (!(obj instanceof TocObject))
124+
if (!(obj instanceof TocObject)) {
125125
return false;
126-
if (((TocObject) obj).getPath() == null)
126+
}
127+
if (((TocObject) obj).getPath() == null) {
127128
return false;
129+
}
128130
}
129131

130132
return true;

ua/org.eclipse.pde.ua.ui/src/org/eclipse/pde/internal/ua/ui/editor/toc/TocHyperlinkDetector.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ public TocHyperlinkDetector(PDESourcePage page) {
3535
@Override
3636
protected IHyperlink[] detectAttributeHyperlink(IDocumentAttributeNode attr) {
3737
String attrValue = attr.getAttributeValue();
38-
if (attrValue.length() == 0)
38+
if (attrValue.length() == 0) {
3939
return null;
40+
}
4041

4142
IDocumentElementNode node = attr.getEnclosingElement();
4243
if (node == null || !(node instanceof TocObject) || !((TocObject) node).getModel().isEditable()) {

ua/org.eclipse.pde.ua.ui/src/org/eclipse/pde/internal/ua/ui/editor/toc/TocSourcePage.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,9 @@ protected boolean isSelectionListener() {
6969

7070
@Override
7171
public <T> T getAdapter(Class<T> adapter) {
72-
if (IHyperlinkDetector.class.equals(adapter))
72+
if (IHyperlinkDetector.class.equals(adapter)) {
7373
return adapter.cast(new TocHyperlinkDetector(this));
74+
}
7475
return super.getAdapter(adapter);
7576
}
7677

@@ -88,8 +89,9 @@ protected IDocumentRange findRange() {
8889

8990
Object selectedObject = getSelection();
9091

91-
if (selectedObject instanceof IDocumentElementNode)
92+
if (selectedObject instanceof IDocumentElementNode) {
9293
return (IDocumentElementNode) selectedObject;
94+
}
9395

9496
return null;
9597
}

ua/org.eclipse.pde.ua.ui/src/org/eclipse/pde/internal/ua/ui/editor/toc/TocTreeSection.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1097,8 +1097,9 @@ private void handleMultiAddAction(List<TocObject> objectsToAdd, TocObject tocTar
10971097
boolean insertBefore, TocObject targetParent) {
10981098
TocObject[] tocObjects = objectsToAdd
10991099
.toArray(new TocObject[objectsToAdd.size()]);
1100-
if (tocObjects == null)
1100+
if (tocObjects == null) {
11011101
return;
1102+
}
11021103

11031104
for (TocObject tocObject : tocObjects) {
11041105
if (tocObject != null) {
@@ -1131,8 +1132,9 @@ private void handleDeleteAction() {
11311132
List<?> list = fTocTree.getStructuredSelection().toList();
11321133
ArrayList<TocObject> objects = new ArrayList<>(list.size());
11331134
for (Object o : list) {
1134-
if (o instanceof TocObject)
1135+
if (o instanceof TocObject) {
11351136
objects.add((TocObject) o);
1137+
}
11361138
}
11371139
boolean beep = false;
11381140

0 commit comments

Comments
 (0)