core/com.nokia.carbide.cpp/src/com/nokia/carbide/cpp/ProductPlugin.java
author wpaul
Tue, 31 Aug 2010 18:54:57 -0500
changeset 1932 bb5cd1564dad
parent 1896 ab1b50f8668c
child 1997 46dd82743e58
permissions -rw-r--r--
moved IDE feature tracking from product plugin to CarbideUIPlugin to fix bug #11966.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
9
6ef327765a4e added copyright
wpaul
parents: 2
diff changeset
     1
/*
6ef327765a4e added copyright
wpaul
parents: 2
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
6ef327765a4e added copyright
wpaul
parents: 2
diff changeset
     3
* All rights reserved.
6ef327765a4e added copyright
wpaul
parents: 2
diff changeset
     4
* This component and the accompanying materials are made available
6ef327765a4e added copyright
wpaul
parents: 2
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
6ef327765a4e added copyright
wpaul
parents: 2
diff changeset
     6
* which accompanies this distribution, and is available
6ef327765a4e added copyright
wpaul
parents: 2
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
6ef327765a4e added copyright
wpaul
parents: 2
diff changeset
     8
*
6ef327765a4e added copyright
wpaul
parents: 2
diff changeset
     9
* Initial Contributors:
6ef327765a4e added copyright
wpaul
parents: 2
diff changeset
    10
* Nokia Corporation - initial contribution.
6ef327765a4e added copyright
wpaul
parents: 2
diff changeset
    11
*
6ef327765a4e added copyright
wpaul
parents: 2
diff changeset
    12
* Contributors:
6ef327765a4e added copyright
wpaul
parents: 2
diff changeset
    13
*
6ef327765a4e added copyright
wpaul
parents: 2
diff changeset
    14
* Description: 
6ef327765a4e added copyright
wpaul
parents: 2
diff changeset
    15
*
6ef327765a4e added copyright
wpaul
parents: 2
diff changeset
    16
*/
2
cawthron
parents:
diff changeset
    17
package com.nokia.carbide.cpp;
cawthron
parents:
diff changeset
    18
1888
fc9d5d520518 Write initial features file at startup to ensure it exists prior to any user installation
dadubrow
parents: 1773
diff changeset
    19
import java.io.File;
fc9d5d520518 Write initial features file at startup to ensure it exists prior to any user installation
dadubrow
parents: 1773
diff changeset
    20
2
cawthron
parents:
diff changeset
    21
import org.eclipse.jface.resource.ImageDescriptor;
1377
40401ea8b1fd move p2 policy code to discovery plugin for now + add system property for disabling unsigned check
dadubrow
parents: 1373
diff changeset
    22
import org.eclipse.ui.plugin.AbstractUIPlugin;
2
cawthron
parents:
diff changeset
    23
import org.osgi.framework.BundleContext;
cawthron
parents:
diff changeset
    24
1888
fc9d5d520518 Write initial features file at startup to ensure it exists prior to any user installation
dadubrow
parents: 1773
diff changeset
    25
import com.nokia.carbide.internal.discovery.ui.wizard.P2Utils;
1773
8d51e542dce4 starting using IDE feature when product plugin loads.
wpaul
parents: 1377
diff changeset
    26
2
cawthron
parents:
diff changeset
    27
/**
cawthron
parents:
diff changeset
    28
 * The main plugin class to be used in the desktop.
cawthron
parents:
diff changeset
    29
 */
cawthron
parents:
diff changeset
    30
public class ProductPlugin extends AbstractUIPlugin {
cawthron
parents:
diff changeset
    31
cawthron
parents:
diff changeset
    32
	//The shared instance.
cawthron
parents:
diff changeset
    33
	private static ProductPlugin plugin;
cawthron
parents:
diff changeset
    34
	
cawthron
parents:
diff changeset
    35
	/**
cawthron
parents:
diff changeset
    36
	 * The constructor.
cawthron
parents:
diff changeset
    37
	 */
cawthron
parents:
diff changeset
    38
	public ProductPlugin() {
cawthron
parents:
diff changeset
    39
		plugin = this;
cawthron
parents:
diff changeset
    40
	}
cawthron
parents:
diff changeset
    41
cawthron
parents:
diff changeset
    42
	/**
cawthron
parents:
diff changeset
    43
	 * This method is called upon plug-in activation
cawthron
parents:
diff changeset
    44
	 */
cawthron
parents:
diff changeset
    45
	public void start(BundleContext context) throws Exception {
cawthron
parents:
diff changeset
    46
		super.start(context);
1932
bb5cd1564dad moved IDE feature tracking from product plugin to CarbideUIPlugin to fix bug #11966.
wpaul
parents: 1896
diff changeset
    47
1888
fc9d5d520518 Write initial features file at startup to ensure it exists prior to any user installation
dadubrow
parents: 1773
diff changeset
    48
		File file = P2Utils.getInitialFeaturesFile();
fc9d5d520518 Write initial features file at startup to ensure it exists prior to any user installation
dadubrow
parents: 1773
diff changeset
    49
		if (!file.exists()) {
fc9d5d520518 Write initial features file at startup to ensure it exists prior to any user installation
dadubrow
parents: 1773
diff changeset
    50
			P2Utils.writeFeaturesToFile(file);
fc9d5d520518 Write initial features file at startup to ensure it exists prior to any user installation
dadubrow
parents: 1773
diff changeset
    51
		}
2
cawthron
parents:
diff changeset
    52
	}
cawthron
parents:
diff changeset
    53
cawthron
parents:
diff changeset
    54
	/**
cawthron
parents:
diff changeset
    55
	 * This method is called when the plug-in is stopped
cawthron
parents:
diff changeset
    56
	 */
cawthron
parents:
diff changeset
    57
	public void stop(BundleContext context) throws Exception {
cawthron
parents:
diff changeset
    58
		super.stop(context);
cawthron
parents:
diff changeset
    59
		plugin = null;
cawthron
parents:
diff changeset
    60
	}
cawthron
parents:
diff changeset
    61
cawthron
parents:
diff changeset
    62
	/**
cawthron
parents:
diff changeset
    63
	 * Returns the shared instance.
cawthron
parents:
diff changeset
    64
	 */
cawthron
parents:
diff changeset
    65
	public static ProductPlugin getDefault() {
cawthron
parents:
diff changeset
    66
		return plugin;
cawthron
parents:
diff changeset
    67
	}
cawthron
parents:
diff changeset
    68
cawthron
parents:
diff changeset
    69
	/**
cawthron
parents:
diff changeset
    70
	 * Returns an image descriptor for the image file at the given
cawthron
parents:
diff changeset
    71
	 * plug-in relative path.
cawthron
parents:
diff changeset
    72
	 *
cawthron
parents:
diff changeset
    73
	 * @param path the path
cawthron
parents:
diff changeset
    74
	 * @return the image descriptor
cawthron
parents:
diff changeset
    75
	 */
cawthron
parents:
diff changeset
    76
	public static ImageDescriptor getImageDescriptor(String path) {
cawthron
parents:
diff changeset
    77
		return AbstractUIPlugin.imageDescriptorFromPlugin("com.nokia.carbide.cpp", path); //$NON-NLS-1$
cawthron
parents:
diff changeset
    78
	}
cawthron
parents:
diff changeset
    79
}