1 package net.sourceforge.phpdt.httpquery;
3 import java.util.ArrayList;
4 import java.util.Collections;
7 import net.sourceforge.phpdt.httpquery.config.Configuration;
8 import net.sourceforge.phpdt.httpquery.config.ConfigurationManager;
9 import net.sourceforge.phpdt.httpquery.config.IConfiguration;
10 import net.sourceforge.phpdt.internal.ui.viewsupport.ListContentProvider;
11 import net.sourceforge.phpdt.phphelp.PHPHelpPlugin;
13 import org.eclipse.jface.viewers.LabelProvider;
14 import org.eclipse.jface.window.Window;
15 import org.eclipse.ui.dialogs.ListSelectionDialog;
17 public class HTTPQueryAction extends AbstractHTTPQueryAction {
19 public HTTPQueryAction() {
23 protected Configuration getConfiguration(String name) {
24 List allConfigsList = ConfigurationManager.getInstance().getConfigurations();
25 ArrayList configsList = new ArrayList();
26 for (int i = 0; i < allConfigsList.size(); i++) {
27 IConfiguration temp = (IConfiguration) allConfigsList.get(i);
28 if (temp.getType().equals(PHPHelpPlugin.HTTP_QUERY)) {
29 if (name != null && temp.getName().equalsIgnoreCase(name)) {
30 return (Configuration) temp;
32 configsList.add(temp);
38 Collections.sort(configsList);
40 ListSelectionDialog listSelectionDialog = new ListSelectionDialog(PHPHelpPlugin.getDefault().getWorkbench()
41 .getActiveWorkbenchWindow().getShell(), configsList, new ListContentProvider(), new LabelProvider(), "Select URL");
42 listSelectionDialog.setTitle("Multiple configuration found");
43 if (listSelectionDialog.open() == Window.OK) {
44 Object[] configurations = listSelectionDialog.getResult();
45 if (configurations != null) {
46 for (int i = 0; i < configurations.length; i++) {
47 return ((Configuration) configurations[i]); // .getURL();