File tree Expand file tree Collapse file tree 5 files changed +20
-8
lines changed
resources/fileTemplates/internal
src/com/magento/idea/magento2plugin/actions
testData/actions/generation/generator/ModuleObserverGenerator/generateModuleObserverFile
tests/com/magento/idea/magento2plugin/actions/generation/generator Expand file tree Collapse file tree 5 files changed +20
-8
lines changed Original file line number Diff line number Diff line change @@ -6,12 +6,16 @@ namespace ${NAMESPACE};
6
6
use Magento\Framework\Event\ObserverInterface;
7
7
use Magento\Framework\Event\Observer;
8
8
9
+ /**
10
+ * Observes the `${EVENT_NAME}` event.
11
+ */
9
12
class ${CLASS_NAME} implements ObserverInterface
10
13
{
11
14
/**
12
15
* Observer for ${EVENT_NAME}.
13
16
*
14
17
* @param Observer $observer
18
+ *
15
19
* @return void
16
20
*/
17
21
public function execute(Observer $observer)
Original file line number Diff line number Diff line change @@ -52,7 +52,8 @@ protected boolean isVisible(
52
52
final PsiDirectory targetDirectory ,
53
53
final PsiFile targetFile
54
54
) {
55
- if (!moduleData .getType ().equals (ComponentType .module )) {
55
+ if (!moduleData .getType ().equals (ComponentType .module )
56
+ || !moduleData .getModuleDir ().equals (targetDirectory .getParentDirectory ())) {
56
57
return false ;
57
58
}
58
59
Original file line number Diff line number Diff line change 7
7
</constraints >
8
8
<properties >
9
9
<opaque value =" true" />
10
- <preferredSize width =" 720 " height =" 280" />
10
+ <preferredSize width =" 420 " height =" 280" />
11
11
<requestFocusEnabled value =" true" />
12
12
</properties >
13
13
<border type =" none" />
14
14
<children >
15
15
<grid id =" 9ad5" layout-manager =" GridLayoutManager" row-count =" 1" column-count =" 2" same-size-horizontally =" false" same-size-vertically =" false" hgap =" -1" vgap =" -1" >
16
16
<margin top =" 0" left =" 0" bottom =" 0" right =" 0" />
17
17
<constraints >
18
- <grid row =" 2" column =" 0" row-span =" 1" col-span =" 1" vsize-policy =" 1 " hsize-policy =" 3" anchor =" 0" fill =" 3" indent =" 0" use-parent-layout =" false" />
18
+ <grid row =" 2" column =" 0" row-span =" 1" col-span =" 1" vsize-policy =" 0 " hsize-policy =" 3" anchor =" 0" fill =" 3" indent =" 0" use-parent-layout =" false" />
19
19
</constraints >
20
20
<properties />
21
21
<border type =" none" />
102
102
</component >
103
103
<component id =" 12752" class =" com.magento.idea.magento2plugin.ui.FilteredComboBox" binding =" eventName" custom-create =" true" >
104
104
<constraints >
105
- <grid row =" 7" column =" 1" row-span =" 1" col-span =" 1" vsize-policy =" 0" hsize-policy =" 2" anchor =" 8" fill =" 1" indent =" 0" use-parent-layout =" false" />
105
+ <grid row =" 7" column =" 1" row-span =" 1" col-span =" 1" vsize-policy =" 0" hsize-policy =" 2" anchor =" 8" fill =" 1" indent =" 0" use-parent-layout =" false" >
106
+ <preferred-size width =" 150" height =" -1" />
107
+ </grid >
106
108
</constraints >
107
109
<properties />
108
110
</component >
116
118
</component >
117
119
<component id =" ec3f4" class =" javax.swing.JComboBox" binding =" observerArea" custom-create =" true" >
118
120
<constraints >
119
- <grid row =" 6" column =" 1" row-span =" 1" col-span =" 1" vsize-policy =" 0" hsize-policy =" 2" anchor =" 8" fill =" 1" indent =" 0" use-parent-layout =" false" />
121
+ <grid row =" 6" column =" 1" row-span =" 1" col-span =" 1" vsize-policy =" 0" hsize-policy =" 2" anchor =" 8" fill =" 1" indent =" 0" use-parent-layout =" false" >
122
+ <preferred-size width =" 150" height =" -1" />
123
+ </grid >
120
124
</constraints >
121
125
<properties />
122
126
</component >
146
150
</component >
147
151
<component id =" 662ad" class =" javax.swing.JLabel" binding =" classNameLabel" >
148
152
<constraints >
149
- <grid row =" 0" column =" 0" row-span =" 1" col-span =" 1" vsize-policy =" 0" hsize-policy =" 0" anchor =" 8" fill =" 0" indent =" 0" use-parent-layout =" false" >
150
- <preferred-size width =" 113" height =" 16" />
151
- </grid >
153
+ <grid row =" 0" column =" 0" row-span =" 1" col-span =" 1" vsize-policy =" 0" hsize-policy =" 0" anchor =" 8" fill =" 0" indent =" 0" use-parent-layout =" false" />
152
154
</constraints >
153
155
<properties >
154
156
<text value =" Class Name" />
Original file line number Diff line number Diff line change 5
5
use Magento \Framework \Event \ObserverInterface ;
6
6
use Magento \Framework \Event \Observer ;
7
7
8
+ /**
9
+ * Observes the `test_event_name` event.
10
+ */
8
11
class TestClassObserver implements ObserverInterface
9
12
{
10
13
/**
11
14
* Observer for test_event_name.
12
15
*
13
16
* @param Observer $observer
17
+ *
14
18
* @return void
15
19
*/
16
20
public function execute (Observer $ observer )
Original file line number Diff line number Diff line change 10
10
import com .magento .idea .magento2plugin .magento .files .ModuleObserverFile ;
11
11
12
12
public final class ModuleObserverGeneratorTest extends BaseGeneratorTestCase {
13
+
13
14
private static final String CLASS_NAME = "TestClassObserver" ;
14
15
15
16
/**
You can’t perform that action at this time.
0 commit comments