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};
66use Magento\Framework\Event\ObserverInterface;
77use Magento\Framework\Event\Observer;
88
9+ /**
10+ * Observes the `${EVENT_NAME}` event.
11+ */
912class ${CLASS_NAME} implements ObserverInterface
1013{
1114 /**
1215 * Observer for ${EVENT_NAME}.
1316 *
1417 * @param Observer $observer
18+ *
1519 * @return void
1620 */
1721 public function execute(Observer $observer)
Original file line number Diff line number Diff line change @@ -52,7 +52,8 @@ protected boolean isVisible(
5252 final PsiDirectory targetDirectory ,
5353 final PsiFile targetFile
5454 ) {
55- if (!moduleData .getType ().equals (ComponentType .module )) {
55+ if (!moduleData .getType ().equals (ComponentType .module )
56+ || !moduleData .getModuleDir ().equals (targetDirectory .getParentDirectory ())) {
5657 return false ;
5758 }
5859
Original file line number Diff line number Diff line change 77 </constraints >
88 <properties >
99 <opaque value =" true" />
10- <preferredSize width =" 720 " height =" 280" />
10+ <preferredSize width =" 420 " height =" 280" />
1111 <requestFocusEnabled value =" true" />
1212 </properties >
1313 <border type =" none" />
1414 <children >
1515 <grid id =" 9ad5" layout-manager =" GridLayoutManager" row-count =" 1" column-count =" 2" same-size-horizontally =" false" same-size-vertically =" false" hgap =" -1" vgap =" -1" >
1616 <margin top =" 0" left =" 0" bottom =" 0" right =" 0" />
1717 <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" />
1919 </constraints >
2020 <properties />
2121 <border type =" none" />
102102 </component >
103103 <component id =" 12752" class =" com.magento.idea.magento2plugin.ui.FilteredComboBox" binding =" eventName" custom-create =" true" >
104104 <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 >
106108 </constraints >
107109 <properties />
108110 </component >
116118 </component >
117119 <component id =" ec3f4" class =" javax.swing.JComboBox" binding =" observerArea" custom-create =" true" >
118120 <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 >
120124 </constraints >
121125 <properties />
122126 </component >
146150 </component >
147151 <component id =" 662ad" class =" javax.swing.JLabel" binding =" classNameLabel" >
148152 <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" />
152154 </constraints >
153155 <properties >
154156 <text value =" Class Name" />
Original file line number Diff line number Diff line change 55use Magento \Framework \Event \ObserverInterface ;
66use Magento \Framework \Event \Observer ;
77
8+ /**
9+ * Observes the `test_event_name` event.
10+ */
811class TestClassObserver implements ObserverInterface
912{
1013 /**
1114 * Observer for test_event_name.
1215 *
1316 * @param Observer $observer
17+ *
1418 * @return void
1519 */
1620 public function execute (Observer $ observer )
Original file line number Diff line number Diff line change 1010import com .magento .idea .magento2plugin .magento .files .ModuleObserverFile ;
1111
1212public final class ModuleObserverGeneratorTest extends BaseGeneratorTestCase {
13+
1314 private static final String CLASS_NAME = "TestClassObserver" ;
1415
1516 /**
You can’t perform that action at this time.
0 commit comments