@@ -95,8 +95,9 @@ public void execute(Map<String, Object> properties, ITerminalService.Done done)
9595 } else {
9696 encoding = WorkbenchEncoding .getWorkbenchDefaultEncoding ();
9797 }
98- if (encoding != null && !"" .equals (encoding )) //$NON-NLS-1$
98+ if (encoding != null && !"" .equals (encoding )) { //$NON-NLS-1$
9999 properties .put (ITerminalsConnectorConstants .PROP_ENCODING , encoding );
100+ }
100101 }
101102
102103 // 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)
163164 if ((service != null && service .getSelection () != null )
164165 || properties .containsKey (ITerminalsConnectorConstants .PROP_SELECTION )) {
165166 ISelection selection = (ISelection ) properties .get (ITerminalsConnectorConstants .PROP_SELECTION );
166- if (selection == null && service != null )
167+ if (selection == null && service != null ) {
167168 selection = service .getSelection ();
169+ }
168170 if (selection instanceof IStructuredSelection && !selection .isEmpty ()) {
169171 String dir = null ;
170172 Iterator <?> iter = ((IStructuredSelection ) selection ).iterator ();
@@ -176,31 +178,35 @@ public void execute(Map<String, Object> properties, ITerminalService.Done done)
176178 && bundle .getState () != Bundle .STOPPING ) {
177179 // If the element is not an IResource, try to adapt to IResource
178180 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 )
181183 : null ;
182- if (adapted == null )
184+ if (adapted == null ) {
183185 adapted = Platform .getAdapterManager ().getAdapter (element ,
184186 org .eclipse .core .resources .IResource .class );
185- if (adapted != null )
187+ }
188+ if (adapted != null ) {
186189 element = adapted ;
190+ }
187191 }
188192
189193 if (element instanceof org .eclipse .core .resources .IResource
190194 && ((org .eclipse .core .resources .IResource ) element ).exists ()) {
191195 IPath location = ((org .eclipse .core .resources .IResource ) element ).getLocation ();
192- if (location == null )
196+ if (location == null ) {
193197 continue ;
194- if (location .toFile ().isFile ())
198+ }
199+ if (location .toFile ().isFile ()) {
195200 location = location .removeLastSegments (1 );
201+ }
196202 if (location .toFile ().isDirectory () && location .toFile ().canRead ()) {
197203 dir = location .toFile ().getAbsolutePath ();
198204 break ;
199205 }
200206 }
201207
202208 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 ;
204210 if (f .isDirectory () && f .canRead ()) {
205211 dir = f .getAbsolutePath ();
206212 break ;
@@ -235,8 +241,9 @@ public void execute(Map<String, Object> properties, ITerminalService.Done done)
235241 private String getTerminalTitle (Map <String , Object > properties ) {
236242 // Try to see if the user set a title explicitly via the properties map.
237243 String title = getDefaultTerminalTitle (properties );
238- if (title != null )
244+ if (title != null ) {
239245 return title ;
246+ }
240247
241248 try {
242249 String hostname = InetAddress .getLocalHost ().getHostName ();
@@ -293,8 +300,9 @@ public ITerminalConnector createTerminalConnector(Map<String, Object> properties
293300
294301 // Check for the terminal connector id
295302 String connectorId = (String ) properties .get (ITerminalsConnectorConstants .PROP_TERMINAL_CONNECTOR_ID );
296- if (connectorId == null )
303+ if (connectorId == null ) {
297304 connectorId = "org.eclipse.terminal.connector.local.LocalConnector" ; //$NON-NLS-1$
305+ }
298306
299307 // Extract the process properties using defaults
300308 String image ;
@@ -357,8 +365,9 @@ public ITerminalConnector createTerminalConnector(Map<String, Object> properties
357365
358366 // Set the ECLIPSE_HOME and ECLIPSE_WORKSPACE environment variables
359367 List <String > envpList = new ArrayList <>();
360- if (envp != null )
368+ if (envp != null ) {
361369 envpList .addAll (Arrays .asList (envp ));
370+ }
362371
363372 // ECLIPSE_HOME
364373 String eclipseHomeLocation = System .getProperty ("eclipse.home.location" ); //$NON-NLS-1$
@@ -406,7 +415,7 @@ public ITerminalConnector createTerminalConnector(Map<String, Object> properties
406415 if (properties .containsKey (ITerminalsConnectorConstants .PROP_PROCESS_MERGE_ENVIRONMENT )) {
407416 Object value = properties .get (ITerminalsConnectorConstants .PROP_PROCESS_MERGE_ENVIRONMENT );
408417 processSettings
409- .setMergeWithNativeEnvironment (value instanceof Boolean ? (( Boolean ) value ) .booleanValue () : false );
418+ .setMergeWithNativeEnvironment (value instanceof Boolean b ? b .booleanValue () : false );
410419 }
411420
412421 // And save the settings to the store
0 commit comments