@Override
public void actionPerformed(ActionEvent e)
{
- if (chimeraPath.getText().trim().length() > 0)
- {
- File f = new File(chimeraPath.getText());
- if (!f.canExecute())
- {
- JOptionPane.showInternalMessageDialog(Desktop.desktop,
- MessageManager.getString("label.invalid_path"),
- MessageManager.getString("label.invalid_name"),
- JOptionPane.ERROR_MESSAGE);
- }
- }
+ validateChimeraPath();
}
});
*/
public void ok_actionPerformed(ActionEvent e)
{
+ if (!validateSettings())
+ {
+ return;
+ }
+
/*
* Save Visual settings
*/
}
/**
+ * Do any necessary validation before saving settings.
+ *
+ * @return
+ */
+ private boolean validateSettings()
+ {
+ if (!validateStructure())
+ {
+ structureTab.requestFocusInWindow();
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ protected boolean validateStructure()
+ {
+ return validateChimeraPath();
+
+ }
+ /**
* DOCUMENT ME!
*/
public void startupFileTextfield_mouseClicked()
userIdWidthlabel.setEnabled(!autoIdWidth.isSelected());
}
+ /**
+ * Returns true if chimera path is to a valid executable, else show an error
+ * dialog.
+ */
+ private boolean validateChimeraPath()
+ {
+ if (chimeraPath.getText().trim().length() > 0)
+ {
+ File f = new File(chimeraPath.getText());
+ if (!f.canExecute())
+ {
+ JOptionPane.showInternalMessageDialog(Desktop.desktop,
+ MessageManager.getString("label.invalid_chimera_path"),
+ MessageManager.getString("label.invalid_name"),
+ JOptionPane.ERROR_MESSAGE);
+ return false;
+ }
+ }
+ return true;
+ }
+
}