1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
|
/*
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
*
* Copyright @ 2015 Atlassian Pty Ltd
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package net.java.sip.communicator.plugin.skinmanager;
import java.util.*;
import net.java.sip.communicator.service.gui.*;
import net.java.sip.communicator.util.*;
import org.jitsi.service.configuration.*;
import org.osgi.framework.*;
/**
* The <tt>BundleActivator</tt> of the SkinManager plugin.
*
* @author Yana Stamcheva
* @author Adam Netocny, CircleTech, s.r.o.
*/
public class SkinManagerActivator
implements BundleActivator
{
/**
* The bundle context.
*/
public static BundleContext bundleContext;
/**
* The user interface service.
*/
private static UIService uiService;
/**
* Indicates if the skin manager configuration form should be enabled
*/
private static final String ENABLED_PROP
= "net.java.sip.communicator.plugin.skinconfig.ENABLED";
/**
* Starts this bundle and adds the
* <td>SkinManagerConfigForm</tt> contained in it to the configuration
* window obtained from the <tt>UIService</tt>.
* @param bc the <tt>BundleContext</tt>
* @throws Exception if one of the operation executed in the start method
* fails
*/
public void start(BundleContext bc) throws Exception
{
bundleContext = bc;
// If the skin manager configuration form is disabled don't continue.
if(getConfigService().getBoolean(ENABLED_PROP, false))
{
Dictionary<String, String> properties
= new Hashtable<String, String>();
properties.put( ConfigurationForm.FORM_TYPE,
ConfigurationForm.ADVANCED_TYPE);
bundleContext.registerService(
ConfigurationForm.class.getName(),
new LazyConfigurationForm(
"net.java.sip.communicator.plugin.skinmanager.SkinManagerPanel",
getClass().getClassLoader(),
"plugin.skinmanager.PLUGIN_ICON",
"plugin.skinmanager.SKINS",
1001, true),
properties);
}
}
/**
* Stops this bundles.
* @param bc the <tt>BundleContext</tt>
* @throws Exception if one of the operation executed in the stop method
* fails
*/
public void stop(BundleContext bc) throws Exception {}
/**
* Returns the <tt>UIService</tt> obtained from the bundle context.
*
* @return the <tt>UIService</tt> obtained from the bundle context
*/
public static UIService getUIService()
{
if (uiService == null)
{
ServiceReference uiReference =
bundleContext.getServiceReference(UIService.class.getName());
uiService =
(UIService) bundleContext
.getService(uiReference);
}
return uiService;
}
/**
* Returns a reference to a ConfigurationService implementation currently
* registered in the bundle context or null if no such implementation was
* found.
*
* @return a currently valid implementation of the ConfigurationService.
*/
public static ConfigurationService getConfigService()
{
return ServiceUtils.getService(
bundleContext,
ConfigurationService.class);
}
}
|