Skip to content

migrate forms to use generated code #2432

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@
import com.intellij.openapi.ui.ComboBox;
import com.intellij.ui.ToolbarDecorator;
import com.intellij.ui.table.TableView;
import com.intellij.uiDesigner.core.GridConstraints;
import com.intellij.uiDesigner.core.GridLayoutManager;
import com.intellij.uiDesigner.core.Spacer;
import com.intellij.util.ui.ColumnInfo;
import com.intellij.util.ui.ListTableModel;
import com.jetbrains.php.lang.psi.elements.PhpClass;
Expand Down Expand Up @@ -67,7 +70,7 @@ public void init() {
this.closeButton.addActionListener(e -> onCancel());

this.getRootPane().registerKeyboardAction(e ->
onCancel(),
onCancel(),
KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0),
JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT
);
Expand Down Expand Up @@ -97,15 +100,51 @@ private void createUIComponents() {
this.tableView.setModelAndUpdateColumns(this.modelList);

mainPanel.add(ToolbarDecorator.createDecorator(this.tableView)
.disableAddAction()
.disableDownAction()
.disableRemoveAction()
.disableUpDownActions()
.createPanel()
.disableAddAction()
.disableDownAction()
.disableRemoveAction()
.disableUpDownActions()
.createPanel()
);

}

{
// GUI initializer generated by IntelliJ IDEA GUI Designer
// >>> IMPORTANT!! <<<
// DO NOT EDIT OR ADD ANY CODE HERE!
$$$setupUI$$$();
}

/**
* Method generated by IntelliJ IDEA GUI Designer
* >>> IMPORTANT!! <<<
* DO NOT edit this method OR call it in your code!
*
* @noinspection ALL
*/
private void $$$setupUI$$$() {
createUIComponents();
panel1 = new JPanel();
panel1.setLayout(new GridLayoutManager(2, 3, new Insets(5, 5, 5, 5), -1, -1));
generateButton = new JButton();
generateButton.setText("Generate");
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));
closeButton = new JButton();
closeButton.setText("Close");
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));
final Spacer spacer1 = new Spacer();
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));
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));
}

/**
* @noinspection ALL
*/
public JComponent $$$getRootComponent$$$() {
return panel1;
}

private static class ServiceParameter {

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

if(!possibleServices.isEmpty()) {
if (!possibleServices.isEmpty()) {
currentService = possibleServices.iterator().next();
}

Expand Down Expand Up @@ -159,16 +198,16 @@ public NamespaceColumn() {
public String valueOf(ServiceParameter modelParameter) {

String classFqn = modelParameter.getClassFqn();
if(StringUtils.isBlank(classFqn)) {
if (StringUtils.isBlank(classFqn)) {
return "unknown";
}

if(classFqn.startsWith("\\")) {
if (classFqn.startsWith("\\")) {
classFqn = classFqn.substring(1);
}

int i = classFqn.lastIndexOf("\\");
if(i > 0) {
if (i > 0) {
String ns = classFqn.substring(0, i);
String clazz = classFqn.substring(i + 1);
classFqn = String.format("%s [%s]", clazz, ns);
Expand All @@ -191,7 +230,7 @@ public String valueOf(ServiceParameter modelParameter) {
return modelParameter.getCurrentService();
}

public void setValue(ServiceParameter modelParameter, String value){
public void setValue(ServiceParameter modelParameter, String value) {
modelParameter.setCurrentService(value);
tableView.getListTableModel().fireTableDataChanged();
}
Expand Down Expand Up @@ -225,7 +264,7 @@ public Icon valueOf(ServiceParameter modelParameter) {
return classInterface != null ? classInterface.getIcon() : null;
}

public java.lang.Class getColumnClass() {
public Class getColumnClass() {
return ImageIcon.class;
}

Expand Down
Loading