@@ -107,8 +107,9 @@ public Object[] getElements(Object inputElement) {
107
107
108
108
@ Override
109
109
public Object [] getChildren (Object inputElement ) {
110
- if (selectedContext == null )
110
+ if (selectedContext == null ) {
111
111
return EMPTY_RESULT ;
112
+ }
112
113
113
114
if (inputElement == LOCAL_VALUE_NODE ) {
114
115
Collection <Object > result = new ArrayList <>();
@@ -118,12 +119,13 @@ public Object[] getChildren(Object inputElement) {
118
119
// For context function, we have to compute the value (if possible),
119
120
// and display it as a standard value
120
121
Map <String , Object > cfValues = new HashMap <>();
121
- for (String key : selectedContext .localContextFunction ().keySet ())
122
+ for (String key : selectedContext .localContextFunction ().keySet ()) {
122
123
try {
123
124
cfValues .put (key , selectedContext .get (key ));
124
125
} catch (Throwable e ) {
125
126
cfValues .put (key , NO_VALUE_COULD_BE_COMPUTED + " (Exception : " + e .getClass ().getName () + ")" ); //$NON-NLS-1$ //$NON-NLS-2$
126
127
}
128
+ }
127
129
result .addAll (cfValues .entrySet ());
128
130
return result .toArray ();
129
131
@@ -139,8 +141,9 @@ public Object[] getChildren(Object inputElement) {
139
141
140
142
if (selectedContext .getRawListenerNames () != null ) {
141
143
for (String name : selectedContext .getRawListenerNames ()) {
142
- if (!localKeys .contains (name ) && !localContextFunctionsKeys .contains (name ))
144
+ if (!localKeys .contains (name ) && !localContextFunctionsKeys .contains (name )) {
143
145
result .add (name );
146
+ }
144
147
}
145
148
}
146
149
return result .isEmpty () ? new String [] { NO_VALUES_FOUND } : result .toArray ();
@@ -164,8 +167,9 @@ public void setDisplayKey(boolean k) {
164
167
@ Override
165
168
@ SuppressWarnings ("unchecked" )
166
169
public String getText (Object element ) {
167
- if (selectedContext == null )
170
+ if (selectedContext == null ) {
168
171
return null ;
172
+ }
169
173
170
174
if (element instanceof Map .Entry ) {
171
175
Map .Entry <String , Object > mapEntry = (Map .Entry <String , Object >) element ;
@@ -176,14 +180,16 @@ public String getText(Object element) {
176
180
// value in value
177
181
String txt = super .getText (element );
178
182
if (displayKey ) {
179
- if (txt .contains ("#" )) //$NON-NLS-1$
183
+ if (txt .contains ("#" )) { //$NON-NLS-1$
180
184
return INJECTED_IN_METHOD ;
181
- else if (txt .contains ("@" )) //$NON-NLS-1$
185
+ } else if (txt .contains ("@" )) { //$NON-NLS-1$
182
186
return UPDATED_IN_CLASS ;
183
- else
187
+ } else {
184
188
return INJECTED_IN_FIELD ;
185
- } else
189
+ }
190
+ } else {
186
191
return txt ;
192
+ }
187
193
}
188
194
189
195
return displayKey ? super .getText (element ) : null ;
@@ -194,8 +200,9 @@ public Color getForeground(Object element) {
194
200
// Return magenta color if the value could not be yet computed (for
195
201
// context functions)
196
202
String s = getText (element );
197
- if ((s != null ) && s .startsWith (NO_VALUE_COULD_BE_COMPUTED ))
203
+ if ((s != null ) && s .startsWith (NO_VALUE_COULD_BE_COMPUTED )) {
198
204
return COLOR_IF_NOT_COMPUTED ;
205
+ }
199
206
200
207
// Return blue color if the string matches the search
201
208
return (contextFilter .matchText (s )) ? COLOR_IF_FOUND : null ;
@@ -210,8 +217,9 @@ public Font getFont(Object element) {
210
217
211
218
@ Override
212
219
public Image getImage (Object element ) {
213
- if (!displayKey ) // No image in value column, only in key column
220
+ if (!displayKey ) { // No image in value column, only in key column
214
221
return null ;
222
+ }
215
223
216
224
if (element == LOCAL_VALUE_NODE ) {
217
225
return selectedContext == null ? null : imgReg .get (LOCAL_VARIABLE_IMG_KEY );
@@ -225,17 +233,18 @@ public Image getImage(Object element) {
225
233
// value in value column
226
234
String txt = super .getText (element );
227
235
228
- if (txt .contains ("#" )) //$NON-NLS-1$
236
+ if (txt .contains ("#" )) { //$NON-NLS-1$
229
237
return imgReg .get (PUBLIC_METHOD_IMG_KEY );
230
- else if (txt .contains ("@" )) //$NON-NLS-1$
238
+ } else if (txt .contains ("@" )) { //$NON-NLS-1$
231
239
return imgReg .get (CONTEXT_FUNCTION_IMG_KEY );
232
- else
240
+ } else {
233
241
return imgReg .get (PUBLIC_FIELD_IMG_KEY );
242
+ }
234
243
235
244
} else if (element instanceof Map .Entry ) {
236
- if (isAContextKeyFunction (element ))
245
+ if (isAContextKeyFunction (element )) {
237
246
return imgReg .get (CONTEXT_FUNCTION_IMG_KEY );
238
- else {
247
+ } else {
239
248
// It is a value. If it is injected somewhere, display the
240
249
// inject image
241
250
return hasChildren (element ) ? imgReg .get (INJECT_IMG_KEY ) : imgReg .get (VALUE_IN_CONTEXT_IMG_KEY );
@@ -262,11 +271,12 @@ public String getToolTipText(Object element) {
262
271
263
272
return Messages .ContextDataProvider_26 + fname ;
264
273
} else {
265
- if (hasChildren (element ))
274
+ if (hasChildren (element )) {
266
275
return Messages .ContextDataProvider_27 ;
267
- else {
268
- if (element instanceof Map .Entry )
276
+ } else {
277
+ if (element instanceof Map .Entry ) {
269
278
return Messages .ContextDataProvider_28 ;
279
+ }
270
280
}
271
281
272
282
}
@@ -303,8 +313,9 @@ boolean isAContextKeyFunction(Object element) {
303
313
304
314
@ Override
305
315
public Object getParent (Object element ) {
306
- if (element == LOCAL_VALUE_NODE || element == INHERITED_INJECTED_VALUE_NODE )
316
+ if (element == LOCAL_VALUE_NODE || element == INHERITED_INJECTED_VALUE_NODE ) {
307
317
return null ;
318
+ }
308
319
309
320
// Not computed
310
321
return null ;
0 commit comments