integrated velocity engine for URL templates
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.wiki / src / net / sourceforge / phpeclipse / wiki / actions / httpquery / AbstractHTTPQueryAction.java
index 1aaad74..c721086 100644 (file)
@@ -4,8 +4,8 @@ import java.io.StringWriter;
 import java.net.URL;
 
 import net.sourceforge.phpeclipse.webbrowser.views.BrowserView;
+import net.sourceforge.phpeclipse.wiki.internal.Configuration;
 import net.sourceforge.phpeclipse.wiki.internal.ConfigurationWorkingCopy;
-import net.sourceforge.phpeclipse.wiki.internal.IConfiguration;
 import net.sourceforge.phpeclipse.wiki.velocity.EditorText;
 
 import org.apache.velocity.VelocityContext;
@@ -32,13 +32,9 @@ public abstract class AbstractHTTPQueryAction implements IEditorActionDelegate {
     text = new EditorText(targetEditor);
   }
 
-  abstract protected IConfiguration getUrl();
+  abstract protected Configuration getConfiguration();
 
   public void run(IAction action) {
-//    String selection = findSelectedText();
-//    if (selection == null || selection.trim().length() == 0) {
-//      selection = "";
-//    }
     URL url;
     IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
     if (window != null) {
@@ -50,8 +46,8 @@ public abstract class AbstractHTTPQueryAction implements IEditorActionDelegate {
         } else {
           page.bringToTop(part);
         }
-        IConfiguration config = getUrl();
-        String templateString = generateUrl(config.getURL());
+        Configuration config = getConfiguration();
+        String templateString = generateUrl(config, config.getURL());
         if (templateString != null && !templateString.equals("")) {
           ((BrowserView) part).setUrl(templateString);
         }
@@ -63,7 +59,7 @@ public abstract class AbstractHTTPQueryAction implements IEditorActionDelegate {
   public void selectionChanged(IAction action, ISelection selection) {
   }
 
-  public String generateUrl(String template) {
+  public String generateUrl(Configuration config, String template) {
 
     /* first, we init the runtime engine. Defaults are fine. */
 
@@ -74,10 +70,6 @@ public abstract class AbstractHTTPQueryAction implements IEditorActionDelegate {
 
       VelocityContext context = new VelocityContext();
       
-      ConfigurationWorkingCopy config = new ConfigurationWorkingCopy();
-      config.setName("test");
-      config.setPassword("pw");
-      
       context.put("config", config);
       text.clear();
       context.put("text", text);