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() {
24 String selectedURL = null;
26 List allConfigsList = ConfigurationManager.getInstance().getConfigurations();
27 ArrayList configsList = new ArrayList();
28 for (int i = 0; i < allConfigsList.size(); i++) {
29 IConfiguration temp = (IConfiguration) allConfigsList.get(i);
30 if (temp.getType().equals(PHPHelpPlugin.HTTP_QUERY)) {
31 configsList.add(temp);
34 Collections.sort(configsList);
36 ListSelectionDialog listSelectionDialog = new ListSelectionDialog(PHPHelpPlugin.getDefault().getWorkbench()
37 .getActiveWorkbenchWindow().getShell(), configsList, new ListContentProvider(), new LabelProvider(), "Select URL");
38 listSelectionDialog.setTitle("Multiple configuration found");
39 if (listSelectionDialog.open() == Window.OK) {
40 Object[] configurations = listSelectionDialog.getResult();
41 if (configurations != null) {
42 for (int i = 0; i < configurations.length; i++) {
43 return ((Configuration) configurations[i]); // .getURL();