import jalview.urls.api.UrlProviderFactoryI;
import jalview.urls.api.UrlProviderI;
import jalview.urls.desktop.DesktopUrlProviderFactory;
+import jalview.util.FileUtils;
import jalview.util.MessageManager;
import jalview.util.Platform;
import jalview.util.UrlConstants;
import javax.swing.JFileChooser;
import javax.swing.JInternalFrame;
import javax.swing.JPanel;
+import javax.swing.JTextField;
import javax.swing.ListSelectionModel;
import javax.swing.RowFilter;
import javax.swing.RowSorter;
public static final String HMMER_PATH = "HMMER_PATH";
+ public static final String CYGWIN_PATH = "CYGWIN_PATH";
+
public static final String HMMSEARCH_DB_PATHS = "HMMSEARCH_DB_PATHS";
public static final String HMMSEARCH_DBS = "HMMSEARCH_DBS";
@Override
public void actionPerformed(ActionEvent e)
{
- validateHMMERPath(true);
+ validateHmmerPath();
}
});
hmmerPath.addFocusListener(new FocusAdapter()
@Override
public void focusLost(FocusEvent e)
{
- validateHMMERPath(true);
+ validateHmmerPath();
+ }
+ });
+ cygwinPath.setText(Cache.getProperty(CYGWIN_PATH));
+ cygwinPath.addActionListener(new ActionListener()
+ {
+ @Override
+ public void actionPerformed(ActionEvent e)
+ {
+ validateCygwinPath();
+ }
+ });
+ cygwinPath.addFocusListener(new FocusAdapter()
+ {
+ @Override
+ public void focusLost(FocusEvent e)
+ {
+ validateCygwinPath();
}
});
Boolean.toString(hmmerBackgroundUniprot.isSelected()));
Cache.applicationProperties.setProperty("SEQUENCES_TO_KEEP",
hmmerSequenceCount.getText());
- Cache.applicationProperties.setProperty(HMMER_PATH,
- hmmerPath.getText());
+ Cache.setOrRemove(HMMER_PATH, hmmerPath.getText());
+ Cache.setOrRemove(CYGWIN_PATH, cygwinPath.getText());
AlignFrame[] frames = Desktop.getAlignFrames();
if (frames != null && frames.length > 0)
{
}
/**
- * Returns true if hmmer path is to a folder that contains an executable
- * hmmbuild or hmmbuild.exe, else false (optionally after showing a warning
- * dialog)
+ * Returns true if the given text field contains a path to a folder that
+ * contains an executable with the given name, else false (after showing a
+ * warning dialog). The executable name will be tried with .exe appended if not
+ * found.
+ *
+ * @param textField
+ * @param executable
*/
- @Override
- protected boolean validateHMMERPath(boolean showWarning)
+ protected boolean validateExecutablePath(JTextField textField, String executable)
{
- String folder = hmmerPath.getText().trim();
+ String folder = textField.getText().trim();
- if (HmmerCommand.getExecutable(HmmerCommand.HMMBUILD, folder) != null)
+ if (FileUtils.getExecutable(executable, folder) != null)
{
return true;
}
- if (showWarning && folder.length() > 0)
+ if (folder.length() > 0)
{
JvOptionPane.showInternalMessageDialog(Desktop.desktop,
- MessageManager.getString("label.hmmbuild_not_found"),
+ MessageManager.formatMessage("label.executable_not_found",
+ executable),
MessageManager.getString("label.invalid_folder"),
JvOptionPane.ERROR_MESSAGE);
}
}
}
+ @Override
+ protected void validateHmmerPath()
+ {
+ validateExecutablePath(hmmerPath, HmmerCommand.HMMBUILD);
+ }
+
+ @Override
+ protected void validateCygwinPath()
+ {
+ validateExecutablePath(cygwinPath, "run");
+ }
+
public class OptionsParam
{
private String name;