Skip to content

Commit 87216d7

Browse files
authored
Merge pull request #595 from anzin/add-resource-to-web-api-dialog-form
Added resource to web API dialog form
2 parents 95d4d60 + ca34cd1 commit 87216d7

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/com/magento/idea/magento2plugin/actions/generation/dialog/NewWebApiDeclarationDialog.java

+12-3
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,12 @@
1818
import com.magento.idea.magento2plugin.actions.generation.generator.xml.WebApiDeclarationGenerator;
1919
import com.magento.idea.magento2plugin.magento.packages.HttpMethod;
2020
import com.magento.idea.magento2plugin.magento.packages.WebApiResource;
21-
import com.magento.idea.magento2plugin.ui.FilteredComboBox;
21+
import com.magento.idea.magento2plugin.util.magento.GetAclResourcesListUtil;
2222
import com.magento.idea.magento2plugin.util.magento.GetModuleNameByDirectoryUtil;
2323
import java.awt.event.KeyEvent;
2424
import java.awt.event.WindowAdapter;
2525
import java.awt.event.WindowEvent;
26+
import java.util.List;
2627
import javax.swing.JButton;
2728
import javax.swing.JComboBox;
2829
import javax.swing.JComponent;
@@ -54,7 +55,7 @@ public class NewWebApiDeclarationDialog extends AbstractDialog {
5455
private JComboBox<ComboBoxItemData> httpMethod;
5556
private JTextField serviceClass;
5657
private JTextField serviceMethod;
57-
private JComboBox aclResource;
58+
private JComboBox<ComboBoxItemData> aclResource;
5859

5960
// labels
6061
private JLabel routeUrlLabel;//NOPMD
@@ -170,11 +171,19 @@ private void fillPredefinedValuesAndDisableInputs() {
170171
@SuppressWarnings({"PMD.UnusedPrivateMethod", "PMD.AvoidInstantiatingObjectsInLoops"})
171172
private void createUIComponents() {
172173
httpMethod = new ComboBox<>();
174+
aclResource = new ComboBox<>();
173175

174176
for (final String method : HttpMethod.getHttpMethodList()) {
175177
httpMethod.addItem(new ComboBoxItemData(method, method));
176178
}
177-
aclResource = new FilteredComboBox(WebApiResource.getDefaultResourcesList());
179+
180+
final List<String> aclResources = GetAclResourcesListUtil.execute(project);
181+
final List<String> defaultResources = WebApiResource.getDefaultResourcesList();
182+
defaultResources.addAll(aclResources);
183+
184+
for (final String acl : defaultResources) {
185+
aclResource.addItem(new ComboBoxItemData(acl, acl));
186+
}
178187
}
179188

180189
/**

0 commit comments

Comments
 (0)