blob: ba306f37ae555966fcb1dbec06f2c6e6aae75923 [file] [log] [blame]
package org.eclipse.ui.internal;
/*
* (c) Copyright IBM Corp. 2000, 2001.
* All Rights Reserved.
*/
import org.eclipse.core.runtime.IPluginDescriptor;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.jface.util.Assert;
import org.eclipse.ui.IWorkbenchPreferenceConstants;
import org.eclipse.ui.plugin.AbstractUIPlugin;
/**
* This class represents the TOP of the workbench UI world
* A plugin class is effectively an application wrapper
* for a plugin & its classes. This class should be thought
* of as the workbench UI's application class.
*
* This class is responsible for tracking various registries
* font, preference, graphics, dialog store.
*
* This class is explicitly referenced by the
* workbench plugin's "plugin.xml" and places it
* into the UI start extension point of the main
* overall application harness
*
* When is this class started?
* When the Application
* calls createExecutableExtension to create an executable
* instance of our workbench class.
*/
public class UIPlugin extends AbstractUIPlugin {
private static UIPlugin inst;
/**
* Create an instance of the WorkbenchPlugin.
* The workbench plugin is effectively the "application" for the workbench UI.
* The entire UI operates as a good plugin citizen.
*/
public UIPlugin(IPluginDescriptor descriptor) {
super(descriptor);
inst = this;
}
/**
* Returns the image registry for this plugin.
*
* Where are the images? The images (typically gifs) are found in the
* same plugins directory.
*
* @see JFace's ImageRegistry
*
* Note: The workbench uses the standard JFace ImageRegistry to track its images. In addition
* the class WorkbenchGraphicResources provides convenience access to the graphics resources
* and fast field access for some of the commonly used graphical images.
*/
protected ImageRegistry createImageRegistry() {
/* Just to be sure that we don't access this
* plug-ins image registry.
*/
Assert.isLegal(false);
return WorkbenchImages.getImageRegistry();
}
public ImageRegistry getImageRegistry() {
/* Just to be sure that we don't access this
* plug-ins image registry.
*/
Assert.isLegal(false);
return null;
}
/* Return the default instance of the receiver. This represents the runtime plugin.
*
* @see AbstractPlugin for the typical implementation pattern for plugin classes.
*/
public static UIPlugin getDefault() {
return inst;
}
/**
* Set default preference values.
* This method must be called whenever the preference store is initially loaded
* because the default values are not stored in the preference store.
*/
protected void initializeDefaultPreferences(IPreferenceStore store) {
store.setDefault(IWorkbenchPreferenceConstants.DEFAULT_PERSPECTIVE_ID, IWorkbenchConstants.DEFAULT_LAYOUT_ID);
store.setDefault(IWorkbenchPreferenceConstants.OPEN_NEW_PERSPECTIVE, IWorkbenchPreferenceConstants.OPEN_PERSPECTIVE_REPLACE);
store.setDefault(IWorkbenchPreferenceConstants.PROJECT_OPEN_NEW_PERSPECTIVE, IWorkbenchPreferenceConstants.OPEN_PERSPECTIVE_REPLACE);
//Deprecated but kept for backwards compatibility
store.setDefault(IWorkbenchPreferenceConstants.SHIFT_OPEN_NEW_PERSPECTIVE, IWorkbenchPreferenceConstants.OPEN_PERSPECTIVE_REPLACE);
store.setDefault(IWorkbenchPreferenceConstants.ALTERNATE_OPEN_NEW_PERSPECTIVE, IWorkbenchPreferenceConstants.OPEN_PERSPECTIVE_REPLACE);
store.setDefault(IWorkbenchPreferenceConstants.LINK_NAVIGATOR_TO_EDITOR, true);
store.addPropertyChangeListener(new PlatformUIPreferenceListener());
}
}