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