connectivity/com.nokia.carbide.remoteConnections.discovery.pccs/src/com/nokia/carbide/remoteconnections/discovery/pccs/Activator.java
author dadubrow
Fri, 26 Feb 2010 11:31:16 -0600
branchRCL_2_4
changeset 1035 a50c0b5d243e
parent 941 e90e6ea44529
permissions -rw-r--r--
remove ui dependency + use new notification to switch mode
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
869
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
     1
/*
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
     2
* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
     3
* All rights reserved.
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
     4
* This component and the accompanying materials are made available
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
     6
* which accompanies this distribution, and is available
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
     8
*
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
     9
* Initial Contributors:
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    11
*
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    12
* Contributors:
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    13
*
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    14
* Description: 
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    15
*
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    16
*/
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    17
package com.nokia.carbide.remoteconnections.discovery.pccs;
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    18
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    19
import org.eclipse.core.runtime.Platform;
1035
a50c0b5d243e remove ui dependency + use new notification to switch mode
dadubrow
parents: 941
diff changeset
    20
import org.eclipse.core.runtime.Plugin;
869
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    21
import org.osgi.framework.BundleContext;
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    22
941
e90e6ea44529 PnP development for switching USB personalities. Bug 10604.
Chad Peckham <chad.peckham@nokia.com>
parents: 869
diff changeset
    23
import com.nokia.cpp.internal.api.utils.core.Logging;
e90e6ea44529 PnP development for switching USB personalities. Bug 10604.
Chad Peckham <chad.peckham@nokia.com>
parents: 869
diff changeset
    24
869
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    25
/**
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    26
 * The activator class controls the plug-in life cycle
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    27
 */
1035
a50c0b5d243e remove ui dependency + use new notification to switch mode
dadubrow
parents: 941
diff changeset
    28
public class Activator extends Plugin {
869
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    29
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    30
	// The plug-in ID
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    31
	public static final String PLUGIN_ID = "com.nokia.carbide.remoteConnections.discovery.pccs"; //$NON-NLS-1$
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    32
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    33
	// The shared instance
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    34
	private static Activator plugin;
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    35
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    36
	private static final String SYMSEE_LAYOUT_PLUGIN = "com.nokia.carbide.internal.doc.user"; //$NON-NLS-1$
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    37
	private static final String AGENT_NAME = Messages.Activator_Agent_Name;
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    38
	private static final String PCSuiteWikiLocation = Messages.Activator_PCSuite_Location;
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    39
	private static final String PCCSLocation = Messages.Activator_PCCS_Location;
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    40
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    41
	/**
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    42
	 * The constructor
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    43
	 */
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    44
	public Activator() {
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    45
	}
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    46
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    47
	/*
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    48
	 * (non-Javadoc)
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    49
	 * @see org.eclipse.core.runtime.Plugins#start(org.osgi.framework.BundleContext)
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    50
	 */
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    51
	public void start(BundleContext context) throws Exception {
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    52
		super.start(context);
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    53
		plugin = this;
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    54
	}
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    55
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    56
	/*
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    57
	 * (non-Javadoc)
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    58
	 * @see org.eclipse.core.runtime.Plugin#stop(org.osgi.framework.BundleContext)
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    59
	 */
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    60
	public void stop(BundleContext context) throws Exception {
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    61
		plugin = null;
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    62
		super.stop(context);
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    63
	}
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    64
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    65
	/**
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    66
	 * Returns the shared instance
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    67
	 *
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    68
	 * @return the shared instance
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    69
	 */
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    70
	public static Activator getDefault() {
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    71
		return plugin;
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    72
	}
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    73
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    74
	public static boolean isSymSEELayout() {
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    75
		if (Platform.getBundle(SYMSEE_LAYOUT_PLUGIN) != null)
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    76
			return true;
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    77
		return false;
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    78
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    79
	}
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    80
	public static String getDisplayName() {
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    81
		return AGENT_NAME;
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    82
	}
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    83
	public static String getLoadErrorURL() {
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    84
		if (isSymSEELayout()) {
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    85
			return PCCSLocation;
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    86
		} else {
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    87
			return PCSuiteWikiLocation;
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    88
		}
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    89
	}
941
e90e6ea44529 PnP development for switching USB personalities. Bug 10604.
Chad Peckham <chad.peckham@nokia.com>
parents: 869
diff changeset
    90
	public static void logError(Throwable t) {
e90e6ea44529 PnP development for switching USB personalities. Bug 10604.
Chad Peckham <chad.peckham@nokia.com>
parents: 869
diff changeset
    91
		Logging.log(plugin, Logging.newSimpleStatus(0, t));
e90e6ea44529 PnP development for switching USB personalities. Bug 10604.
Chad Peckham <chad.peckham@nokia.com>
parents: 869
diff changeset
    92
	}
e90e6ea44529 PnP development for switching USB personalities. Bug 10604.
Chad Peckham <chad.peckham@nokia.com>
parents: 869
diff changeset
    93
	
e90e6ea44529 PnP development for switching USB personalities. Bug 10604.
Chad Peckham <chad.peckham@nokia.com>
parents: 869
diff changeset
    94
	public static void logMessage(String message, int type) {
e90e6ea44529 PnP development for switching USB personalities. Bug 10604.
Chad Peckham <chad.peckham@nokia.com>
parents: 869
diff changeset
    95
		Logging.log(plugin, Logging.newStatus(plugin, type, message));
e90e6ea44529 PnP development for switching USB personalities. Bug 10604.
Chad Peckham <chad.peckham@nokia.com>
parents: 869
diff changeset
    96
	}
869
cb5e1f0959c9 move com.nokia.carbide.remoteConnections.discovery.pccs to carbidecpp repository
cawthron
parents:
diff changeset
    97
}