blob: 01d4a220e035d0af4696f4829f151bc2283910c4 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2001, 2004 IBM Corporation 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:
* IBM Corporation - initial API and implementation
* Jens Lukowski/Innoopract - initial renaming/restructuring
*
*******************************************************************************/
package org.eclipse.wst.sse.ui.contentproperties;
import java.util.MissingResourceException;
import java.util.ResourceBundle;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPluginDescriptor;
import org.eclipse.core.runtime.Plugin;
import org.eclipse.ui.IStartup;
/**
* @deprecated This plugin has combined with the org.eclipse.wst.sse.ui plugin.
* Use SSEUIPlugin instead.
*/
public class ContentPropertiesPlugin extends Plugin implements IStartup {
//The shared instance.
private static ContentPropertiesPlugin plugin;
/**
* Returns the shared instance.
*/
public static ContentPropertiesPlugin getDefault() {
return plugin;
}
/**
* Returns the string from the plugin's resource bundle, or 'key' if not
* found.
*/
public static String getResourceString(String key) {
ResourceBundle bundle = ContentPropertiesPlugin.getDefault().getResourceBundle();
try {
return bundle.getString(key);
} catch (MissingResourceException e) {
return key;
}
}
/**
* Returns the workspace instance.
*/
public static IWorkspace getWorkspace() {
return ResourcesPlugin.getWorkspace();
}
//Resource bundle.
private ResourceBundle resourceBundle;
/**
* The constructor.
*/
public ContentPropertiesPlugin(IPluginDescriptor descriptor) {
super(descriptor);
plugin = this;
}
private void disableSynchronizer() {
ContentSettingsSynchronizer listener = ContentSettingsSynchronizer.getInstance();
if (listener != null && listener.isListening())
listener.unInstall();
}
/*
* (non-Javadoc)
*
* @see org.eclipse.ui.IStartup#earlyStartup()
*/
public void earlyStartup() {
enableSynchronizer();
}
private void enableSynchronizer() {
ContentSettingsSynchronizer listener = ContentSettingsSynchronizer.getInstance();
if (listener != null && !listener.isListening())
listener.install();
}
/**
* Returns the plugin's resource bundle,
*/
public ResourceBundle getResourceBundle() {
return resourceBundle;
}
/*
* (non-Javadoc)
*
* @see org.eclipse.core.runtime.Plugin#shutdown()
*/
public void shutdown() throws CoreException {
super.shutdown();
disableSynchronizer();
}
/*
* (non-Javadoc)
*
* @see org.eclipse.core.runtime.Plugin#startup()
*/
public void startup() throws CoreException {
super.startup();
enableSynchronizer();
}
}