X-Git-Url: http://git.phpeclipse.com diff --git a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/editor/WikiEditorPlugin.java b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/editor/WikiEditorPlugin.java index 915af72..558759e 100644 --- a/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/editor/WikiEditorPlugin.java +++ b/archive/net.sourceforge.phpeclipse.wiki/src/net/sourceforge/phpeclipse/wiki/editor/WikiEditorPlugin.java @@ -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. + *

+ * Value is of type Boolean. + *

+ */ + public final static String EDITOR_WRAP_WORDS = "editor.wrap.words"; //$NON-NLS-1$ + public final static String CONFIG_MEMENTO = "" + "" + "" + "" @@ -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) {