|
2 | 2 | * Copyright © Magento, Inc. All rights reserved.
|
3 | 3 | * See COPYING.txt for license details.
|
4 | 4 | */
|
| 5 | + |
5 | 6 | package com.magento.idea.magento2plugin.actions.generation.dialog;
|
6 | 7 |
|
7 | 8 | import com.intellij.openapi.project.Project;
|
|
18 | 19 | import com.magento.idea.magento2plugin.ui.FilteredComboBox;
|
19 | 20 | import org.jetbrains.annotations.NotNull;
|
20 | 21 |
|
21 |
| -import javax.swing.*; |
22 |
| -import java.awt.event.*; |
| 22 | +import javax.swing.JButton; |
| 23 | +import javax.swing.JComboBox; |
| 24 | +import javax.swing.JComponent; |
| 25 | +import javax.swing.JLabel; |
| 26 | +import javax.swing.JPanel; |
| 27 | +import javax.swing.JTextField; |
| 28 | +import javax.swing.KeyStroke; |
| 29 | +import java.awt.event.KeyEvent; |
| 30 | +import java.awt.event.WindowAdapter; |
| 31 | +import java.awt.event.WindowEvent; |
23 | 32 | import java.util.List;
|
24 | 33 |
|
25 | 34 | public class CreateAnObserverDialog extends AbstractDialog {
|
@@ -62,26 +71,38 @@ public void windowClosing(WindowEvent e) {
|
62 | 71 | }
|
63 | 72 | });
|
64 | 73 |
|
65 |
| - contentPane.registerKeyboardAction(new ActionListener() { |
66 |
| - public void actionPerformed(ActionEvent e) { |
67 |
| - onCancel(); |
68 |
| - } |
69 |
| - }, KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); |
| 74 | + contentPane.registerKeyboardAction( |
| 75 | + e -> onCancel(), |
| 76 | + KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), |
| 77 | + JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT |
| 78 | + ); |
70 | 79 | }
|
71 | 80 |
|
| 81 | + /** |
| 82 | + * Open an action dialog |
| 83 | + * |
| 84 | + * @param project |
| 85 | + * @param targetEvent |
| 86 | + */ |
72 | 87 | public static void open(@NotNull Project project, String targetEvent) {
|
73 | 88 | CreateAnObserverDialog dialog = new CreateAnObserverDialog(project, targetEvent);
|
74 | 89 | dialog.pack();
|
75 | 90 | dialog.centerDialog(dialog);
|
76 | 91 | dialog.setVisible(true);
|
77 | 92 | }
|
78 | 93 |
|
| 94 | + /** |
| 95 | + * Setup observer area combobox |
| 96 | + */ |
79 | 97 | private void fillTargetAreaOptions() {
|
80 | 98 | for (Package.Areas area : Package.Areas.values()) {
|
81 | 99 | observerArea.addItem(area.toString());
|
82 | 100 | }
|
83 | 101 | }
|
84 | 102 |
|
| 103 | + /** |
| 104 | + * Perform code generation using input data |
| 105 | + */ |
85 | 106 | private void onOK() {
|
86 | 107 | if (!validator.validate(project)) {
|
87 | 108 | return;
|
@@ -126,6 +147,7 @@ public String getObserverModule() {
|
126 | 147 | return this.observerModule.getSelectedItem().toString();
|
127 | 148 | }
|
128 | 149 |
|
| 150 | + @SuppressWarnings("checkstyle:AbbreviationAsWordInName") |
129 | 151 | private void createUIComponents() {
|
130 | 152 | List<String> allModulesList = ModuleIndex.getInstance(project).getEditableModuleNames();
|
131 | 153 |
|
|
0 commit comments