diff options
author | Hamdan Msheik | 2014-03-26 18:03:11 +0000 |
---|---|---|
committer | Hamdan Msheik | 2014-04-01 15:51:17 +0000 |
commit | 21a7e8fbd321339fee58041c9214cbf8817b8c44 (patch) | |
tree | 96c4e102b9b65504be3630f648c3d1477fffdc3d /bundles/org.eclipse.equinox.p2.ui.sdk.scheduler | |
parent | e71ae37595a0121eefe71110061ff33097cb17f5 (diff) | |
download | rt.equinox.p2-21a7e8fbd321339fee58041c9214cbf8817b8c44.tar.gz rt.equinox.p2-21a7e8fbd321339fee58041c9214cbf8817b8c44.tar.xz rt.equinox.p2-21a7e8fbd321339fee58041c9214cbf8817b8c44.zip |
Bug 427195 - Migration wizard sort issue.I20140402-0100
Improved migration wizard message.
Change-Id: Ia8deaf7f8915dec092fd59248a1094d80cd2236e
Signed-off-by: Hamdan Msheik <hamdan.msheik@ericsson.com>
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.ui.sdk.scheduler')
2 files changed, 43 insertions, 23 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationPage.java b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationPage.java index f065189ba..ac8a7bcc8 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationPage.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/MigrationPage.java @@ -9,7 +9,7 @@ * WindRiver Corporation - initial API and implementation * IBM Corporation - Ongoing development * Ericsson AB (Pascal Rapicault) - Bug 387115 - Allow to export everything - * Ericsson AB (Hamdan Msheik) - Bug 398833, 402560 + * Ericsson AB (Hamdan Msheik) - Bug 398833, 402560, 427195 *******************************************************************************/ package org.eclipse.equinox.internal.p2.ui.sdk.scheduler.migration; @@ -75,6 +75,7 @@ public class MigrationPage extends WizardPage implements ISelectableIUsPage, Lis protected IProvisioningAgent otherInstanceAgent = null; private Collection<IInstallableUnit> unitsToMigrate; + private Set<IInstallableUnit> selectedUnitsToMigrate; // selected units to be migrated, initially contains all units not installed in current profile. private IProfile toImportFrom = null; // private File instancePath = null; private URI[] metaURIs = null; @@ -277,11 +278,11 @@ public class MigrationPage extends WizardPage implements ISelectableIUsPage, Lis column.getColumn().setMoveable(true); if (titles[i].equals(ProvUIMessages.Column_Name)) { column.getColumn().setWidth(300); + updateTableSorting(i); } else { column.getColumn().setWidth(200); } - if (ProvUIMessages.Column_Name.equals(titles[i])) - updateTableSorting(i); + final int columnIndex = i; column.getColumn().addSelectionListener(new SelectionAdapter() { @Override @@ -404,7 +405,7 @@ public class MigrationPage extends WizardPage implements ISelectableIUsPage, Lis } }); parent.addControlListener(new ControlAdapter() { - private final int[] columnRate = new int[] {6, 2, 2}; + private final int[] columnRate = new int[] {4, 2, 2}; @Override public void controlResized(ControlEvent e) { @@ -444,6 +445,9 @@ public class MigrationPage extends WizardPage implements ISelectableIUsPage, Lis } } }); + + selectedUnitsToMigrate = identifyUnitsToBeMigrated(); + ICheckStateProvider provider = getViewerDefaultState(); if (provider != null) viewer.setCheckStateProvider(provider); @@ -457,13 +461,14 @@ public class MigrationPage extends WizardPage implements ISelectableIUsPage, Lis viewer.setInput(getInput()); viewer.getTree().addListener(SWT.Selection, new Listener() { - public void handleEvent(Event event) { - if (event.detail == SWT.CHECK) { - if (hasInstalled(ProvUI.getAdapter(event.item.getData(), IInstallableUnit.class))) { - viewer.getTree().setRedraw(false); - ((TreeItem) event.item).setChecked(false); - viewer.getTree().setRedraw(true); + if (event.item instanceof TreeItem && event.detail == SWT.CHECK) { + TreeItem treeItem = (TreeItem) event.item; + IInstallableUnit iu = ProvUI.getAdapter(event.item.getData(), IInstallableUnit.class); + if (treeItem.getChecked()) { + selectedUnitsToMigrate.add(iu); + } else { + selectedUnitsToMigrate.remove(iu); } } updatePageCompletion(); @@ -498,6 +503,15 @@ public class MigrationPage extends WizardPage implements ISelectableIUsPage, Lis @Override public void widgetSelected(SelectionEvent e) { for (TreeItem item : viewer.getTree().getItems()) { + if (item.getChecked()) { + item.setChecked(false); + Event event = new Event(); + event.widget = item.getParent(); + event.detail = SWT.CHECK; + event.item = item; + event.type = SWT.Selection; + viewer.getTree().notifyListeners(SWT.Selection, event); + } viewer.setSubtreeChecked(item.getData(), false); } updatePageCompletion(); @@ -506,6 +520,21 @@ public class MigrationPage extends WizardPage implements ISelectableIUsPage, Lis } + private Set<IInstallableUnit> identifyUnitsToBeMigrated() { + + Set<IInstallableUnit> ius = new HashSet<IInstallableUnit>(); + if (profile != null) { + for (IInstallableUnit iu : unitsToMigrate) { + IQueryResult<IInstallableUnit> collector = profile.query(QueryUtil.createIUQuery(iu.getId(), new VersionRange(iu.getVersion(), true, null, false)), new NullProgressMonitor()); + if (collector.isEmpty()) { + ius.add(iu); + } + } + } + + return ius; + } + protected void createAdditionOptions(Composite parent) { Composite composite = new Composite(parent, SWT.BORDER); @@ -532,22 +561,15 @@ public class MigrationPage extends WizardPage implements ISelectableIUsPage, Lis } public boolean isChecked(Object element) { - if (profile != null) { - IInstallableUnit iu = ProvUI.getAdapter(element, IInstallableUnit.class); - IQueryResult<IInstallableUnit> collector = profile.query(QueryUtil.createIUQuery(iu.getId(), new VersionRange(iu.getVersion(), true, null, false)), new NullProgressMonitor()); - if (collector.isEmpty()) { - return true; - } + IInstallableUnit iu = ProvUI.getAdapter(element, IInstallableUnit.class); + if (selectedUnitsToMigrate.contains(iu)) { + return true; } return false; } }; } - // protected ITableLabelProvider getLabelProvider() { - // return new IUDetailsLabelProvider(null, getColumnConfig(), null); - // } - protected ITreeContentProvider getContentProvider() { ProvElementContentProvider provider = new ProvElementContentProvider() { @Override @@ -604,8 +626,6 @@ public class MigrationPage extends WizardPage implements ISelectableIUsPage, Lis boolean pageComplete = determinePageCompletion(); setPageComplete(pageComplete); if (pageComplete) { - // if (this instanceof AbstractImportPage_c) - // saveWidgetValues(); setMessage(null); } } diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/messages.properties b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/messages.properties index 0063c3bf5..c92e67f75 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/messages.properties +++ b/bundles/org.eclipse.equinox.p2.ui.sdk.scheduler/src/org/eclipse/equinox/internal/p2/ui/sdk/scheduler/migration/messages.properties @@ -10,7 +10,7 @@ MigrationWizard_WINDOWTITLE=Migrate MigrationWizard_WINDOWTITLE_FIRSTRUN=Import MigrationPage_DIALOG_TITLE=Migration wizard MigrationPage_DIALOG_TITLE_FIRSTRUN=Import wizard -MigrationPage_DIALOG_DESCRIPTION=Because {0} has been updated, the plug-ins you had installed are now disabled.\nThis wizard will help you install those again. +MigrationPage_DIALOG_DESCRIPTION=This wizard helps you to import and reinstall previously installed plug-ins. It is triggered because\neither you are launching eclipse for the first time or your {0} has been updated. MigrationPage_DIALOG_DESCRIPTION_FIRSTRUN=It is the first time you are running {0} from this location.\nThis wizard will help you install plug-ins you may have previously installed. MigrationPage_CONFIRMATION_TITLE=Migration cancellation MigrationPage_CONFIRMATION_DIALOG=Canceling this operation will stop the re-installation of your plug-ins. Are you sure you want to cancel? |