Whole refactor.
[phpeclipse.git] / net.sourceforge.phpeclipse.phphelp / src / net / sourceforge / phpdt / httpquery / HTTPQueryAction.java
index 50dce47..7b0381c 100644 (file)
@@ -16,35 +16,42 @@ import org.eclipse.ui.dialogs.ListSelectionDialog;
 
 public class HTTPQueryAction extends AbstractHTTPQueryAction {
 
-  public HTTPQueryAction() {
-    super();
-  }
-
-  protected Configuration getConfiguration() {
-    String selectedURL = null;
-
-    List allConfigsList = ConfigurationManager.getInstance().getConfigurations();
-    ArrayList configsList = new ArrayList();
-    for (int i = 0; i < allConfigsList.size(); i++) {
-      IConfiguration temp = (IConfiguration) allConfigsList.get(i);
-      if (temp.getType().equals(PHPHelpPlugin.HTTP_QUERY)) {
-        configsList.add(temp);
-      }
-    }
-    Collections.sort(configsList);
-
-    ListSelectionDialog listSelectionDialog = new ListSelectionDialog(PHPHelpPlugin.getDefault().getWorkbench()
-        .getActiveWorkbenchWindow().getShell(), configsList, new ListContentProvider(), new LabelProvider(), "Select URL");
-    listSelectionDialog.setTitle("Multiple configuration found");
-    if (listSelectionDialog.open() == Window.OK) {
-      Object[] configurations = listSelectionDialog.getResult();
-      if (configurations != null) {
-        for (int i = 0; i < configurations.length; i++) {
-          return ((Configuration) configurations[i]); // .getURL();
-        }
-      }
-    }
-    return null;
-  }
+       public HTTPQueryAction() {
+               super();
+       }
+
+       protected Configuration getConfiguration(String name) {
+               List allConfigsList = ConfigurationManager.getInstance()
+                               .getConfigurations();
+               ArrayList configsList = new ArrayList();
+               for (int i = 0; i < allConfigsList.size(); i++) {
+                       IConfiguration temp = (IConfiguration) allConfigsList.get(i);
+                       if (temp.getType().equals(PHPHelpPlugin.HTTP_QUERY)) {
+                               if (name != null && temp.getName().equalsIgnoreCase(name)) {
+                                       return (Configuration) temp;
+                               }
+                               configsList.add(temp);
+                       }
+               }
+               if (name != null) {
+                       return null;
+               }
+               Collections.sort(configsList);
+
+               ListSelectionDialog listSelectionDialog = new ListSelectionDialog(
+                               PHPHelpPlugin.getDefault().getWorkbench()
+                                               .getActiveWorkbenchWindow().getShell(), configsList,
+                               new ListContentProvider(), new LabelProvider(), "Select URL");
+               listSelectionDialog.setTitle("Multiple configuration found");
+               if (listSelectionDialog.open() == Window.OK) {
+                       Object[] configurations = listSelectionDialog.getResult();
+                       if (configurations != null) {
+                               for (int i = 0; i < configurations.length; i++) {
+                                       return ((Configuration) configurations[i]); // .getURL();
+                               }
+                       }
+               }
+               return null;
+       }
 
 }
\ No newline at end of file