From 318baf99e8572d589e91aaa62f76feef21ef18dc Mon Sep 17 00:00:00 2001 From: Daniel Espendiller Date: Wed, 23 Apr 2025 19:52:14 +0200 Subject: [PATCH] #2427 inline generated form code --- .../idea/symfony2plugin/SettingsForm.java | 149 ++++++++++++++++-- .../profiler/ui/ProfilerSettingsDialog.form | 2 +- .../profiler/ui/ProfilerSettingsDialog.java | 97 +++++++++++- .../ui/ContainerSettingsForm.java | 57 ++++++- .../ui/MethodParameterDialog.form | 2 +- .../ui/MethodParameterDialog.java | 95 ++++++++++- .../MethodParameterReferenceSettingsForm.java | 48 +++++- .../ui/MethodSignatureTypeDialog.form | 2 +- .../ui/MethodSignatureTypeDialog.java | 76 ++++++++- .../ui/MethodSignatureTypeSettingsForm.java | 49 +++++- .../ui/RoutingSettingsForm.form | 2 +- .../ui/RoutingSettingsForm.java | 60 ++++++- .../ui/TwigJsonExampleDialog.form | 2 +- .../ui/TwigJsonExampleDialog.java | 50 ++++++ .../ui/TwigNamespaceDialog.form | 2 +- .../ui/TwigNamespaceDialog.java | 85 +++++++++- .../symfony2plugin/ui/TwigSettingsForm.java | 75 +++++++-- 17 files changed, 774 insertions(+), 79 deletions(-) diff --git a/src/main/java/fr/adrienbrault/idea/symfony2plugin/SettingsForm.java b/src/main/java/fr/adrienbrault/idea/symfony2plugin/SettingsForm.java index 3e7643cd6..f643368f6 100644 --- a/src/main/java/fr/adrienbrault/idea/symfony2plugin/SettingsForm.java +++ b/src/main/java/fr/adrienbrault/idea/symfony2plugin/SettingsForm.java @@ -11,6 +11,11 @@ import com.intellij.openapi.ui.TextFieldWithBrowseButton; import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.uiDesigner.core.GridConstraints; +import com.intellij.uiDesigner.core.GridLayoutManager; +import com.intellij.uiDesigner.core.Spacer; +import com.jgoodies.forms.layout.CellConstraints; +import com.jgoodies.forms.layout.FormLayout; import fr.adrienbrault.idea.symfony2plugin.stubs.util.IndexUtil; import fr.adrienbrault.idea.symfony2plugin.util.IdeHelper; import fr.adrienbrault.idea.symfony2plugin.util.ProjectUtil; @@ -21,6 +26,7 @@ import org.jetbrains.annotations.Nullable; import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; @@ -126,21 +132,21 @@ public void mouseClicked(MouseEvent e) { public boolean isModified() { return !pluginEnabled.isSelected() == getSettings().pluginEnabled - || !pathToTranslationRootTextField.getText().equals(getSettings().pathToTranslation) - || !enableSchedulerCheckBox.isSelected() == getSettings().remoteDevFileScheduler - - || !codeFoldingPhpRoute.isSelected() == getSettings().codeFoldingPhpRoute - || !codeFoldingPhpModel.isSelected() == getSettings().codeFoldingPhpModel - || !codeFoldingPhpTemplate.isSelected() == getSettings().codeFoldingPhpTemplate - || !codeFoldingTwigRoute.isSelected() == getSettings().codeFoldingTwigRoute - || !codeFoldingTwigTemplate.isSelected() == getSettings().codeFoldingTwigTemplate - || !codeFoldingTwigConstant.isSelected() == getSettings().codeFoldingTwigConstant - || !featureTwigIcon.isSelected() == getSettings().featureTwigIcon - || !featureTypeProvider.isSelected() == getSettings().featureTypeProvider - - || !directoryToApp.getText().equals(getSettings().directoryToApp) - || !directoryToWeb.getText().equals(getSettings().directoryToWeb) - ; + || !pathToTranslationRootTextField.getText().equals(getSettings().pathToTranslation) + || !enableSchedulerCheckBox.isSelected() == getSettings().remoteDevFileScheduler + + || !codeFoldingPhpRoute.isSelected() == getSettings().codeFoldingPhpRoute + || !codeFoldingPhpModel.isSelected() == getSettings().codeFoldingPhpModel + || !codeFoldingPhpTemplate.isSelected() == getSettings().codeFoldingPhpTemplate + || !codeFoldingTwigRoute.isSelected() == getSettings().codeFoldingTwigRoute + || !codeFoldingTwigTemplate.isSelected() == getSettings().codeFoldingTwigTemplate + || !codeFoldingTwigConstant.isSelected() == getSettings().codeFoldingTwigConstant + || !featureTwigIcon.isSelected() == getSettings().featureTwigIcon + || !featureTypeProvider.isSelected() == getSettings().featureTypeProvider + + || !directoryToApp.getText().equals(getSettings().directoryToApp) + || !directoryToWeb.getText().equals(getSettings().directoryToWeb) + ; } @Override @@ -251,4 +257,117 @@ public static void show(@NotNull Project project) { ShowSettingsUtilImpl.showSettingsDialog(project, "Symfony2.SettingsForm", null); } + { +// 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$$$() { + panel1 = new JPanel(); + panel1.setLayout(new GridLayoutManager(2, 5, new Insets(0, 0, 0, 0), -1, -1)); + final JPanel panel2 = new JPanel(); + panel2.setLayout(new FormLayout("fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:d:grow,left:4dlu:noGrow,fill:max(d;4px):noGrow,left:4dlu:noGrow,fill:max(d;4px):noGrow", "center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:6dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow,top:4dlu:noGrow,center:max(d;4px):noGrow")); + panel1.add(panel2, new GridConstraints(1, 0, 1, 5, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + directoryToWebLabel = new JLabel(); + directoryToWebLabel.setText("Web Directory"); + CellConstraints cc = new CellConstraints(); + panel2.add(directoryToWebLabel, cc.xy(1, 3)); + directoryToWeb = new TextFieldWithBrowseButton(); + panel2.add(directoryToWeb, cc.xy(3, 3, CellConstraints.FILL, CellConstraints.DEFAULT)); + directoryToWebReset = new JButton(); + directoryToWebReset.setText("Default"); + panel2.add(directoryToWebReset, cc.xy(5, 3)); + final JLabel label1 = new JLabel(); + label1.setText("Translation Root Path"); + panel2.add(label1, cc.xy(1, 1)); + pathToTranslationRootTextField = new TextFieldWithBrowseButton(); + panel2.add(pathToTranslationRootTextField, cc.xy(3, 1, CellConstraints.FILL, CellConstraints.DEFAULT)); + pathToTranslationRootTextFieldReset = new JButton(); + pathToTranslationRootTextFieldReset.setText("Default"); + panel2.add(pathToTranslationRootTextFieldReset, cc.xy(5, 1)); + final JLabel label2 = new JLabel(); + label2.setText("Code Folding"); + panel2.add(label2, cc.xy(3, 9)); + codeFoldingPhpRoute = new JCheckBox(); + codeFoldingPhpRoute.setText("Route (PHP)"); + panel2.add(codeFoldingPhpRoute, cc.xy(3, 11)); + codeFoldingPhpModel = new JCheckBox(); + codeFoldingPhpModel.setText("Repository Entity (PHP)"); + panel2.add(codeFoldingPhpModel, cc.xy(3, 13)); + codeFoldingTwigRoute = new JCheckBox(); + codeFoldingTwigRoute.setText("Route (Twig)"); + panel2.add(codeFoldingTwigRoute, cc.xy(3, 17)); + codeFoldingPhpTemplate = new JCheckBox(); + codeFoldingPhpTemplate.setText("Template (PHP)"); + panel2.add(codeFoldingPhpTemplate, cc.xy(3, 15)); + codeFoldingTwigTemplate = new JCheckBox(); + codeFoldingTwigTemplate.setText("Template (Twig)"); + panel2.add(codeFoldingTwigTemplate, cc.xy(3, 19)); + codeFoldingTwigConstant = new JCheckBox(); + codeFoldingTwigConstant.setText("Constant (Twig)"); + panel2.add(codeFoldingTwigConstant, cc.xy(3, 21)); + enableSchedulerCheckBox = new JCheckBox(); + enableSchedulerCheckBox.setText("Enable 5min scheduler (reopen Project after change)"); + enableSchedulerCheckBox.setMnemonic('S'); + enableSchedulerCheckBox.setDisplayedMnemonicIndex(12); + panel2.add(enableSchedulerCheckBox, cc.xy(3, 5)); + final JLabel label3 = new JLabel(); + label3.setText("Download remote files (exp.)"); + panel2.add(label3, cc.xy(1, 5)); + final JLabel label4 = new JLabel(); + label4.setText("Custom Features"); + panel2.add(label4, cc.xy(3, 23)); + featureTwigIcon = new JCheckBox(); + featureTwigIcon.setText("Twig Icon Decoration"); + featureTwigIcon.setToolTipText("Decorate Twig file icons with layer to show possible content type"); + panel2.add(featureTwigIcon, cc.xy(3, 25)); + directoryToAppLabel = new JLabel(); + directoryToAppLabel.setText("App Directory"); + panel2.add(directoryToAppLabel, cc.xy(1, 31)); + directoryToApp = new TextFieldWithBrowseButton(); + panel2.add(directoryToApp, cc.xy(3, 31, CellConstraints.FILL, CellConstraints.DEFAULT)); + directoryToAppReset = new JButton(); + directoryToAppReset.setText("Default"); + panel2.add(directoryToAppReset, cc.xy(5, 31)); + final JLabel label5 = new JLabel(); + label5.setText("Legacy Features"); + panel2.add(label5, cc.xy(1, 29)); + featureTypeProvider = new JCheckBox(); + featureTypeProvider.setText("Type Provider"); + featureTypeProvider.setToolTipText("Resolve return type via parameter eg \"ContainerInterface::get, EntityManager::find\""); + panel2.add(featureTypeProvider, cc.xy(3, 27)); + pluginEnabled = new JCheckBox(); + pluginEnabled.setText("Enable for Project (needs restart)"); + panel1.add(pluginEnabled, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + buttonHelp = new JButton(); + buttonHelp.setHorizontalAlignment(0); + buttonHelp.setHorizontalTextPosition(4); + buttonHelp.setText("Project Page / Documentation"); + panel1.add(buttonHelp, new GridConstraints(0, 4, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + buttonReindex = new JButton(); + buttonReindex.setText("Clear Index"); + panel1.add(buttonReindex, new GridConstraints(0, 3, 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(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); + buttonAutoConfigure = new JButton(); + buttonAutoConfigure.setText("Auto Configure"); + panel1.add(buttonAutoConfigure, new GridConstraints(0, 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)); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return panel1; + } + } diff --git a/src/main/java/fr/adrienbrault/idea/symfony2plugin/profiler/ui/ProfilerSettingsDialog.form b/src/main/java/fr/adrienbrault/idea/symfony2plugin/profiler/ui/ProfilerSettingsDialog.form index 0495258cd..5847508f3 100644 --- a/src/main/java/fr/adrienbrault/idea/symfony2plugin/profiler/ui/ProfilerSettingsDialog.form +++ b/src/main/java/fr/adrienbrault/idea/symfony2plugin/profiler/ui/ProfilerSettingsDialog.form @@ -3,7 +3,7 @@ - + diff --git a/src/main/java/fr/adrienbrault/idea/symfony2plugin/profiler/ui/ProfilerSettingsDialog.java b/src/main/java/fr/adrienbrault/idea/symfony2plugin/profiler/ui/ProfilerSettingsDialog.java index 06d211e85..bb69466cd 100644 --- a/src/main/java/fr/adrienbrault/idea/symfony2plugin/profiler/ui/ProfilerSettingsDialog.java +++ b/src/main/java/fr/adrienbrault/idea/symfony2plugin/profiler/ui/ProfilerSettingsDialog.java @@ -10,6 +10,9 @@ import com.intellij.openapi.ui.TextFieldWithBrowseButton; import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.uiDesigner.core.GridConstraints; +import com.intellij.uiDesigner.core.GridLayoutManager; +import com.intellij.uiDesigner.core.Spacer; import fr.adrienbrault.idea.symfony2plugin.Settings; import fr.adrienbrault.idea.symfony2plugin.util.ProjectUtil; import org.jetbrains.annotations.Nls; @@ -17,6 +20,7 @@ import org.jetbrains.annotations.Nullable; import javax.swing.*; +import java.awt.*; import java.awt.event.ActionEvent; /** @@ -63,12 +67,12 @@ public boolean isModified() { return settings.profilerLocalEnabled != radioLocalProfiler.isSelected() || - !textLocalProfilerUrl.getText().equals(settings.profilerLocalUrl) || - !textLocalProfilerCsvPath.getText().equals(settings.profilerCsvPath) || + !textLocalProfilerUrl.getText().equals(settings.profilerLocalUrl) || + !textLocalProfilerCsvPath.getText().equals(settings.profilerCsvPath) || - settings.profilerHttpEnabled != radioHttpProfiler.isSelected() || - !textHttpProfilerUrl.getText().equals(settings.profilerHttpUrl) - ; + settings.profilerHttpEnabled != radioHttpProfiler.isSelected() || + !textHttpProfilerUrl.getText().equals(settings.profilerHttpUrl) + ; } @Override @@ -99,7 +103,7 @@ public void reset() { private void updateDefaultRadio() { // set default if non profiler selected - if(!radioLocalProfiler.isSelected() && !radioHttpProfiler.isSelected()) { + if (!radioLocalProfiler.isSelected() && !radioHttpProfiler.isSelected()) { radioDefaultProfiler.setSelected(true); } } @@ -117,7 +121,7 @@ public void actionPerformed(ActionEvent e) { String text = textField.getText(); VirtualFile toSelect = VfsUtil.findRelativeFile(text, projectDirectory); - if(toSelect == null) { + if (toSelect == null) { toSelect = projectDirectory; } @@ -140,4 +144,83 @@ public void actionPerformed(ActionEvent e) { } }; } + + { +// 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$$$() { + mainPanel = new JPanel(); + mainPanel.setLayout(new GridLayoutManager(4, 2, new Insets(0, 0, 0, 0), -1, -1)); + final Spacer spacer1 = new Spacer(); + mainPanel.add(spacer1, new GridConstraints(3, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); + final JPanel panel1 = new JPanel(); + panel1.setLayout(new GridLayoutManager(5, 2, new Insets(0, 0, 0, 0), -1, -1)); + mainPanel.add(panel1, new GridConstraints(1, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + radioLocalProfiler = new JRadioButton(); + radioLocalProfiler.setText("Local Profiler"); + panel1.add(radioLocalProfiler, new GridConstraints(0, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + textLocalProfilerUrl = new JTextField(); + panel1.add(textLocalProfilerUrl, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + final JLabel label1 = new JLabel(); + label1.setText("Base url"); + panel1.add(label1, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label2 = new JLabel(); + label2.setText(" Overwrite baseUrl prefix for url navigation: http://127.0.0.1:8080, http://127.0.0.1/app_dev.php"); + panel1.add(label2, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + textLocalProfilerCsvPath = new TextFieldWithBrowseButton(); + panel1.add(textLocalProfilerCsvPath, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + final JLabel label3 = new JLabel(); + label3.setText("CSV File"); + panel1.add(label3, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label4 = new JLabel(); + label4.setText("Location for profiler csv file: var/cache/dev/index.csv"); + panel1.add(label4, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JPanel panel2 = new JPanel(); + panel2.setLayout(new GridLayoutManager(3, 2, new Insets(0, 0, 0, 0), -1, -1)); + mainPanel.add(panel2, new GridConstraints(2, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + final JLabel label5 = new JLabel(); + label5.setText("Base url"); + panel2.add(label5, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + textHttpProfilerUrl = new JTextField(); + panel2.add(textHttpProfilerUrl, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + radioHttpProfiler = new JRadioButton(); + radioHttpProfiler.setText("HTTP Profiler"); + panel2.add(radioHttpProfiler, new GridConstraints(0, 0, 1, 2, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label6 = new JLabel(); + label6.setText("Profiler url for HTML extraction without \"_profiler\": http://127.0.0.1:8080. "); + panel2.add(label6, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JPanel panel3 = new JPanel(); + panel3.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1)); + mainPanel.add(panel3, new GridConstraints(0, 0, 1, 2, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + radioDefaultProfiler = new JRadioButton(); + radioDefaultProfiler.setText("Default Profiler"); + panel3.add(radioDefaultProfiler, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label7 = new JLabel(); + label7.setText("Extract index.csv from container configuration"); + panel3.add(label7, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + ButtonGroup buttonGroup; + buttonGroup = new ButtonGroup(); + buttonGroup.add(radioDefaultProfiler); + buttonGroup.add(radioLocalProfiler); + buttonGroup.add(radioHttpProfiler); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return mainPanel; + } + } diff --git a/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/ContainerSettingsForm.java b/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/ContainerSettingsForm.java index 33a357f26..8bfb27128 100644 --- a/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/ContainerSettingsForm.java +++ b/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/ContainerSettingsForm.java @@ -20,11 +20,13 @@ import fr.adrienbrault.idea.symfony2plugin.ui.utils.dict.UiPathColumnInfo; import fr.adrienbrault.idea.symfony2plugin.ui.utils.dict.WebServerFileDialogExtensionCallback; import fr.adrienbrault.idea.symfony2plugin.webDeployment.WebDeploymentUtil; +import org.apache.commons.lang3.StringUtils; import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; +import java.awt.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; @@ -80,7 +82,7 @@ public void mouseClicked(MouseEvent e) { private void fillContainerList() { List containerFiles = getSettings().containerFiles; - if(containerFiles != null && !containerFiles.isEmpty()) { + if (containerFiles != null && !containerFiles.isEmpty()) { this.modelList.addRows(containerFiles); } } @@ -114,9 +116,9 @@ public boolean canCreateElement() { tablePanel.setEditAction(anActionButton -> { ContainerFile containerFile = ContainerSettingsForm.this.tableView.getSelectedObject(); - if(containerFile != null) { + if (containerFile != null) { String uri = UiSettingsUtil.getPathDialog(project, XmlFileType.INSTANCE); - if(uri != null) { + if (uri != null) { containerFile.setPath(uri); ContainerSettingsForm.this.changed = true; } @@ -126,13 +128,13 @@ public boolean canCreateElement() { tablePanel.setAddAction(anActionButton -> { String uri = UiSettingsUtil.getPathDialog(project, XmlFileType.INSTANCE); - if(uri != null) { + if (uri != null) { ContainerSettingsForm.this.tableView.getListTableModel().addRow(new ContainerFile(uri)); ContainerSettingsForm.this.changed = true; } }); - if(WebDeploymentUtil.isEnabled(project)) { + if (WebDeploymentUtil.isEnabled(project)) { addWebDeploymentButton(tablePanel); } @@ -148,7 +150,7 @@ public void actionPerformed(AnActionEvent anActionEvent) { @Override public void success(@NotNull WebServerConfig server, @NotNull WebServerConfig.RemotePath remotePath) { ContainerSettingsForm.this.tableView.getListTableModel().addRow( - new ContainerFile("remote://" + org.apache.commons.lang3.StringUtils.stripStart(remotePath.path, "/")) + new ContainerFile("remote://" + StringUtils.stripStart(remotePath.path, "/")) ); ContainerSettingsForm.this.changed = true; @@ -171,7 +173,7 @@ public boolean isModified() { public void apply() throws ConfigurationException { List containerFiles = new ArrayList<>(); - for(ContainerFile containerFile :this.tableView.getListTableModel().getItems()) { + for (ContainerFile containerFile : this.tableView.getListTableModel().getItems()) { containerFiles.add(new ContainerFile(containerFile.getPath())); } @@ -192,8 +194,47 @@ public void reset() { private void resetContainerList() { // clear list, easier? - while(this.modelList.getRowCount() > 0) { + while (this.modelList.getRowCount() > 0) { this.modelList.removeRow(0); } } + + { +// 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$$$() { + panel1 = new JPanel(); + panel1.setLayout(new BorderLayout(0, 0)); + listviewPanel = new JPanel(); + listviewPanel.setLayout(new BorderLayout(0, 0)); + panel1.add(listviewPanel, BorderLayout.CENTER); + final JPanel panel2 = new JPanel(); + panel2.setLayout(new BorderLayout(0, 0)); + panel1.add(panel2, BorderLayout.NORTH); + final JLabel label1 = new JLabel(); + label1.setText("Add additional Symfony xml container files"); + panel2.add(label1, BorderLayout.CENTER); + buttonReset = new JButton(); + buttonReset.setText("Reset To Default"); + panel2.add(buttonReset, BorderLayout.EAST); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return panel1; + } + } diff --git a/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/MethodParameterDialog.form b/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/MethodParameterDialog.form index 6f4647c97..76603d31a 100644 --- a/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/MethodParameterDialog.form +++ b/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/MethodParameterDialog.form @@ -3,7 +3,7 @@ - + diff --git a/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/MethodParameterDialog.java b/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/MethodParameterDialog.java index d49c5105d..d01789f33 100644 --- a/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/MethodParameterDialog.java +++ b/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/MethodParameterDialog.java @@ -3,6 +3,9 @@ import com.intellij.openapi.project.Project; import com.intellij.ui.ColoredListCellRenderer; 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 fr.adrienbrault.idea.symfony2plugin.assistant.AssistantReferenceContributor; import fr.adrienbrault.idea.symfony2plugin.assistant.reference.AssistantReferenceUtil; import fr.adrienbrault.idea.symfony2plugin.assistant.reference.MethodParameterSetting; @@ -11,6 +14,7 @@ import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.text.JTextComponent; +import java.awt.*; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.WindowAdapter; @@ -34,6 +38,83 @@ public class MethodParameterDialog extends JDialog { private final Project project; + { +// 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$$$() { + contentPane = new JPanel(); + contentPane.setLayout(new GridLayoutManager(2, 1, new Insets(10, 10, 10, 10), -1, -1)); + final JPanel panel1 = new JPanel(); + panel1.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); + contentPane.add(panel1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false)); + final Spacer spacer1 = new Spacer(); + panel1.add(spacer1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); + final JPanel panel2 = new JPanel(); + panel2.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1, true, false)); + panel1.add(panel2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + buttonOK = new JButton(); + buttonOK.setText("OK"); + panel2.add(buttonOK, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + buttonCancel = new JButton(); + buttonCancel.setText("Cancel"); + panel2.add(buttonCancel, new GridConstraints(0, 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 JPanel panel3 = new JPanel(); + panel3.setLayout(new GridLayoutManager(7, 2, new Insets(0, 0, 0, 0), -1, -1)); + contentPane.add(panel3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + textCallTo = new JTextField(); + textCallTo.setText(""); + panel3.add(textCallTo, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + final Spacer spacer2 = new Spacer(); + panel3.add(spacer2, new GridConstraints(6, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); + final JLabel label1 = new JLabel(); + label1.setText("CallTo"); + panel3.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + textMethodName = new JTextField(); + panel3.add(textMethodName, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + final JLabel label2 = new JLabel(); + label2.setText("Method"); + panel3.add(label2, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + comboProvider = new JComboBox(); + panel3.add(comboProvider, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + comboContributor = new JComboBox(); + panel3.add(comboContributor, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label3 = new JLabel(); + label3.setText("Provider"); + panel3.add(label3, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label4 = new JLabel(); + label4.setText("Contributor"); + panel3.add(label4, new GridConstraints(4, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + textContributorData = new JTextField(); + panel3.add(textContributorData, new GridConstraints(5, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + final JLabel label5 = new JLabel(); + label5.setText("ContributorData"); + panel3.add(label5, new GridConstraints(5, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label6 = new JLabel(); + label6.setText("Index"); + panel3.add(label6, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + textIndex = new JTextField(); + panel3.add(textIndex, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + label4.setLabelFor(comboContributor); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return contentPane; + } + static class ComboBoxRenderer extends ColoredListCellRenderer { @Override protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) { @@ -72,7 +153,7 @@ public void windowClosing(WindowEvent e) { comboContributor.addItemListener(e -> { AssistantReferenceContributor assistantReferenceContributor = AssistantReferenceUtil.getContributorProviderByName(MethodParameterDialog.this.project, (String) e.getItem()); - if(assistantReferenceContributor != null) { + if (assistantReferenceContributor != null) { MethodParameterDialog.this.textContributorData.setEnabled(assistantReferenceContributor.supportData()); } }); @@ -95,11 +176,11 @@ public void keyReleased(KeyEvent e) { } private void attachComboBoxValues(Project project) { - for(String provider: AssistantReferenceUtil.getReferenceProvider(project)) { + for (String provider : AssistantReferenceUtil.getReferenceProvider(project)) { comboProvider.addItem(provider); } - for(String provider: AssistantReferenceUtil.getContributorProvider(project)) { + for (String provider : AssistantReferenceUtil.getContributorProvider(project)) { comboContributor.addItem(provider); } } @@ -113,11 +194,11 @@ public MethodParameterDialog(Project project, TableView this.textContributorData.setText(methodParameterSetting.getContributorData()); this.methodParameterSetting = methodParameterSetting; - if(methodParameterSetting.getReferenceProviderName() != null) { + if (methodParameterSetting.getReferenceProviderName() != null) { this.comboProvider.setSelectedItem(methodParameterSetting.getReferenceProviderName()); } - if(methodParameterSetting.getContributorName() != null) { + if (methodParameterSetting.getContributorName() != null) { this.comboContributor.setSelectedItem(methodParameterSetting.getContributorName()); } @@ -135,7 +216,7 @@ private void onOK() { MethodParameterSetting twigPath = new MethodParameterSetting(this.textCallTo.getText(), this.textMethodName.getText(), index, (String) this.comboProvider.getSelectedItem()); twigPath.setContributorName((String) comboContributor.getSelectedItem()); - if(textContributorData.isEnabled()) { + if (textContributorData.isEnabled()) { twigPath.setContributorData(textContributorData.getText()); } @@ -143,7 +224,7 @@ private void onOK() { // re-add old item to not use public setter wor twigpaths // update ? - if(this.methodParameterSetting != null) { + if (this.methodParameterSetting != null) { int row = this.tableView.getSelectedRows()[0]; this.tableView.getListTableModel().removeRow(row); this.tableView.getListTableModel().insertRow(row, twigPath); diff --git a/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/MethodParameterReferenceSettingsForm.java b/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/MethodParameterReferenceSettingsForm.java index a10fe4d51..2cfe747c3 100644 --- a/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/MethodParameterReferenceSettingsForm.java +++ b/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/MethodParameterReferenceSettingsForm.java @@ -5,6 +5,8 @@ import com.intellij.openapi.project.Project; 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.util.ui.ColumnInfo; import com.intellij.util.ui.ElementProducer; import com.intellij.util.ui.ListTableModel; @@ -25,7 +27,7 @@ /** * @author Daniel Espendiller */ -public class MethodParameterReferenceSettingsForm implements Configurable { +public class MethodParameterReferenceSettingsForm implements Configurable { private JPanel panel1; private JPanel panelConfigTableView; private JButton buttonHelp; @@ -130,7 +132,7 @@ private Settings getSettings() { private void resetList() { // clear list, easier? - while(this.modelList.getRowCount() > 0) { + while (this.modelList.getRowCount() > 0) { this.modelList.removeRow(0); } @@ -148,6 +150,46 @@ public void disposeUIResources() { } + { +// 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$$$() { + panel1 = new JPanel(); + panel1.setLayout(new BorderLayout(0, 0)); + final JPanel panel2 = new JPanel(); + panel2.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); + panel1.add(panel2, BorderLayout.NORTH); + final JLabel label1 = new JLabel(); + label1.setText("Provides Completion and Goto for method parameter"); + panel2.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + buttonHelp = new JButton(); + buttonHelp.setHorizontalAlignment(0); + buttonHelp.setHorizontalTextPosition(11); + buttonHelp.setText("Help"); + panel2.add(buttonHelp, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + panelConfigTableView = new JPanel(); + panelConfigTableView.setLayout(new BorderLayout(0, 0)); + panel1.add(panelConfigTableView, BorderLayout.CENTER); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return panel1; + } + private static class CallToColumn extends ColumnInfo { public CallToColumn() { @@ -228,7 +270,7 @@ public String valueOf(MethodParameterSetting methodParameterSetting) { private void openTwigPathDialog(@Nullable MethodParameterSetting methodParameterSetting) { MethodParameterDialog twigNamespaceDialog; - if(methodParameterSetting == null) { + if (methodParameterSetting == null) { twigNamespaceDialog = new MethodParameterDialog(project, this.tableView); } else { twigNamespaceDialog = new MethodParameterDialog(project, this.tableView, methodParameterSetting); diff --git a/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/MethodSignatureTypeDialog.form b/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/MethodSignatureTypeDialog.form index 215c1080a..5836a3703 100644 --- a/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/MethodSignatureTypeDialog.form +++ b/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/MethodSignatureTypeDialog.form @@ -3,7 +3,7 @@ - + diff --git a/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/MethodSignatureTypeDialog.java b/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/MethodSignatureTypeDialog.java index 898ea6304..d488457d7 100644 --- a/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/MethodSignatureTypeDialog.java +++ b/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/MethodSignatureTypeDialog.java @@ -3,6 +3,9 @@ import com.intellij.openapi.project.Project; import com.intellij.ui.ColoredListCellRenderer; 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 fr.adrienbrault.idea.symfony2plugin.assistant.signature.MethodSignatureSetting; import fr.adrienbrault.idea.symfony2plugin.assistant.signature.PhpTypeSignatureInterface; import fr.adrienbrault.idea.symfony2plugin.assistant.signature.PhpTypeSignatureTypes; @@ -11,6 +14,7 @@ import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; import javax.swing.text.JTextComponent; +import java.awt.*; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; import java.awt.event.WindowAdapter; @@ -32,6 +36,72 @@ public class MethodSignatureTypeDialog extends JDialog { private final Project project; + { +// 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$$$() { + contentPane = new JPanel(); + contentPane.setLayout(new GridLayoutManager(2, 1, new Insets(10, 10, 10, 10), -1, -1)); + final JPanel panel1 = new JPanel(); + panel1.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); + contentPane.add(panel1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false)); + final Spacer spacer1 = new Spacer(); + panel1.add(spacer1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); + final JPanel panel2 = new JPanel(); + panel2.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1, true, false)); + panel1.add(panel2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + buttonOK = new JButton(); + buttonOK.setText("OK"); + panel2.add(buttonOK, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + buttonCancel = new JButton(); + buttonCancel.setText("Cancel"); + panel2.add(buttonCancel, new GridConstraints(0, 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 JPanel panel3 = new JPanel(); + panel3.setLayout(new GridLayoutManager(5, 2, new Insets(0, 0, 0, 0), -1, -1)); + contentPane.add(panel3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + textCallTo = new JTextField(); + textCallTo.setText(""); + panel3.add(textCallTo, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + final Spacer spacer2 = new Spacer(); + panel3.add(spacer2, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); + final JLabel label1 = new JLabel(); + label1.setText("CallTo"); + panel3.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + textMethodName = new JTextField(); + panel3.add(textMethodName, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + final JLabel label2 = new JLabel(); + label2.setText("Method"); + panel3.add(label2, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + comboProvider = new JComboBox(); + panel3.add(comboProvider, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label3 = new JLabel(); + label3.setText("Provider"); + panel3.add(label3, new GridConstraints(3, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label4 = new JLabel(); + label4.setText("Index"); + panel3.add(label4, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + textIndex = new JTextField(); + panel3.add(textIndex, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return contentPane; + } + static class ComboBoxRenderer extends ColoredListCellRenderer { @Override protected void customizeCellRenderer(JList list, Object value, int index, boolean selected, boolean hasFocus) { @@ -84,7 +154,7 @@ public void keyReleased(KeyEvent e) { } private void attachComboBoxValues(Project project) { - for(PhpTypeSignatureInterface provider: PhpTypeSignatureTypes.DEFAULT_PROVIDER) { + for (PhpTypeSignatureInterface provider : PhpTypeSignatureTypes.DEFAULT_PROVIDER) { comboProvider.addItem(provider.getName()); } } @@ -97,7 +167,7 @@ public MethodSignatureTypeDialog(Project project, TableView */ -public class MethodSignatureTypeSettingsForm implements Configurable { +public class MethodSignatureTypeSettingsForm implements Configurable { private JPanel panel1; private JPanel panelConfigTableView; private JCheckBox enableCustomSignatureTypesCheckBox; @@ -72,7 +74,7 @@ public void mouseClicked(MouseEvent e) { private void attachItems() { - if(this.getSettings().methodSignatureSettings == null) { + if (this.getSettings().methodSignatureSettings == null) { return; } @@ -144,7 +146,7 @@ private Settings getSettings() { private void resetList() { // clear list, easier? - while(this.modelList.getRowCount() > 0) { + while (this.modelList.getRowCount() > 0) { this.modelList.removeRow(0); } @@ -162,6 +164,45 @@ public void disposeUIResources() { } + { +// 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$$$() { + panel1 = new JPanel(); + panel1.setLayout(new BorderLayout(0, 0)); + panelConfigTableView = new JPanel(); + panelConfigTableView.setLayout(new BorderLayout(0, 0)); + panel1.add(panelConfigTableView, BorderLayout.CENTER); + final JPanel panel2 = new JPanel(); + panel2.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); + panel1.add(panel2, BorderLayout.NORTH); + enableCustomSignatureTypesCheckBox = new JCheckBox(); + enableCustomSignatureTypesCheckBox.setSelected(false); + enableCustomSignatureTypesCheckBox.setText("Enable Custom Signature Types"); + panel2.add(enableCustomSignatureTypesCheckBox, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + buttonHelp = new JButton(); + buttonHelp.setText("Help"); + panel2.add(buttonHelp, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_EAST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return panel1; + } + private static class CallToColumn extends ColumnInfo { public CallToColumn() { @@ -216,7 +257,7 @@ public String valueOf(MethodSignatureSetting methodParameterSetting) { private void openTwigPathDialog(@Nullable MethodSignatureSetting methodParameterSetting) { MethodSignatureTypeDialog twigNamespaceDialog; - if(methodParameterSetting == null) { + if (methodParameterSetting == null) { twigNamespaceDialog = new MethodSignatureTypeDialog(project, this.tableView); } else { twigNamespaceDialog = new MethodSignatureTypeDialog(project, this.tableView, methodParameterSetting); diff --git a/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/RoutingSettingsForm.form b/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/RoutingSettingsForm.form index d540e6fa1..5c6a07d9a 100644 --- a/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/RoutingSettingsForm.form +++ b/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/RoutingSettingsForm.form @@ -33,7 +33,7 @@ - + diff --git a/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/RoutingSettingsForm.java b/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/RoutingSettingsForm.java index f04bb5fbb..08d355b1c 100644 --- a/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/RoutingSettingsForm.java +++ b/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/RoutingSettingsForm.java @@ -19,11 +19,13 @@ import fr.adrienbrault.idea.symfony2plugin.ui.utils.dict.UiPathColumnInfo; import fr.adrienbrault.idea.symfony2plugin.ui.utils.dict.WebServerFileDialogExtensionCallback; import fr.adrienbrault.idea.symfony2plugin.webDeployment.WebDeploymentUtil; +import org.apache.commons.lang3.StringUtils; import org.jetbrains.annotations.Nls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; +import java.awt.*; import java.awt.event.MouseAdapter; import java.awt.event.MouseEvent; import java.util.ArrayList; @@ -77,7 +79,7 @@ public void mouseClicked(MouseEvent e) { private void initList() { List containerFiles = getSettings().routingFiles; - if(containerFiles != null && !containerFiles.isEmpty()) { + if (containerFiles != null && !containerFiles.isEmpty()) { this.modelList.addRows(containerFiles); } } @@ -111,12 +113,12 @@ public boolean canCreateElement() { tablePanel.setEditAction(anActionButton -> { RoutingFile containerFile = RoutingSettingsForm.this.tableView.getSelectedObject(); - if(containerFile == null) { + if (containerFile == null) { return; } String uri = UiSettingsUtil.getPathDialog(project, PhpFileType.INSTANCE); - if(uri == null) { + if (uri == null) { return; } @@ -126,7 +128,7 @@ public boolean canCreateElement() { tablePanel.setAddAction(anActionButton -> { String uri = UiSettingsUtil.getPathDialog(project, PhpFileType.INSTANCE); - if(uri == null) { + if (uri == null) { return; } @@ -134,7 +136,7 @@ public boolean canCreateElement() { RoutingSettingsForm.this.changed = true; }); - if(WebDeploymentUtil.isEnabled(project)) { + if (WebDeploymentUtil.isEnabled(project)) { addWebDeploymentButton(tablePanel); } @@ -151,7 +153,7 @@ public void actionPerformed(@NotNull AnActionEvent anActionEvent) { @Override public void success(@NotNull WebServerConfig server, @NotNull WebServerConfig.RemotePath remotePath) { RoutingSettingsForm.this.tableView.getListTableModel().addRow( - new RoutingFile("remote://" + org.apache.commons.lang3.StringUtils.stripStart(remotePath.path, "/")) + new RoutingFile("remote://" + StringUtils.stripStart(remotePath.path, "/")) ); RoutingSettingsForm.this.changed = true; @@ -174,7 +176,7 @@ public boolean isModified() { public void apply() throws ConfigurationException { List containerFiles = new ArrayList<>(); - for(RoutingFile containerFile :this.tableView.getListTableModel().getItems()) { + for (RoutingFile containerFile : this.tableView.getListTableModel().getItems()) { containerFiles.add(new RoutingFile(containerFile.getPath())); } @@ -195,7 +197,7 @@ public void reset() { private void resetList() { // clear list, easier? - while(this.modelList.getRowCount() > 0) { + while (this.modelList.getRowCount() > 0) { this.modelList.removeRow(0); } } @@ -203,4 +205,46 @@ private void resetList() { @Override public void disposeUIResources() { } + + { +// 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$$$() { + panel1 = new JPanel(); + panel1.setLayout(new BorderLayout(0, 0)); + listviewPanel = new JPanel(); + listviewPanel.setLayout(new BorderLayout(0, 0)); + panel1.add(listviewPanel, BorderLayout.CENTER); + final JPanel panel2 = new JPanel(); + panel2.setLayout(new BorderLayout(0, 0)); + panel1.add(panel2, BorderLayout.NORTH); + final JLabel label1 = new JLabel(); + label1.setText("Add PHP Routing"); + panel2.add(label1, BorderLayout.CENTER); + buttonReset = new JButton(); + buttonReset.setText("Reset To Default"); + panel2.add(buttonReset, BorderLayout.EAST); + ifYouApplicationDoesTextPane = new JTextPane(); + ifYouApplicationDoesTextPane.setText("If you application does not support guessing the value for compiled route files, you add custom ones. Some examples: var/cache/dev/[appDevUrlGenerator.php, UrlGenerator.php, url_generating_routes.php]"); + panel2.add(ifYouApplicationDoesTextPane, BorderLayout.SOUTH); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return panel1; + } + } diff --git a/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/TwigJsonExampleDialog.form b/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/TwigJsonExampleDialog.form index 928e22e13..844378b17 100644 --- a/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/TwigJsonExampleDialog.form +++ b/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/TwigJsonExampleDialog.form @@ -3,7 +3,7 @@ - + diff --git a/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/TwigJsonExampleDialog.java b/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/TwigJsonExampleDialog.java index 4a98d6077..5b0675b67 100644 --- a/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/TwigJsonExampleDialog.java +++ b/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/TwigJsonExampleDialog.java @@ -1,5 +1,8 @@ package fr.adrienbrault.idea.symfony2plugin.ui; +import com.intellij.uiDesigner.core.GridConstraints; +import com.intellij.uiDesigner.core.GridLayoutManager; +import com.intellij.uiDesigner.core.Spacer; import fr.adrienbrault.idea.symfony2plugin.Symfony2Icons; import org.jetbrains.annotations.NotNull; @@ -34,4 +37,51 @@ public static void open(@NotNull Component relativeTo) { twigJsonExampleForm.setLocationRelativeTo(relativeTo); twigJsonExampleForm.setVisible(true); } + + { +// 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$$$() { + contentPane = new JPanel(); + contentPane.setLayout(new GridLayoutManager(2, 1, new Insets(10, 10, 10, 10), -1, -1)); + final JPanel panel1 = new JPanel(); + panel1.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); + contentPane.add(panel1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false)); + final Spacer spacer1 = new Spacer(); + panel1.add(spacer1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); + final JPanel panel2 = new JPanel(); + panel2.setLayout(new GridLayoutManager(1, 1, new Insets(0, 0, 0, 0), -1, -1)); + panel1.add(panel2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + buttonOK = new JButton(); + buttonOK.setText("OK"); + panel2.add(buttonOK, new GridConstraints(0, 0, 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 JPanel panel3 = new JPanel(); + panel3.setLayout(new GridLayoutManager(2, 1, new Insets(0, 0, 0, 0), -1, -1)); + contentPane.add(panel3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + pathIsRelativeToTextArea = new JTextArea(); + pathIsRelativeToTextArea.setText("// \"path\" is relative to file (ide-twig.json)\n{\n \"namespaces\": [\n {\n \"namespace\": \"foo\", // @foo/bar/foo.htm.twig\n \"path\": \"res\"\n },\n {\n \"path\": \"res\" // bar/foo.htm.twig\n },\n {\n \"path\": \"res\", // FooBundle:bar:foo.htm.twig\n \"type\": \"Bundle\",\n \"namespace\": \"FooBundle\"\n }\n ]\n}"); + panel3.add(pathIsRelativeToTextArea, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_WANT_GROW, null, new Dimension(150, 50), null, 0, false)); + final JLabel label1 = new JLabel(); + label1.setText("Example \"ide-twig.json\"; supports multiple locations"); + panel3.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return contentPane; + } + } diff --git a/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/TwigNamespaceDialog.form b/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/TwigNamespaceDialog.form index 471fc6363..e267e92f0 100644 --- a/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/TwigNamespaceDialog.form +++ b/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/TwigNamespaceDialog.form @@ -3,7 +3,7 @@ - + diff --git a/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/TwigNamespaceDialog.java b/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/TwigNamespaceDialog.java index 10ead6db1..45d8ce44b 100644 --- a/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/TwigNamespaceDialog.java +++ b/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/TwigNamespaceDialog.java @@ -9,6 +9,9 @@ import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; 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 fr.adrienbrault.idea.symfony2plugin.templating.path.TwigPath; import fr.adrienbrault.idea.symfony2plugin.templating.util.TwigUtil; import fr.adrienbrault.idea.symfony2plugin.util.ProjectUtil; @@ -17,6 +20,7 @@ import javax.swing.*; import javax.swing.event.DocumentEvent; import javax.swing.event.DocumentListener; +import java.awt.*; import java.awt.event.*; /** @@ -81,21 +85,21 @@ private void setOkState() { private void onOK() { // empty namespace use "__main__", as this is same as Twig internals does String namespace = this.name.getText(); - if(StringUtils.isBlank(namespace)) { + if (StringUtils.isBlank(namespace)) { namespace = "__main__"; } String namespacePath = this.namespacePath.getText(); TwigPath twigPath = new TwigPath(namespacePath, namespace, TwigUtil.NamespaceType.valueOf((String) this.namespaceType.getSelectedItem()), true); - if(namespacePath.isEmpty()) { + if (namespacePath.isEmpty()) { dispose(); return; } // re-add old item to not use public setter wor twigpaths // update ? - if(this.twigPath != null) { + if (this.twigPath != null) { int row = this.tableView.getSelectedRows()[0]; this.tableView.getListTableModel().removeRow(row); this.tableView.getListTableModel().insertRow(row, twigPath); @@ -120,9 +124,9 @@ private TextBrowseFolderListener createBrowseFolderListener(final JTextField tex public void actionPerformed(ActionEvent e) { VirtualFile projectDirectory = ProjectUtil.getProjectDir(project); VirtualFile selectedFile = FileChooser.chooseFile( - fileChooserDescriptor, - project, - VfsUtil.findRelativeFile(textField.getText(), projectDirectory) + fileChooserDescriptor, + project, + VfsUtil.findRelativeFile(textField.getText(), projectDirectory) ); if (null == selectedFile) { @@ -139,6 +143,75 @@ public void actionPerformed(ActionEvent e) { }; } + { +// 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$$$() { + contentPane = new JPanel(); + contentPane.setLayout(new GridLayoutManager(2, 1, new Insets(5, 5, 5, 5), -1, -1)); + final JPanel panel1 = new JPanel(); + panel1.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1)); + contentPane.add(panel1, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, 1, null, null, null, 0, false)); + final Spacer spacer1 = new Spacer(); + panel1.add(spacer1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); + final JPanel panel2 = new JPanel(); + panel2.setLayout(new GridLayoutManager(1, 2, new Insets(0, 0, 0, 0), -1, -1, true, false)); + panel1.add(panel2, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + buttonOK = new JButton(); + buttonOK.setText("OK"); + panel2.add(buttonOK, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + buttonCancel = new JButton(); + buttonCancel.setText("Cancel"); + panel2.add(buttonCancel, new GridConstraints(0, 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 JPanel panel3 = new JPanel(); + panel3.setLayout(new GridLayoutManager(5, 2, new Insets(0, 0, 0, 0), -1, -1)); + contentPane.add(panel3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_BOTH, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + namespaceType = new JComboBox(); + final DefaultComboBoxModel defaultComboBoxModel1 = new DefaultComboBoxModel(); + defaultComboBoxModel1.addElement("ADD_PATH"); + defaultComboBoxModel1.addElement("BUNDLE"); + namespaceType.setModel(defaultComboBoxModel1); + panel3.add(namespaceType, new GridConstraints(2, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final Spacer spacer2 = new Spacer(); + panel3.add(spacer2, new GridConstraints(4, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_VERTICAL, 1, GridConstraints.SIZEPOLICY_WANT_GROW, null, null, null, 0, false)); + final JLabel label1 = new JLabel(); + label1.setText("Type"); + panel3.add(label1, new GridConstraints(2, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + final JLabel label2 = new JLabel(); + label2.setText("Project-Path"); + panel3.add(label2, new GridConstraints(1, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + namespacePath = new TextFieldWithBrowseButton(); + panel3.add(namespacePath, new GridConstraints(1, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + chkboxEnabled = new JCheckBox(); + chkboxEnabled.setSelected(true); + chkboxEnabled.setText("Enabled"); + panel3.add(chkboxEnabled, new GridConstraints(3, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + name = new JTextField(); + panel3.add(name, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, GridConstraints.SIZEPOLICY_FIXED, null, new Dimension(150, -1), null, 0, false)); + final JLabel label3 = new JLabel(); + label3.setText("Namespace"); + panel3.add(label3, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_FIXED, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + label3.setLabelFor(name); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return contentPane; + } + private class ChangeDocumentListener implements DocumentListener { @Override public void insertUpdate(DocumentEvent e) { diff --git a/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/TwigSettingsForm.java b/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/TwigSettingsForm.java index a63e69142..8bac8d79c 100644 --- a/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/TwigSettingsForm.java +++ b/src/main/java/fr/adrienbrault/idea/symfony2plugin/ui/TwigSettingsForm.java @@ -6,6 +6,9 @@ import com.intellij.openapi.project.Project; 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.ElementProducer; import com.intellij.util.ui.ListTableModel; @@ -155,9 +158,9 @@ public boolean isModified() { public void apply() throws ConfigurationException { List twigPaths = new ArrayList<>(); - for(TwigPath twigPath :this.tableView.getListTableModel().getItems()) { + for (TwigPath twigPath : this.tableView.getListTableModel().getItems()) { // only custom and disabled path need to save - if((!twigPath.isEnabled() && twigPath.getRelativePath(this.project) != null) || twigPath.isCustomPath()) { + if ((!twigPath.isEnabled() && twigPath.getRelativePath(this.project) != null) || twigPath.isCustomPath()) { twigPaths.add(new TwigNamespaceSetting(twigPath.getNamespace(), twigPath.getRelativePath(this.project), twigPath.isEnabled(), twigPath.getNamespaceType(), twigPath.isCustomPath())); } } @@ -173,7 +176,7 @@ private Settings getSettings() { private void resetList() { // clear list, easier? - while(this.modelList.getRowCount() > 0) { + while (this.modelList.getRowCount() > 0) { this.modelList.removeRow(0); } @@ -196,6 +199,57 @@ public void disposeUIResources() { this.resetList(); } + { +// 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$$$() { + panel1 = new JPanel(); + panel1.setLayout(new BorderLayout(0, 0)); + panelTableView = new JPanel(); + panelTableView.setLayout(new BorderLayout(0, 0)); + panel1.add(panelTableView, BorderLayout.CENTER); + final JPanel panel2 = new JPanel(); + panel2.setLayout(new BorderLayout(0, 0)); + panel1.add(panel2, BorderLayout.NORTH); + final JPanel panel3 = new JPanel(); + panel3.setLayout(new GridLayoutManager(1, 5, new Insets(0, 0, 0, 0), -1, -1)); + panel2.add(panel3, BorderLayout.NORTH); + final JLabel label1 = new JLabel(); + label1.setText("Manage Twig Namespaces"); + panel3.add(label1, new GridConstraints(0, 0, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + resetToDefault = new JButton(); + resetToDefault.setText("Reset To Default"); + panel3.add(resetToDefault, new GridConstraints(0, 4, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, null, null, null, 0, false)); + buttonJsonExample = new JButton(); + buttonJsonExample.setText("JSON Example"); + panel3.add(buttonJsonExample, new GridConstraints(0, 3, 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(); + panel3.add(spacer1, new GridConstraints(0, 1, 1, 1, GridConstraints.ANCHOR_CENTER, GridConstraints.FILL_HORIZONTAL, GridConstraints.SIZEPOLICY_WANT_GROW, 1, null, null, null, 0, false)); + chkTwigBundleNamespaceSupport = new JCheckBox(); + chkTwigBundleNamespaceSupport.setSelected(true); + chkTwigBundleNamespaceSupport.setText("Support Bundle Namespaces"); + chkTwigBundleNamespaceSupport.setToolTipText("Example: Foobar:Bar:Foo.html.twig (for older Symfony Versions)"); + panel3.add(chkTwigBundleNamespaceSupport, new GridConstraints(0, 2, 1, 1, GridConstraints.ANCHOR_WEST, GridConstraints.FILL_NONE, GridConstraints.SIZEPOLICY_CAN_SHRINK | GridConstraints.SIZEPOLICY_CAN_GROW, GridConstraints.SIZEPOLICY_FIXED, null, null, null, 0, false)); + } + + /** + * @noinspection ALL + */ + public JComponent $$$getRootComponent$$$() { + return panel1; + } + private static class NamespaceColumn extends ColumnInfo { public NamespaceColumn() { @@ -205,7 +259,7 @@ public NamespaceColumn() { @Nullable @Override public String valueOf(TwigPath twigPath) { - return twigPath.getNamespace(); + return twigPath.getNamespace(); } } @@ -251,19 +305,16 @@ public String valueOf(TwigPath twigPath) { } } - private abstract static class BooleanColumn extends ColumnInfo - { + private abstract static class BooleanColumn extends ColumnInfo { public BooleanColumn(String name) { super(name); } - public boolean isCellEditable(TwigPath groupItem) - { + public boolean isCellEditable(TwigPath groupItem) { return true; } - public Class getColumnClass() - { + public Class getColumnClass() { return Boolean.class; } } @@ -278,7 +329,7 @@ public Boolean valueOf(TwigPath twigPath) { return twigPath.isEnabled(); } - public void setValue(TwigPath twigPath, Boolean value){ + public void setValue(TwigPath twigPath, Boolean value) { twigPath.setEnabled(value); TwigSettingsForm.this.tableView.getListTableModel().fireTableDataChanged(); } @@ -291,7 +342,7 @@ public int getWidth(JTable table) { private void openTwigPathDialog(@Nullable TwigPath twigPath) { TwigNamespaceDialog twigNamespaceDialog; - if(twigPath == null) { + if (twigPath == null) { twigNamespaceDialog = new TwigNamespaceDialog(project, this.tableView); } else { twigNamespaceDialog = new TwigNamespaceDialog(project, this.tableView, twigPath);