@@ -200,16 +200,15 @@ public IResource getResource() {
200200 if (path != null ) {
201201 IWorkspaceRoot root = ResourcesPlugin .getWorkspace ().getRoot ();
202202 IResource resource = root .findMember (path );
203- if (resource != null && resource instanceof IContainer ) {
203+ if (resource instanceof IContainer container ) {
204204 String resourceName = resourceGroup .getResource ();
205- if (resourceName .length () > 0 ) {
205+ if (! resourceName .isEmpty () ) {
206206 try {
207- return (( IContainer ) resource ) .getFolder (IPath .fromOSString (resourceName ));
207+ return container .getFolder (IPath .fromOSString (resourceName ));
208208 } catch (IllegalArgumentException e ) {
209209 // continue below.
210210 }
211211 }
212- return resource ;
213212 }
214213 return resource ;
215214 }
@@ -238,7 +237,7 @@ private void setupLinkedResourceTarget() {
238237 } else {
239238 IPath path = URIUtil .toPath (existingLink );
240239 if (path != null ) {
241- setDefaultLinkValue = path .toPortableString ().length () > 0 ;
240+ setDefaultLinkValue = ! path .toPortableString ().isEmpty () ;
242241 }
243242 }
244243
@@ -450,10 +449,10 @@ public IFolder createNewFolder() {
450449 op1 .execute (monitor , WorkspaceUndoUtil .getUIInfoAdapter (getShell ()));
451450 } catch (final ExecutionException e ) {
452451 getContainer ().getShell ().getDisplay ().syncExec (() -> {
453- if (e .getCause () instanceof CoreException ) {
452+ if (e .getCause () instanceof CoreException coreException ) {
454453 ErrorDialog .openError (getContainer ().getShell (), // Was Utilities.getFocusShell()
455454 IDEWorkbenchMessages .WizardNewFolderCreationPage_errorTitle , null , // no special message
456- (( CoreException ) e . getCause ()) .getStatus ());
455+ coreException .getStatus ());
457456 } else {
458457 IDEWorkbenchPlugin .log (getClass (), "createNewFolder()" , e .getCause ()); //$NON-NLS-1$
459458 MessageDialog .openError (getContainer ().getShell (),
@@ -771,7 +770,7 @@ private boolean isFilteredByParent() {
771770 if (createVirtualFolder ) {
772771 return false ;
773772 }
774- if (( linkedResourceGroup == null ) || linkedResourceGroup .isEnabled ()) {
773+ if (linkedResourceGroup == null || linkedResourceGroup .isEnabled ()) {
775774 return false ;
776775 }
777776 IPath containerPath = resourceGroup .getContainerFullPath ();
@@ -782,7 +781,7 @@ private boolean isFilteredByParent() {
782781 if (resourceName == null ) {
783782 return false ;
784783 }
785- if (resourceName .length () > 0 ) {
784+ if (! resourceName .isEmpty () ) {
786785 IPath newFolderPath = containerPath .append (resourceName );
787786 if (newFolderPath .segmentCount () < 2 ) {
788787 return false ;
0 commit comments