Skip to content

Commit 57503bd

Browse files
author
Vitaliy Boyko
committed
Refactoring, adjusting width of the popup
1 parent d9a5242 commit 57503bd

File tree

2 files changed

+13
-8
lines changed

2 files changed

+13
-8
lines changed
Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
inspection.plugin.duplicateInSameFile=The plugin name already used in this file. For more details see Inspection Description.
22
inspection.plugin.duplicateInOtherPlaces=The plugin name "{0}" for targeted "{1}" class is already used in the module "{2}" ({3} scope). For more details see Inspection Description.
3-
inspection.graphql.resolver.mustImplement=Class must implements any of the following interfaces: \\Magento\\Framework\\GraphQl\\Query\\ResolverInterface, \\Magento\\Framework\\GraphQl\\Query\\Resolver\\BatchResolverInterface, \\Magento\\Framework\\GraphQl\\Query\\Resolver\\BatchServiceContractResolverInterface
3+
inspection.graphql.resolver.mustImplement=Class must implements any of the following interfaces: \\Magento\\Framework\\GraphQl\\Query\\ResolverInterface, \\Magento\\Framework\\GraphQl\\Query\\Resolver\\BatchResolverInterface, \\Magento\\Framework\\GraphQl\\Query\\Resolver\\BatchServiceContractResolverInterface
4+
inspection.graphql.resolver.fix.family=Implement Resolver interface
5+
inspection.graphql.resolver.fix.title=Select one of the following interface

src/com/magento/idea/magento2plugin/inspections/php/fix/PhpImplementResolverClassQuickFix.java

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,29 @@
1414
import com.jetbrains.php.refactoring.extract.extractInterface.PhpExtractInterfaceProcessor;
1515
import com.jetbrains.php.lang.psi.PhpPsiElementFactory;
1616
import com.jetbrains.php.lang.psi.elements.PhpClass;
17+
import com.magento.idea.magento2plugin.bundles.InspectionBundle;
1718
import com.magento.idea.magento2plugin.magento.files.GraphQlResolver;
1819
import org.jetbrains.annotations.NotNull;
1920
import javax.swing.*;
2021

2122
public class PhpImplementResolverClassQuickFix implements LocalQuickFix {
22-
public static final String FAMILY_NAME = "Implements Resolver interface";
23-
public static final String DIALOG_TITLE = "Select one of the following interface";
23+
private InspectionBundle inspectionBundle = new InspectionBundle();
24+
2425
@NotNull
2526
@Override
2627
public String getFamilyName() {
27-
return FAMILY_NAME;
28+
return inspectionBundle.message("inspection.graphql.resolver.fix.family");
2829
}
2930

3031
@Override
3132
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
32-
String[] expectedInterface = { GraphQlResolver.BATCH_RESOLVER_INTERFACE,
33-
GraphQlResolver.BATCH_SERVICE_CONTRACT_RESOLVER_INTERFACE,
34-
GraphQlResolver.RESOLVER_INTERFACE
33+
String[] expectedInterface = {
34+
GraphQlResolver.BATCH_RESOLVER_INTERFACE,
35+
GraphQlResolver.BATCH_SERVICE_CONTRACT_RESOLVER_INTERFACE,
36+
GraphQlResolver.RESOLVER_INTERFACE
3537
};
3638
final JComboBox expectedInterfaceDropdown = new JComboBox(expectedInterface);
39+
((JLabel)expectedInterfaceDropdown.getRenderer()).setHorizontalAlignment(SwingConstants.CENTER);
3740
DialogBuilder dialogBox = createDialogBox(expectedInterfaceDropdown, project);
3841
if (dialogBox.showAndGet()) {
3942
String getSelectedInterface = expectedInterfaceDropdown.getSelectedItem().toString();
@@ -56,7 +59,7 @@ private DialogBuilder createDialogBox(JComboBox selectedClass, Project project)
5659
JPanel panel = new JPanel();
5760
panel.add(selectedClass);
5861
DialogBuilder builder = new DialogBuilder(project);
59-
builder.setTitle(DIALOG_TITLE);
62+
builder.setTitle(inspectionBundle.message("inspection.graphql.resolver.fix.title"));
6063
builder.setCenterPanel(panel);
6164
builder.addOkAction();
6265
builder.addCancelAction();

0 commit comments

Comments
 (0)