Skip to content

Commit 312eb3b

Browse files
eclipse-platform-botakurtakov
authored andcommitted
Perform clean code of bundles/org.eclipse.ui.views.properties.tabbed
1 parent 8cc6d1b commit 312eb3b

File tree

9 files changed

+26
-31
lines changed

9 files changed

+26
-31
lines changed

bundles/org.eclipse.ui.views.properties.tabbed/src/org/eclipse/ui/internal/views/properties/tabbed/css/TabbedPropertyListCssPropertyHandler.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,11 @@ public class TabbedPropertyListCssPropertyHandler extends AbstractCSSPropertySWT
3030
@Override
3131
protected void applyCSSProperty(Control control, String property, CSSValue value, String pseudo, CSSEngine engine)
3232
throws Exception {
33-
if (!(control instanceof TabbedPropertyList) || property == null
33+
if (!(control instanceof TabbedPropertyList list) || property == null
3434
|| value.getCssValueType() != CSSValue.CSS_PRIMITIVE_VALUE) {
3535
return;
3636
}
3737

38-
TabbedPropertyList list = (TabbedPropertyList) control;
3938
Color color = CSSSWTColorHelper.getSWTColor(value, control.getDisplay());
4039

4140
switch (property) {

bundles/org.eclipse.ui.views.properties.tabbed/src/org/eclipse/ui/internal/views/properties/tabbed/css/TabbedPropertyTitleCssPropertyHandler.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,11 @@ public TabbedPropertyTitleCssPropertyHandler() {
4141
@Override
4242
protected void applyCSSProperty(Control control, String property, CSSValue value, String pseudo, CSSEngine engine)
4343
throws Exception {
44-
if (!(control instanceof TabbedPropertyTitle) || value.getCssValueType() != CSSValue.CSS_PRIMITIVE_VALUE
44+
if (!(control instanceof TabbedPropertyTitle title) || value.getCssValueType() != CSSValue.CSS_PRIMITIVE_VALUE
4545
|| property == null || !cssPropertyToSWTProperty.containsKey(property)) {
4646
return;
4747
}
4848

49-
TabbedPropertyTitle title = (TabbedPropertyTitle) control;
5049
title.setColor(cssPropertyToSWTProperty.get(property), CSSSWTColorHelper.getRGBA(value));
5150
}
5251

bundles/org.eclipse.ui.views.properties.tabbed/src/org/eclipse/ui/internal/views/properties/tabbed/view/SectionDescriptor.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -57,19 +57,19 @@ public class SectionDescriptor extends AbstractSectionDescriptor {
5757

5858
private static final String ELEMENT_INPUT = "input"; //$NON-NLS-1$
5959

60-
private String id;
60+
private final String id;
6161

62-
private String targetTab;
62+
private final String targetTab;
6363

64-
private String afterSection;
64+
private final String afterSection;
6565

6666
private List<String> inputTypes;
6767

6868
private IFilter filter;
6969

7070
private int enablesFor = ENABLES_FOR_ANY;
7171

72-
private IConfigurationElement configurationElement;
72+
private final IConfigurationElement configurationElement;
7373

7474
/**
7575
* Constructor for the section descriptor.

bundles/org.eclipse.ui.views.properties.tabbed/src/org/eclipse/ui/internal/views/properties/tabbed/view/TabbedPropertyComposite.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
public class TabbedPropertyComposite
3131
extends Composite {
3232

33-
private TabbedPropertySheetWidgetFactory factory;
33+
private final TabbedPropertySheetWidgetFactory factory;
3434

3535
private Composite mainComposite;
3636

@@ -44,7 +44,7 @@ public class TabbedPropertyComposite
4444

4545
private TabbedPropertyList listComposite;
4646

47-
private boolean displayTitle;
47+
private final boolean displayTitle;
4848

4949
/**
5050
* Constructor for a TabbedPropertyComposite

bundles/org.eclipse.ui.views.properties.tabbed/src/org/eclipse/ui/internal/views/properties/tabbed/view/TabbedPropertyList.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,9 +88,9 @@ public class TabbedPropertyList
8888

8989
private int bottomVisibleIndex = NONE;
9090

91-
private TopNavigationElement topNavigationElement;
91+
private final TopNavigationElement topNavigationElement;
9292

93-
private BottomNavigationElement bottomNavigationElement;
93+
private final BottomNavigationElement bottomNavigationElement;
9494

9595
private int widestLabelIndex = NONE;
9696

@@ -124,16 +124,16 @@ public class TabbedPropertyList
124124

125125
private Color bottomNavigationElementShadowStroke2;
126126

127-
private TabbedPropertySheetWidgetFactory factory;
127+
private final TabbedPropertySheetWidgetFactory factory;
128128

129129
/**
130130
* One of the tabs in the tabbed property list.
131131
*/
132132
public class ListElement extends Canvas {
133133

134-
private ITabItem tab;
134+
private final ITabItem tab;
135135

136-
private int index;
136+
private final int index;
137137

138138
private boolean selected;
139139

bundles/org.eclipse.ui.views.properties.tabbed/src/org/eclipse/ui/internal/views/properties/tabbed/view/TabbedPropertyRegistry.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -519,8 +519,9 @@ public void dispose() {
519519

520520
if (tabDescriptors != null) {
521521
for (ITabDescriptor tabDescriptor : tabDescriptors) {
522-
if (tabDescriptor instanceof TabDescriptor)
522+
if (tabDescriptor instanceof TabDescriptor) {
523523
((TabDescriptor)tabDescriptor).dispose();
524+
}
524525
}
525526
}
526527
}

bundles/org.eclipse.ui.views.properties.tabbed/src/org/eclipse/ui/internal/views/properties/tabbed/view/TabbedPropertyTitle.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public class TabbedPropertyTitle
5151

5252
private static final String TITLE_FONT = "org.eclipse.ui.internal.views.properties.tabbed.view.TabbedPropertyTitle"; //$NON-NLS-1$
5353

54-
private TabbedPropertySheetWidgetFactory factory;
54+
private final TabbedPropertySheetWidgetFactory factory;
5555

5656
/**
5757
* Constructor for TabbedPropertyTitle.

bundles/org.eclipse.ui.views.properties.tabbed/src/org/eclipse/ui/views/properties/tabbed/AbstractSectionDescriptor.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
*/
3232
public abstract class AbstractSectionDescriptor implements ISectionDescriptor {
3333

34-
private TabbedPropertyRegistryClassSectionFilter classFilter;
34+
private final TabbedPropertyRegistryClassSectionFilter classFilter;
3535

3636
/**
3737
* Constructor for AbstractSectionDescriptor.

bundles/org.eclipse.ui.views.properties.tabbed/src/org/eclipse/ui/views/properties/tabbed/TabbedPropertySheetPage.java

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -99,13 +99,13 @@ public class TabbedPropertySheetPage
9999

100100
private Map<ITabDescriptor, TabContents> descriptorToTab;
101101

102-
private Map<TabContents, Composite> tabToComposite;
102+
private final Map<TabContents, Composite> tabToComposite;
103103

104-
private List<String> selectionQueue;
104+
private final List<String> selectionQueue;
105105

106106
private boolean selectionQueueLocked;
107107

108-
private List<ITabSelectionListener> tabSelectionListeners;
108+
private final List<ITabSelectionListener> tabSelectionListeners;
109109

110110
private IWorkbenchWindow cachedWorkbenchWindow;
111111

@@ -114,7 +114,7 @@ public class TabbedPropertySheetPage
114114
/**
115115
* a listener that is interested in part activation events.
116116
*/
117-
private IPartListener partActivationListener = new IPartListener() {
117+
private final IPartListener partActivationListener = new IPartListener() {
118118

119119
@Override
120120
public void partActivated(IWorkbenchPart part) {
@@ -141,7 +141,7 @@ public void partOpened(IWorkbenchPart part) {
141141
private static class TabbedPropertySheetPageContributorFromSelection
142142
implements ITabbedPropertySheetPageContributor {
143143

144-
private String contributorId;
144+
private final String contributorId;
145145

146146
/**
147147
* Constructor that takes in a contributor id taken from a selection.
@@ -522,11 +522,9 @@ public void setActionBars(IActionBars actionBars) {
522522
// Override the undo and redo global action handlers
523523
// to use the contributor action handlers
524524
IActionBars partActionBars = null;
525-
if (contributor instanceof IEditorPart) {
526-
IEditorPart editorPart = (IEditorPart) contributor;
525+
if (contributor instanceof IEditorPart editorPart) {
527526
partActionBars = editorPart.getEditorSite().getActionBars();
528-
} else if (contributor instanceof IViewPart) {
529-
IViewPart viewPart = (IViewPart) contributor;
527+
} else if (contributor instanceof IViewPart viewPart) {
530528
partActionBars = viewPart.getViewSite().getActionBars();
531529
}
532530

@@ -812,8 +810,7 @@ public void removeTabSelectionListener(ITabSelectionListener listener) {
812810
* @since 3.4
813811
*/
814812
public void overrideTabs() {
815-
if (tabListContentProvider instanceof IOverridableTabListContentProvider) {
816-
IOverridableTabListContentProvider overridableTabListContentProvider = (IOverridableTabListContentProvider) tabListContentProvider;
813+
if (tabListContentProvider instanceof IOverridableTabListContentProvider overridableTabListContentProvider) {
817814
overridableTabListContentProvider.overrideTabs();
818815
}
819816
}
@@ -883,11 +880,10 @@ private void validateRegistry(ISelection selection) {
883880
return;
884881
}
885882

886-
if (!(selection instanceof IStructuredSelection)) {
883+
if (!(selection instanceof IStructuredSelection structuredSelection)) {
887884
return;
888885
}
889886

890-
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
891887
if (structuredSelection.isEmpty()) {
892888
return;
893889
}

0 commit comments

Comments
 (0)