Skip to content

Commit 66588e3

Browse files
eclipse-platform-botakurtakov
authored andcommitted
Perform clean code of bundles/org.eclipse.e4.ui.bindings
1 parent dd1cf23 commit 66588e3

File tree

5 files changed

+16
-18
lines changed

5 files changed

+16
-18
lines changed

bundles/org.eclipse.e4.ui.bindings/src/org/eclipse/e4/ui/bindings/internal/BindingTable.java

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -119,8 +119,7 @@ public int compare(Binding o1, Binding o2) {
119119
private final int countStrokes(final Trigger[] triggers) {
120120
int strokeCount = triggers.length;
121121
for (final Trigger trigger : triggers) {
122-
if (trigger instanceof KeyStroke) {
123-
final KeyStroke keyStroke = (KeyStroke) trigger;
122+
if (trigger instanceof final KeyStroke keyStroke) {
124123
final int modifierKeys = keyStroke.getModifierKeys();
125124
final IKeyLookup lookup = KeyLookupFactory.getDefault();
126125
if ((modifierKeys & lookup.getAlt()) != 0) {
@@ -146,18 +145,18 @@ private final int countStrokes(final Trigger[] triggers) {
146145

147146
public static final BindingComparator BEST_SEQUENCE = new BindingComparator();
148147

149-
private Context tableId;
150-
private ArrayList<Binding> bindings = new ArrayList<>();
151-
private Map<TriggerSequence, Binding> bindingsByTrigger = new HashMap<>();
152-
private Map<ParameterizedCommand, ArrayList<Binding>> bindingsByCommand = new HashMap<>();
153-
private Map<TriggerSequence, ArrayList<Binding>> bindingsByPrefix = new HashMap<>();
154-
private Map<TriggerSequence, ArrayList<Binding>> conflicts = new HashMap<>();
155-
private Map<TriggerSequence, ArrayList<Binding>> orderedBindingsByTrigger = new HashMap<>();
148+
private final Context tableId;
149+
private final ArrayList<Binding> bindings = new ArrayList<>();
150+
private final Map<TriggerSequence, Binding> bindingsByTrigger = new HashMap<>();
151+
private final Map<ParameterizedCommand, ArrayList<Binding>> bindingsByCommand = new HashMap<>();
152+
private final Map<TriggerSequence, ArrayList<Binding>> bindingsByPrefix = new HashMap<>();
153+
private final Map<TriggerSequence, ArrayList<Binding>> conflicts = new HashMap<>();
154+
private final Map<TriggerSequence, ArrayList<Binding>> orderedBindingsByTrigger = new HashMap<>();
156155
private final Map<Binding, Boolean> activeBindings = new HashMap<>();
157156

158157
private IContributionFactory contributionFactory;
159158

160-
private MApplication application;
159+
private final MApplication application;
161160

162161
public BindingTable(Context context, MApplication application) {
163162
tableId = context;

bundles/org.eclipse.e4.ui.bindings/src/org/eclipse/e4/ui/bindings/internal/ContextSet.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public class ContextSet {
2727
public static ContextSet EMPTY = new ContextSet(Collections.<Context> emptyList());
2828

2929
public static class CComp implements Comparator<Context> {
30-
private ContextManager manager;
30+
private final ContextManager manager;
3131

3232
public CComp(ContextManager manager) {
3333
this.manager = manager;
@@ -72,7 +72,7 @@ public static Comparator<Context> getComparator() {
7272
return CONTEXT_COMP;
7373
}
7474

75-
private List<Context> contexts;
75+
private final List<Context> contexts;
7676

7777
public ContextSet(Collection<Context> c) {
7878
contexts = new ArrayList<>(c);

bundles/org.eclipse.e4.ui.bindings/src/org/eclipse/e4/ui/bindings/internal/KeyAssistDialog.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ public class KeyAssistDialog extends PopupDialog {
7070
/**
7171
* The ordered list of command identifiers corresponding to the table.
7272
*/
73-
private List<Binding> bindings = new ArrayList<>();
73+
private final List<Binding> bindings = new ArrayList<>();
7474

7575
/**
7676
* The table containing of the possible completions. This value is <code>null</code> until the
@@ -87,7 +87,7 @@ public class KeyAssistDialog extends PopupDialog {
8787
/**
8888
* The key binding listener for the associated workbench.
8989
*/
90-
private KeyBindingDispatcher workbenchKeyboard;
90+
private final KeyBindingDispatcher workbenchKeyboard;
9191

9292
/**
9393
* A sorted map of conflicts or partial matches to be used when the dialog pops up.
@@ -96,7 +96,7 @@ public class KeyAssistDialog extends PopupDialog {
9696
*/
9797
private Collection<Binding> matches;
9898

99-
private IEclipseContext context;
99+
private final IEclipseContext context;
100100

101101
/**
102102
* Constructs a new instance of <code>KeyAssistDialog</code>. When the dialog is first

bundles/org.eclipse.e4.ui.bindings/src/org/eclipse/e4/ui/bindings/keys/KeyBindingDispatcher.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -331,8 +331,7 @@ public final boolean executeCommand(final ParameterizedCommand parameterizedComm
331331
logger.trace((Throwable) commandException,
332332
"Command exception for: " + parameterizedCommand + " in " //$NON-NLS-1$ //$NON-NLS-2$
333333
+ describe(context));
334-
if (handlerService instanceof HandlerServiceImpl) {
335-
HandlerServiceImpl serviceImpl = (HandlerServiceImpl) handlerService;
334+
if (handlerService instanceof HandlerServiceImpl serviceImpl) {
336335
IEclipseContext serviceContext = serviceImpl.getContext();
337336
if (serviceContext != null) {
338337
StringBuilder sb = new StringBuilder("\n\tExecution context: "); //$NON-NLS-1$

bundles/org.eclipse.e4.ui.bindings/src/org/eclipse/e4/ui/bindings/keys/OutOfOrderVerifyListener.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ final class OutOfOrderVerifyListener implements VerifyKeyListener {
3838
/**
3939
* The listener that will be chained in if the verify event has not been eaten yet.
4040
*/
41-
private OutOfOrderListener chainedListener;
41+
private final OutOfOrderListener chainedListener;
4242

4343
/**
4444
* Constructs a new instance of <code>OutOfOrderVerifyListener</code> with the listener that

0 commit comments

Comments
 (0)