Skip to content

Commit e52dce4

Browse files
Perform clean code of ua/org.eclipse.pde.ua.ui
1 parent 4e00417 commit e52dce4

17 files changed

+52
-28
lines changed

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

+8-5
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

+2-1
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

+2-1
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

+2-1
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

+2-1
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

+2-1
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

+4-2
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

+2-1
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

+4-2
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

+4-2
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

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ public void setToRemove(TocObject tocObject) {
5353

5454
@Override
5555
public void run() {
56-
if (fTocObjects == null)
56+
if (fTocObjects == null) {
5757
return;
58+
}
5859

5960
for (int i = 0; i < fTocObjects.length; ++i) {
6061
if (fTocObjects[i] != null && fTocObjects[i].canBeRemoved()) {

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

+2-1
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ private void configureParentLayout(Composite parent) {
6464
public void createDetails(Composite parent) { // Create the main section
6565
int style = ExpandableComposite.TITLE_BAR;
6666

67-
if (getDetailsDescription() != null)
67+
if (getDetailsDescription() != null) {
6868
style |= Section.DESCRIPTION;
69+
}
6970

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

ua/org.eclipse.pde.ua.ui/src/org/eclipse/pde/internal/ua/ui/wizards/cheatsheet/RegisterCSWizardPage.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,14 @@ private void initialize() {
111111
private void initializePluginModel() {
112112
IPluginModelBase base = PluginRegistry.findModel(getPluginProject());
113113
// should never happen
114-
if (base == null)
114+
if (base == null) {
115115
return;
116-
if (base instanceof IBundlePluginModelBase)
116+
}
117+
if (base instanceof IBundlePluginModelBase) {
117118
fExtensionsModel = ((IBundlePluginModelBase) base).getExtensionsModel();
118-
else
119+
} else {
119120
fExtensionsModel = base;
121+
}
120122
}
121123

122124
@Override

ua/org.eclipse.pde.ua.ui/src/org/eclipse/pde/internal/ua/ui/wizards/ctxhelp/NewCtxHelpOperation.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,9 @@ protected void openFile() {
8282
return;
8383
}
8484
IWorkbenchPage page = ww.getActivePage();
85-
if (page == null || !fFile.exists())
85+
if (page == null || !fFile.exists()) {
8686
return;
87+
}
8788
IWorkbenchPart focusPart = page.getActivePart();
8889
if (focusPart instanceof ISetSelectionTarget) {
8990
ISelection selection = new StructuredSelection(fFile);

ua/org.eclipse.pde.ua.ui/src/org/eclipse/pde/internal/ua/ui/wizards/toc/NewTocFileWizard.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,9 @@ public class NewTocFileWizard extends TocHTMLWizard {
2828
@Override
2929
public void addPages() {
3030
fPage = new TocWizardPage("tocfile", getSelection()); //$NON-NLS-1$
31-
if (fInitialPath != null)
31+
if (fInitialPath != null) {
3232
fPage.setContainerFullPath(fInitialPath);
33+
}
3334
addPage(fPage);
3435
}
3536

ua/org.eclipse.pde.ua.ui/src/org/eclipse/pde/internal/ua/ui/wizards/toc/RegisterTocWizardPage.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -85,12 +85,14 @@ private void initialize() {
8585
private void initializePluginModel() {
8686
IPluginModelBase base = PluginRegistry.findModel(getPluginProject());
8787

88-
if (base == null)
88+
if (base == null) {
8989
return;
90-
if (base instanceof IBundlePluginModelBase)
90+
}
91+
if (base instanceof IBundlePluginModelBase) {
9192
fExtensionsModel = ((IBundlePluginModelBase) base).getExtensionsModel();
92-
else
93+
} else {
9394
fExtensionsModel = base;
95+
}
9496
}
9597

9698
private void updateUI() {

ua/org.eclipse.pde.ua.ui/src/org/eclipse/pde/internal/ua/ui/wizards/toc/TocOperation.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -83,8 +83,9 @@ protected void openFile() {
8383
return;
8484
}
8585
IWorkbenchPage page = ww.getActivePage();
86-
if (page == null || !fFile.exists())
86+
if (page == null || !fFile.exists()) {
8787
return;
88+
}
8889
IWorkbenchPart focusPart = page.getActivePart();
8990
if (focusPart instanceof ISetSelectionTarget) {
9091
ISelection selection = new StructuredSelection(fFile);

0 commit comments

Comments
 (0)