|
17 | 17 | import com.intellij.util.ui.ColumnInfo;
|
18 | 18 | import com.intellij.util.ui.ListTableModel;
|
19 | 19 | import com.jetbrains.php.lang.psi.elements.*;
|
| 20 | +import fr.adrienbrault.idea.symfony2plugin.Settings; |
20 | 21 | import fr.adrienbrault.idea.symfony2plugin.Symfony2Icons;
|
21 | 22 | import fr.adrienbrault.idea.symfony2plugin.action.ServiceActionUtil;
|
22 | 23 | import fr.adrienbrault.idea.symfony2plugin.dic.ContainerService;
|
@@ -111,10 +112,24 @@ public void init() {
|
111 | 112 | new IsServiceColumn()
|
112 | 113 | );
|
113 | 114 |
|
114 |
| - // default is xml |
115 |
| - radioButtonOutXml.setSelected(true); |
| 115 | + // set default output language on last user selection |
| 116 | + String lastServiceGeneratorLanguage = Settings.getInstance(project).lastServiceGeneratorLanguage; |
| 117 | + if ("xml".equalsIgnoreCase(lastServiceGeneratorLanguage)) { |
| 118 | + radioButtonOutXml.setSelected(true); |
| 119 | + } else if ("yaml".equalsIgnoreCase(lastServiceGeneratorLanguage)) { |
| 120 | + radioButtonOutYaml.setSelected(true); |
| 121 | + } |
| 122 | + |
| 123 | + // overwrite language output on direct file context |
116 | 124 | if(this.psiFile instanceof YAMLFile) {
|
117 | 125 | radioButtonOutYaml.setSelected(true);
|
| 126 | + } else if(this.psiFile instanceof XmlFile) { |
| 127 | + radioButtonOutXml.setSelected(true); |
| 128 | + } |
| 129 | + |
| 130 | + // lets use yaml as default |
| 131 | + if(!radioButtonOutYaml.isSelected() && !radioButtonOutXml.isSelected()) { |
| 132 | + radioButtonOutYaml.setSelected(true); |
118 | 133 | }
|
119 | 134 |
|
120 | 135 | this.tableView = new TableView<>();
|
@@ -307,6 +322,9 @@ private void generateServiceDefinition() {
|
307 | 322 | outputType = ServiceBuilder.OutputType.Yaml;
|
308 | 323 | }
|
309 | 324 |
|
| 325 | + // save last selection |
| 326 | + Settings.getInstance(project).lastServiceGeneratorLanguage = outputType.toString().toLowerCase(); |
| 327 | + |
310 | 328 | textAreaOutput.setText(createServiceAsText(outputType));
|
311 | 329 | }
|
312 | 330 |
|
|
0 commit comments