Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1142 fix bug IllegalArgumentException in NewModuleAction class #1150

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
import org.jetbrains.annotations.NotNull;

public class NewModuleAction extends com.intellij.openapi.actionSystem.AnAction {
public static String actionName = "Magento 2 Module";
public static String actionDescription = "Create a new Magento 2 Module";
public static final String ACTION_NAME = "Magento 2 Module";
public static final String ACTION_DESCRIPTION = "Create a new Magento 2 Module";

/**
* Constructor.
*/
public NewModuleAction() {
super(actionName, actionDescription, MagentoIcons.MODULE);
super(ACTION_NAME, ACTION_DESCRIPTION, MagentoIcons.MODULE);
}

@Override
Expand Down Expand Up @@ -67,6 +67,10 @@ public boolean isDumbAware() {
public void update(final AnActionEvent event) {
final Project project = event.getData(PlatformDataKeys.PROJECT);

if (project == null) {
return;
}

if (Settings.isEnabled(project)) {
final String magentoPath = Settings.getMagentoPath(project);
if (magentoPath == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public NewModuleDialog(
detectPackageName(initialBaseDir);
setContentPane(contentPane);
setModal(true);
setTitle(NewModuleAction.actionDescription);
setTitle(NewModuleAction.ACTION_DESCRIPTION);
getRootPane().setDefaultButton(buttonOK);
setLicenses();
setModuleDependencies();
Expand Down Expand Up @@ -214,7 +214,7 @@ private PsiFile generateComposerJson() {
getModuleLicense(),
getModuleDependencies(),
true
), project).generate(NewModuleAction.actionName);
), project).generate(NewModuleAction.ACTION_NAME);
}

private PsiFile generateRegistrationPhp() {
Expand All @@ -223,7 +223,7 @@ private PsiFile generateRegistrationPhp() {
getModuleName(),
getBaseDir(),
true
), project).generate(NewModuleAction.actionName);
), project).generate(NewModuleAction.ACTION_NAME);
}

private void generateModuleXml() {
Expand All @@ -234,15 +234,15 @@ private void generateModuleXml() {
getBaseDir(),
getModuleDependencies(),
true
), project).generate(NewModuleAction.actionName, true);
), project).generate(NewModuleAction.ACTION_NAME, true);
}

private void generateReadmeMd() {
new ModuleReadmeMdGenerator(new ModuleReadmeMdData(
getPackageName(),
getModuleName(),
getBaseDir()
), project).generate(NewModuleAction.actionName);
), project).generate(NewModuleAction.ACTION_NAME);
}

private PsiDirectory getBaseDir() {
Expand Down