Enable word wrapping with preference key editor.wrap.words (false by default)
authoraxelcl <axelcl>
Sun, 6 Feb 2005 17:19:45 +0000 (17:19 +0000)
committeraxelcl <axelcl>
Sun, 6 Feb 2005 17:19:45 +0000 (17:19 +0000)
12 files changed:
archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/category/CategoryDialog.java [new file with mode: 0644]
archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/category/CreateFilesFromCategoryEditorAction.java [new file with mode: 0644]
archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/category/Messages.java [new file with mode: 0644]
archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/category/Messages.properties [new file with mode: 0644]
archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/category/ParseCategory.java [new file with mode: 0644]
archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/connect/Content.java
archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/connect/Loaded.java
archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/connect/MediaWikiConnector.java
archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/mediawiki/connect/XMLReader.java
archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/editor/WPPropertySource.java [new file with mode: 0644]
archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/editor/WikiEditor.java
archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/editor/WikiEditorPlugin.java

diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/category/CategoryDialog.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/category/CategoryDialog.java
new file mode 100644 (file)
index 0000000..c7831d7
--- /dev/null
@@ -0,0 +1,171 @@
+/*******************************************************************************
+ * Copyright (c) 2000, 2004 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials 
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ * 
+ * Contributors:
+ *     IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package net.sourceforge.phpeclipse.wiki.actions.category;
+
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.swt.widgets.Text;
+
+/**
+ * A dialog for prompting for a category and fPassword
+ */
+public class CategoryDialog extends Dialog {
+  // widgets
+  protected Text categoryField;
+
+  protected String category = null;
+
+  /**
+   * Creates a new CategoryDialog.
+   * 
+   * @param parentShell
+   *          the parent shell
+   * @param location
+   *          the location
+   * @param defaultName
+   *          the default fUser name
+   * @param message
+   *          a mesage to display to the fUser
+   */
+  public CategoryDialog(Shell parentShell) {
+    super(parentShell);
+  }
+
+  /**
+   * @see Window#configureShell
+   */
+  protected void configureShell(Shell newShell) {
+    super.configureShell(newShell);
+    newShell.setText(Messages.getString("CategoryDialog.required")); //$NON-NLS-1$
+    // set F1 help
+    //         WorkbenchHelp.setHelp(newShell, IHelpContextIds.USER_VALIDATION_DIALOG);
+  }
+
+  /**
+   * @see Window#create
+   */
+  public void create() {
+    super.create();
+    // add some default values
+    categoryField.setFocus();
+  }
+
+  /**
+   * @see Dialog#createDialogArea
+   */
+  protected Control createDialogArea(Composite parent) {
+    Composite top = new Composite(parent, SWT.NONE);
+    GridLayout layout = new GridLayout();
+    layout.numColumns = 2;
+
+    top.setLayout(layout);
+    top.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+    Composite imageComposite = new Composite(top, SWT.NONE);
+    layout = new GridLayout();
+    imageComposite.setLayout(layout);
+    imageComposite.setLayoutData(new GridData(GridData.FILL_VERTICAL));
+
+    Composite main = new Composite(top, SWT.NONE);
+    layout = new GridLayout();
+    layout.numColumns = 3;
+    main.setLayout(layout);
+    main.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+    GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+
+    createCategoryFields(main);
+
+    Dialog.applyDialogFont(parent);
+
+    return main;
+  }
+
+  /**
+   * Create a spacer.
+   */
+  //  protected void createSpacer(Composite top, int columnSpan, int vertSpan) {
+  //    Label l = new Label(top, SWT.NONE);
+  //    GridData data = new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL);
+  //    data.horizontalSpan = columnSpan;
+  //    data.verticalSpan = vertSpan;
+  //    l.setLayoutData(data);
+  //  }
+  /**
+   * Creates the three widgets that represent the fPassword entry area.
+   * 
+   * @param parent
+   *          the parent of the widgets
+   */
+  //  protected void createPasswordFields(Composite parent) {
+  //    new Label(parent, SWT.NONE).setText(Messages.getString("CategoryDialog.password")); //$NON-NLS-1$
+  //
+  //    passwordField = new Text(parent, SWT.BORDER | SWT.PASSWORD);
+  //    GridData data = new GridData(GridData.FILL_HORIZONTAL);
+  //    data.horizontalSpan = 2;
+  //    data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH);
+  //    passwordField.setLayoutData(data);
+  //  }
+  /**
+   * Creates the three widgets that represent the fUser name entry area.
+   * 
+   * @param parent
+   *          the parent of the widgets
+   */
+  protected void createCategoryFields(Composite parent) {
+    new Label(parent, SWT.NONE).setText(Messages.getString("CategoryDialog.category")); //$NON-NLS-1$
+
+    categoryField = new Text(parent, SWT.BORDER);
+    GridData data = new GridData(GridData.FILL_HORIZONTAL);
+    data.horizontalSpan = 2;
+    data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.ENTRY_FIELD_WIDTH);
+    categoryField.setLayoutData(data);
+  }
+
+  /**
+   * Returns the category entered by the fUser, or null if the fUser canceled.
+   * 
+   * @return the entered category
+   */
+  public String getCategory() {
+    return category;
+  }
+
+  /**
+   * Notifies that the ok button of this dialog has been pressed.
+   * <p>
+   * The default implementation of this framework method sets this dialog's return code to <code>Window.OK</code> and closes the
+   * dialog. Subclasses may override.
+   * </p>
+   */
+  protected void okPressed() {
+    category = categoryField.getText();
+
+    super.okPressed();
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.jface.dialogs.Dialog#close()
+   */
+  public boolean close() {
+    return super.close();
+  }
+}
\ No newline at end of file
diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/category/CreateFilesFromCategoryEditorAction.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/category/CreateFilesFromCategoryEditorAction.java
new file mode 100644 (file)
index 0000000..fccc4e7
--- /dev/null
@@ -0,0 +1,120 @@
+package net.sourceforge.phpeclipse.wiki.actions.category;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashSet;
+
+import net.sourceforge.phpeclipse.wiki.actions.CreateFilesJob;
+import net.sourceforge.phpeclipse.wiki.actions.OpenWikiLinkEditorAction;
+import net.sourceforge.phpeclipse.wiki.actions.mediawiki.connect.Loaded;
+import net.sourceforge.phpeclipse.wiki.actions.mediawiki.connect.MediaWikiConnector;
+import net.sourceforge.phpeclipse.wiki.editor.WikiEditorPlugin;
+import net.sourceforge.phpeclipse.wiki.preferences.Util;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.text.IDocument;
+import org.eclipse.jface.viewers.LabelProvider;
+import org.eclipse.jface.window.Window;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IFileEditorInput;
+import org.eclipse.ui.dialogs.ListSelectionDialog;
+import org.eclipse.ui.internal.dialogs.ListContentProvider;
+
+public final class CreateFilesFromCategoryEditorAction extends OpenWikiLinkEditorAction {
+
+  class WikiFile implements Comparable {
+    IFile file;
+
+    String wikiTitle;
+
+    public WikiFile(IFile f, String title) {
+      file = f;
+      wikiTitle = title;
+    }
+
+    /*
+     * (non-Javadoc)
+     * 
+     * @see java.lang.Object#toString()
+     */
+    public String toString() {
+      return wikiTitle + " - " + file.getProjectRelativePath().toString();
+    }
+    /* (non-Javadoc)
+     * @see java.lang.Comparable#compareTo(java.lang.Object)
+     */
+    public int compareTo(Object o) {
+      return wikiTitle.compareTo(((WikiFile)o).wikiTitle);
+    }
+  }
+
+  public void openWikiLinkOnSelection() {
+    IDocument doc = getDocument();
+    Shell shell = Util.findShell();
+    if (shell == null) {
+      return;
+    }
+    CategoryDialog dialog = new CategoryDialog(shell);//$NON-NLS-1$
+    dialog.open();
+    String category = dialog.getCategory();
+    
+    // TODO: this doesn#t work at the moment:
+    MediaWikiConnector connector = new MediaWikiConnector();
+      Loaded page = null;
+//        connector.loadCategory(actionUrl, wikipedia.getCharSet(), "plog4u.org bot");
+      
+    ParseCategory pc = new ParseCategory();
+    pc.parseCategory(page.getContent().getBody());
+    
+    ArrayList startPositionList = pc.getTitleList();
+
+    HashSet wikiNames = new HashSet();
+    ArrayList filesList = new ArrayList();
+    ArrayList wikiList = new ArrayList();
+    String wikiTitle;
+    Integer posInteger;
+    IFile currentFile = ((IFileEditorInput) editor.getEditorInput()).getFile();
+
+    for (int i = 0; i < startPositionList.size(); i++) {
+      wikiTitle = (String) startPositionList.get(i);
+
+      if (wikiTitle != null && !wikiTitle.equals("")) {
+        if (!wikiNames.contains(wikiTitle)) {
+          IFile file = getWikiFile(currentFile, wikiTitle);
+          if (!file.exists()) {
+            filesList.add(new WikiFile(file, wikiTitle));
+          }
+          wikiNames.add(wikiTitle);
+        }
+      }
+    }
+
+    if (filesList.size() > 0) {
+      Collections.sort(filesList);
+      ListSelectionDialog listSelectionDialog = new ListSelectionDialog(WikiEditorPlugin.getDefault().getWorkbench()
+          .getActiveWorkbenchWindow().getShell(), filesList, new ListContentProvider(), new LabelProvider(),
+          "Select the links for file creation:");
+      listSelectionDialog.setTitle("Links found in this article");
+      if (listSelectionDialog.open() == Window.OK) {
+        Object[] locations = listSelectionDialog.getResult();
+        if (locations.length > 0) {
+          IFile[] files = new IFile[locations.length];
+          String[] wikiTitles = new String[locations.length];
+          for (int i = 0; i < files.length; i++) {
+            files[i] = ((WikiFile) locations[i]).file;
+            wikiTitles[i] = ((WikiFile) locations[i]).wikiTitle;
+          }
+          
+          Job job = new CreateFilesJob(files, wikiTitles);
+          //        job.setRule(createRule(files));
+          job.setRule(null);
+          job.setUser(true);
+          job.schedule();
+        }
+      }
+
+    }
+  }
+
+}
\ No newline at end of file
diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/category/Messages.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/category/Messages.java
new file mode 100644 (file)
index 0000000..b3e4616
--- /dev/null
@@ -0,0 +1,93 @@
+/*******************************************************************************
+ * Copyright (c) 2003 Berthold Daum.
+ * All rights reserved. This program and the accompanying materials 
+ * are made available under the terms of the Common Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/cpl-v10.html
+ * 
+ * Contributors:
+ *     Berthold Daum
+ *******************************************************************************/
+
+package net.sourceforge.phpeclipse.wiki.actions.category;
+
+import java.text.MessageFormat;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+
+
+public class Messages {
+
+       private final static String RESOURCE_BUNDLE= "net.sourceforge.phpeclipse.wiki.actions.category.Messages";//$NON-NLS-1$
+       
+       private static ResourceBundle fgResourceBundle = null;
+       
+       private static boolean notRead = true;
+
+       public Messages() {
+       }
+       public static ResourceBundle getResourceBundle() {
+               if (notRead) {
+                       notRead = false;
+                       try {
+                               fgResourceBundle = ResourceBundle.getBundle(RESOURCE_BUNDLE);
+                       }
+                       catch (Exception e) {
+                       }
+               }
+               
+               return fgResourceBundle;
+       }
+       public static String getString(String key) {
+               try {
+                       return getResourceBundle().getString(key);
+               } catch (Exception e) {
+                       return "!" + key + "!";//$NON-NLS-2$ //$NON-NLS-1$
+               }
+       }
+       
+       /**
+        * Lookup the message with the given ID in this catalog and bind its
+        * substitution locations with the given string.
+        */
+       public static String bind(String id, String binding) {
+               return bind(id, new String[] { binding });
+       }
+       
+       /**
+        * Lookup the message with the given ID in this catalog and bind its
+        * substitution locations with the given strings.
+        */
+       public static String bind(String id, String binding1, String binding2) {
+               return bind(id, new String[] { binding1, binding2 });
+       }
+       
+       /**
+        * Gets a string from the resource bundle. We don't want to crash because of a missing String.
+        * Returns the key if not found.
+        */
+       public static String bind(String key) {
+               try {
+                       return getString(key);
+               } catch (MissingResourceException e) {
+                       return key;
+               } catch (NullPointerException e) {
+                       return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
+               }
+       }
+       
+       /**
+        * Gets a string from the resource bundle and binds it with the given arguments. If the key is 
+        * not found, return the key.
+        */
+       public static String bind(String key, Object[] args) {
+               try {
+                       return MessageFormat.format(bind(key), args);
+               } catch (MissingResourceException e) {
+                       return key;
+               } catch (NullPointerException e) {
+                       return "!" + key + "!"; //$NON-NLS-1$ //$NON-NLS-2$
+               }
+       }
+}
+
diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/category/Messages.properties b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/category/Messages.properties
new file mode 100644 (file)
index 0000000..b856847
--- /dev/null
@@ -0,0 +1,2 @@
+CategoryDialog.required=Category Input
+CategoryDialog.category=Category
\ No newline at end of file
diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/category/ParseCategory.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/actions/category/ParseCategory.java
new file mode 100644 (file)
index 0000000..6bfb884
--- /dev/null
@@ -0,0 +1,223 @@
+package net.sourceforge.phpeclipse.wiki.actions.category;
+
+import java.util.ArrayList;
+
+public class ParseCategory {
+  ArrayList titleList;
+
+  public ParseCategory() {
+    titleList = new ArrayList();
+  }
+  public void parseCategory(String text) {
+    int index1 = text.indexOf("contentSub");
+    int index2 = text.indexOf("printfooter");
+    if (index2 < 0) {
+      index2 = text.length();
+    }
+    if (index1 > 0 && index2 > index1) {
+      try {
+        int i = index1;
+        int titleStart;
+        int titleEnd;
+        char ch;
+        while (true) {
+          ch = text.charAt(i++);
+          if (i>index2) {
+            break;
+          }
+          if (ch == 't' && text.charAt(i) == 'i' && text.charAt(i +1) == 't' && text.charAt(i + 2) == 'l'
+              && text.charAt(i + 3) == 'e') {
+            i += 4;
+            titleStart = -1;
+            
+// found: "title"
+            while (true) {
+              ch = text.charAt(i++);
+              if (ch=='"') {
+                if (titleStart>0) {
+                  titleList.add(text.substring(titleStart,i-1));
+                  break;
+                }
+                titleStart = i;
+              }
+            }
+            
+          }
+        }
+      } catch (IndexOutOfBoundsException e) {
+
+      }
+
+    }
+  }
+
+  public static void main(String[] args) {
+    String test = "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Transitional//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd\">\r\n"
+        + "<html xmlns=\"http://www.w3.org/1999/xhtml\" xml:lang=\"de\" lang=\"de\" dir=\"ltr\">\r\n"
+        + "  <head>\r\n"
+        + "    <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\"/>\r\n"
+        + "    <meta name=\"KEYWORDS\" content=\"Kategorie:Eclipse Tips\" />\r\n"
+        + "<meta name=\"robots\" content=\"index,follow\" />\r\n"
+        + "<link rel=\"shortcut icon\" href=\"/favicon.ico\" />\r\n"
+        + "<link title=\"Creative Commons\" type=\"application/rdf+xml\" href=\"/index.php?title=Kategorie:Eclipse_Tips&amp;action=creativecommons\" rel=\"meta\" />\r\n"
+        + "<link rel=\"copyright\" href=\"http://www.gnu.org/copyleft/fdl.html\" />\r\n"
+        + "\r\n"
+        + "    <title>Kategorie:Eclipse Tips - Plog4u</title>\r\n"
+        + "    <style type=\"text/css\" media=\"screen,projection\">/*<![CDATA[*/ @import \"/stylesheets/monobook/main.css\"; /*]]>*/</style>\r\n"
+        + "\r\n"
+        + "    <link rel=\"stylesheet\" type=\"text/css\" media=\"print\" href=\"/stylesheets/commonPrint.css\"/>\r\n"
+        + "    <!--[if IE]><style type=\"text/css\" media=\"all\">@import \"/stylesheets/monobook/IEFixes.css\";</style>\r\n"
+        + "    <script type=\"text/javascript\" src=\"/stylesheets/IEFixes.js\"></script>\r\n"
+        + "    <meta http-equiv=\"imagetoolbar\" content=\"no\" /><![endif]-->\r\n"
+        + "    <script src=\"/index.php?title=-&amp;action=raw&amp;gen=js\" type=\"text/javascript\"></script>\r\n"
+        + "    <script type=\"text/javascript\" src=\"/stylesheets/wikibits.js\"></script>\r\n"
+        + "    <style type=\"text/css\">/*<![CDATA[*/ @import \"/index.php?title=-&action=raw&gen=css\";\r\n"
+        + " /*]]>*/</style>\r\n"
+        + "    \r\n"
+        + "  </head>\r\n"
+        + "  <body class=\"ns-14\">\r\n"
+        + "\r\n"
+        + "    <div id=\"globalWrapper\">\r\n"
+        + "      <div id=\"column-content\">\r\n"
+        + "    <div id=\"content\">\r\n"
+        + "        \r\n"
+        + "      <a name=\"top\" id=\"contentTop\"></a>\r\n"
+        + "      <h1 class=\"firstHeading\">Kategorie:Eclipse Tips</h1>\r\n"
+        + "      <div id=\"bodyContent\">\r\n"
+        + "        <h3 id=\"siteSub\">aus Plog4u, der freien Eclipse Wissensdatenbank</h3>\r\n"
+        + "        <div id=\"contentSub\"></div>\r\n"
+        + "\r\n"
+        + "        \r\n"
+        + "\r\n"
+        + "        \r\n"
+        + "        <!-- start content -->\r\n"
+        + "        <p>(Dieser Artikel enthält momentan keinen Text)<br style=\"clear:both;\"/>\r\n"
+        + "</p>\r\n"
+        + "<h2>Artikel in der Kategorie \"Eclipse Tips\"</h2>\r\n"
+        + "Dieser Kategorie gehören 6 Artikel an.<h3>B</h3>\r\n"
+        + "<ul><li><a href=\"/index.php/Benutzung:Eclipse:Tips:Eclipse_Sprachpaket\" title =\"Benutzung:Eclipse:Tips:Eclipse Sprachpaket\">Benutzung:Eclipse:Tips:Eclipse Sprachpaket</a></li><li><a href=\"/index.php/Benutzung:Eclipse:Tips:Eclipse_Starten\" title =\"Benutzung:Eclipse:Tips:Eclipse Starten\">Benutzung:Eclipse:Tips:Eclipse Starten</a></li><li><a href=\"/index.php/Benutzung:Eclipse:Tips:JDT:Pr%C3%A4fixe_f%C3%BCr_Klassenattribute\" title =\"Benutzung:Eclipse:Tips:JDT:Präfixe für Klassenattribute\">Benutzung:Eclipse:Tips:JDT:Präfixe für Klassenattribute</a></li><li><a href=\"/index.php/Benutzung:Eclipse:Tips:Plugins_aufrufen\" title =\"Benutzung:Eclipse:Tips:Plugins aufrufen\">Benutzung:Eclipse:Tips:Plugins aufrufen</a></li><li><a href=\"/index.php/Benutzung:Eclipse:Tips:Sourceforge_CVS_Zugriff\" title =\"Benutzung:Eclipse:Tips:Sourceforge CVS Zugriff\">Benutzung:Eclipse:Tips:Sourceforge CVS Zugriff</a></li><li><a href=\"/index.php/Benutzung:Eclipse:Tips:Stringvergleiche_in_JUnit\" title =\"Benutzung:Eclipse:Tips:Stringvergleiche in JUnit\">Benutzung:Eclipse:Tips:Stringvergleiche in JUnit</a></li></ul>\r\n"
+        + "\r\n"
+        + "<div class=\"printfooter\">\r\n"
+        + "Von \"<a href=\"http://www.plog4u.de/index.php/Kategorie:Eclipse_Tips\">http://www.plog4u.de/index.php/Kategorie:Eclipse_Tips</a>\"</div>\r\n"
+        + "\r\n"
+        + "        \r\n"
+        + "        <!-- end content -->\r\n"
+        + "        <div class=\"visualClear\"></div>\r\n"
+        + "      </div>\r\n"
+        + "    </div>\r\n"
+        + "      </div>\r\n"
+        + "      <div id=\"column-one\">\r\n"
+        + "\r\n"
+        + "    <div id=\"p-cactions\" class=\"portlet\">\r\n"
+        + "      <h5>Views</h5>\r\n"
+        + "      <ul>\r\n"
+        + "        <li id=\"ca-nstab-category\" class=\"selected\"><a href=\"/index.php/Kategorie:Eclipse_Tips\">Kategorie</a></li><li id=\"ca-talk\" class=\"new\"><a href=\"/index.php?title=Kategorie_Diskussion:Eclipse_Tips&amp;action=edit\">Diskussion</a></li><li id=\"ca-edit\" class=\"\"><a href=\"/index.php?title=Kategorie:Eclipse_Tips&amp;action=edit\">bearbeiten</a></li>\r\n"
+        + "      </ul>\r\n"
+        + "    </div>\r\n"
+        + "    <div class=\"portlet\" id=\"p-personal\">\r\n"
+        + "\r\n"
+        + "      <h5>\'Persönliche Werkzeuge</h5>\r\n"
+        + "      <div class=\"pBody\">\r\n"
+        + "        <ul>\r\n"
+        + "          <li id=\"pt-anonuserpage\"><a href=\"/index.php/Benutzer:217.252.6.161\" class=\"new\">217.252.6.161</a></li><li id=\"pt-anontalk\"><a href=\"/index.php/Benutzer_Diskussion:217.252.6.161\" class=\"new\">Diskussionsseite dieser IP</a></li><li id=\"pt-anonlogin\"><a href=\"/index.php?title=Spezial:Userlogin&amp;returnto=Kategorie:Eclipse_Tips\">Anmelden</a></li>\r\n"
+        + "        </ul>\r\n"
+        + "      </div>\r\n"
+        + "    </div>\r\n"
+        + "\r\n"
+        + "<!--        <div class=\"portlet\" id=\"p-logo\">\r\n"
+        + "      <a style=\"background-image: url(/stylesheets/images/wiki.png);\" href=\"/index.php/Hauptseite\" i18n:attributes=\"title string:mainpage\"></a>\r\n"
+        + "    </div> -->\r\n"
+        + "    <div class=\"portlet\" id=\"p-nav\">\r\n"
+        + "      <h5>Navigation</h5>\r\n"
+        + "      <div class=\"pBody\">\r\n"
+        + "        <ul>\r\n"
+        + "          <li id=\"n-mainpage\"><a href=\"/index.php/Hauptseite\">Hauptseite</a></li>\r\n"
+        + "          <li id=\"n-portal\"><a href=\"/index.php/Plog4u:Portal\">Plog4u-Portal</a></li>\r\n"
+        + "          <li id=\"n-currentevents\"><a href=\"/index.php/Aktuelle_Ereignisse\">Aktuelle Ereignisse</a></li>\r\n"
+        + "\r\n"
+        + "          <li id=\"n-recentchanges\"><a href=\"/index.php/Spezial:Recentchanges\">Letzte Änderungen</a></li>\r\n"
+        + "          <li id=\"n-randompage\"><a href=\"/index.php/Spezial:Randompage\">Zufälliger Artikel</a></li>\r\n"
+        + "          <li id=\"n-help\"><a href=\"/index.php/Plog4u:Hilfe\">Hilfe</a></li>\r\n"
+        + "          \r\n"
+        + "<li><a href=\"http://www.plog4u.de/impressum.html\">Impressum</a></li>\r\n"
+        + "        </ul>\r\n"
+        + "      </div>\r\n"
+        + "    </div>\r\n"
+        + "\r\n"
+        + "    <div id=\"p-search\" class=\"portlet\">\r\n"
+        + "      <h5>Suche</h5>\r\n"
+        + "      <div class=\"pBody\">\r\n"
+        + "        <form name=\"searchform\" action=\"/index.php/Spezial:Search\" id=\"searchform\">\r\n"
+        + "          <input accesskey=\"f\" id=\"searchInput\" name=\"search\" type=\"text\" />\r\n"
+        + "          <input value=\"Los\" type=\"submit\" name=\"go\" class=\"searchButton\" />&nbsp;<input value=\"Suche\" type=\"submit\" name=\"fulltext\" class=\"searchButton\" />\r\n"
+        + "        </form>\r\n"
+        + "      </div>\r\n"
+        + "\r\n"
+        + "    </div>\r\n"
+        + "    <div class=\"portlet\" id=\"p-tb\">\r\n"
+        + "      <h5>Werkzeuge</h5>\r\n"
+        + "      <div class=\"pBody\">\r\n"
+        + "        <ul>\r\n"
+        + "          <li id=\"t-whatlinkshere\"><a href=\"/index.php?title=Spezial:Whatlinkshere&amp;target=Kategorie%3AEclipse_Tips\">Was zeigt hierhin</a></li>\r\n"
+        + "          <li id=\"t-recentchangeslinked\"><a href=\"/index.php?title=Spezial:Recentchangeslinked&amp;target=Kategorie%3AEclipse_Tips\">Verlinkte Seiten</a></li>\r\n"
+        + "\r\n"
+        + "          \r\n"
+        + "          \r\n"
+        + "          \r\n"
+        + "          \r\n"
+        + "          <li id=\"t-specialpages\"><a href=\"/index.php/Spezial:Specialpages\">Spezialseiten</a></li>\r\n"
+        + "        </ul>\r\n"
+        + "      </div>\r\n"
+        + "    </div>\r\n"
+        + "\r\n"
+        + "      <div class=\"portlet\" id=\"p-advertisement\">\r\n"
+        + "       <h5>werbung</h5>\r\n"
+        + "       <div class=\"pBody\">\r\n"
+        + "\r\n"
+        + "<script type=\"text/javascript\"><!--\r\n"
+        + "google_ad_client = \"pub-0182243963199149\";\r\n"
+        + "google_ad_width = 120;\r\n"
+        + "google_ad_height = 240;\r\n"
+        + "google_ad_format = \"120x240_as\";\r\n"
+        + "google_ad_channel =\"4781857343\";\r\n"
+        + "google_ad_language =\"de\";\r\n"
+        + "//--></script>\r\n"
+        + "<script type=\"text/javascript\" src=\"http://pagead2.googlesyndication.com/pagead/show_ads.js\">\r\n"
+        + "</script>\r\n"
+        + "\r\n"
+        + "       </div>\r\n"
+        + "      </div>\r\n"
+        + "    \r\n"
+        + "      </div><!-- end of the left (by default at least) column -->\r\n"
+        + "      <div class=\"visualClear\"></div>\r\n"
+        + "      <div id=\"footer\">\r\n"
+        + "    <div id=\"f-poweredbyico\"><a href=\"http://www.mediawiki.org/\"><img src=\"/stylesheets/images/poweredby_mediawiki_88x31.png\" alt=\"MediaWiki\" /></a></div>\r\n"
+        + "\r\n"
+        + "    <div id=\"f-copyrightico\"><a href=\"http://www.gnu.org/copyleft/fdl.html\"><img src=\"/stylesheets/images/gnu-fdl.png\" alt=\'GNU Free Documentation License 1.2\' /></a></div>\r\n"
+        + "    <ul id=\"f-list\">\r\n"
+        + "      \r\n"
+        + "      \r\n"
+        + "      \r\n"
+        + "      \r\n"
+        + "      <li id=\"f-about\"><a href=\"/index.php/Plog4u:%C3%9Cber_Plog4u\" title =\"Plog4u:Über Plog4u\">Über Plog4u</a></li>\r\n"
+        + "      <li id=\"f-disclaimer\"><a href=\"/index.php/Plog4u:Lizenzbestimmungen\" title =\"Plog4u:Lizenzbestimmungen\">Lizenzbestimmungen</a></li>\r\n"
+        + "    </ul>\r\n"
+        + "      </div>\r\n"
+        + "    </div>\r\n"
+        + "    <!-- Served by single in 0.09 secs. -->\r\n"
+        + "\r\n"
+        + "  </body>\r\n" + "</html>\r\n" + "";
+    ParseCategory pc = new ParseCategory();
+    pc.parseCategory(test);
+    ArrayList list = pc.getTitleList();
+    for (int i = 0; i < list.size(); i++) {
+      System.out.println(list.get(i));
+    }
+  }
+  /**
+   * @return Returns the titleList.
+   */
+  public ArrayList getTitleList() {
+    return titleList;
+  }
+}
\ No newline at end of file
index 6d2334b..d3be0aa 100644 (file)
@@ -18,4 +18,16 @@ public class Content {
     this.timestamp = timestamp;
     this.body = body;
   }
+  /**
+   * @return Returns the body.
+   */
+  public String getBody() {
+    return body;
+  }
+  /**
+   * @return Returns the timestamp.
+   */
+  public String getTimestamp() {
+    return timestamp;
+  }
 }
\ No newline at end of file
index c844cd6..ec8b4e8 100644 (file)
@@ -21,4 +21,28 @@ public class Loaded {
     this.content = content;
   }
 
+  /**
+   * @return Returns the actionURL.
+   */
+  public String getActionURL() {
+    return actionURL;
+  }
+  /**
+   * @return Returns the charSet.
+   */
+  public String getCharSet() {
+    return charSet;
+  }
+  /**
+   * @return Returns the content.
+   */
+  public Content getContent() {
+    return content;
+  }
+  /**
+   * @return Returns the title.
+   */
+  public String getTitle() {
+    return title;
+  }
 }
\ No newline at end of file
index 9225b17..ca80eec 100644 (file)
@@ -55,8 +55,8 @@ public class MediaWikiConnector {
       + ".*<input[^>]*\\svalue=\"(\\d*)\"[^>]*\\sname=\"wpEdittime\"[^>]*>" + ".*", Pattern.DOTALL);
 
   //  <input type='hidden' value="53ee6d8b42ff9b7d" name="wpEditToken" />
-  private static final Pattern EDIT_TOKEN = Pattern.compile(".*<input\\stype='hidden'\\svalue=\"(.*?)\"\\sname=\"wpEditToken\"\\s/>.*",
-      Pattern.DOTALL);
+  private static final Pattern EDIT_TOKEN = Pattern.compile(
+      ".*<input\\stype='hidden'\\svalue=\"(.*?)\"\\sname=\"wpEditToken\"\\s/>.*", Pattern.DOTALL);
 
   //setup default user agent
   final static public String userAgent = "plog4u.org/0.0";
@@ -311,6 +311,37 @@ public class MediaWikiConnector {
     return result;
   }
 
+  public Loaded loadCategory(String actionURL, String charSet, String title) throws UnexpectedAnswerException, MethodException,
+      PageNotEditableException {
+    GetMethod method = new GetMethod(actionURL);
+    method.setFollowRedirects(false);
+    method.addRequestHeader("User-Agent", userAgent);
+    NameValuePair[] params = new NameValuePair[] { new NameValuePair("title", title) };
+    method.setQueryString(EncodingUtil.formUrlEncode(params, charSet));
+
+    Loaded result;
+    try {
+      int responseCode = client.executeMethod(method);
+      String responseBody = method.getResponseBodyAsString();
+      //                       log(method);
+
+      if (responseCode == 200) {
+        Parsed parsed = parseBody(charSet, responseBody);
+        Content content = new Content(parsed.timestamp, parsed.body);
+        result = new Loaded(actionURL, charSet, parsed.title, content);
+      } else {
+        throw new UnexpectedAnswerException("load not successful: expected 200 OK, got " + method.getStatusLine());
+      }
+    } catch (HttpException e) {
+      throw new MethodException("method failed", e);
+    } catch (IOException e) {
+      throw new MethodException("method failed", e);
+    } finally {
+      method.releaseConnection();
+    }
+    return result;
+  }
+
   public ArrayList loadXML(IWikipedia config, String actionURL, String pages) throws UnexpectedAnswerException, MethodException,
       InterruptedException {
     storeThrottle.delay();
index 013ff3b..5729e55 100644 (file)
@@ -316,7 +316,7 @@ public class XMLReader {
           + "    <title>Mechanisches Fernsehen</title>\r\n"
           + "    <revision>\r\n"
           + "      <timestamp>2004-11-22T12:41:10Z</timestamp>\r\n"
-          + "      <contributor><username>Electrocat</username></contributor>\r\n"
+          + "      <contributor><category>Electrocat</category></contributor>\r\n"
           + "      <text>Als \'\'\'mechanisches Fernsehen\'\'\' bezeichnet man [[Fernsehen]], bei dem die Bildzerlegung und -zusammensetzung im Gegensatz zum [[elektronisches Fernsehen|elektronischen Fernsehen]] mechanisch erfolgt. Die eigentliche Übertragung findet natürlich auf elektrischem Wege statt.\r\n"
           + "\r\n"
           + "Das mechanische Fernsehen war die erste Form des Fernsehens. Die erste  brauchbare Realisierung erfolgte mit Hilfe der nach ihrem Erfinder [[Paul Nipkow]] benannten [[Nipkow-Scheibe]]. Hierbei ist insbesondere die Pionierarbeit des ungarischen Ingenieurs [[D. von Mihaly]] und des schottischen Erfinders [[John Logie Baird]] zu erwähnen. [[D. von Mihaly]] entwickelte ebenfalls ein vollkommen anderes Verfahren, bei dem ein Spiegel zwischen einem Hufeisenmagneten schnell oszillierte. In einem verbesserten Verfahren wurde ein Spiegel auf Drahtsaiten befestigt, welche nach Stromdurchleitung in eine schnelle Schwingung versetzt wurden. Ein wieder anderes Verfahren entwickelte [[Dr. Carolus]] bei [[Telefunken]], wo mit schnell rotierenden Spiegeln gearbeitet wurde. Durch Carolus wurden auch beide Systeme miteinander kombiniert (Spiegelrad für horizontale Abtastung, oszillierende Spiegel für vertikale Abtastung. \r\n"
@@ -343,7 +343,7 @@ public class XMLReader {
           + "    <title>Anrechenbare Kosten</title>\r\n"
           + "    <revision>\r\n"
           + "      <timestamp>2004-09-22T17:18:23Z</timestamp>\r\n"
-          + "      <contributor><username>Fenice</username></contributor>\r\n"
+          + "      <contributor><category>Fenice</category></contributor>\r\n"
           + "      <comment>cat</comment>\r\n"
           + "\r\n"
           + "      <text>Die \'\'\'anrechenbaren Kosten\'\'\' sind eines der Regelkriterien bei der Ermittlung des [[Honorar]]s von Architekten und Ingenieuren nach der [[HOAI]]. Sie werden aus einem fachspezifischen Kostenanteil auf Basis der Kostenermittlungen nach [[DIN 276]] errechnet und können daher innerhalb eines Projektes je nach [[Leistungsphasen|Leistungsphase]] unterschiedlich hoch sein.\r\n"
diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/editor/WPPropertySource.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/editor/WPPropertySource.java
new file mode 100644 (file)
index 0000000..6d5e14f
--- /dev/null
@@ -0,0 +1,92 @@
+package net.sourceforge.phpeclipse.wiki.editor;
+
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.ui.views.properties.IResourcePropertyConstants;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+
+public class WPPropertySource implements IPropertySource {
+  //  final boolean isWPFile;
+  /**
+   * The <code>IResource</code> property key for Wikipedia timestamp.
+   */
+  public static final String P_TIMESTAMP = "net.sourceforge.phpeclipse.wiki.timestamp"; //$NON-NLS-1$
+
+  private static PropertyDescriptor wpEditorDescriptor;
+  { 
+    wpEditorDescriptor = new PropertyDescriptor(P_TIMESTAMP, "Wikipedia Timestamp");
+    wpEditorDescriptor.setAlwaysIncompatible(true);
+    wpEditorDescriptor.setCategory(IResourcePropertyConstants.P_FILE_SYSTEM_CATEGORY);
+  }
+
+  public WPPropertySource(WikiEditor source) {
+    //    super(source);
+    //    if (file.getFileExtension().equalsIgnoreCase("wp")) {
+    //      isWPFile = true;
+    //      return;
+    //    }
+    //    isWPFile = false;
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
+   */
+  public IPropertyDescriptor[] getPropertyDescriptors() {
+    IPropertyDescriptor[] p = new IPropertyDescriptor[1];
+    p[0] = wpEditorDescriptor;
+    return p;
+    //    if (isWPFile) {
+    //      IPropertyDescriptor[] sp = super.getPropertyDescriptors();
+    //      IPropertyDescriptor[] p = new IPropertyDescriptor[sp.length+1];
+    //      System.arraycopy(sp,0,p,0,sp.length);
+    //      p[sp.length] = wpEditorDescriptor;
+    //      return p;
+    //    }
+    //    return super.getPropertyDescriptors();
+  }
+
+  /*
+   * (non-Javadoc)
+   * 
+   * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
+   */
+  public Object getPropertyValue(Object key) {
+    //    Object returnValue = super.getPropertyValue(key);
+    //
+    //    if (returnValue != null)
+    //      return returnValue;
+
+    if (key.equals(P_TIMESTAMP))
+      return "4711";
+
+    return null;
+  }
+  /* (non-Javadoc)
+   * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
+   */
+  public Object getEditableValue() {
+    // TODO Auto-generated method stub
+    return null;
+  }
+  /* (non-Javadoc)
+   * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)
+   */
+  public boolean isPropertySet(Object id) {
+    return id.equals(P_TIMESTAMP);
+  }
+  /* (non-Javadoc)
+   * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
+   */
+  public void resetPropertyValue(Object id) {
+
+  }
+  /* (non-Javadoc)
+   * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
+   */
+  public void setPropertyValue(Object id, Object value) {
+
+  }
+}
\ No newline at end of file
index dc9c7a4..913b58c 100644 (file)
@@ -52,6 +52,9 @@ public class WikiEditor extends AbstractDecoratedTextEditor {
    * @see org.eclipse.core.runtime.IAdaptable#getAdapter(java.lang.Class)
    */
   public Object getAdapter(Class required) {
+//    if (IPropertySource.class.equals(required)) {
+//      return new WPPropertySource(this);
+//    }
     if (IContentOutlinePage.class.equals(required)) {
       if (fOutlinePage == null)
         fOutlinePage = new WikiOutlinePage(this);
@@ -94,8 +97,16 @@ public class WikiEditor extends AbstractDecoratedTextEditor {
     projectionViewer.doOperation(ProjectionViewer.TOGGLE);
 
     fOccurrencesUpdater = new WikiOccurrencesUpdater(this);
+    
+    setWordWrap();
   }
 
+  private void setWordWrap() {
+    if (getSourceViewer() != null) {
+      getSourceViewer().getTextWidget().setWordWrap(
+          WikiEditorPlugin.getDefault().getPreferenceStore().getBoolean(WikiEditorPlugin.EDITOR_WRAP_WORDS));
+    }
+  }
   /*
    * @see org.eclipse.ui.texteditor.AbstractDecoratedTextEditor#createSourceViewer(org.eclipse.swt.widgets.Composite,
    *      org.eclipse.jface.text.source.IVerticalRuler, int)
index 915af72..558759e 100644 (file)
@@ -9,7 +9,6 @@ import java.net.URL;
 import java.sql.SQLException;
 import java.text.MessageFormat;
 import java.util.ArrayList;
-import java.util.Enumeration;
 import java.util.Hashtable;
 import java.util.List;
 import java.util.MissingResourceException;
@@ -21,9 +20,13 @@ import net.sourceforge.phpeclipse.wiki.internal.ConfigurationManager;
 import net.sourceforge.phpeclipse.wiki.internal.IConfigurationWorkingCopy;
 import net.sourceforge.phpeclipse.wiki.sql.WikipediaDB;
 
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
 import org.eclipse.core.resources.IWorkspace;
 import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.core.runtime.IAdapterManager;
 import org.eclipse.core.runtime.IExtension;
 import org.eclipse.core.runtime.IPluginDescriptor;
 import org.eclipse.core.runtime.IStatus;
@@ -37,13 +40,15 @@ import org.eclipse.jface.text.templates.ContextTypeRegistry;
 import org.eclipse.jface.text.templates.persistence.TemplateStore;
 import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.widgets.Display;
-import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IContributorResourceAdapter;
+import org.eclipse.ui.IPersistableElement;
 import org.eclipse.ui.IWorkbenchPage;
 import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.editors.text.templates.ContributionContextTypeRegistry;
 import org.eclipse.ui.editors.text.templates.ContributionTemplateStore;
 import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.osgi.framework.BundleContext;
 
 public class WikiEditorPlugin extends AbstractUIPlugin {
 
@@ -151,6 +156,14 @@ public class WikiEditorPlugin extends AbstractUIPlugin {
 
   public final static String HTTP_PROXYPASSWORD = "http.proxyPassword";
 
+  /**
+   * A named preference that controls whether the 'wrap words' feature is enabled.
+   * <p>
+   * Value is of type <code>Boolean</code>.
+   * </p>
+   */
+  public final static String EDITOR_WRAP_WORDS = "editor.wrap.words"; //$NON-NLS-1$
+
   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\"/>"
@@ -362,7 +375,20 @@ public class WikiEditorPlugin extends AbstractUIPlugin {
       InputStream is = getDefault().openStream(new Path("prefs/default_" + operatingSystem + ".properties"));
       PropertyResourceBundle resourceBundle = new PropertyResourceBundle(is);
 
-      String key = HTTP_TIMEOUT;
+      String key = EDITOR_WRAP_WORDS;
+      try {
+        String wordWrap = resourceBundle.getString(key);
+        Boolean b = Boolean.valueOf(wordWrap);
+        if (b.booleanValue()) { 
+          store.setDefault(key, "true");
+        } else {
+          store.setDefault(key, "false");
+        }
+      } catch (Exception e) {
+        store.setDefault(key, "true");
+      }
+
+      key = HTTP_TIMEOUT;
       try {
         String timeout = resourceBundle.getString(key);
         int val = Integer.parseInt(timeout);
@@ -425,7 +451,7 @@ public class WikiEditorPlugin extends AbstractUIPlugin {
       } catch (Exception e) {
         store.setDefault(key, System.getProperty(key, ""));
       }
-      
+
     } catch (Exception e) {
     }
 
@@ -490,9 +516,9 @@ public class WikiEditorPlugin extends AbstractUIPlugin {
     }
   }
 
-  public void startup() throws CoreException {
-    super.startup();
-  }
+  //  public void startup() throws CoreException {
+  //    super.startup();
+  //  }
 
   /**
    * Returns the translated String found with the given key.
@@ -570,18 +596,26 @@ public class WikiEditorPlugin extends AbstractUIPlugin {
   }
 
   /*
-   * (non-Javadoc)
-   * 
-   * @see org.eclipse.core.runtime.Plugin#shutdown()
+   * (non - Javadoc) Method declared in Plugin
    */
-  public void shutdown() throws CoreException {
-    if (fWikiDB != null) {
-      try {
-        fWikiDB.shutdown();
-      } catch (SQLException e) {
+  public void start(BundleContext context) throws Exception {
+    super.start(context);
+  }
+
+  /*
+   * @see org.eclipse.core.runtime.Plugin#stop
+   */
+  public void stop(BundleContext context) throws Exception {
+    try {
+      if (fWikiDB != null) {
+        try {
+          fWikiDB.shutdown();
+        } catch (SQLException e) {
+        }
       }
+    } finally {
+      super.stop(context);
     }
-    super.shutdown();
   }
 
   public static void log(int severity, String message) {