aboutsummaryrefslogtreecommitdiffstats
path: root/src/net/java/sip/communicator/service/gui
diff options
context:
space:
mode:
Diffstat (limited to 'src/net/java/sip/communicator/service/gui')
-rw-r--r--src/net/java/sip/communicator/service/gui/AlertUIService.java246
-rw-r--r--src/net/java/sip/communicator/service/gui/ChatLinkClickedListener.java38
-rw-r--r--src/net/java/sip/communicator/service/gui/Container.java6
-rw-r--r--src/net/java/sip/communicator/service/gui/LazyConfigurationForm.java436
-rw-r--r--src/net/java/sip/communicator/service/gui/UIService.java26
-rw-r--r--src/net/java/sip/communicator/service/gui/internal/GuiServiceActivator.java152
6 files changed, 449 insertions, 455 deletions
diff --git a/src/net/java/sip/communicator/service/gui/AlertUIService.java b/src/net/java/sip/communicator/service/gui/AlertUIService.java
index 2843d60..a6055c4 100644
--- a/src/net/java/sip/communicator/service/gui/AlertUIService.java
+++ b/src/net/java/sip/communicator/service/gui/AlertUIService.java
@@ -1,4 +1,4 @@
-/*
+/*
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
*
* Copyright @ 2015 Atlassian Pty Ltd
@@ -15,125 +15,125 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.java.sip.communicator.service.gui;
-
-/**
- * The <tt>AlertUIService</tt> is a service that allows to show error messages
- * and warnings.
- *
- * @author Yana Stamcheva
- */
-public interface AlertUIService
-{
- /**
- * Indicates that the OK button is pressed.
- */
- public static final int OK_RETURN_CODE = 0;
-
- /**
- * Indicates that the Cancel button is pressed.
- */
- public static final int CANCEL_RETURN_CODE = 1;
-
- /**
- * Indicates that the OK button is pressed and the Don't ask check box is
- * checked.
- */
- public static final int OK_DONT_ASK_CODE = 2;
-
- /**
- * The type of the alert dialog, which displays a warning instead of an
- * error.
- */
- public static final int WARNING = 1;
-
- /**
- * The type of alert dialog which displays a warning instead of an error.
- */
- public static final int ERROR = 0;
-
- /**
- * Shows an alert dialog with the given title and message.
- *
- * @param title the title of the dialog
- * @param message the message to be displayed
- */
- public void showAlertDialog(String title,
- String message);
-
- /**
- * Shows an alert dialog with the given title message and exception
- * corresponding to the error.
- *
- * @param title the title of the dialog
- * @param message the message to be displayed
- * @param e the exception corresponding to the error
- */
- public void showAlertDialog(String title,
- String message,
- Throwable e);
-
- /**
- * Shows an alert dialog with the given title, message and type of message.
- *
- * @param title the title of the error dialog
- * @param message the message to be displayed
- * @param type the dialog type (warning or error)
- */
- public void showAlertDialog(String title,
- String message,
- int type);
-
- /**
- * Shows an notification pop-up which can be clicked. An error dialog is
- * shown when the notification is clicked.
- *
- * @param title the title of the error dialog and the notification pop-up
- * @param message the message to be displayed in the error dialog and the
- * pop-up
- */
- public void showAlertPopup(String title, String message);
-
- /**
- * Shows an notification pop-up which can be clicked. An error dialog is
- * shown when the notification is clicked.
- *
- * @param title the title of the error dialog and the notification pop-up
- * @param message the message to be displayed in the error dialog and the
- * pop-up
- * @param e the exception that can be shown in the error dialog
- */
- public void showAlertPopup(String title, String message,
- Throwable e);
-
- /**
- * Shows an notification pop-up which can be clicked. An error dialog is
- * shown when the notification is clicked.
- *
- * @param title the title of the notification pop-up
- * @param message the message of the pop-up
- * @param errorDialogTitle the title of the error dialog
- * @param errorDialogMessage the message of the error dialog
- */
- public void showAlertPopup(String title, String message,
- String errorDialogTitle, String errorDialogMessage);
-
- /**
- * Shows an notification pop-up which can be clicked. An error dialog is
- * shown when the notification is clicked.
- *
- * @param title the title of the notification pop-up
- * @param message the message of the pop-up
- * @param errorDialogTitle the title of the error dialog
- * @param errorDialogMessage the message of the error dialog
- * @param e the exception that can be shown in the error dialog
- */
- public void showAlertPopup(String title, String message,
- String errorDialogTitle, String errorDialogMessage, Throwable e);
-
- /**
- * Releases the resources acquired by this instance throughout its lifetime
- * and removes the listeners.
- */
- public void dispose();
-}
+package net.java.sip.communicator.service.gui;
+
+/**
+ * The <tt>AlertUIService</tt> is a service that allows to show error messages
+ * and warnings.
+ *
+ * @author Yana Stamcheva
+ */
+public interface AlertUIService
+{
+ /**
+ * Indicates that the OK button is pressed.
+ */
+ public static final int OK_RETURN_CODE = 0;
+
+ /**
+ * Indicates that the Cancel button is pressed.
+ */
+ public static final int CANCEL_RETURN_CODE = 1;
+
+ /**
+ * Indicates that the OK button is pressed and the Don't ask check box is
+ * checked.
+ */
+ public static final int OK_DONT_ASK_CODE = 2;
+
+ /**
+ * The type of the alert dialog, which displays a warning instead of an
+ * error.
+ */
+ public static final int WARNING = 1;
+
+ /**
+ * The type of alert dialog which displays a warning instead of an error.
+ */
+ public static final int ERROR = 0;
+
+ /**
+ * Shows an alert dialog with the given title and message.
+ *
+ * @param title the title of the dialog
+ * @param message the message to be displayed
+ */
+ public void showAlertDialog(String title,
+ String message);
+
+ /**
+ * Shows an alert dialog with the given title message and exception
+ * corresponding to the error.
+ *
+ * @param title the title of the dialog
+ * @param message the message to be displayed
+ * @param e the exception corresponding to the error
+ */
+ public void showAlertDialog(String title,
+ String message,
+ Throwable e);
+
+ /**
+ * Shows an alert dialog with the given title, message and type of message.
+ *
+ * @param title the title of the error dialog
+ * @param message the message to be displayed
+ * @param type the dialog type (warning or error)
+ */
+ public void showAlertDialog(String title,
+ String message,
+ int type);
+
+ /**
+ * Shows an notification pop-up which can be clicked. An error dialog is
+ * shown when the notification is clicked.
+ *
+ * @param title the title of the error dialog and the notification pop-up
+ * @param message the message to be displayed in the error dialog and the
+ * pop-up
+ */
+ public void showAlertPopup(String title, String message);
+
+ /**
+ * Shows an notification pop-up which can be clicked. An error dialog is
+ * shown when the notification is clicked.
+ *
+ * @param title the title of the error dialog and the notification pop-up
+ * @param message the message to be displayed in the error dialog and the
+ * pop-up
+ * @param e the exception that can be shown in the error dialog
+ */
+ public void showAlertPopup(String title, String message,
+ Throwable e);
+
+ /**
+ * Shows an notification pop-up which can be clicked. An error dialog is
+ * shown when the notification is clicked.
+ *
+ * @param title the title of the notification pop-up
+ * @param message the message of the pop-up
+ * @param errorDialogTitle the title of the error dialog
+ * @param errorDialogMessage the message of the error dialog
+ */
+ public void showAlertPopup(String title, String message,
+ String errorDialogTitle, String errorDialogMessage);
+
+ /**
+ * Shows an notification pop-up which can be clicked. An error dialog is
+ * shown when the notification is clicked.
+ *
+ * @param title the title of the notification pop-up
+ * @param message the message of the pop-up
+ * @param errorDialogTitle the title of the error dialog
+ * @param errorDialogMessage the message of the error dialog
+ * @param e the exception that can be shown in the error dialog
+ */
+ public void showAlertPopup(String title, String message,
+ String errorDialogTitle, String errorDialogMessage, Throwable e);
+
+ /**
+ * Releases the resources acquired by this instance throughout its lifetime
+ * and removes the listeners.
+ */
+ public void dispose();
+}
diff --git a/src/net/java/sip/communicator/service/gui/ChatLinkClickedListener.java b/src/net/java/sip/communicator/service/gui/ChatLinkClickedListener.java
index 5d64489..cf7468f 100644
--- a/src/net/java/sip/communicator/service/gui/ChatLinkClickedListener.java
+++ b/src/net/java/sip/communicator/service/gui/ChatLinkClickedListener.java
@@ -1,4 +1,4 @@
-/*
+/*
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
*
* Copyright @ 2015 Atlassian Pty Ltd
@@ -15,21 +15,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.java.sip.communicator.service.gui;
-
-import java.net.*;
-
-/**
- * Event-callback for clicks on links.
- *
- * @author Daniel Perren
- */
-public interface ChatLinkClickedListener
-{
- /**
- * Callback that is executed when a link was clicked.
- *
- * @param url The URI of the link that was clicked.
- */
- public void chatLinkClicked(URI url);
-}
+package net.java.sip.communicator.service.gui;
+
+import java.net.*;
+
+/**
+ * Event-callback for clicks on links.
+ *
+ * @author Daniel Perren
+ */
+public interface ChatLinkClickedListener
+{
+ /**
+ * Callback that is executed when a link was clicked.
+ *
+ * @param url The URI of the link that was clicked.
+ */
+ public void chatLinkClicked(URI url);
+}
diff --git a/src/net/java/sip/communicator/service/gui/Container.java b/src/net/java/sip/communicator/service/gui/Container.java
index 1b5e144..d0fcab7 100644
--- a/src/net/java/sip/communicator/service/gui/Container.java
+++ b/src/net/java/sip/communicator/service/gui/Container.java
@@ -257,4 +257,10 @@ public class Container
else
return false;
}
+
+ @Override
+ public int hashCode()
+ {
+ return containerName.hashCode();
+ }
}
diff --git a/src/net/java/sip/communicator/service/gui/LazyConfigurationForm.java b/src/net/java/sip/communicator/service/gui/LazyConfigurationForm.java
index f5db9fa..fe4a66e 100644
--- a/src/net/java/sip/communicator/service/gui/LazyConfigurationForm.java
+++ b/src/net/java/sip/communicator/service/gui/LazyConfigurationForm.java
@@ -1,4 +1,4 @@
-/*
+/*
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
*
* Copyright @ 2015 Atlassian Pty Ltd
@@ -15,220 +15,220 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.java.sip.communicator.service.gui;
-
-import java.lang.reflect.*;
-
-import net.java.sip.communicator.service.gui.internal.*;
-import net.java.sip.communicator.service.resources.*;
-
-import org.jitsi.service.resources.*;
-
-/**
- * @author Lubomir Marinov
- * @author Yana Stamcheva
- */
-public class LazyConfigurationForm
- implements ConfigurationForm
-{
- /**
- * The <tt>ResourceManagementService</tt> used to obtain any resources.
- */
- private static ResourceManagementService resources;
-
- /**
- * Returns an instance of the <tt>ResourceManagementService</tt>, which
- * could be used to obtain any resources.
- * @return an instance of the <tt>ResourceManagementService</tt>
- */
- private static ResourceManagementService getResources()
- {
- if (resources == null)
- resources =
- ResourceManagementServiceUtils.getService(GuiServiceActivator
- .getBundleContext());
- return resources;
- }
-
- /**
- * The form class loader.
- */
- private final ClassLoader formClassLoader;
-
- /**
- * The class name of the form.
- */
- private final String formClassName;
-
- /**
- * The identifier of the icon.
- */
- private final String iconID;
-
- /**
- * The index of the form in the parent container.
- */
- private final int index;
-
- /**
- * The title identifier.
- */
- private final String titleID;
-
- /**
- * Indicates if this form is advanced.
- */
- private final boolean isAdvanced;
-
- /**
- * Creates an instance of <tt>LazyConfigurationForm</tt>.
- * @param formClassName the class name of the configuration form
- * @param formClassLoader the class loader
- * @param iconID the identifier of the form icon
- * @param titleID the identifier of the form title
- */
- public LazyConfigurationForm(String formClassName,
- ClassLoader formClassLoader, String iconID, String titleID)
- {
- this(formClassName, formClassLoader, iconID, titleID, -1, false);
- }
-
- /**
- * Creates an instance of <tt>LazyConfigurationForm</tt>.
- * @param formClassName the class name of the configuration form
- * @param formClassLoader the class loader
- * @param iconID the identifier of the form icon
- * @param titleID the identifier of the form title
- * @param index the index of the form in the parent container
- */
- public LazyConfigurationForm(String formClassName,
- ClassLoader formClassLoader, String iconID, String titleID, int index)
- {
- this(formClassName, formClassLoader, iconID, titleID, index, false);
- }
-
- /**
- * Creates an instance of <tt>LazyConfigurationForm</tt>.
- * @param formClassName the class name of the configuration form
- * @param formClassLoader the class loader
- * @param iconID the identifier of the form icon
- * @param titleID the identifier of the form title
- * @param index the index of the form in the parent container
- * @param isAdvanced indicates if the form is advanced configuration form
- */
- public LazyConfigurationForm(String formClassName,
- ClassLoader formClassLoader,
- String iconID,
- String titleID,
- int index,
- boolean isAdvanced)
- {
- this.formClassName = formClassName;
- this.formClassLoader = formClassLoader;
- this.iconID = iconID;
- this.titleID = titleID;
- this.index = index;
- this.isAdvanced = isAdvanced;
- }
-
- /**
- * Returns the form component.
- * @return the form component
- */
- public Object getForm()
- {
- Exception exception;
- try
- {
- return Class
- .forName(getFormClassName(), true, getFormClassLoader())
- .newInstance();
- }
- catch (ClassNotFoundException ex)
- {
- exception = ex;
- }
- catch (IllegalAccessException ex)
- {
- exception = ex;
- }
- catch (InstantiationException ex)
- {
- exception = ex;
- }
- throw new UndeclaredThrowableException(exception);
- }
-
- /**
- * Returns the form class loader.
- * @return the form class loader
- */
- protected ClassLoader getFormClassLoader()
- {
- return formClassLoader;
- }
-
- /**
- * Returns the form class name.
- * @return the form class name
- */
- public String getFormClassName()
- {
- return formClassName;
- }
-
- /**
- * Returns the icon of the form.
- * @return a byte array containing the icon of the form
- */
- public byte[] getIcon()
- {
- return getResources().getImageInBytes(getIconID());
- }
-
- /**
- * Returns the identifier of the icon.
- * @return the identifier of the icon
- */
- protected String getIconID()
- {
- return iconID;
- }
-
- /**
- * Returns the index of the form in its parent container.
- * @return the index of the form in its parent container
- */
- public int getIndex()
- {
- return index;
- }
-
- /**
- * Returns the title of the form.
- * @return the title of the form
- */
- public String getTitle()
- {
- return getResources().getI18NString(getTitleID());
- }
-
- /**
- * Returns the identifier of the title of the form.
- * @return the identifier of the title of the form
- */
- protected String getTitleID()
- {
- return titleID;
- }
-
- /**
- * Indicates if the form is an advanced form.
- * @return <tt>true</tt> to indicate that this is an advanced form,
- * otherwise returns <tt>false</tt>
- */
- public boolean isAdvanced()
- {
- return isAdvanced;
- }
-}
+package net.java.sip.communicator.service.gui;
+
+import java.lang.reflect.*;
+
+import net.java.sip.communicator.service.gui.internal.*;
+import net.java.sip.communicator.service.resources.*;
+
+import org.jitsi.service.resources.*;
+
+/**
+ * @author Lubomir Marinov
+ * @author Yana Stamcheva
+ */
+public class LazyConfigurationForm
+ implements ConfigurationForm
+{
+ /**
+ * The <tt>ResourceManagementService</tt> used to obtain any resources.
+ */
+ private static ResourceManagementService resources;
+
+ /**
+ * Returns an instance of the <tt>ResourceManagementService</tt>, which
+ * could be used to obtain any resources.
+ * @return an instance of the <tt>ResourceManagementService</tt>
+ */
+ private static ResourceManagementService getResources()
+ {
+ if (resources == null)
+ resources =
+ ResourceManagementServiceUtils.getService(GuiServiceActivator
+ .getBundleContext());
+ return resources;
+ }
+
+ /**
+ * The form class loader.
+ */
+ private final ClassLoader formClassLoader;
+
+ /**
+ * The class name of the form.
+ */
+ private final String formClassName;
+
+ /**
+ * The identifier of the icon.
+ */
+ private final String iconID;
+
+ /**
+ * The index of the form in the parent container.
+ */
+ private final int index;
+
+ /**
+ * The title identifier.
+ */
+ private final String titleID;
+
+ /**
+ * Indicates if this form is advanced.
+ */
+ private final boolean isAdvanced;
+
+ /**
+ * Creates an instance of <tt>LazyConfigurationForm</tt>.
+ * @param formClassName the class name of the configuration form
+ * @param formClassLoader the class loader
+ * @param iconID the identifier of the form icon
+ * @param titleID the identifier of the form title
+ */
+ public LazyConfigurationForm(String formClassName,
+ ClassLoader formClassLoader, String iconID, String titleID)
+ {
+ this(formClassName, formClassLoader, iconID, titleID, -1, false);
+ }
+
+ /**
+ * Creates an instance of <tt>LazyConfigurationForm</tt>.
+ * @param formClassName the class name of the configuration form
+ * @param formClassLoader the class loader
+ * @param iconID the identifier of the form icon
+ * @param titleID the identifier of the form title
+ * @param index the index of the form in the parent container
+ */
+ public LazyConfigurationForm(String formClassName,
+ ClassLoader formClassLoader, String iconID, String titleID, int index)
+ {
+ this(formClassName, formClassLoader, iconID, titleID, index, false);
+ }
+
+ /**
+ * Creates an instance of <tt>LazyConfigurationForm</tt>.
+ * @param formClassName the class name of the configuration form
+ * @param formClassLoader the class loader
+ * @param iconID the identifier of the form icon
+ * @param titleID the identifier of the form title
+ * @param index the index of the form in the parent container
+ * @param isAdvanced indicates if the form is advanced configuration form
+ */
+ public LazyConfigurationForm(String formClassName,
+ ClassLoader formClassLoader,
+ String iconID,
+ String titleID,
+ int index,
+ boolean isAdvanced)
+ {
+ this.formClassName = formClassName;
+ this.formClassLoader = formClassLoader;
+ this.iconID = iconID;
+ this.titleID = titleID;
+ this.index = index;
+ this.isAdvanced = isAdvanced;
+ }
+
+ /**
+ * Returns the form component.
+ * @return the form component
+ */
+ public Object getForm()
+ {
+ Exception exception;
+ try
+ {
+ return Class
+ .forName(getFormClassName(), true, getFormClassLoader())
+ .newInstance();
+ }
+ catch (ClassNotFoundException ex)
+ {
+ exception = ex;
+ }
+ catch (IllegalAccessException ex)
+ {
+ exception = ex;
+ }
+ catch (InstantiationException ex)
+ {
+ exception = ex;
+ }
+ throw new UndeclaredThrowableException(exception);
+ }
+
+ /**
+ * Returns the form class loader.
+ * @return the form class loader
+ */
+ protected ClassLoader getFormClassLoader()
+ {
+ return formClassLoader;
+ }
+
+ /**
+ * Returns the form class name.
+ * @return the form class name
+ */
+ public String getFormClassName()
+ {
+ return formClassName;
+ }
+
+ /**
+ * Returns the icon of the form.
+ * @return a byte array containing the icon of the form
+ */
+ public byte[] getIcon()
+ {
+ return getResources().getImageInBytes(getIconID());
+ }
+
+ /**
+ * Returns the identifier of the icon.
+ * @return the identifier of the icon
+ */
+ protected String getIconID()
+ {
+ return iconID;
+ }
+
+ /**
+ * Returns the index of the form in its parent container.
+ * @return the index of the form in its parent container
+ */
+ public int getIndex()
+ {
+ return index;
+ }
+
+ /**
+ * Returns the title of the form.
+ * @return the title of the form
+ */
+ public String getTitle()
+ {
+ return getResources().getI18NString(getTitleID());
+ }
+
+ /**
+ * Returns the identifier of the title of the form.
+ * @return the identifier of the title of the form
+ */
+ protected String getTitleID()
+ {
+ return titleID;
+ }
+
+ /**
+ * Indicates if the form is an advanced form.
+ * @return <tt>true</tt> to indicate that this is an advanced form,
+ * otherwise returns <tt>false</tt>
+ */
+ public boolean isAdvanced()
+ {
+ return isAdvanced;
+ }
+}
diff --git a/src/net/java/sip/communicator/service/gui/UIService.java b/src/net/java/sip/communicator/service/gui/UIService.java
index 33219d8..48994d4 100644
--- a/src/net/java/sip/communicator/service/gui/UIService.java
+++ b/src/net/java/sip/communicator/service/gui/UIService.java
@@ -157,26 +157,14 @@ public interface UIService
public void bringToFront();
/**
- * Sets the exitOnClose property. When TRUE, the user could exit the
- * application by simply closing the main application window (by clicking
- * the X button or pressing Alt-F4). When set to FALSE the main application
- * window will be only hidden.
- *
- * @param exitOnClose When TRUE, the user could exit the application by
- * simply closing the main application window (by clicking the X
- * button or pressing Alt-F4). When set to FALSE the main
- * application window will be only hidden.
- */
- public void setExitOnMainWindowClose(boolean exitOnClose);
-
- /**
- * Returns TRUE if the application could be exited by closing the main
- * application window, otherwise returns FALSE.
- *
- * @return Returns TRUE if the application could be exited by closing the
- * main application window, otherwise returns FALSE
+ * Called from the systray service when a tray has been initialized and
+ * hiding (instead of minimizing or exiting) is possible). If hiding is
+ * possible and the option to minimize is not selected, the application
+ * gets hidden on clicking 'X'.
+ *
+ * @param true if a tray icon was loaded.
*/
- public boolean getExitOnMainWindowClose();
+ public void setMainWindowCanHide(boolean exitOnClose);
/**
* Returns an exported window given by the <tt>WindowID</tt>. This could be
diff --git a/src/net/java/sip/communicator/service/gui/internal/GuiServiceActivator.java b/src/net/java/sip/communicator/service/gui/internal/GuiServiceActivator.java
index 7dfbc37..abfc1bd 100644
--- a/src/net/java/sip/communicator/service/gui/internal/GuiServiceActivator.java
+++ b/src/net/java/sip/communicator/service/gui/internal/GuiServiceActivator.java
@@ -1,4 +1,4 @@
-/*
+/*
* Jitsi, the OpenSource Java VoIP and Instant Messaging client.
*
* Copyright @ 2015 Atlassian Pty Ltd
@@ -15,78 +15,78 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package net.java.sip.communicator.service.gui.internal;
-
-import net.java.sip.communicator.util.*;
-
-import org.jitsi.service.resources.*;
-import org.osgi.framework.*;
-
-/**
- * @author Lubomir Marinov
- * @author Yana Stamcheva
- */
-public class GuiServiceActivator
- implements BundleActivator
-{
- /**
- * The <tt>BundleContext</tt> of the service.
- */
- private static BundleContext bundleContext;
-
- /**
- * The <tt>ResourceManagementService</tt>, which gives access to application
- * resources.
- */
- private static ResourceManagementService resourceService;
-
- /**
- * Returns the <tt>BundleContext</tt>.
- *
- * @return bundle context
- */
- public static BundleContext getBundleContext()
- {
- return bundleContext;
- }
-
- /**
- * Initialize and start GUI service
- *
- * @param bundleContext the <tt>BundleContext</tt>
- */
- public void start(BundleContext bundleContext)
- {
- GuiServiceActivator.bundleContext = bundleContext;
- }
-
- /**
- * Stops this bundle.
- *
- * @param bundleContext the <tt>BundleContext</tt>
- */
- public void stop(BundleContext bundleContext)
- {
- if (GuiServiceActivator.bundleContext == bundleContext)
- GuiServiceActivator.bundleContext = null;
- }
-
- /**
- * Returns the <tt>ResourceManagementService</tt>, through which we will
- * access all resources.
- *
- * @return the <tt>ResourceManagementService</tt>, through which we will
- * access all resources.
- */
- public static ResourceManagementService getResources()
- {
- if (resourceService == null)
- {
- resourceService
- = ServiceUtils.getService(
- bundleContext,
- ResourceManagementService.class);
- }
- return resourceService;
- }
-}
+package net.java.sip.communicator.service.gui.internal;
+
+import net.java.sip.communicator.util.*;
+
+import org.jitsi.service.resources.*;
+import org.osgi.framework.*;
+
+/**
+ * @author Lubomir Marinov
+ * @author Yana Stamcheva
+ */
+public class GuiServiceActivator
+ implements BundleActivator
+{
+ /**
+ * The <tt>BundleContext</tt> of the service.
+ */
+ private static BundleContext bundleContext;
+
+ /**
+ * The <tt>ResourceManagementService</tt>, which gives access to application
+ * resources.
+ */
+ private static ResourceManagementService resourceService;
+
+ /**
+ * Returns the <tt>BundleContext</tt>.
+ *
+ * @return bundle context
+ */
+ public static BundleContext getBundleContext()
+ {
+ return bundleContext;
+ }
+
+ /**
+ * Initialize and start GUI service
+ *
+ * @param bundleContext the <tt>BundleContext</tt>
+ */
+ public void start(BundleContext bundleContext)
+ {
+ GuiServiceActivator.bundleContext = bundleContext;
+ }
+
+ /**
+ * Stops this bundle.
+ *
+ * @param bundleContext the <tt>BundleContext</tt>
+ */
+ public void stop(BundleContext bundleContext)
+ {
+ if (GuiServiceActivator.bundleContext == bundleContext)
+ GuiServiceActivator.bundleContext = null;
+ }
+
+ /**
+ * Returns the <tt>ResourceManagementService</tt>, through which we will
+ * access all resources.
+ *
+ * @return the <tt>ResourceManagementService</tt>, through which we will
+ * access all resources.
+ */
+ public static ResourceManagementService getResources()
+ {
+ if (resourceService == null)
+ {
+ resourceService
+ = ServiceUtils.getService(
+ bundleContext,
+ ResourceManagementService.class);
+ }
+ return resourceService;
+ }
+}