|
|
|
@ -7,6 +7,7 @@ import com.fr.data.security.ssh.SshException;
|
|
|
|
|
import com.fr.data.security.ssh.SshType; |
|
|
|
|
import com.fr.data.security.ssh.impl.KeyVerifySsh; |
|
|
|
|
import com.fr.data.security.ssh.impl.NormalSsh; |
|
|
|
|
import com.fr.data.security.ssl.SslUtils; |
|
|
|
|
import com.fr.design.border.UITitledBorder; |
|
|
|
|
import com.fr.design.constants.UIConstants; |
|
|
|
|
import com.fr.design.dialog.BasicPane; |
|
|
|
@ -25,7 +26,6 @@ import com.fr.file.FILE;
|
|
|
|
|
import com.fr.file.FILEChooserPane; |
|
|
|
|
import com.fr.file.filter.ChooseFileFilter; |
|
|
|
|
import com.fr.stable.StringUtils; |
|
|
|
|
import com.fr.stable.project.ProjectConstants; |
|
|
|
|
import com.fr.third.guava.collect.HashBiMap; |
|
|
|
|
|
|
|
|
|
import javax.swing.ImageIcon; |
|
|
|
@ -131,7 +131,7 @@ public class SshPane extends BasicPane {
|
|
|
|
|
fileChooserButton.addActionListener(new ActionListener() { |
|
|
|
|
@Override |
|
|
|
|
public void actionPerformed(ActionEvent e) { |
|
|
|
|
FILEChooserPane fileChooser = FILEChooserPane.getInstanceWithDesignatePath(ProjectConstants.RESOURCES_NAME, new ChooseFileFilter(true)); |
|
|
|
|
FILEChooserPane fileChooser = FILEChooserPane.getInstanceWithDesignatePath(SslUtils.PREFIX, new ChooseFileFilter(true), SslUtils.CERTIFICATES); |
|
|
|
|
int type = fileChooser.showOpenDialog(SshPane.this, StringUtils.EMPTY); |
|
|
|
|
if (type == FILEChooserPane.OK_OPTION) { |
|
|
|
|
final FILE file = fileChooser.getSelectedFILE(); |
|
|
|
@ -142,6 +142,7 @@ public class SshPane extends BasicPane {
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
fileChooser.removeAllFilter(); |
|
|
|
|
fileChooser.removeTopPath(); |
|
|
|
|
} |
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
@ -241,7 +242,6 @@ public class SshPane extends BasicPane {
|
|
|
|
|
public static class KeyFileUITextField extends UITextField { |
|
|
|
|
private static final Pattern ERROR_START = Pattern.compile("^([/\\\\.]+).*"); |
|
|
|
|
private static final Pattern MUTI_DOT = Pattern.compile("\\.+"); |
|
|
|
|
private static final String PREFIX = ProjectConstants.RESOURCES_NAME + "/"; |
|
|
|
|
private static final String UPPER = ".."; |
|
|
|
|
|
|
|
|
|
public KeyFileUITextField(int columns) { |
|
|
|
@ -283,7 +283,7 @@ public class SshPane extends BasicPane {
|
|
|
|
|
public String getText() { |
|
|
|
|
// 获取的时候,不为空,给他加上前缀就好了,否则还是空
|
|
|
|
|
if (!StringUtils.isEmpty(super.getText())) { |
|
|
|
|
return PREFIX + super.getText(); |
|
|
|
|
return SslUtils.PREFIX + super.getText(); |
|
|
|
|
} |
|
|
|
|
return StringUtils.EMPTY; |
|
|
|
|
} |
|
|
|
@ -291,8 +291,8 @@ public class SshPane extends BasicPane {
|
|
|
|
|
@Override |
|
|
|
|
public void setText(String text) { |
|
|
|
|
// 设置的时候,不为空,说明文件指定了(文件需要是resource下),替换掉前缀
|
|
|
|
|
if (!StringUtils.isEmpty(text) && text.startsWith(PREFIX)) { |
|
|
|
|
super.setText(text.replaceFirst(PREFIX, "")); |
|
|
|
|
if (!StringUtils.isEmpty(text) && text.startsWith(SslUtils.PREFIX)) { |
|
|
|
|
super.setText(text.replaceFirst(SslUtils.PREFIX, "")); |
|
|
|
|
} else { |
|
|
|
|
super.setText(text); |
|
|
|
|
} |
|
|
|
|