diff --git a/uk/ac/sanger/artemis/components/filetree/LocalAndRemoteFileManager.java b/uk/ac/sanger/artemis/components/filetree/LocalAndRemoteFileManager.java index 810e917ee4f5618deaab256c56a838c9b7f128bd..b2dfc49434b6271f180be22ef0e68c3206354a47 100644 --- a/uk/ac/sanger/artemis/components/filetree/LocalAndRemoteFileManager.java +++ b/uk/ac/sanger/artemis/components/filetree/LocalAndRemoteFileManager.java @@ -75,7 +75,11 @@ public class LocalAndRemoteFileManager extends JFrame JScrollPane remoteTree = new JScrollPane(sshtree); remotePanel.add(remoteTree,BorderLayout.CENTER); - final JLabel remote_status_line = getStatusLabel("REMOTE"); + String remote_name = SshLogin.getHostname(); + if(!SshLogin.getPort().equals("")) + remote_name = remote_name + ":" + SshLogin.getPort(); + + final JLabel remote_status_line = getStatusLabel("REMOTE "+remote_name); remotePanel.add(remote_status_line,BorderLayout.NORTH); final JSplitPane treePane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, diff --git a/uk/ac/sanger/artemis/components/filetree/SshFileTree.java b/uk/ac/sanger/artemis/components/filetree/SshFileTree.java index f3b6c3dd66376cab442903928f1887327ba5f1fd..bb433d4a10ea0b2e49d2c94c83964b84e26ad891 100644 --- a/uk/ac/sanger/artemis/components/filetree/SshFileTree.java +++ b/uk/ac/sanger/artemis/components/filetree/SshFileTree.java @@ -402,8 +402,12 @@ public class SshFileTree extends JTree implements DragGestureListener, final RemoteFileNode node, final RemoteFileNode parentNode) { setCursor(cbusy); - node.rename(pathToNewFile+"/"+newfile); + boolean lrename = node.rename(pathToNewFile+"/"+newfile); setCursor(cdone); + + if(!lrename) + return; + Runnable deleteFileFromTree = new Runnable() { public void run () @@ -782,9 +786,11 @@ public class SshFileTree extends JTree implements DragGestureListener, exploreNode(fdropPath); if(!nodeExists(fdropPath,serverName)) + { rename(fn.getRootDir(),fn.getFullName(), fdropPath.getPathName(), dropFile, fn, fdropPath); + } } } catch(Exception ex){} diff --git a/uk/ac/sanger/artemis/j2ssh/SshFileManager.java b/uk/ac/sanger/artemis/j2ssh/SshFileManager.java index 9588bc8a1b1ac7bed1fa6c0c2929f222cfb60da2..f9e36b0ccbe89daa54876a9be13eff7cedf3c14e 100644 --- a/uk/ac/sanger/artemis/j2ssh/SshFileManager.java +++ b/uk/ac/sanger/artemis/j2ssh/SshFileManager.java @@ -146,6 +146,7 @@ public class SshFileManager } catch(IOException ioe) { + rescue(); ioe.printStackTrace(); return false; } @@ -163,6 +164,7 @@ public class SshFileManager } catch(IOException ioe) { + rescue(); ioe.printStackTrace(); return false; } @@ -181,6 +183,7 @@ public class SshFileManager } catch(IOException ioe) { + rescue(); ioe.printStackTrace(); } @@ -198,8 +201,7 @@ public class SshFileManager catch(IOException ioe) { rescue(); - rename(old_file, new_file); - ioe.printStackTrace(); +// ioe.printStackTrace(); return false; } @@ -243,6 +245,7 @@ public class SshFileManager } catch(IOException ioe) { + rescue(); // remote file doesn't exist } @@ -257,6 +260,7 @@ public class SshFileManager } catch(IOException ioe) { + rescue(); ioe.printStackTrace(); return false; } @@ -284,6 +288,7 @@ public class SshFileManager } catch(IOException ioe) { + rescue(); ioe.printStackTrace(); return null; } diff --git a/uk/ac/sanger/artemis/j2ssh/SshLogin.java b/uk/ac/sanger/artemis/j2ssh/SshLogin.java index a01214898787cbdeb314a4833e95200ee6ed71c6..b4f00da8b22128c19206a8661be1e5e4fd49c54b 100644 --- a/uk/ac/sanger/artemis/j2ssh/SshLogin.java +++ b/uk/ac/sanger/artemis/j2ssh/SshLogin.java @@ -1,4 +1,4 @@ -/* ExternalProgram.java +/* SshLogin.java * * created: Aug 2005 * @@ -95,7 +95,7 @@ public class SshLogin public SshClient getSshClient() { - if(ssh == null) + if(ssh == null || !ssh.isConnected()) { try { @@ -111,6 +111,16 @@ public class SshLogin return ufield.getText().trim(); } + public static String getHostname() + { + return hostfield.getText().trim(); + } + + public static String getPort() + { + return portfield.getText().trim(); + } + public static Properties getProperties() { return settings; @@ -126,11 +136,15 @@ public class SshLogin { SshClient ssh = null; int result = AuthenticationProtocolState.FAILED; + int count = 0; while(result != AuthenticationProtocolState.COMPLETE) { - if(!setLogin()) - return null; + if( !(count == 0 && pfield.getPassword().length > 0) ) + { + if(!setLogin()) + return null; + } // Create a password authentication instance PasswordAuthenticationClient pwd = new PasswordAuthenticationClient();