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