01: /*******************************************************************************
02: * Copyright (c) 2005 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.ui.examples.undo;
11:
12: import org.eclipse.ui.plugin.*;
13: import org.eclipse.jface.resource.ImageDescriptor;
14: import org.osgi.framework.BundleContext;
15:
16: /**
17: * The main plugin class to be used in the desktop.
18: */
19: public class UndoPlugin extends AbstractUIPlugin {
20:
21: //The shared instance.
22: private static UndoPlugin plugin;
23:
24: /**
25: * The constructor.
26: */
27: public UndoPlugin() {
28: plugin = this ;
29: }
30:
31: /**
32: * This method is called upon plug-in activation
33: */
34: public void start(BundleContext context) throws Exception {
35: super .start(context);
36: }
37:
38: /**
39: * This method is called when the plug-in is stopped
40: */
41: public void stop(BundleContext context) throws Exception {
42: super .stop(context);
43: plugin = null;
44: }
45:
46: /**
47: * Returns the shared instance.
48: */
49: public static UndoPlugin getDefault() {
50: return plugin;
51: }
52:
53: /**
54: * Returns an image descriptor for the image file at the given
55: * plug-in relative path.
56: *
57: * @param path the path
58: * @return the image descriptor
59: */
60: public static ImageDescriptor getImageDescriptor(String path) {
61: return AbstractUIPlugin.imageDescriptorFromPlugin(
62: "org.eclipse.ui.examples.undo2", path);
63: }
64: }
|