Skip to content

Commit b2be064

Browse files
author
Vitaliy Boyko
committed
Moved configs to frameworks section
1 parent 8c7e9a1 commit b2be064

File tree

5 files changed

+71
-10
lines changed

5 files changed

+71
-10
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ This is a plugin for Magento 2 development in the PhpStorm IDE. It is available
1111
2. Navigate to `Plugins`
1212
3. Click the `Browse repositories...` button and search for "Magento PhpStorm"
1313
4. Install the plugin and restart PhpStorm
14-
5. Go to `Settings > Preferences > Languages & Frameworks > PHP > Magento` in the PhpStorm IDE
14+
5. Go to `Settings > Preferences > Languages & Frameworks > PHP > Frameworks > Magento` in the PhpStorm IDE
1515
6. Check `Enable` and `OK` button.
1616

1717
## Works with

resources/META-INF/plugin.xml

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,6 @@
8282
<directoryProjectGenerator implementation="com.magento.idea.magento2plugin.generation.MagentoModuleGenerator"/>
8383
<projectTemplatesFactory implementation="com.magento.idea.magento2plugin.generation.MagentoTemplatesFactory"/>
8484

85-
<projectConfigurable instance="com.magento.idea.magento2plugin.project.SettingsForm"
86-
id="Magento2.SettingsForm"
87-
displayName="Magento"
88-
nonDefaultProject="true"
89-
groupId="language"
90-
parentId="reference.webide.settings.project.settings.php"
91-
/>
9285
<projectService serviceImplementation="com.magento.idea.magento2plugin.project.Settings"/>
9386

9487
<completion.contributor language="XML" implementationClass="com.magento.idea.magento2plugin.completion.xml.XmlCompletionContributor" />
@@ -156,4 +149,9 @@
156149
<internalFileTemplate name="Magento Module Events Xml"/>
157150
</extensions>
158151

152+
<extensions defaultExtensionNs="com.jetbrains.php">
153+
<frameworkProjectConfigurableProvider implementation="com.magento.idea.magento2plugin.project.ConfigurableProvider"/>
154+
<frameworkUsageProvider implementation="com.magento.idea.magento2plugin.project.UsagesProvider"/>
155+
</extensions>
156+
159157
</idea-plugin>
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
package com.magento.idea.magento2plugin.project;
6+
7+
import com.intellij.openapi.project.Project;
8+
import com.jetbrains.php.frameworks.PhpFrameworkConfigurable;
9+
import com.jetbrains.php.frameworks.PhpFrameworkConfigurableProvider;
10+
import org.jetbrains.annotations.Nls;
11+
import org.jetbrains.annotations.NotNull;
12+
13+
public class ConfigurableProvider implements PhpFrameworkConfigurableProvider {
14+
public ConfigurableProvider() {
15+
}
16+
17+
@Nls
18+
@NotNull
19+
public String getName() {
20+
return "Magento 2";
21+
}
22+
23+
@NotNull
24+
public PhpFrameworkConfigurable createConfigurable(@NotNull Project project) {
25+
26+
return new SettingsForm(project);
27+
}
28+
}

src/com/magento/idea/magento2plugin/project/SettingsForm.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
import com.intellij.openapi.application.ApplicationManager;
1010
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
1111
import com.intellij.openapi.fileChooser.FileChooserDescriptorFactory;
12-
import com.intellij.openapi.options.Configurable;
1312
import com.intellij.openapi.options.ConfigurationException;
1413
import com.intellij.openapi.project.Project;
1514
import com.intellij.openapi.ui.ComponentWithBrowseButton;
@@ -20,6 +19,7 @@
2019
import com.intellij.psi.PsiFile;
2120
import com.intellij.psi.PsiManager;
2221
import com.intellij.psi.search.FilenameIndex;
22+
import com.jetbrains.php.frameworks.PhpFrameworkConfigurable;
2323
import com.magento.idea.magento2plugin.actions.generation.util.MagentoVersion;
2424
import com.magento.idea.magento2plugin.indexes.IndexManager;
2525
import com.magento.idea.magento2plugin.init.ConfigurationManager;
@@ -34,7 +34,7 @@
3434
import java.util.Collection;
3535
import java.util.Stack;
3636

37-
public class SettingsForm implements Configurable {
37+
public class SettingsForm implements PhpFrameworkConfigurable {
3838

3939
private final static String DISPLAY_NAME = "Magento";
4040
private final Project project;
@@ -167,6 +167,17 @@ protected VirtualFile getInitialFile() {
167167
};
168168
this.magentoPath.addActionListener(browseFolderListener);
169169
}
170+
171+
@Override
172+
public boolean isBeingUsed() {
173+
return this.pluginEnabled.isSelected();
174+
}
175+
176+
@NotNull
177+
@Override
178+
public String getId() {
179+
return "Magento2.SettingsForm";
180+
}
170181
}
171182

172183
class RegenerateUrnMapListener extends MouseAdapter {
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/**
2+
* Copyright © Magento, Inc. All rights reserved.
3+
* See COPYING.txt for license details.
4+
*/
5+
package com.magento.idea.magento2plugin.project;
6+
7+
import com.intellij.openapi.project.Project;
8+
import com.jetbrains.php.frameworks.PhpFrameworkUsageProvider;
9+
import org.jetbrains.annotations.NotNull;
10+
11+
public class UsagesProvider implements PhpFrameworkUsageProvider {
12+
public UsagesProvider() {
13+
}
14+
15+
@NotNull
16+
public String getName() {
17+
return "Magento 2";
18+
}
19+
20+
public boolean isEnabled(@NotNull Project project) {
21+
22+
return Settings.getInstance(project).pluginEnabled;
23+
}
24+
}

0 commit comments

Comments
 (0)