core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/wizard/ImportWizard.java
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/wizard/ImportWizard.java Thu Aug 12 13:56:20 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/wizard/ImportWizard.java Thu Aug 12 15:22:11 2010 -0500
@@ -16,6 +16,12 @@
*/
package com.nokia.carbide.internal.discovery.ui.wizard;
+import java.lang.reflect.InvocationTargetException;
+import java.text.MessageFormat;
+
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.IImportWizard;
@@ -35,12 +41,30 @@
@Override
public boolean performFinish() {
- // TODO read from file and install
+ final ImportExportData data = importPage.getData();
+ IRunnableWithProgress runnable = new IRunnableWithProgress() {
+ @Override
+ public void run(final IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
+ try {
+ P2Utils.doInstall(data.getURIs(), data.getFeatureInfos(), data.getWantsVersions(), monitor);
+ } catch (Exception e) {
+ throw new InvocationTargetException(e);
+ }
+ }
+ };
+
+ try {
+ getContainer().run(true, true, runnable);
+ } catch (Exception e) {
+ MessageDialog.openError(getShell(), "Error",
+ MessageFormat.format("Could not install due to error: {0}", e.getLocalizedMessage()));
+ }
return true;
}
public void init(IWorkbench workbench, IStructuredSelection selection) {
setDefaultPageImageDescriptor(Activator.getImageDescriptor("icons\\install_wiz.gif")); //$NON-NLS-1$
+ setNeedsProgressMonitor(true);
setWindowTitle("Import Installed Feature Configuration");
importPage = new ImportPage();
addPage(importPage);