11package de .espend .idea .php .annotation .ui ;
22
33import com .intellij .openapi .options .Configurable ;
4+ import com .intellij .ui .IdeBorderFactory ;
5+ import com .intellij .ui .TitledSeparator ;
6+ import com .intellij .util .ui .FormBuilder ;
7+ import com .intellij .util .ui .JBUI ;
48import de .espend .idea .php .annotation .ApplicationSettings ;
59import de .espend .idea .php .annotation .util .PluginUtil ;
610import org .jetbrains .annotations .Nls ;
711import org .jetbrains .annotations .Nullable ;
812
913import javax .swing .*;
10- import java .awt .event .MouseAdapter ;
11- import java .awt .event .MouseEvent ;
14+ import java .awt .*;
1215
1316/**
1417 * @author Daniel Espendiller <daniel@espendiller.net>
1518 */
1619public class SettingsForm implements Configurable {
17- private JCheckBox appendRoundBracket ;
18- private JPanel panel ;
19- private JButton buttonCleanIndex ;
20+ private final JCheckBox appendRoundBracket = new JCheckBox ( "Insert round bracket after class name" ) ;
21+ private final JButton buttonCleanIndex = new JButton ( "Schedule annotation reindex" ) ;
22+ private final JPanel panel ;
2023
2124 public SettingsForm () {
22- buttonCleanIndex .addMouseListener (new MouseAdapter () {
23- @ Override
24- public void mouseClicked (MouseEvent e ) {
25- PluginUtil .forceReindex ();
26- super .mouseClicked (e );
27- }
28- });
25+ this .panel = createPanel ();
26+
27+ buttonCleanIndex .addActionListener (e -> PluginUtil .forceReindex ());
28+ updateUIFromSettings ();
29+ }
30+
31+ private JPanel createPanel () {
32+ JPanel actionsPanel = new JPanel (new FlowLayout (FlowLayout .LEFT , 0 , 0 ));
33+ actionsPanel .add (buttonCleanIndex );
34+
35+ JPanel content = FormBuilder .createFormBuilder ()
36+ .addComponent (new TitledSeparator ("Actions" ))
37+ .addComponent (actionsPanel , JBUI .scale (6 ))
38+ .addVerticalGap (JBUI .scale (12 ))
39+ .addComponent (new TitledSeparator ("Autocomplete (Annotations)" ))
40+ .addComponent (appendRoundBracket , JBUI .scale (6 ))
41+ .getPanel ();
42+
43+ JPanel root = new JPanel (new BorderLayout ());
44+ root .setBorder (IdeBorderFactory .createEmptyBorder (JBUI .insets (10 , 0 , 0 , 0 )));
45+ root .add (content , BorderLayout .NORTH );
46+
47+ return root ;
2948 }
3049
3150 @ Nls
@@ -48,9 +67,7 @@ public JComponent createComponent() {
4867
4968 @ Override
5069 public boolean isModified () {
51- return
52- !appendRoundBracket .isSelected () == ApplicationSettings .getInstance ().appendRoundBracket
53- ;
70+ return appendRoundBracket .isSelected () != ApplicationSettings .getInstance ().appendRoundBracket ;
5471 }
5572
5673 @ Override
0 commit comments