--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/wizard/AbstractImportExportPage.java Fri Aug 13 11:58:38 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/wizard/AbstractImportExportPage.java Fri Aug 13 13:39:46 2010 -0500
@@ -25,8 +25,10 @@
import org.eclipse.jface.layout.GridLayoutFactory;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ArrayContentProvider;
+import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.ColumnLabelProvider;
+import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.TableViewerColumn;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.SWT;
@@ -54,6 +56,8 @@
protected Text pathText;
protected Button browseButton;
protected CheckboxTableViewer viewer;
+ protected Button checkAllButton;
+ protected Button checkNoneButton;
protected static final ImageDescriptor FEATURE_IMGDESC = Activator
.getImageDescriptor("icons/iu_obj.gif"); //$NON-NLS-1$
protected Image featureImg;
@@ -146,22 +150,32 @@
GridDataFactory.swtDefaults().align(SWT.END, SWT.BEGINNING)
.applyTo(buttonComposite);
buttonComposite.setLayout(new GridLayout());
- Button checkAllButton = new Button(buttonComposite, SWT.PUSH);
+ checkAllButton = new Button(buttonComposite, SWT.PUSH);
checkAllButton.setText(Messages.AbstractImportExportPage_CheckAllLabel);
setButtonLayoutData(checkAllButton);
checkAllButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
viewer.setAllChecked(true);
+ enableButtons();
+ setPageComplete(validatePage());
}
});
- Button checkNoneButton = new Button(buttonComposite, SWT.PUSH);
+ checkNoneButton = new Button(buttonComposite, SWT.PUSH);
checkNoneButton.setText(Messages.AbstractImportExportPage_CheckNoneLabel);
setButtonLayoutData(checkNoneButton);
checkNoneButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
viewer.setAllChecked(false);
+ enableButtons();
+ setPageComplete(validatePage());
+ }
+ });
+ viewer.addCheckStateListener(new ICheckStateListener() {
+ public void checkStateChanged(CheckStateChangedEvent event) {
+ enableButtons();
+ setPageComplete(validatePage());
}
});
}
@@ -187,9 +201,15 @@
protected void updateViewer() {
packColumns();
viewer.setAllChecked(true);
+ enableButtons();
setPageComplete(validatePage());
}
+ private void enableButtons() {
+ checkAllButton.setEnabled(viewer.getTable().getItemCount() > viewer.getCheckedElements().length);
+ checkNoneButton.setEnabled(viewer.getCheckedElements().length > 0);
+ }
+
@Override
public void dispose() {
super.dispose();
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/wizard/ExportPage.java Fri Aug 13 11:58:38 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/wizard/ExportPage.java Fri Aug 13 13:39:46 2010 -0500
@@ -28,8 +28,6 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.dialogs.DialogPage;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
@@ -70,12 +68,6 @@
@Override
protected void createViewerGroup(Composite parent, String labelText) {
super.createViewerGroup(parent, labelText);
-
- viewer.addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- setPageComplete(validatePage());
- }
- });
startGetInputJob();
updateViewer();
}
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/wizard/FeatureInstallOperation.java Fri Aug 13 11:58:38 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/wizard/FeatureInstallOperation.java Fri Aug 13 13:39:46 2010 -0500
@@ -26,6 +26,7 @@
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.equinox.p2.core.ProvisionException;
@@ -35,6 +36,7 @@
import org.eclipse.equinox.p2.operations.RepositoryTracker;
import org.eclipse.equinox.p2.query.IQuery;
import org.eclipse.equinox.p2.query.IQueryResult;
+import org.eclipse.equinox.p2.query.IQueryable;
import org.eclipse.equinox.p2.query.QueryUtil;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
@@ -44,7 +46,7 @@
import com.nokia.carbide.discovery.ui.Messages;
-public class FeatureInstallOperation implements IRunnableWithProgress {
+class FeatureInstallOperation implements IRunnableWithProgress {
private Collection<URI> uris;
private Collection<FeatureInfo> featureInfos;
@@ -80,7 +82,9 @@
Display.getDefault().asyncExec(new Runnable() {
@Override
public void run() {
- provisioningUI.openInstallWizard(ius, operation, null);
+ IQueryable<IInstallableUnit> additions = operation.getProvisioningPlan().getAdditions();
+ IQueryResult<IInstallableUnit> result = additions.query(QueryUtil.createIUGroupQuery(), new NullProgressMonitor());
+ provisioningUI.openInstallWizard(result.toSet(), operation, null);
}
});
}
@@ -140,15 +144,6 @@
monitor.done();
}
-// private FeatureInfo findInfo(Collection<FeatureInfo> featureInfos, String id, Version version) {
-// for (FeatureInfo featureInfo : featureInfos) {
-// boolean sameId = featureInfo.getId().equals(id);
-// if (sameId && (!wantVersions || version.toString().equals(featureInfo.getVersion().toString())))
-// return featureInfo;
-// }
-// return null;
-// }
-
private InstallOperation resolve(SubMonitor monitor) throws CoreException {
checkIfCanceled(monitor);
URI[] uris = (URI[]) urisUsed.toArray(new URI[urisUsed.size()]);
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/wizard/ImportPage.java Fri Aug 13 11:58:38 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/wizard/ImportPage.java Fri Aug 13 13:39:46 2010 -0500
@@ -20,7 +20,10 @@
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
+import java.net.URI;
import java.text.MessageFormat;
+import java.util.ArrayList;
+import java.util.Collection;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
@@ -29,8 +32,6 @@
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.layout.GridDataFactory;
import org.eclipse.jface.layout.GridLayoutFactory;
-import org.eclipse.jface.viewers.CheckStateChangedEvent;
-import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
@@ -110,12 +111,6 @@
@Override
protected void createViewerGroup(Composite parent, String labelText) {
super.createViewerGroup(parent, labelText);
-
- viewer.addCheckStateListener(new ICheckStateListener() {
- public void checkStateChanged(CheckStateChangedEvent event) {
- setPageComplete(validatePage());
- }
- });
updateViewer();
}
@@ -193,8 +188,17 @@
}
}
- public ImportExportData getData() {
- return readData;
+ public Collection<FeatureInfo> getFeatureInfos() {
+ Collection<FeatureInfo> infos = new ArrayList<FeatureInfo>();
+ Object[] objs = viewer.getCheckedElements();
+ for (Object o : objs) {
+ infos.add((FeatureInfo) o);
+ }
+ return infos;
+ }
+
+ public Collection<URI> getURIs() {
+ return readData.getURIs();
}
public boolean getWantsOriginalVersions() {
--- a/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/wizard/ImportWizard.java Fri Aug 13 11:58:38 2010 -0500
+++ b/core/com.nokia.carbide.discovery.ui/src/com/nokia/carbide/internal/discovery/ui/wizard/ImportWizard.java Fri Aug 13 13:39:46 2010 -0500
@@ -44,9 +44,8 @@
@Override
public boolean performFinish() {
try {
- ImportExportData data = importPage.getData();
getContainer().run(true, true, new FeatureInstallOperation(
- data.getURIs(), data.getFeatureInfos(), importPage.getWantsOriginalVersions()));
+ importPage.getURIs(), importPage.getFeatureInfos(), importPage.getWantsOriginalVersions()));
} catch (InvocationTargetException e) {
Throwable cause = e.getCause();
if (cause instanceof CoreException) {