KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > emf > codegen > CodeGenPlugin


1 /**
2  * <copyright>
3  *
4  * Copyright (c) 2002-2004 IBM Corporation and others.
5  * All rights reserved. This program and the accompanying materials
6  * are made available under the terms of the CodeGen Public License v1.0
7  * which accompanies this distribution, and is available at
8  * http://www.eclipse.org/legal/epl-v10.html
9  *
10  * Contributors:
11  * IBM - Initial API and implementation
12  *
13  * </copyright>
14  *
15  * $Id: CodeGenPlugin.java,v 1.4 2005/06/08 06:15:57 nickb Exp $
16  */

17 package org.eclipse.emf.codegen;
18
19
20 import org.eclipse.emf.common.EMFPlugin;
21 import org.eclipse.emf.common.util.ResourceLocator;
22
23
24 /**
25  * The <b>Plugin</b> for the model EMF.CodeGen library.
26  * EMF must run
27  * within an Eclipse workbench,
28  * within a headless Eclipse workspace,
29  * or just stand-alone as part of some other application.
30  * To support this, all resource access should be directed to the resource locator,
31  * which can redirect the service as appopriate to the runtime.
32  * During stand-alone invocation no plugin initialization takes place.
33  * In this case, common.resources.jar must be on the CLASSPATH.
34  * @see #INSTANCE
35  */

36 public final class CodeGenPlugin extends EMFPlugin
37 {
38   /**
39    * The singleton instance of the plugin.
40    */

41   public static final CodeGenPlugin INSTANCE = new CodeGenPlugin();
42
43   /**
44    * The one instance of this class.
45    */

46   private static Implementation plugin;
47
48   /**
49    * Creates the singleton instance.
50    */

51   private CodeGenPlugin()
52   {
53     super(new ResourceLocator[] {});
54   }
55
56   /*
57    * Javadoc copied from base class.
58    */

59   public ResourceLocator getPluginResourceLocator()
60   {
61     return plugin;
62   }
63
64   /**
65    * Returns the singleton instance of the Eclipse plugin.
66    * @return the singleton instance.
67    */

68   public static Implementation getPlugin()
69   {
70     return plugin;
71   }
72
73   /**
74    * Returns the singleton instance of the Eclipse plugin.
75    */

76   public static void write(Exception JavaDoc exception)
77   {
78     INSTANCE.log(exception);
79   }
80
81   /**
82    * The actual implementation of the Eclipse <b>Plugin</b>.
83    */

84   public static class Implementation extends EMFPlugin.EclipsePlugin
85   {
86     /**
87      * Creates an instance.
88      */

89     public Implementation()
90     {
91       super();
92
93       // Remember the static instance.
94
//
95
plugin = this;
96     }
97   }
98 }
99
Popular Tags