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()
26 ArrayList configsList = new ArrayList();
27 for (int i = 0; i < allConfigsList.size(); i++) {
28 IConfiguration temp = (IConfiguration) allConfigsList.get(i);
29 if (temp.getType().equals(PHPHelpPlugin.HTTP_QUERY)) {
30 if (name != null && temp.getName().equalsIgnoreCase(name)) {
31 return (Configuration) temp;
33 configsList.add(temp);
39 Collections.sort(configsList);
41 ListSelectionDialog listSelectionDialog = new ListSelectionDialog(
42 PHPHelpPlugin.getDefault().getWorkbench()
43 .getActiveWorkbenchWindow().getShell(), configsList,
44 new ListContentProvider(), new LabelProvider(), "Select URL");
45 listSelectionDialog.setTitle("Multiple configuration found");
46 if (listSelectionDialog.open() == Window.OK) {
47 Object[] configurations = listSelectionDialog.getResult();
48 if (configurations != null) {
49 for (int i = 0; i < configurations.length; i++) {
50 return ((Configuration) configurations[i]); // .getURL();