Skip to content

Commit

Permalink
Code cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
Mailaender committed Oct 26, 2023
1 parent 1b9c729 commit fa9f4b1
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ protected boolean dispatchEvents() {
public static Display getDisplay(Widget widget) {

Display display = null;
if(widget instanceof Control) {
display = ((Control)widget).getDisplay();
if(widget instanceof Control control) {
display = control.getDisplay();
} else {
display = getDisplay();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2019, 2022 Lablicate GmbH.
* Copyright (c) 2019, 2023 Lablicate GmbH.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
Expand All @@ -13,6 +13,7 @@
package org.eclipse.chemclipse.ux.extension.ui.swt;

import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
Expand Down Expand Up @@ -120,8 +121,9 @@ private static File[] filterRoots(File[] roots) {

List<File> rootFiles = new ArrayList<>();
for(File root : roots) {
if((!PreferenceSupplier.showNetworkShares()) && isWindowsNetworkDriveRoot(root))
if((!PreferenceSupplier.showNetworkShares()) && isWindowsNetworkDriveRoot(root)) {
continue;
}
rootFiles.add(root);
}
return rootFiles.toArray(new File[rootFiles.size()]);
Expand All @@ -143,8 +145,11 @@ private static boolean isWindowsNetworkDriveRoot(File file) {
process.getOutputStream().close();
int exitCode = process.waitFor();
return exitCode == 0;
} catch(Exception e) {
} catch(IOException e) {
logger.error("Failed to detect network drive status for " + driveLetter, e);
} catch(InterruptedException e) {
logger.error(e);
Thread.currentThread().interrupt();
}
return false;
}
Expand Down

0 comments on commit fa9f4b1

Please sign in to comment.