Improved Templates i.e.
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.wiki / src / net / sourceforge / phpeclipse / wiki / editor / WikiEditorPlugin.java
index 6e7669b..1b3b0c1 100644 (file)
@@ -3,6 +3,7 @@ package net.sourceforge.phpeclipse.wiki.editor;
 import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URL;
+import java.sql.SQLException;
 import java.text.MessageFormat;
 import java.util.Hashtable;
 import java.util.List;
@@ -11,6 +12,7 @@ import java.util.ResourceBundle;
 
 import net.sourceforge.phpeclipse.wiki.internal.IConfigurationWorkingCopy;
 import net.sourceforge.phpeclipse.wiki.internal.ConfigurationManager;
+import net.sourceforge.phpeclipse.wiki.sql.WikipediaDB;
 
 import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IExtension;
@@ -36,15 +38,17 @@ import org.eclipse.ui.plugin.AbstractUIPlugin;
 public class WikiEditorPlugin extends AbstractUIPlugin {
 
   private static WikiEditorPlugin fgPlugin;
+
   public static final String HTTP_QUERY = "HTTP Query";
+
   public static final String WIKIPEDIA_GET_TEXT = "Wikipedia-Load Text";
-  public static final String WEBLOG_API_SEND = "MetaWeblog API-Post";
-  
-  public static final String[] CONFIGURATION_TYPES = {
-      HTTP_QUERY,
-      WIKIPEDIA_GET_TEXT, 
-      WEBLOG_API_SEND
-  };
+
+  public static final String BLOG_A_WIKI = "Blog as Wiki Text";
+
+  public static final String BLOG_A_HTML = "Blog as HTML Text";
+
+  public static final String[] CONFIGURATION_TYPES = { HTTP_QUERY, WIKIPEDIA_GET_TEXT, BLOG_A_WIKI, BLOG_A_HTML };
+
   //image paths
   public static final String ICON_PATH = "icons/full/"; //$NON-NLS-1$
 
@@ -53,25 +57,34 @@ public class WikiEditorPlugin extends AbstractUIPlugin {
   public final static String HTML_OUTPUT_PATH = "__static_wiki_folder";
 
   public final static String WIKI_TEXTS_BASE_PATH = "__wiki_texts_base_path";
-  
+
   public final static String LOCAL_TEMPLATE_FILE_NAME = "__local_template_file_name";
+
   public final static String EXPORT_TEMPLATE_FILE_NAME = "__export_template_file_name";
-  public final static String LOCAL_CSS_URL = "__local_css_url"; 
+
+  public final static String LOCAL_CSS_URL = "__local_css_url";
+
   public final static String EXPORT_CSS_URL = "__export_css_url";
+
   public final static String PREF_STRING_CONFIGURATIONS = "configurations";
-  public final static String CONFIG_MEMENTO = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" +
-               "<configurations>"+
-"<config name=\"Google Search\" type-id=\"HTTP Query\" url=\"http://www.google.com/search?q=$text.selection\"/>" +
-"<config name=\"Koders.com Search\" type-id=\"HTTP Query\" url=\"http://koders.com/?s=$text.selection\"/>" +
-"<config name=\"Leo.org Translation\" type-id=\"HTTP Query\" url=\"http://dict.leo.org/?search=$text.selection\"/>" +
-"<config name=\"Wikipedia-en\" type-id=\"Wikipedia-Load Text\" url=\"http://en.wikipedia.org/w/wiki.phtml?title=$text.wikiname&amp;action=edit\"/>" +
-"<config name=\"Wikibooks-en\" type-id=\"Wikipedia-Load Text\" url=\"http://en.wikibooks.org/w/wiki.phtml?title=$text.wikiname&amp;action=edit\"/>" +
-"</configurations>";
+
+  public final static String CONFIG_MEMENTO = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>"
+      + "<configurations>"
+      + "<config name=\"Google Search\" type-id=\"HTTP Query\" url=\"http://www.google.com/search?q=$text.selection\"/>"
+      + "<config name=\"Koders.com Search\" type-id=\"HTTP Query\" url=\"http://koders.com/?s=$text.selection\"/>"
+      + "<config name=\"Leo.org Translation\" type-id=\"HTTP Query\" url=\"http://dict.leo.org/?search=$text.selection\"/>"
+      + "<config name=\"Wikipedia-en\" type-id=\"Wikipedia-Load Text\" url=\"http://en.wikipedia.org/w/wiki.phtml?title=$text.wikiname&amp;action=edit\"/>"
+      + "<config name=\"Wikibooks-en\" type-id=\"Wikipedia-Load Text\" url=\"http://en.wikibooks.org/w/wiki.phtml?title=$text.wikiname&amp;action=edit\"/>"
+      + "</configurations>";
+
+  public static WikipediaDB fWikiDB = null;
+
   private static ConfigurationManager manager;
-//
-//  public static final String IMG_MONITOR_ON = "monitorOn";
-//
-//  public static final String IMG_MONITOR_OFF = "monitorOff";
+
+  //
+  //  public static final String IMG_MONITOR_ON = "monitorOn";
+  //
+  //  public static final String IMG_MONITOR_OFF = "monitorOff";
 
   /**
    * Creates an image and places it in the image registry.
@@ -357,8 +370,23 @@ public class WikiEditorPlugin extends AbstractUIPlugin {
   public static IConfigurationWorkingCopy createConfiguration() {
     return manager.createConfiguration();
   }
-  
+
   public static String[] getTypes() {
     return CONFIGURATION_TYPES;
   }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.core.runtime.Plugin#shutdown()
+   */
+  public void shutdown() throws CoreException {
+    if (fWikiDB != null) {
+      try {
+        fWikiDB.shutdown();
+      } catch (SQLException e) {
+      }
+    }
+    super.shutdown();
+  }
 }
\ No newline at end of file