Refresh Wiki Editor Texct from MySQL via JDBC interface
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.wiki / src / net / sourceforge / phpeclipse / wiki / preferences / Util.java
index b8d41f4..417165e 100644 (file)
@@ -21,6 +21,15 @@ import org.eclipse.ui.PlatformUI;
 import org.plog4u.wiki.filter.FilterUtil;
 
 public class Util {
+  public static String titleToDB(String in) {
+    return in.replaceAll(" ", "_");
+  }
+  public static String db2Title(String in) {
+    return in.replaceAll("_", " ");
+  }
+  public static String db2TitleLink(String in) {
+    return "[["+in.replaceAll("_", " ")+"]]";
+  }
   public static Shell findShell() {
     IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
     if (window != null) {
@@ -110,7 +119,7 @@ public class Util {
     return "true".equals(use);
   }
 
-  public static void setWikiTextsPath(IProject project) {
+  public static void setWikiBuilderPreferences(IProject project) {
     String value = project.getLocation().toString();
     IPreferenceStore store = WikiEditorPlugin.getDefault().getPreferenceStore();
     String globalBasePath = store.getString(WikiEditorPlugin.WIKI_TEXTS_BASE_PATH);
@@ -118,6 +127,8 @@ public class Util {
       store.setValue(WikiEditorPlugin.WIKI_TEXTS_BASE_PATH, value + "/wpsrc");
       store.setValue(WikiEditorPlugin.LOCAL_TEMPLATE_FILE_NAME, value + "/wpsrc/main.vm");
       store.setValue(WikiEditorPlugin.EXPORT_TEMPLATE_FILE_NAME, value + "/wpsrc/export.vm");
+      store.setValue(WikiEditorPlugin.LOCAL_CSS_URL, "file://"+value+"/wpsrc/main.css");
+      store.setValue(WikiEditorPlugin.EXPORT_CSS_URL, "file://"+value+"/wpsrc/main.css");
     }
     String htmlFolder = store.getString(WikiEditorPlugin.HTML_OUTPUT_PATH);
     if (htmlFolder == null || htmlFolder.equals("")) {  
@@ -129,6 +140,8 @@ public class Util {
     setProperty(project, WikiProjectPreferences.PREF_ID, WikiEditorPlugin.HTML_OUTPUT_PATH, value + "/wpbin");
     setProperty(project, WikiProjectPreferences.PREF_ID, WikiEditorPlugin.LOCAL_TEMPLATE_FILE_NAME, value + "/wpsrc/main.vm");
     setProperty(project, WikiProjectPreferences.PREF_ID, WikiEditorPlugin.EXPORT_TEMPLATE_FILE_NAME, value + "/wpsrc/export.vm");
+    setProperty(project, WikiProjectPreferences.PREF_ID, WikiEditorPlugin.LOCAL_CSS_URL, "file://"+value+"/wpsrc/main.css");
+    setProperty(project, WikiProjectPreferences.PREF_ID, WikiEditorPlugin.EXPORT_CSS_URL, "file://"+value+"/wpsrc/main.css");
     //    IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
     //    IResource resource = root.findMember(project.getLocation());
     NullProgressMonitor _monitor = new NullProgressMonitor();
@@ -159,11 +172,15 @@ public class Util {
   public static String getLocalTemplate(IResource file) {
     return Util.getPreferenceValue(file.getProject(), WikiEditorPlugin.LOCAL_TEMPLATE_FILE_NAME);
   }
-  
+  public static String getLocalCssUrl(IResource file) {
+    return Util.getPreferenceValue(file.getProject(), WikiEditorPlugin.LOCAL_CSS_URL);
+  }
   public static String getExportTemplate(IResource file) {
     return Util.getPreferenceValue(file.getProject(), WikiEditorPlugin.EXPORT_TEMPLATE_FILE_NAME);
   }
-  
+  public static String getExportCssUrl(IResource file) {
+    return Util.getPreferenceValue(file.getProject(), WikiEditorPlugin.EXPORT_CSS_URL);
+  }
   public static String getProjectsWikiTextsPath(IProject project) {
     return Util.getPreferenceValue(project, WikiEditorPlugin.WIKI_TEXTS_BASE_PATH);
   }