Skip to content

Commit 551d1e7

Browse files
committed
migrate forms to use generated code
1 parent 019a477 commit 551d1e7

File tree

3 files changed

+323
-54
lines changed

3 files changed

+323
-54
lines changed

src/main/java/fr/adrienbrault/idea/symfony2plugin/action/ui/ServiceArgumentSelectionDialog.java

+51-12
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
import com.intellij.openapi.ui.ComboBox;
66
import com.intellij.ui.ToolbarDecorator;
77
import com.intellij.ui.table.TableView;
8+
import com.intellij.uiDesigner.core.GridConstraints;
9+
import com.intellij.uiDesigner.core.GridLayoutManager;
10+
import com.intellij.uiDesigner.core.Spacer;
811
import com.intellij.util.ui.ColumnInfo;
912
import com.intellij.util.ui.ListTableModel;
1013
import com.jetbrains.php.lang.psi.elements.PhpClass;
@@ -67,7 +70,7 @@ public void init() {
6770
this.closeButton.addActionListener(e -> onCancel());
6871

6972
this.getRootPane().registerKeyboardAction(e ->
70-
onCancel(),
73+
onCancel(),
7174
KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
7275
JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
7376
);
@@ -97,15 +100,51 @@ private void createUIComponents() {
97100
this.tableView.setModelAndUpdateColumns(this.modelList);
98101

99102
mainPanel.add(ToolbarDecorator.createDecorator(this.tableView)
100-
.disableAddAction()
101-
.disableDownAction()
102-
.disableRemoveAction()
103-
.disableUpDownActions()
104-
.createPanel()
103+
.disableAddAction()
104+
.disableDownAction()
105+
.disableRemoveAction()
106+
.disableUpDownActions()
107+
.createPanel()
105108
);
106109

107110
}
108111

112+
{
113+
// GUI initializer generated by IntelliJ IDEA GUI Designer
114+
// >>> IMPORTANT!! <<<
115+
// DO NOT EDIT OR ADD ANY CODE HERE!
116+
$$$setupUI$$$();
117+
}
118+
119+
/**
120+
* Method generated by IntelliJ IDEA GUI Designer
121+
* >>> IMPORTANT!! <<<
122+
* DO NOT edit this method OR call it in your code!
123+
*
124+
* @noinspection ALL
125+
*/
126+
private void $$$setupUI$$$() {
127+
createUIComponents();
128+
panel1 = new JPanel();
129+
panel1.setLayout(new GridLayoutManager(2, 3, new Insets(5, 5, 5, 5), -1, -1));
130+
generateButton = new JButton();
131+
generateButton.setText("Generate");
132+
panel1.add(generateButton, new GridConstraints(1, 2, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
133+
closeButton = new JButton();
134+
closeButton.setText("Close");
135+
panel1.add(closeButton, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false));
136+
final Spacer spacer1 = new Spacer();
137+
panel1.add(spacer1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false));
138+
panel1.add(mainPanel, new GridConstraints(0, 0, 1, 3, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false));
139+
}
140+
141+
/**
142+
* @noinspection ALL
143+
*/
144+
public JComponent $$$getRootComponent$$$() {
145+
return panel1;
146+
}
147+
109148
private static class ServiceParameter {
110149

111150
private final String classFqn;
@@ -117,7 +156,7 @@ public ServiceParameter(String classFqn, Set<String> possibleServices) {
117156
this.classFqn = classFqn;
118157
this.possibleServices = possibleServices;
119158

120-
if(!possibleServices.isEmpty()) {
159+
if (!possibleServices.isEmpty()) {
121160
currentService = possibleServices.iterator().next();
122161
}
123162

@@ -159,16 +198,16 @@ public NamespaceColumn() {
159198
public String valueOf(ServiceParameter modelParameter) {
160199

161200
String classFqn = modelParameter.getClassFqn();
162-
if(StringUtils.isBlank(classFqn)) {
201+
if (StringUtils.isBlank(classFqn)) {
163202
return "unknown";
164203
}
165204

166-
if(classFqn.startsWith("\\")) {
205+
if (classFqn.startsWith("\\")) {
167206
classFqn = classFqn.substring(1);
168207
}
169208

170209
int i = classFqn.lastIndexOf("\\");
171-
if(i > 0) {
210+
if (i > 0) {
172211
String ns = classFqn.substring(0, i);
173212
String clazz = classFqn.substring(i + 1);
174213
classFqn = String.format("%s [%s]", clazz, ns);
@@ -191,7 +230,7 @@ public String valueOf(ServiceParameter modelParameter) {
191230
return modelParameter.getCurrentService();
192231
}
193232

194-
public void setValue(ServiceParameter modelParameter, String value){
233+
public void setValue(ServiceParameter modelParameter, String value) {
195234
modelParameter.setCurrentService(value);
196235
tableView.getListTableModel().fireTableDataChanged();
197236
}
@@ -225,7 +264,7 @@ public Icon valueOf(ServiceParameter modelParameter) {
225264
return classInterface != null ? classInterface.getIcon() : null;
226265
}
227266

228-
public java.lang.Class getColumnClass() {
267+
public Class getColumnClass() {
229268
return ImageIcon.class;
230269
}
231270

0 commit comments

Comments
 (0)