core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/sdk/ui/NewPluginChecker.java
branchRCL_2_4
changeset 885 14d07a3e6c84
parent 231 4885a40e8b9b
equal deleted inserted replaced
882:e5207e7f4eb1 885:14d07a3e6c84
    15 *
    15 *
    16 */
    16 */
    17 package com.nokia.carbide.cpp.internal.sdk.ui;
    17 package com.nokia.carbide.cpp.internal.sdk.ui;
    18 
    18 
    19 import com.nokia.carbide.cpp.internal.sdk.core.model.DynamicFeatureInstaller;
    19 import com.nokia.carbide.cpp.internal.sdk.core.model.DynamicFeatureInstaller;
    20 import com.nokia.carbide.cpp.internal.sdk.core.model.InstallationFailureException;
       
    21 import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
    20 import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
    22 import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
    21 import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
    23 import com.nokia.carbide.cpp.sdk.ui.SDKUIPlugin;
    22 import com.nokia.carbide.cpp.sdk.ui.SDKUIPlugin;
    24 import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils;
    23 import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils;
    25 
    24 
    29 import org.eclipse.swt.widgets.Shell;
    28 import org.eclipse.swt.widgets.Shell;
    30 import org.eclipse.ui.IWorkbench;
    29 import org.eclipse.ui.IWorkbench;
    31 import org.eclipse.ui.IWorkbenchWindow;
    30 import org.eclipse.ui.IWorkbenchWindow;
    32 
    31 
    33 import java.io.File;
    32 import java.io.File;
    34 import java.io.FileNotFoundException;
       
    35 import java.net.MalformedURLException;
       
    36 import java.util.List;
    33 import java.util.List;
    37 
    34 
    38 @SuppressWarnings("restriction")
    35 @SuppressWarnings("restriction")
    39 public class NewPluginChecker {
    36 public class NewPluginChecker {
    40 
    37 
    41 	private static final String SDK_FEATURE_SUBDIR = "epoc32/kit/feature";  //$NON-NLS-1$
    38 	private static final String SDK_FEATURE_SUBDIR = "epoc32/kit";  //$NON-NLS-1$
    42 	
    39 	
    43 	public static void checkForNewlyInstalledPlugins(final IWorkbench workbench){
    40 	public static void checkForNewlyInstalledPlugins(final IWorkbench workbench){
    44 		final List<ISymbianSDK> sdkList = SDKCorePlugin.getSDKManager().getSDKList();
    41 		final List<ISymbianSDK> sdkList = SDKCorePlugin.getSDKManager().getSDKList();
    45 		Job job = new Job("Checking installed SDKs for plugins") { 
    42 		Job job = new Job("Checking installed SDKs for plugins") { 
    46 			@Override
    43 			@Override
    47 			protected IStatus run(IProgressMonitor monitor) {
    44 			protected IStatus run(IProgressMonitor monitor) {
    48 				boolean installed = false;
    45 				boolean installed = false;
    49 				boolean oneSDKWasScanned = false;
    46 				boolean oneSDKWasScanned = false;
    50 				for (ISymbianSDK sdk : sdkList) {
    47 				for (ISymbianSDK sdk : sdkList) {
    51 					
    48 					
    52 					if (sdk.isPreviouslyScanned() == false){
    49 					if (sdk.isPreviouslyScanned() == false) {
    53 						oneSDKWasScanned = true;
    50 						oneSDKWasScanned = true;
    54 						// XML was parsed, now try to run the feature installer
    51 						// XML was parsed, now try to run the feature installer
       
    52 						sdk.setPreviouslyScanned(true);
       
    53 
    55 						try {
    54 						try {
    56 							sdk.setPreviouslyScanned(true);
    55 							DynamicFeatureInstaller installer = new DynamicFeatureInstaller(new File(sdk.getEPOCROOT() + SDK_FEATURE_SUBDIR), null);
    57 							String eclipsePluginsPath = sdk.getEPOCROOT() + SDK_FEATURE_SUBDIR;
       
    58 							DynamicFeatureInstaller installer = new DynamicFeatureInstaller(new File(eclipsePluginsPath), null);
       
    59 							if (installer.install()) {
    56 							if (installer.install()) {
    60 								installed = true;
    57 								installed = true;
    61 							}
    58 							}
    62 	// Boog 8383: We should fail silently, since this will not break anything and may SDKs will not have any documentation
    59 						} catch (Exception e) {
    63 	// Otherwise, these errors will be logged every time this check is done (workspace is opened)
    60 							// Boog 8383: We should fail silently, since this will not break anything and may SDKs will not have any documentation
    64 	// Originally, this was used to install MBS build support, but now is only used for SDK documentation
    61 							// Otherwise, these errors will be logged every time this check is done (workspace is opened)
    65 						} catch (MalformedURLException e) {
    62 							// Originally, this was used to install MBS build support, but now is only used for SDK documentation
    66 	//						ResourcesPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SDKCorePlugin.PLUGIN_ID, IStatus.ERROR, "Unable to install plug-ins dynamically.", e));
       
    67 						} catch (FileNotFoundException e) {
       
    68 	//						ResourcesPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SDKCorePlugin.PLUGIN_ID, IStatus.ERROR, "Unable to install plug-ins dynamically.", e));
       
    69 						} catch (InstallationFailureException e) {
       
    70 	//						ResourcesPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SDKCorePlugin.PLUGIN_ID, IStatus.ERROR, "Unable to install plug-ins dynamically.", e));
    63 	//						ResourcesPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SDKCorePlugin.PLUGIN_ID, IStatus.ERROR, "Unable to install plug-ins dynamically.", e));
    71 						}
    64 						}
    72 					}
    65 					}
    73 					
       
    74 				}
    66 				}
    75 				
    67 				
    76 				if (oneSDKWasScanned) {
    68 				if (oneSDKWasScanned) {
    77 					SDKCorePlugin.getSDKManager().updateCarbideSDKCache();
    69 					SDKCorePlugin.getSDKManager().updateCarbideSDKCache();
    78 				}
    70 				}