Upload/Download of multiple files now possible
[phpeclipse.git] / archive / net.sourceforge.phpeclipse.wiki / src / net / sourceforge / phpeclipse / wiki / actions / OpenWikiLinkEditorAction.java
index d8b4537..8f38c48 100644 (file)
@@ -32,11 +32,11 @@ import org.eclipse.ui.ide.IDE;
 import org.eclipse.ui.internal.ide.IDEWorkbenchPlugin;
 import org.eclipse.ui.texteditor.AbstractTextEditor;
 
-public final class OpenWikiLinkEditorAction implements IEditorActionDelegate {
+public class OpenWikiLinkEditorAction implements IEditorActionDelegate {
 
-  private IWorkbenchWindow window;
+  protected IWorkbenchWindow window;
 
-  private AbstractTextEditor editor;
+  protected AbstractTextEditor editor;
 
   public void dispose() {
   }
@@ -144,10 +144,10 @@ public final class OpenWikiLinkEditorAction implements IEditorActionDelegate {
     
     String textRegion = getWikiString(editor, doc, pos);
     IFileEditorInput ei = (IFileEditorInput) editor.getEditorInput();
-    openWikiFile(ei.getFile(), textRegion);
+    openWikiFile(ei.getFile(), textRegion, true);
   }
 
-  public static void openWikiUrl(IProject project, String word) {
+  public void openWikiUrl(IProject project, String word) {
     if (word != null && !word.equals("")) {
       IFile cfile = project.getFile("dummy.wp");
       IFile file = getWikiFile(cfile, word);
@@ -167,7 +167,7 @@ public final class OpenWikiLinkEditorAction implements IEditorActionDelegate {
     } 
   } 
   
-  public static void openWikiFile(IFile cfile, String word) {
+  protected void openWikiFile(IFile cfile, String word, boolean openEditor) {
     if (word != null && !word.equals("")) {
       IFile file = getWikiFile(cfile, word);
       try {
@@ -186,13 +186,13 @@ public final class OpenWikiLinkEditorAction implements IEditorActionDelegate {
     } 
   }
 
-  private static void createNewFileIfNeeded(IFile file, String word) throws CoreException {
+  protected void createNewFileIfNeeded(IFile file, String word) throws CoreException {
     if (!file.exists()) {
-      createWikiFile(file, word);
+      createWikiFile(file);
     }
   }
 
-  private static IFile getWikiFile(IFile file, String word) {
+  protected IFile getWikiFile(IFile file, String word) {
     String wikiFileName = Util.getWikiFileName(word, file, WikiEditorPlugin.HTML_OUTPUT_PATH);
     IPath path = new Path(wikiFileName);
     return ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path);
@@ -234,12 +234,12 @@ public final class OpenWikiLinkEditorAction implements IEditorActionDelegate {
     }
   }
 
-  private static void createWikiFile(IFile file, String word) throws CoreException {
+  private void createWikiFile(IFile file) throws CoreException {
     IContainer parent = file.getParent();
     if (parent instanceof IFolder && (!((IFolder) parent).exists())) {
       createFolder((IFolder) parent, null);
     }
-    String newText = "<!--" + word + "-->";
+    String newText = WikiEditorPlugin.AUTOMATICALLY_CREATED;
     byte[] buffer = newText.getBytes();
     ByteArrayInputStream source = new ByteArrayInputStream(buffer);
     file.create(source, true, null);