Skip to content

Commit c0eea04

Browse files
eclipse-platform-botakurtakov
authored andcommitted
Perform clean code of bundles/org.eclipse.ui.navigator
1 parent 6c7aa05 commit c0eea04

File tree

75 files changed

+387
-306
lines changed

Some content is hidden

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

75 files changed

+387
-306
lines changed

bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/CommonNavigatorActionGroup.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public class CommonNavigatorActionGroup extends ActionGroup implements IMementoA
6161

6262
private final CommonViewer commonViewer;
6363

64-
private CommonNavigator commonNavigator;
64+
private final CommonNavigator commonNavigator;
6565

6666
private final LinkHelperService linkHelperService;
6767

bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/CommonNavigatorFrameSource.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
*/
2323
public class CommonNavigatorFrameSource extends TreeViewerFrameSource {
2424

25-
private CommonNavigator navigator;
25+
private final CommonNavigator navigator;
2626

2727
/**
2828
* Constructs a new frame source for the specified common navigator.

bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/CommonViewerSiteDelegate.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
public class CommonViewerSiteDelegate implements ICommonViewerSite {
2828

2929

30-
private String id;
30+
private final String id;
3131
private ISelectionProvider selectionProvider;
32-
private Shell shell;
32+
private final Shell shell;
3333

3434
public CommonViewerSiteDelegate(String anId, ISelectionProvider aSelectionProvider, Shell aShell) {
3535
Assert.isNotNull(anId);

bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/CommonViewerSiteIEditorPartSiteDelegate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
public class CommonViewerSiteIEditorPartSiteDelegate implements
3333
ICommonViewerWorkbenchSite {
3434

35-
private IEditorSite editorSite;
35+
private final IEditorSite editorSite;
3636

3737
public CommonViewerSiteIEditorPartSiteDelegate(IEditorSite anEditorSite) {
3838
editorSite = anEditorSite;

bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/CommonViewerSiteIPageSiteDelegate.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,9 @@
2727
*/
2828
public class CommonViewerSiteIPageSiteDelegate implements ICommonViewerSite {
2929

30-
private IPageSite pageSite;
30+
private final IPageSite pageSite;
3131

32-
private String viewerId;
32+
private final String viewerId;
3333

3434
public CommonViewerSiteIPageSiteDelegate(String aViewerId,
3535
IPageSite aPageSite) {

bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/CommonViewerSiteIViewSiteDelegate.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
*/
3333
public class CommonViewerSiteIViewSiteDelegate implements ICommonViewerWorkbenchSite {
3434

35-
private IViewSite viewSite;
35+
private final IViewSite viewSite;
3636

3737
public CommonViewerSiteIViewSiteDelegate(IViewSite aViewSite) {
3838
viewSite = aViewSite;

bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/ContributorTrackingSet.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class ContributorTrackingSet extends LinkedHashSet {
3434

3535
private INavigatorContentDescriptor contributor;
3636
private INavigatorContentDescriptor firstClassContributor;
37-
private NavigatorContentService contentService;
37+
private final NavigatorContentService contentService;
3838

3939
/**
4040
* Construct a tracking set.
@@ -71,8 +71,9 @@ public boolean remove(Object o) {
7171
@Override
7272
public void clear() {
7373
Iterator it = iterator();
74-
while (it.hasNext())
74+
while (it.hasNext()) {
7575
contentService.forgetContribution(it.next());
76+
}
7677
super.clear();
7778
}
7879

@@ -104,8 +105,9 @@ public void setContributor(INavigatorContentDescriptor newContributor, INavigato
104105

105106
public void setContents(Object[] contents) {
106107
super.clear();
107-
if(contents != null)
108+
if(contents != null) {
108109
addAll(Arrays.asList(contents));
110+
}
109111

110112
}
111113

bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/CustomAndExpression.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,9 @@ public CustomAndExpression(IConfigurationElement element) {
4545
Assert.isNotNull(element);
4646

4747
final IConfigurationElement[] children = element.getChildren();
48-
if (children.length == 0)
48+
if (children.length == 0) {
4949
return;
50+
}
5051
SafeRunner.run(new NavigatorSafeRunnable() {
5152
@Override
5253
public void run() throws Exception {

bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/NavigatorActivationService.java

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public final class NavigatorActivationService implements
6868

6969
private final ListenerList<IExtensionActivationListener> listeners = new ListenerList<>();
7070

71-
private INavigatorContentService contentService;
71+
private final INavigatorContentService contentService;
7272

7373
/**
7474
* Create an instance of the service.
@@ -94,16 +94,19 @@ public NavigatorActivationService(INavigatorContentService aContentService) {
9494
@Override
9595
public boolean isNavigatorExtensionActive(String aNavigatorExtensionId) {
9696
Boolean b = activatedExtensionsMap.get(aNavigatorExtensionId);
97-
if(b != null)
97+
if(b != null) {
9898
return b.booleanValue();
99+
}
99100
synchronized (activatedExtensionsMap) {
100101
NavigatorContentDescriptor descriptor = CONTENT_DESCRIPTOR_REGISTRY.getContentDescriptor(aNavigatorExtensionId);
101-
if (descriptor == null)
102+
if (descriptor == null) {
102103
return false;
103-
if(descriptor.isActiveByDefault())
104+
}
105+
if(descriptor.isActiveByDefault()) {
104106
activatedExtensionsMap.put(aNavigatorExtensionId, Boolean.TRUE);
105-
else
107+
} else {
106108
activatedExtensionsMap.put(aNavigatorExtensionId, Boolean.FALSE);
109+
}
107110
return descriptor.isActiveByDefault();
108111
}
109112
}
@@ -241,8 +244,9 @@ private void notifyListeners(String[] navigatorExtensionIds,
241244
boolean toEnable) {
242245

243246
if(navigatorExtensionIds != null) { // should really never be null, but just in case
244-
if(navigatorExtensionIds.length > 1)
247+
if(navigatorExtensionIds.length > 1) {
245248
Arrays.sort(navigatorExtensionIds);
249+
}
246250

247251
for (IExtensionActivationListener element : listeners) {
248252
element.onExtensionActivation(contentService.getViewerId(), navigatorExtensionIds, toEnable);
@@ -275,8 +279,9 @@ private void revertExtensionActivations() {
275279
} else {
276280
// IS THIS THE RIGHT WAY TO HANDLE THIS CASE?
277281
NavigatorContentDescriptor descriptor = CONTENT_DESCRIPTOR_REGISTRY.getContentDescriptor(contentExtensionId);
278-
if(descriptor != null)
282+
if(descriptor != null) {
279283
activatedExtensionsMap.put(id, Boolean.valueOf(descriptor.isActiveByDefault()));
284+
}
280285
}
281286
}
282287

bundles/org.eclipse.ui.navigator/src/org/eclipse/ui/internal/navigator/NavigatorContentService.java

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -123,8 +123,8 @@ public class NavigatorContentService implements IExtensionActivationListener,
123123
* to record the object/description associations which are when stored
124124
* in the Tree associated with the viewer.
125125
*/
126-
private Map<Object, INavigatorContentDescriptor> contributionMemory;
127-
private Map<Object, INavigatorContentDescriptor> contributionMemoryFirstClass;
126+
private final Map<Object, INavigatorContentDescriptor> contributionMemory;
127+
private final Map<Object, INavigatorContentDescriptor> contributionMemoryFirstClass;
128128

129129
private ILabelProvider labelProvider;
130130

@@ -338,8 +338,9 @@ protected void updateService(Viewer aViewer, Object anOldInput, Object aNewInput
338338
// Prevents the world from being started again once we have been disposed. In
339339
// the dispose process, the ContentViewer will call setInput() on the
340340
// NavigatorContentServiceContentProvider, which gets us here
341-
if (isDisposed)
341+
if (isDisposed) {
342342
return;
343+
}
343344
NavigatorContentDescriptorManager.getInstance().clearCache();
344345
synchronized (this) {
345346
if (structuredViewerManager == null) {
@@ -579,8 +580,9 @@ public INavigatorContentExtension getContentExtensionById(
579580
String anExtensionId) {
580581
NavigatorContentDescriptor descriptor = CONTENT_DESCRIPTOR_REGISTRY
581582
.getContentDescriptor(anExtensionId);
582-
if (descriptor != null)
583+
if (descriptor != null) {
583584
return getExtension(descriptor);
585+
}
584586
return null;
585587
}
586588

@@ -667,9 +669,10 @@ public void rememberContribution(INavigatorContentDescriptor source,
667669
synchronized (this) {
668670
if (contributionMemory.get(element) == null
669671
|| contributionMemoryFirstClass.get(element) == firstClassSource) {
670-
if (Policy.DEBUG_RESOLUTION)
672+
if (Policy.DEBUG_RESOLUTION) {
671673
System.out
672674
.println("rememberContribution: " + Policy.getObjectString(element) + " source: " + source); //$NON-NLS-1$//$NON-NLS-2$
675+
}
673676
contributionMemory.put(element, source);
674677
contributionMemoryFirstClass.put(element, firstClassSource);
675678
}
@@ -719,17 +722,20 @@ public int getContributionMemorySize() {
719722
* @see #findContentExtensionsByTriggerPoint(Object)
720723
*/
721724
public synchronized NavigatorContentDescriptor getSourceOfContribution(Object element) {
722-
if (element == null)
725+
if (element == null) {
723726
return null;
724-
if (structuredViewerManager == null)
727+
}
728+
if (structuredViewerManager == null) {
725729
return null;
730+
}
726731
// Try here first because it might not yet be in the tree
727732
NavigatorContentDescriptor src;
728733
synchronized (this) {
729734
src = (NavigatorContentDescriptor) contributionMemory.get(element);
730735
}
731-
if (src != null)
736+
if (src != null) {
732737
return src;
738+
}
733739
return (NavigatorContentDescriptor) structuredViewerManager.getData(element);
734740
}
735741
public static final boolean CONSIDER_OVERRIDES = true;

0 commit comments

Comments
 (0)