*** empty log message ***
diff --git a/bundles/org.eclipse.wst.xsl.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.wst.xsl.ui/META-INF/MANIFEST.MF
index bb0266e..cbc219a 100644
--- a/bundles/org.eclipse.wst.xsl.ui/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.wst.xsl.ui/META-INF/MANIFEST.MF
@@ -33,3 +33,4 @@
org.eclipse.wst.xsl.ui.internal.util;x-internal:=true,
org.eclipse.wst.xsl.ui.internal.validation;x-internal:=true,
org.eclipse.wst.xsl.ui.internal.wizards;x-internal:=true
+Bundle-ActivationPolicy: lazy
diff --git a/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/XSLUIConstants.java b/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/XSLUIConstants.java
index b815457..8966542 100644
--- a/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/XSLUIConstants.java
+++ b/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/XSLUIConstants.java
@@ -13,4 +13,5 @@
public class XSLUIConstants
{
public static final String TEMPLATE_CONTEXT_XSL_NEW = "xsl_new";
+ public static final String NEW_FILE_TEMPLATE_NAME = "NEW_FILE_TEMPLATE_NAME";
}
diff --git a/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/XSLUIPlugin.java b/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/XSLUIPlugin.java
index 920ed33..43f119d 100644
--- a/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/XSLUIPlugin.java
+++ b/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/XSLUIPlugin.java
@@ -1,14 +1,3 @@
-/*******************************************************************************
- * Copyright (c) 2008 Standards for Technology in Automotive Retail and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * David Carver - STAR - bug 213849 - initial API and implementation
- *******************************************************************************/
-
package org.eclipse.wst.xsl.ui.internal;
import java.io.IOException;
@@ -16,33 +5,20 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.text.templates.ContextTypeRegistry;
import org.eclipse.jface.text.templates.persistence.TemplateStore;
-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.preferences.ScopedPreferenceStore;
+import org.osgi.framework.BundleContext;
/**
- * XSLUIPlugin
- * @author dcarver
- *
+ * The activator class controls the plug-in life cycle
*/
public class XSLUIPlugin extends AbstractUIPlugin {
/**
- *
- */
- public static final String ID = null;
-
- /**
- * A Singleton Instance of this plugin.
- */
- protected static XSLUIPlugin INSTANCE;
-
- /**
* The template store for the xsl editor.
*/
private TemplateStore fTemplateStore;
@@ -68,76 +44,53 @@
* The plugin id for this plugin.
*/
static public String PLUGIN_ID = "org.eclipse.wst.xsl.ui"; //$NON-NLS-1$
+
+ // The shared instance
+ private static XSLUIPlugin plugin;
+
/**
- * Constructor Class
+ * The constructor
*/
public XSLUIPlugin() {
- super();
- INSTANCE = this;
}
-
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
/**
- * Returns a default instance
- * @return
+ * Returns the shared instance
+ *
+ * @return the shared instance
*/
public static XSLUIPlugin getDefault() {
- if (INSTANCE == null) {
- INSTANCE = new XSLUIPlugin();
- }
- return INSTANCE;
+ return plugin;
}
- /**
- * TODO: Add Javadoc
- * @return
- */
- public synchronized static XSLUIPlugin getInstance() {
- if (INSTANCE == null) {
- INSTANCE = new XSLUIPlugin();
- }
- return INSTANCE;
+ public static void log(Exception e)
+ {
+ getDefault().getLog().log(new Status(IStatus.ERROR, PLUGIN_ID, 0, "", e)); //$NON-NLS-1$
}
-
-
-
- /**
- * Utility methods for logging exceptions.
- *
- * @param e
- * @param severity
- */
- public static void log(Throwable e, int severity) {
- IStatus status = null;
- if (e instanceof CoreException) {
- status = ((CoreException)e).getStatus();
- } else {
- String m = e.getMessage();
- status = new Status(severity, PLUGIN_ID, 0, m==null? "<no message>" : m, e); //$NON-NLS-1$
- }
- System.out.println(e.getClass().getName()+": "+status); //$NON-NLS-1$
- INSTANCE.getLog().log(status);
- }
-
- /**
- *
- * @param throwable
- */
- public static void log(Throwable throwable) {
- log(throwable, IStatus.ERROR); }
-
- /**
- * TODO: Add Javadoc
- */
- @Override
- public IPreferenceStore getPreferenceStore() {
- if (preferenceStore == null) {
- preferenceStore = (ScopedPreferenceStore) PlatformUI
- .getPreferenceStore();
- }
- return preferenceStore;
+ public static void log(CoreException e)
+ {
+ getDefault().getLog().log(e.getStatus());
}
-
+
/**
* Returns the template store for the xsl templates.
*
@@ -154,7 +107,7 @@
}
catch (IOException e)
{
- XSLUIPlugin.log(e);
+ log(e);
}
}
return fTemplateStore;
@@ -188,7 +141,7 @@
fXPathTemplateStore.load();
}
catch (IOException e) {
- XSLUIPlugin.log(e);
+ log(e);
}
}
return fXPathTemplateStore;
@@ -213,5 +166,4 @@
return fXPathContextTypeRegistry;
}
-
}
diff --git a/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/wizards/NewXSLFileTemplatesWizardPage.java b/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/wizards/NewXSLFileTemplatesWizardPage.java
index b107822..1d4d328 100644
--- a/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/wizards/NewXSLFileTemplatesWizardPage.java
+++ b/bundles/org.eclipse.wst.xsl.ui/src/org/eclipse/wst/xsl/ui/internal/wizards/NewXSLFileTemplatesWizardPage.java
@@ -341,32 +341,32 @@
private void loadLastSavedPreferences()
{
-// String templateName = XSLUIPlugin.getDefault().getPreferenceStore().getString("JSPUIPreferenceNames.NEW_FILE_TEMPLATE_NAME");
-// if (templateName == null || templateName.length() == 0)
-// {
-// fLastSelectedTemplateName = ""; //$NON-NLS-1$
-// fUseTemplateButton.setSelection(false);
-// }
-// else
-// {
-// fLastSelectedTemplateName = templateName;
-// fUseTemplateButton.setSelection(true);
-// }
-// enableTemplates();
+ String templateName = XSLUIPlugin.getDefault().getPreferenceStore().getString(XSLUIConstants.NEW_FILE_TEMPLATE_NAME);
+ if (templateName == null || templateName.length() == 0)
+ {
+ fLastSelectedTemplateName = ""; //$NON-NLS-1$
+ fUseTemplateButton.setSelection(false);
+ }
+ else
+ {
+ fLastSelectedTemplateName = templateName;
+ fUseTemplateButton.setSelection(true);
+ }
+ enableTemplates();
}
void saveLastSavedPreferences()
{
-// String templateName = ""; //$NON-NLS-1$
-//
-// Template template = getSelectedTemplate();
-// if (template != null)
-// {
-// templateName = template.getName();
-// }
-//
-// XSLUIPlugin.getDefault().getPreferenceStore().setValue(JSPUIPreferenceNames.NEW_FILE_TEMPLATE_NAME, templateName);
-// XSLUIPlugin.getDefault().savePluginPreferences();
+ String templateName = ""; //$NON-NLS-1$
+
+ Template template = getSelectedTemplate();
+ if (template != null)
+ {
+ templateName = template.getName();
+ }
+
+ XSLUIPlugin.getDefault().getPreferenceStore().setValue(XSLUIConstants.NEW_FILE_TEMPLATE_NAME, templateName);
+ XSLUIPlugin.getDefault().savePluginPreferences();
}
private void setSelectedTemplate(String templateName)