Skip to content

869: enhanced new cron group dialog UX #882

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

Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
869: Code refactoring
  • Loading branch information
bohdan-harniuk committed Dec 21, 2021
commit f80dbf2969580bfda9a69dcf435896574e56fbe6
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import com.magento.idea.magento2plugin.MagentoIcons;
import com.magento.idea.magento2plugin.actions.generation.dialog.NewCronGroupDialog;

@SuppressWarnings({"PMD.OnlyOneReturn"})
public class NewCronGroupAction extends com.intellij.openapi.actionSystem.AnAction {

public static final String ACTION_NAME = "Magento 2 Cron Group";
public static final String ACTION_DESCRIPTION = "Create a new Magento 2 Cron Group";

Expand All @@ -35,18 +35,16 @@ public void actionPerformed(final AnActionEvent event) {
if (view == null) {
return;
}

final Project project = CommonDataKeys.PROJECT.getData(dataContext);

if (project == null) {
return;
}

final PsiDirectory directory = view.getOrChooseDirectory();

if (directory == null) {
return;
}

NewCronGroupDialog.open(project, directory);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,16 @@
"PMD.ExcessiveImports,"
})
public class NewCronGroupDialog extends AbstractDialog {

private final String moduleName;
private final Project project;
private JPanel contentPanel;
private JButton buttonOK;
private JButton buttonCancel;
private static final String NAME = "name";

@FieldValidation(rule = RuleRegistry.NOT_EMPTY,
message = {NotEmptyRule.MESSAGE, NAME})
@FieldValidation(rule = RuleRegistry.IDENTIFIER,
message = {IdentifierRule.MESSAGE, NAME})
@FieldValidation(rule = RuleRegistry.NOT_EMPTY, message = {NotEmptyRule.MESSAGE, NAME})
@FieldValidation(rule = RuleRegistry.IDENTIFIER, message = {IdentifierRule.MESSAGE, NAME})
private JTextField cronGroupName;

private JSpinner scheduleGenerateEvery;
Expand Down Expand Up @@ -142,13 +141,8 @@ public static void open(final Project project, final PsiDirectory directory) {
private void onOK() {
if (validateFormFields()) {
generateFile();
exit();
}
exit();
}

@Override
protected void onCancel() {
dispose();
}

private void generateFile() {
Expand Down