KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > axis > tool > service > eclipse > plugin > ServiceArchiver


1  /**
2  * Copyright 2004,2005 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.axis.tool.service.eclipse.plugin;
17
18 import java.util.MissingResourceException JavaDoc;
19 import java.util.ResourceBundle JavaDoc;
20
21 import org.eclipse.jface.resource.ImageDescriptor;
22 import org.eclipse.ui.plugin.AbstractUIPlugin;
23 import org.osgi.framework.BundleContext;
24
25 /**
26  * The main plugin class to be used in the desktop.
27  */

28 public class ServiceArchiver extends AbstractUIPlugin {
29     //The shared instance.
30
private static ServiceArchiver plugin;
31     //Resource bundle.
32
private ResourceBundle JavaDoc resourceBundle;
33     private static ImageDescriptor wizardImageDescriptor;
34     /**
35      * The constructor.
36      */

37     public ServiceArchiver() {
38         super();
39         plugin = this;
40         try {
41             resourceBundle = ResourceBundle.getBundle("org.apache.axis.tool.service.resource.ServiceResources");
42         } catch (MissingResourceException JavaDoc x) {
43             resourceBundle = null;
44         }
45     }
46
47     /**
48      * This method is called upon plug-in activation
49      */

50     public void start(BundleContext context) throws Exception JavaDoc {
51         super.start(context);
52     }
53
54     /**
55      * This method is called when the plug-in is stopped
56      */

57     public void stop(BundleContext context) throws Exception JavaDoc {
58         super.stop(context);
59     }
60
61     /**
62      * Returns the shared instance.
63      */

64     public static ServiceArchiver getDefault() {
65         return plugin;
66     }
67
68     /**
69      * Returns the string from the plugin's resource bundle,
70      * or 'key' if not found.
71      */

72     public static String JavaDoc getResourceString(String JavaDoc key) {
73         ResourceBundle JavaDoc bundle = ServiceArchiver.getDefault().getResourceBundle();
74         try {
75             return (bundle != null) ? bundle.getString(key) : key;
76         } catch (MissingResourceException JavaDoc e) {
77             return key;
78         }
79     }
80
81     /**
82      * Returns the plugin's resource bundle,
83      */

84     public ResourceBundle JavaDoc getResourceBundle() {
85         return resourceBundle;
86     }
87     
88     public static ImageDescriptor getWizardImageDescriptor(){
89         if (wizardImageDescriptor==null){
90             wizardImageDescriptor =ServiceArchiver.imageDescriptorFromPlugin("Axis_Service_Archiver","icons/asf-feather.gif");
91         }
92         return wizardImageDescriptor;
93     }
94 }
95
Popular Tags