unlock(false);
fresh();
}
else if(e.getActionCommand().equals("mkdir"))
{
Creator c = new Creator("Create:", con);
//TODO: do we need this on events? UpdateDaemon.updateRemoteDirGUI();
//fresh();
}
else if(e.getActionCommand().equals("cmd"))
{
if(!(con instanceof FtpConnection))
{
Log.debug("This feature is for ftp only.");
return;
}
int opt = JOptionPane.showOptionDialog(this, "Would you like to type one command or to open a shell?","Question", JOptionPane.DEFAULT_OPTION, JOptionPane.QUESTION_MESSAGE,
new ImageIcon(HImage.getImage(this, Settings.helpImage)), new String[] {"Shell","Command", "Cancel"}, "Command");
if(opt == 1) {
RemoteCommand rc = new RemoteCommand();
}
else if(opt == 0) {
FtpConnection conn = (FtpConnection) con;
Shell s = new Shell(conn.getCommandInputReader(), conn.getCommandOutputStream());
}
//fresh();
}
else if(e.getActionCommand().equals("cd"))
{
PathChanger pthc = new PathChanger("remote");
//fresh();
//String tmp = UITool.getPathFromDialog();
//setPath(tmp);
}
else if(e.getActionCommand().equals("fresh"))
{
fresh();
}
else if(e.getActionCommand().equals("->"))
{
blockedTransfer(-2);
}
else if(e.getActionCommand().equals("<-"))
{
blockedTransfer(-2);
}
else if(e.getActionCommand().equals("list"))
{
try
{
if(!(con instanceof FtpConnection)) {
Log.debug("Can only list FtpConnection output!");
}
PrintStream out = new PrintStream(Settings.ls_out);
for(int i=0; i<((FtpConnection)con).currentListing.size(); i++) {
out.println(((FtpConnection)con).currentListing.get(i));
}
out.flush();
out.close();
java.net.URL url = new java.io.File(Settings.ls_out).toURL();
Displayer d = new Displayer(url, new Font("monospaced",Font.PLAIN, 11));
JFtp.desktop.add(d, new Integer(Integer.MAX_VALUE - 13));
}
catch(java.net.MalformedURLException ex)
{
ex.printStackTrace();
Log.debug("ERROR: Malformed URL!");
}
catch(FileNotFoundException ex2)
{
ex2.printStackTrace();
Log.debug("ERROR: File not found!");
}
}
else if(e.getActionCommand().equals("type") && (!JFtp.uiBlocked))
{
if(!(con instanceof FtpConnection))
{
Log.debug("You can only set the transfer type for ftp connections.");
return;
}
FtpConnection c = (FtpConnection) con;
String t = c.getTypeNow();
boolean ret = false;
if(t.equals(FtpConnection.ASCII))
{
ret = c.type(FtpConnection.BINARY);
}
else if(t.equals(FtpConnection.BINARY))
{
ret = c.type(FtpConnection.EBCDIC);
}
if(t.equals(FtpConnection.EBCDIC) ||
(!ret && !t.equals(FtpConnection.L8)))
{
ret = c.type(FtpConnection.L8);
}
if(!ret)
{
c.type(FtpConnection.ASCII);
Log.debug("Warning: type should be \"I\" if you want to transfer binary files!");
}
Log.debug("Type is now " + c.getTypeNow());
}
else if(e.getActionCommand().equals("que")) /*&& (!JFtp.uiBlocked))*/
{
if(!(con instanceof FtpConnection))