A placeholder module for build, to support the CVS modules reorg
[phpeclipse.git] / net.sourceforge.phpeclipse.phphelp / src / net / sourceforge / phpdt / httpquery / HTTPQueryAction.java
1 package net.sourceforge.phpdt.httpquery;
2
3 import java.util.ArrayList;
4 import java.util.Collections;
5 import java.util.List;
6
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;
12
13 import org.eclipse.jface.viewers.LabelProvider;
14 import org.eclipse.jface.window.Window;
15 import org.eclipse.ui.dialogs.ListSelectionDialog;
16
17 public class HTTPQueryAction extends AbstractHTTPQueryAction {
18
19         public HTTPQueryAction() {
20                 super();
21         }
22
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;
31                                 }
32                                 configsList.add(temp);
33                         }
34                 }
35                 if (name != null) {
36                         return null;
37                 }
38                 Collections.sort(configsList);
39
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();
48                                 }
49                         }
50                 }
51                 return null;
52         }
53
54 }