@@ -95,8 +95,9 @@ public void execute(Map<String, Object> properties, ITerminalService.Done done)
95
95
} else {
96
96
encoding = WorkbenchEncoding .getWorkbenchDefaultEncoding ();
97
97
}
98
- if (encoding != null && !"" .equals (encoding )) //$NON-NLS-1$
98
+ if (encoding != null && !"" .equals (encoding )) { //$NON-NLS-1$
99
99
properties .put (ITerminalsConnectorConstants .PROP_ENCODING , encoding );
100
+ }
100
101
}
101
102
102
103
// For local terminals, force a new terminal tab each time it is launched,
@@ -163,8 +164,9 @@ public void execute(Map<String, Object> properties, ITerminalService.Done done)
163
164
if ((service != null && service .getSelection () != null )
164
165
|| properties .containsKey (ITerminalsConnectorConstants .PROP_SELECTION )) {
165
166
ISelection selection = (ISelection ) properties .get (ITerminalsConnectorConstants .PROP_SELECTION );
166
- if (selection == null && service != null )
167
+ if (selection == null && service != null ) {
167
168
selection = service .getSelection ();
169
+ }
168
170
if (selection instanceof IStructuredSelection && !selection .isEmpty ()) {
169
171
String dir = null ;
170
172
Iterator <?> iter = ((IStructuredSelection ) selection ).iterator ();
@@ -176,31 +178,35 @@ public void execute(Map<String, Object> properties, ITerminalService.Done done)
176
178
&& bundle .getState () != Bundle .STOPPING ) {
177
179
// If the element is not an IResource, try to adapt to IResource
178
180
if (!(element instanceof org .eclipse .core .resources .IResource )) {
179
- Object adapted = element instanceof IAdaptable
180
- ? (( IAdaptable ) element ) .getAdapter (org .eclipse .core .resources .IResource .class )
181
+ Object adapted = element instanceof IAdaptable i
182
+ ? i .getAdapter (org .eclipse .core .resources .IResource .class )
181
183
: null ;
182
- if (adapted == null )
184
+ if (adapted == null ) {
183
185
adapted = Platform .getAdapterManager ().getAdapter (element ,
184
186
org .eclipse .core .resources .IResource .class );
185
- if (adapted != null )
187
+ }
188
+ if (adapted != null ) {
186
189
element = adapted ;
190
+ }
187
191
}
188
192
189
193
if (element instanceof org .eclipse .core .resources .IResource
190
194
&& ((org .eclipse .core .resources .IResource ) element ).exists ()) {
191
195
IPath location = ((org .eclipse .core .resources .IResource ) element ).getLocation ();
192
- if (location == null )
196
+ if (location == null ) {
193
197
continue ;
194
- if (location .toFile ().isFile ())
198
+ }
199
+ if (location .toFile ().isFile ()) {
195
200
location = location .removeLastSegments (1 );
201
+ }
196
202
if (location .toFile ().isDirectory () && location .toFile ().canRead ()) {
197
203
dir = location .toFile ().getAbsolutePath ();
198
204
break ;
199
205
}
200
206
}
201
207
202
208
if (element instanceof IPath || element instanceof File ) {
203
- File f = element instanceof IPath ? (( IPath ) element ) .toFile () : (File ) element ;
209
+ File f = element instanceof IPath i ? i .toFile () : (File ) element ;
204
210
if (f .isDirectory () && f .canRead ()) {
205
211
dir = f .getAbsolutePath ();
206
212
break ;
@@ -235,8 +241,9 @@ public void execute(Map<String, Object> properties, ITerminalService.Done done)
235
241
private String getTerminalTitle (Map <String , Object > properties ) {
236
242
// Try to see if the user set a title explicitly via the properties map.
237
243
String title = getDefaultTerminalTitle (properties );
238
- if (title != null )
244
+ if (title != null ) {
239
245
return title ;
246
+ }
240
247
241
248
try {
242
249
String hostname = InetAddress .getLocalHost ().getHostName ();
@@ -293,8 +300,9 @@ public ITerminalConnector createTerminalConnector(Map<String, Object> properties
293
300
294
301
// Check for the terminal connector id
295
302
String connectorId = (String ) properties .get (ITerminalsConnectorConstants .PROP_TERMINAL_CONNECTOR_ID );
296
- if (connectorId == null )
303
+ if (connectorId == null ) {
297
304
connectorId = "org.eclipse.terminal.connector.local.LocalConnector" ; //$NON-NLS-1$
305
+ }
298
306
299
307
// Extract the process properties using defaults
300
308
String image ;
@@ -357,8 +365,9 @@ public ITerminalConnector createTerminalConnector(Map<String, Object> properties
357
365
358
366
// Set the ECLIPSE_HOME and ECLIPSE_WORKSPACE environment variables
359
367
List <String > envpList = new ArrayList <>();
360
- if (envp != null )
368
+ if (envp != null ) {
361
369
envpList .addAll (Arrays .asList (envp ));
370
+ }
362
371
363
372
// ECLIPSE_HOME
364
373
String eclipseHomeLocation = System .getProperty ("eclipse.home.location" ); //$NON-NLS-1$
@@ -406,7 +415,7 @@ public ITerminalConnector createTerminalConnector(Map<String, Object> properties
406
415
if (properties .containsKey (ITerminalsConnectorConstants .PROP_PROCESS_MERGE_ENVIRONMENT )) {
407
416
Object value = properties .get (ITerminalsConnectorConstants .PROP_PROCESS_MERGE_ENVIRONMENT );
408
417
processSettings
409
- .setMergeWithNativeEnvironment (value instanceof Boolean ? (( Boolean ) value ) .booleanValue () : false );
418
+ .setMergeWithNativeEnvironment (value instanceof Boolean b ? b .booleanValue () : false );
410
419
}
411
420
412
421
// And save the settings to the store
0 commit comments