added PY-13384 Create New Project: update depending on location fields on changing location

This commit is contained in:
Ekaterina Tuzova
2014-07-31 18:55:55 +04:00
parent 44a1a63d3c
commit d5cde67b7a
2 changed files with 18 additions and 1 deletions
@@ -155,7 +155,22 @@ abstract public class AbstractProjectSettingsStep extends AbstractActionWithPane
final FileChooserDescriptor descriptor = FileChooserDescriptorFactory.createSingleFolderDescriptor();
myLocationField.addBrowseFolderListener("Select base directory", "Select base directory for the Project",
null, descriptor);
myLocationField.getTextField().getDocument().addDocumentListener(new DocumentAdapter() {
@Override
protected void textChanged(DocumentEvent e) {
if (myProjectGenerator instanceof PythonProjectGenerator) {
String path = myLocationField.getText().trim();
if (path.endsWith(File.separator)) {
path = path.substring(0, path.length() - File.separator.length());
}
int ind = path.lastIndexOf(File.separator);
if (ind != -1) {
String projectName = path.substring(ind + 1, path.length());
((PythonProjectGenerator)myProjectGenerator).locationChanged(projectName);
}
}
}
});
final JLabel locationLabel = new JLabel("Location:");
c.gridx = 0;
c.gridy = 0;