Skip to content

Commit e9311a3

Browse files
eclipse-platform-botakurtakov
authored andcommitted
Perform clean code of bundles/org.eclipse.ui.views
1 parent 2b23a8f commit e9311a3

13 files changed

+37
-36
lines changed

bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/contentoutline/ContentOutline.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ public class ContentOutline extends PageBookView implements ISelectionProvider,
9696
/**
9797
* Message to show on the default page.
9898
*/
99-
private String defaultText =ContentOutlineMessages.ContentOutline_noOutline;
99+
private final String defaultText =ContentOutlineMessages.ContentOutline_noOutline;
100100

101101
/**
102102
* Creates a content outline view with no content outline pages.

bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/contentoutline/ContentOutlinePage.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
* </p>
5454
*/
5555
public abstract class ContentOutlinePage extends Page implements IContentOutlinePage, ISelectionChangedListener {
56-
private ListenerList<ISelectionChangedListener> selectionChangedListeners = new ListenerList<>();
56+
private final ListenerList<ISelectionChangedListener> selectionChangedListeners = new ListenerList<>();
5757

5858
private TreeViewer treeViewer;
5959

bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/ComboBoxPropertyDescriptor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public class ComboBoxPropertyDescriptor extends PropertyDescriptor {
4848
/**
4949
* The labels to display in the combo box
5050
*/
51-
private String[] labels;
51+
private final String[] labels;
5252

5353
/**
5454
* Creates an property descriptor with the given id, display name, and list

bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/CopyPropertyAction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
/**
3232
* System clipboard
3333
*/
34-
private Clipboard clipboard;
34+
private final Clipboard clipboard;
3535

3636
/**
3737
* Creates the action.

bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/NewPropertySheetHandler.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ public Object execute(ExecutionEvent event) throws ExecutionException {
6262
try {
6363
PropertySheet sheet = findPropertySheet(event, context);
6464
sheet.show(context);
65-
if (activePart instanceof PropertySheet) {
66-
PropertySheet parent = (PropertySheet) activePart;
65+
if (activePart instanceof PropertySheet parent) {
6766
parent.setPinned(true);
6867
} else if(!sheet.isPinned()) {
6968
sheet.setPinned(PIN_NEW_PROPERTY_VIEW);
@@ -84,8 +83,7 @@ public Object execute(ExecutionEvent event) throws ExecutionException {
8483
protected PropertyShowInContext getShowInContext(ExecutionEvent event)
8584
throws ExecutionException {
8685
IWorkbenchPart activePart = HandlerUtil.getActivePartChecked(event);
87-
if (activePart instanceof PropertySheet) {
88-
PropertySheet sheet = (PropertySheet) activePart;
86+
if (activePart instanceof PropertySheet sheet) {
8987
return (PropertyShowInContext) sheet.getShowInContext();
9088
}
9189
IShowInSource adapter = Adapters.adapt(activePart, IShowInSource.class);

bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertyDescriptor.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ public class PropertyDescriptor implements IPropertyDescriptor {
5656
/**
5757
* The property id.
5858
*/
59-
private Object id;
59+
private final Object id;
6060

6161
/**
6262
* The name to display for the property.
6363
*/
64-
private String display;
64+
private final String display;
6565

6666
/**
6767
* Category name, or <code>null</code> if none (the default).

bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheet.java

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public class PropertySheet extends PageBookView
119119
/**
120120
* Message to show on the default page.
121121
*/
122-
private String defaultText = PropertiesMessages.PropertyViewer_noProperties;
122+
private final String defaultText = PropertiesMessages.PropertyViewer_noProperties;
123123

124124
/**
125125
* The initial selection when the property sheet opens
@@ -410,8 +410,9 @@ protected boolean isImportant(IWorkbenchPart part) {
410410
@Override
411411
public void partClosed(IWorkbenchPart part) {
412412
if (part.equals(currentPart)) {
413-
if (isPinned())
413+
if (isPinned()) {
414414
pinPropertySheetAction.setChecked(false);
415+
}
415416
currentSelection = null;
416417
currentPart = null;
417418
}
@@ -656,8 +657,7 @@ public ShowInContext getShowInContext() {
656657
@Override
657658
public boolean show(ShowInContext aContext) {
658659
if (!isPinned()
659-
&& aContext instanceof PropertyShowInContext) {
660-
PropertyShowInContext context = (PropertyShowInContext) aContext;
660+
&& aContext instanceof PropertyShowInContext context) {
661661
IWorkbenchPart part = context.getPart();
662662
if (part != null) {
663663
partActivated(part);
@@ -689,8 +689,9 @@ private HashSet<String> getIgnoredViews() {
689689
for (IConfigurationElement element : elements) {
690690
if ("excludeSources".equalsIgnoreCase(element.getName())) { //$NON-NLS-1$
691691
String id = element.getAttribute("id"); //$NON-NLS-1$
692-
if (id != null)
692+
if (id != null) {
693693
ignoredViews.add(id);
694+
}
694695
}
695696
}
696697
}

bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetCategory.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
* entries so they are displayed together.
2222
*/
2323
/*package*/class PropertySheetCategory {
24-
private String categoryName;
24+
private final String categoryName;
2525

2626
private List<IPropertySheetEntry> entries = new ArrayList<>();
2727

bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetEntry.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public class PropertySheetEntry extends EventManager implements IPropertySheetEn
9191
* Create the CellEditorListener for this entry. It listens for value
9292
* changes in the CellEditor, and cancel and finish requests.
9393
*/
94-
private ICellEditorListener cellEditorListener = new ICellEditorListener() {
94+
private final ICellEditorListener cellEditorListener = new ICellEditorListener() {
9595
@Override
9696
public void editorValueChanged(boolean oldValidState,
9797
boolean newValidState) {
@@ -438,8 +438,9 @@ protected PropertySheetEntry getParent() {
438438
* @since 3.1 (was previously private)
439439
*/
440440
protected IPropertySource getPropertySource(Object object) {
441-
if (sources.containsKey(object))
441+
if (sources.containsKey(object)) {
442442
return sources.get(object);
443+
}
443444

444445
IPropertySource result = null;
445446
IPropertySourceProvider provider = propertySourceProvider;
@@ -608,8 +609,7 @@ public void resetPropertyValue() {
608609
IPropertySource source = getPropertySource(object);
609610
if (source.isPropertySet(descriptor.getId())) {
610611
// fix for https://bugs.eclipse.org/bugs/show_bug.cgi?id=21756
611-
if (source instanceof IPropertySource2) {
612-
IPropertySource2 extendedSource = (IPropertySource2) source;
612+
if (source instanceof IPropertySource2 extendedSource) {
613613
// continue with next if property is not resettable
614614
if (!extendedSource.isPropertyResettable(descriptor.getId())) {
615615
continue;

bundles/org.eclipse.ui.views/src/org/eclipse/ui/views/properties/PropertySheetPage.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,8 +219,9 @@ private Object getFirstContext(Object helpContext, HelpEvent e) {
219219
Object[] contexts;
220220
contexts = (Object[]) helpContext;
221221

222-
if (contexts.length > 0)
222+
if (contexts.length > 0) {
223223
return contexts[0];
224+
}
224225
return null;
225226
}
226227
});

0 commit comments

Comments
 (0)