|
@@ -39,12 +39,14 @@ public class GenerateDialog extends DialogWrapper {
|
39
|
39
|
private JBList _listTables;
|
40
|
40
|
private JBList _listColumns;
|
41
|
41
|
private TextFieldWithBrowseButton _textModels;
|
|
42
|
+ private TextFieldWithBrowseButton _textDataSource;
|
42
|
43
|
private TextFieldWithBrowseButton _textDataSourceTemplate;
|
43
|
44
|
private TextFieldWithBrowseButton _textModelsTemplate;
|
44
|
45
|
private TextFieldWithBrowseButton _textConfigPath;
|
45
|
46
|
private JTextField _textFilesExtension;
|
46
|
|
- private JLabel _lblDataSourceTemplatePath;
|
47
|
47
|
private JLabel _lblModelsPath;
|
|
48
|
+ private JLabel _lblDataSourcePath;
|
|
49
|
+ private JLabel _lblDataSourceTemplatePath;
|
48
|
50
|
private JLabel _lblModelsTemplatePath;
|
49
|
51
|
private TextFieldWithBrowseButton _textCastFile;
|
50
|
52
|
private JLabel _lblCastFile;
|
|
@@ -70,6 +72,7 @@ public class GenerateDialog extends DialogWrapper {
|
70
|
72
|
if (_options != null) {
|
71
|
73
|
showSource(_options.getSelection());
|
72
|
74
|
_textModels.setText(Helper.getAbsolutePath(_project, _options.getModelsRelativePath()));
|
|
75
|
+ _textDataSource.setText(Helper.getAbsolutePath(_project, _options.getDataSourceRelativePath()));
|
73
|
76
|
_textDataSourceTemplate.setText(Helper.getAbsolutePath(_project, _options.getDataSourceTemplateRelativePath()));
|
74
|
77
|
_textModelsTemplate.setText(Helper.getAbsolutePath(_project, _options.getModelsTemplateRelativePath()));
|
75
|
78
|
_textFilesExtension.setText(_options.getFilesExtension());
|
|
@@ -79,6 +82,7 @@ public class GenerateDialog extends DialogWrapper {
|
79
|
82
|
else {
|
80
|
83
|
showSource(null);
|
81
|
84
|
_textModels.setText("");
|
|
85
|
+ _textDataSource.setText("");
|
82
|
86
|
_textDataSourceTemplate.setText("");
|
83
|
87
|
_textModelsTemplate.setText("");
|
84
|
88
|
_textFilesExtension.setText("");
|
|
@@ -92,6 +96,8 @@ public class GenerateDialog extends DialogWrapper {
|
92
|
96
|
protected ValidationInfo doValidate() {
|
93
|
97
|
ValidationInfo info = null;
|
94
|
98
|
File modelDir = _options == null ? null : new File(Helper.getAbsolutePath(_project, _options.getModelsRelativePath()));
|
|
99
|
+ File dataSourcePath = _options == null ? null : new File(Helper.getAbsolutePath(_project, _options.getDataSourceRelativePath()));
|
|
100
|
+ File dataSourceDir = _options == null ? null : new File(dataSourcePath.getParent());
|
95
|
101
|
File dataSourceTemplatePath = _options == null ? null : new File(Helper.getAbsolutePath(_project, _options.getDataSourceTemplateRelativePath()));
|
96
|
102
|
File modelsTemplatePath = _options == null ? null : new File(Helper.getAbsolutePath(_project, _options.getModelsTemplateRelativePath()));
|
97
|
103
|
File configPath = _options == null ? null : new File(_options.getConfigAbsolutePath());
|
|
@@ -104,6 +110,9 @@ public class GenerateDialog extends DialogWrapper {
|
104
|
110
|
else if (!modelDir.exists() || !modelDir.isDirectory()) {
|
105
|
111
|
info = new ValidationInfo("Models folder does not exists", _textModels.getTextField());
|
106
|
112
|
}
|
|
113
|
+ else if (!dataSourceDir.exists() || !dataSourceDir.isDirectory()) {
|
|
114
|
+ info = new ValidationInfo("Data source folder does not exists", _textDataSource.getTextField());
|
|
115
|
+ }
|
107
|
116
|
else if (!dataSourceTemplatePath.exists() || !dataSourceTemplatePath.isFile()) {
|
108
|
117
|
info = new ValidationInfo("Data source template file does not exists", _textDataSourceTemplate.getTextField());
|
109
|
118
|
}
|
|
@@ -157,6 +166,7 @@ public class GenerateDialog extends DialogWrapper {
|
157
|
166
|
});
|
158
|
167
|
|
159
|
168
|
setupTextField(_textModels, null, true, "Models");
|
|
169
|
+ setupTextField(_textDataSource, null, false, "Data Source");
|
160
|
170
|
setupTextField(_textDataSourceTemplate, null, false, "Data Source Template");
|
161
|
171
|
setupTextField(_textModelsTemplate, null, false, "Models Template");
|
162
|
172
|
setupTextField(_textConfigPath, null, false, "Configuration");
|
|
@@ -166,6 +176,11 @@ public class GenerateDialog extends DialogWrapper {
|
166
|
176
|
_options.setModelsRelativePath(Helper.getRelativePath(_project, s));
|
167
|
177
|
_lblModelsPath.setText("$ProjectRoot/" + _options.getModelsRelativePath());
|
168
|
178
|
});
|
|
179
|
+
|
|
180
|
+ setupTextFieldListener(_textDataSource.getTextField(), s -> {
|
|
181
|
+ _options.setDataSourceRelativePath(Helper.getRelativePath(_project, s));
|
|
182
|
+ _lblDataSourcePath.setText("$ProjectRoot/" + _options.getDataSourceRelativePath());
|
|
183
|
+ });
|
169
|
184
|
setupTextFieldListener(_textDataSourceTemplate.getTextField(), s -> {
|
170
|
185
|
_options.setDataSourceTemplateRelativePath(Helper.getRelativePath(_project, s));
|
171
|
186
|
_lblDataSourceTemplatePath.setText("$ProjectRoot/" + _options.getDataSourceTemplateRelativePath());
|