Skip to content

Commit

Permalink
Merge pull request #2217 from Haehnchen/feature/auto-configure-button
Browse files Browse the repository at this point in the history
provide auto configure button inside Settings
  • Loading branch information
Haehnchen authored Aug 26, 2023
2 parents fdde7e9 + 20b3668 commit 2ff150f
Show file tree
Hide file tree
Showing 2 changed files with 83 additions and 47 deletions.
113 changes: 66 additions & 47 deletions src/main/java/fr/adrienbrault/idea/symfony2plugin/SettingsForm.form
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="fr.adrienbrault.idea.symfony2plugin.SettingsForm">
<grid id="27dc6" binding="panel1" default-binding="true" layout-manager="GridLayoutManager" row-count="2" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<grid id="27dc6" binding="panel1" default-binding="true" layout-manager="GridLayoutManager" row-count="2" column-count="5" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<xy x="20" y="20" width="774" height="749"/>
Expand All @@ -14,9 +14,11 @@
<rowspec value="center:max(d;4px):noGrow"/>
<rowspec value="top:4dlu:noGrow"/>
<rowspec value="center:max(d;4px):noGrow"/>
<rowspec value="top:6dlu:noGrow"/>
<rowspec value="center:max(d;4px):noGrow"/>
<rowspec value="top:4dlu:noGrow"/>
<rowspec value="center:max(d;4px):noGrow"/>
<rowspec value="top:6dlu:noGrow"/>
<rowspec value="top:4dlu:noGrow"/>
<rowspec value="center:max(d;4px):noGrow"/>
<rowspec value="top:4dlu:noGrow"/>
<rowspec value="center:max(d;4px):noGrow"/>
Expand Down Expand Up @@ -44,41 +46,14 @@
<colspec value="left:4dlu:noGrow"/>
<colspec value="fill:max(d;4px):noGrow"/>
<constraints>
<grid row="1" column="0" row-span="1" col-span="4" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
<grid row="1" column="0" row-span="1" col-span="5" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
</constraints>
<properties/>
<border type="none"/>
<children>
<component id="58414" class="javax.swing.JLabel" binding="directoryToAppLabel">
<constraints>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<forms/>
</constraints>
<properties>
<text value="App Directory"/>
</properties>
</component>
<component id="c6525" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="directoryToApp">
<constraints>
<grid row="2" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
<forms defaultalign-horz="false"/>
</constraints>
<properties/>
</component>
<component id="b7268" class="javax.swing.JButton" binding="directoryToAppReset">
<constraints>
<grid row="2" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<forms/>
</constraints>
<properties>
<text value="Default"/>
</properties>
</component>
<component id="ea64" class="javax.swing.JLabel" binding="directoryToWebLabel">
<constraints>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<forms/>
</constraints>
<properties>
Expand All @@ -87,7 +62,7 @@
</component>
<component id="e6a9f" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="directoryToWeb">
<constraints>
<grid row="4" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<grid row="2" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
<forms defaultalign-horz="false"/>
Expand All @@ -96,7 +71,7 @@
</component>
<component id="50465" class="javax.swing.JButton" binding="directoryToWebReset">
<constraints>
<grid row="4" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="2" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<forms/>
</constraints>
<properties>
Expand Down Expand Up @@ -132,7 +107,7 @@
</component>
<component id="df4be" class="javax.swing.JLabel">
<constraints>
<grid row="10" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="8" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<forms/>
</constraints>
<properties>
Expand All @@ -141,7 +116,7 @@
</component>
<component id="b198c" class="javax.swing.JCheckBox" binding="codeFoldingPhpRoute">
<constraints>
<grid row="12" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="10" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<forms/>
</constraints>
<properties>
Expand All @@ -150,7 +125,7 @@
</component>
<component id="2246c" class="javax.swing.JCheckBox" binding="codeFoldingPhpModel">
<constraints>
<grid row="14" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="12" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<forms/>
</constraints>
<properties>
Expand All @@ -159,7 +134,7 @@
</component>
<component id="d5f04" class="javax.swing.JCheckBox" binding="codeFoldingTwigRoute">
<constraints>
<grid row="18" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="16" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<forms/>
</constraints>
<properties>
Expand All @@ -168,7 +143,7 @@
</component>
<component id="6b688" class="javax.swing.JCheckBox" binding="codeFoldingPhpTemplate">
<constraints>
<grid row="16" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="14" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<forms/>
</constraints>
<properties>
Expand All @@ -177,7 +152,7 @@
</component>
<component id="9bf85" class="javax.swing.JCheckBox" binding="codeFoldingTwigTemplate">
<constraints>
<grid row="20" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="18" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<forms/>
</constraints>
<properties>
Expand All @@ -186,7 +161,7 @@
</component>
<component id="c828d" class="javax.swing.JCheckBox" binding="codeFoldingTwigConstant">
<constraints>
<grid row="22" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="20" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<forms/>
</constraints>
<properties>
Expand All @@ -195,7 +170,7 @@
</component>
<component id="dedbe" class="javax.swing.JCheckBox" binding="enableSchedulerCheckBox">
<constraints>
<grid row="6" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="4" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<forms/>
</constraints>
<properties>
Expand All @@ -204,7 +179,7 @@
</component>
<component id="b004d" class="javax.swing.JLabel">
<constraints>
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<forms/>
</constraints>
<properties>
Expand All @@ -213,7 +188,7 @@
</component>
<component id="24207" class="javax.swing.JLabel">
<constraints>
<grid row="24" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="22" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<forms/>
</constraints>
<properties>
Expand All @@ -222,27 +197,63 @@
</component>
<component id="bcf9" class="javax.swing.JCheckBox" binding="featureTwigIcon">
<constraints>
<grid row="26" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<grid row="24" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<forms/>
</constraints>
<properties>
<text value="Twig Icon Decoration"/>
<toolTipText value="Decorate Twig file icons with layer to show possible content type"/>
</properties>
</component>
<component id="58414" class="javax.swing.JLabel" binding="directoryToAppLabel">
<constraints>
<grid row="28" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<forms/>
</constraints>
<properties>
<text value="App Directory"/>
</properties>
</component>
<component id="c6525" class="com.intellij.openapi.ui.TextFieldWithBrowseButton" binding="directoryToApp">
<constraints>
<grid row="28" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="6" anchor="8" fill="1" indent="0" use-parent-layout="false">
<preferred-size width="150" height="-1"/>
</grid>
<forms defaultalign-horz="false"/>
</constraints>
<properties/>
</component>
<component id="b7268" class="javax.swing.JButton" binding="directoryToAppReset">
<constraints>
<grid row="28" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<forms/>
</constraints>
<properties>
<text value="Default"/>
</properties>
</component>
<component id="4cd0" class="javax.swing.JLabel">
<constraints>
<grid row="26" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
<forms/>
</constraints>
<properties>
<text value="Legacy Features"/>
</properties>
</component>
</children>
</grid>
<component id="2ef99" class="javax.swing.JCheckBox" binding="pluginEnabled">
<constraints>
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Enable Plugin for this Project (change need restart)"/>
<text value="Enable for Project (needs restart)"/>
</properties>
</component>
<component id="20f77" class="javax.swing.JButton" binding="buttonHelp">
<constraints>
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
<grid row="0" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<horizontalAlignment value="0"/>
Expand All @@ -252,7 +263,7 @@
</component>
<component id="47a96" class="javax.swing.JButton" binding="buttonReindex">
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
<grid row="0" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Clear Index"/>
Expand All @@ -263,6 +274,14 @@
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<component id="b02cb" class="javax.swing.JButton" binding="buttonAutoConfigure">
<constraints>
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
<properties>
<text value="Auto Configure"/>
</properties>
</component>
</children>
</grid>
</form>
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import fr.adrienbrault.idea.symfony2plugin.util.IdeHelper;
import fr.adrienbrault.idea.symfony2plugin.util.ProjectUtil;
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;
Expand All @@ -24,6 +25,7 @@
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.util.List;

/**
* @author Daniel Espendiller <[email protected]>
Expand Down Expand Up @@ -57,6 +59,7 @@ public class SettingsForm implements Configurable {
private JButton buttonReindex;
private JCheckBox enableSchedulerCheckBox;
private JCheckBox featureTwigIcon;
private JButton buttonAutoConfigure;

public SettingsForm(@NotNull final Project project) {
this.project = project;
Expand All @@ -67,6 +70,7 @@ public void mouseClicked(MouseEvent e) {
IdeHelper.openUrl(Symfony2ProjectComponent.HELP_URL);
}
});

}

@Nls
Expand Down Expand Up @@ -101,6 +105,19 @@ public void mouseClicked(MouseEvent e) {
}
});

buttonAutoConfigure.addMouseListener(new MouseAdapter() {
@Override
public void mouseClicked(MouseEvent e) {
super.mouseClicked(e);
List<String> list = IdeHelper.enablePluginAndConfigure(project).stream().map(s -> "- " + s).toList();

getSettings().pluginEnabled = true;
updateUIFromSettings();

JOptionPane.showMessageDialog(panel1, "Plugin activated and configured with:\n" + StringUtils.join(list, "\n"), "Symfony Plugin", JOptionPane.PLAIN_MESSAGE);
}
});

return panel1;
}

Expand Down

0 comments on commit 2ff150f

Please sign in to comment.