Open PHP Help Online Manual in the browser / add other http querie for google and...
[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() {
24     String selectedURL = null;
25
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);
32       }
33     }
34     Collections.sort(configsList);
35
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();
44         }
45       }
46     }
47     return null;
48   }
49
50 }