Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.ui')
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/.classpath4
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/.project5
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/.settings/org.eclipse.jdt.core.prefs15
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/META-INF/MANIFEST.MF80
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/OSGI-INF/repositoryTracker_component.xml7
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/OSGI-INF/serviceui_component.xml7
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/build.properties7
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/icons/tool/close.gifbin73 -> 0 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/icons/tool/close_hot.gifbin852 -> 0 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/icons/tool/update.gifbin600 -> 0 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/icons/tool/update_problems.gifbin1005 -> 0 bytes
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/plugin.xml47
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/BatchChangeCompleteEvent.java41
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ColocatedRepositoryTracker.java167
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/DefaultMetadataURLValidator.java85
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/DefaultQueryProvider.java189
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ElementQueryDescriptor.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/ElementQueryDescriptor.java)31
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ElementWrapper.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/ElementWrapper.java)17
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/IProvHelpContextIds.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/IProvHelpContextIds.java)3
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/PlanAnalyzer.java179
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUI.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/ProvUI.java)163
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIActivator.java94
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIAdapterFactory.java16
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIImages.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/ProvUIImages.java)8
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIMessages.java68
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIProvisioningListener.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/ProvUIProvisioningListener.java)32
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvisioningOperationRunner.java143
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryProvider.java200
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableArtifactRepositoryManager.java57
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableMetadataRepositoryManager.java56
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableRepositoryManager.java172
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/RepositoryLocationQuery.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/RepositoryLocationQuery.java)22
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/RepositoryOperationBeginningEvent.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/BatchChangeBeginningEvent.java)17
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/RepositoryOperationEndingEvent.java79
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/SimpleLicenseManager.java120
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/UIRepositoryEvent.java36
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/UpdateManagerCompatibility.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/UpdateManagerCompatibility.java)53
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ValidationDialogServiceUI.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/ValidationDialogServiceUI.java)9
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/ColocatedRepositoryAction.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/actions/ColocatedRepositoryAction.java)20
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/ExistingIUInProfileAction.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/actions/ExistingIUInProfileAction.java)62
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/InstallAction.java68
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/ProfileModificationAction.java212
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/PropertyDialogAction.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/actions/PropertyDialogAction.java)2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/ProvisioningAction.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/actions/ProvisioningAction.java)23
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/RefreshAction.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/actions/RefreshAction.java)7
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/RemoveColocatedRepositoryAction.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/actions/RemoveColocatedRepositoryAction.java)13
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/UninstallAction.java54
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/UpdateAction.java70
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AddRepositoryDialog.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/AddRepositoryDialog.java)35
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ApplyProfileChangesDialog.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUGroup.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/AvailableIUGroup.java)100
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUPatternFilter.java7
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUsPage.java71
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ComboAutoCompleteField.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ContainerCheckedTreeViewer.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/CopyHandler.java1
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/CopyPopup.java1
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/CopyUtils.java1
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/DelayedFilterCheckboxTree.java53
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IRepositorySelectionListener.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/IRepositorySelectionListener.java)2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IResolutionErrorReportingPage.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IUCopyrightPropertyPage.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/IUCopyrightPropertyPage.java)10
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IUDetailsGroup.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IUGeneralInfoPropertyPage.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/IUGeneralInfoPropertyPage.java)14
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IULicensePropertyPage.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/IULicensePropertyPage.java)16
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IUPropertyPage.java6
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/InstallWizard.java144
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/InstallWizardPage.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/InstalledIUGroup.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/InstalledIUGroup.java)20
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/PreselectedIUInstallWizard.java85
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningOperationWizard.java223
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningWizardDialog.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/ProvisioningWizardDialog.java)3
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningWizardPage.java24
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositoryManipulatorDropTarget.java29
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositoryNameAndLocationDialog.java44
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositorySelectionGroup.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/RepositorySelectionGroup.java)150
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionResultsWizardPage.java87
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionStatusPage.java48
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/SelectableIUsPage.java64
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/SizeComputingWizardPage.java57
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/StructuredIUGroup.java35
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UninstallWizard.java91
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UninstallWizardPage.java17
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UpdateWizard.java146
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UpdateWizardPage.java15
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/WizardWithLicenses.java85
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/messages.properties80
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactElement.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactRepositories.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/model/ArtifactRepositories.java)13
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactRepositoryElement.java99
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableIUElement.java50
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableUpdateElement.java22
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/CategoryElement.java39
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ElementUtils.java71
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/IIUElement.java25
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/IRepositoryElement.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/model/IRepositoryElement.java)8
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/IUElementListRoot.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/model/IUElementListRoot.java)3
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/InstalledIUElement.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/model/InstalledIUElement.java)19
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/MetadataRepositories.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/model/MetadataRepositories.java)17
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/MetadataRepositoryElement.java84
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProfileElement.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/model/ProfileElement.java)25
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProfileSnapshots.java44
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/Profiles.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/model/Profiles.java)11
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProvElement.java5
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElement.java38
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElementWrapper.java36
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/RemoteQueriedElement.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/RollbackProfileElement.java30
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/RootElement.java28
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/Updates.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/model/Updates.java)7
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/AnyRequiredCapabilityQuery.java43
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/ArtifactKeyWrapper.java46
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/ArtifactRepositoryElementWrapper.java50
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/AvailableIUWrapper.java26
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/CategoryElementWrapper.java31
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/IUViewQueryContext.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/policy/IUViewQueryContext.java)47
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/InstalledIUElementWrapper.java10
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/MetadataRepositoryElementWrapper.java8
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/ProfileElementWrapper.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/QueryableProfileRegistry.java33
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/QueryableUpdates.java33
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/DeferredQueryContentProvider.java9
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUColumnConfig.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/viewers/IUColumnConfig.java)2
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUComparator.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/viewers/IUComparator.java)16
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUDetailsLabelProvider.java29
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUDragAdapter.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/viewers/IUDragAdapter.java)18
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/InstallIUDropAdapter.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/viewers/InstallIUDropAdapter.java)34
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/ProvElementComparer.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/viewers/ProvElementComparer.java)20
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/ProvElementContentProvider.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/viewers/ProvElementContentProvider.java)6
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/ProvElementLabelProvider.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/viewers/ProvElementLabelProvider.java)51
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/RepositoryContentProvider.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/viewers/RepositoryContentProvider.java)5
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/RepositoryDetailsLabelProvider.java28
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/StructuredViewerProvisioningListener.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/viewers/StructuredViewerProvisioningListener.java)23
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/IStatusCodes.java48
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/IUPropertyUtils.java241
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/ProfileFactory.java81
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/ProvisioningOperationRunner.java251
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/QueryableArtifactRepositoryManager.java72
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/QueryableMetadataRepositoryManager.java97
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/QueryableRepositoryManager.java238
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/ResolutionResult.java127
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/actions/InstallAction.java158
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/actions/ProfileModificationAction.java304
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/actions/UninstallAction.java73
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/actions/UpdateAction.java99
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/InstallWizard.java137
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/PreselectedIUInstallWizard.java93
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/UninstallWizard.java97
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/UpdateWizard.java265
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/operations/AddColocatedRepositoryOperation.java51
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/operations/AddProfileOperation.java37
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/operations/AddRepositoryOperation.java66
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/operations/DownloadPhaseSet.java24
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/operations/PlannerResolutionOperation.java85
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/operations/ProfileModificationOperation.java87
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/operations/ProvisioningOperation.java86
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/operations/ProvisioningUtil.java450
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/operations/RemoveColocatedRepositoryOperation.java39
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/operations/RemoveProfilesOperation.java37
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/operations/RemoveRepositoryOperation.java26
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/operations/RepositoryOperation.java56
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/operations/SizingPhaseSet.java31
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/policy/ColocatedRepositoryManipulator.java166
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/policy/IProfileChooser.java29
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/policy/LicenseManager.java47
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/policy/PlanValidator.java45
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/policy/Policy.java289
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/policy/QueryProvider.java31
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/policy/RepositoryLocationValidator.java56
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/policy/RepositoryManipulator.java100
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/AcceptLicensesWizardPage.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/AcceptLicensesWizardPage.java)204
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/ICopyable.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ICopyable.java)15
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/InstalledSoftwarePage.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/InstalledSoftwarePage.java)44
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/LicenseManager.java85
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/LoadMetadataRepositoryJob.java177
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/Policy.java355
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/ProvisioningUI.java442
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RepositoryManipulationPage.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/RepositoryManipulationPage.java)288
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/RevertProfilePage.java (renamed from bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/RevertProfilePage.java)97
-rw-r--r--bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/p2/ui/package.html39
180 files changed, 4704 insertions, 7076 deletions
diff --git a/bundles/org.eclipse.equinox.p2.ui/.classpath b/bundles/org.eclipse.equinox.p2.ui/.classpath
index ce7393340..64c5e31b7 100644
--- a/bundles/org.eclipse.equinox.p2.ui/.classpath
+++ b/bundles/org.eclipse.equinox.p2.ui/.classpath
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
- <classpathentry kind="src" path="src"/>
- <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.4"/>
+ <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/>
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/bundles/org.eclipse.equinox.p2.ui/.project b/bundles/org.eclipse.equinox.p2.ui/.project
index 06b02bb38..1b62af1af 100644
--- a/bundles/org.eclipse.equinox.p2.ui/.project
+++ b/bundles/org.eclipse.equinox.p2.ui/.project
@@ -25,6 +25,11 @@
<arguments>
</arguments>
</buildCommand>
+ <buildCommand>
+ <name>org.eclipse.pde.ds.core.builder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.pde.PluginNature</nature>
diff --git a/bundles/org.eclipse.equinox.p2.ui/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.equinox.p2.ui/.settings/org.eclipse.jdt.core.prefs
index a6b401a0d..19b78b9fd 100644
--- a/bundles/org.eclipse.equinox.p2.ui/.settings/org.eclipse.jdt.core.prefs
+++ b/bundles/org.eclipse.equinox.p2.ui/.settings/org.eclipse.jdt.core.prefs
@@ -1,4 +1,4 @@
-#Tue Sep 18 21:22:20 EDT 2007
+#Tue Dec 22 23:22:15 CET 2009
eclipse.preferences.version=1
org.eclipse.jdt.core.builder.cleanOutputFolder=clean
org.eclipse.jdt.core.builder.duplicateResourceTask=warning
@@ -7,24 +7,24 @@ org.eclipse.jdt.core.builder.resourceCopyExclusionFilter=*.launch
org.eclipse.jdt.core.circularClasspath=error
org.eclipse.jdt.core.classpath.exclusionPatterns=enabled
org.eclipse.jdt.core.classpath.multipleOutputLocations=enabled
-org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=disabled
-org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.2
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=jsr14
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
-org.eclipse.jdt.core.compiler.compliance=1.4
+org.eclipse.jdt.core.compiler.compliance=1.5
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.doc.comment.support=enabled
org.eclipse.jdt.core.compiler.maxProblemPerUnit=1000
org.eclipse.jdt.core.compiler.problem.annotationSuperInterface=warning
-org.eclipse.jdt.core.compiler.problem.assertIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.autoboxing=ignore
org.eclipse.jdt.core.compiler.problem.deprecation=warning
org.eclipse.jdt.core.compiler.problem.deprecationInDeprecatedCode=disabled
org.eclipse.jdt.core.compiler.problem.deprecationWhenOverridingDeprecatedMethod=enabled
org.eclipse.jdt.core.compiler.problem.discouragedReference=error
org.eclipse.jdt.core.compiler.problem.emptyStatement=warning
-org.eclipse.jdt.core.compiler.problem.enumIdentifier=warning
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.problem.fieldHiding=warning
org.eclipse.jdt.core.compiler.problem.finalParameterBound=ignore
org.eclipse.jdt.core.compiler.problem.finallyBlockNotCompletingNormally=warning
@@ -71,7 +71,7 @@ org.eclipse.jdt.core.compiler.problem.unusedParameterWhenImplementingAbstract=en
org.eclipse.jdt.core.compiler.problem.unusedParameterWhenOverridingConcrete=enabled
org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=error
org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning
-org.eclipse.jdt.core.compiler.source=1.3
+org.eclipse.jdt.core.compiler.source=1.5
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_enum_constant=16
@@ -143,7 +143,6 @@ org.eclipse.jdt.core.formatter.indent_statements_compare_to_body=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_cases=true
org.eclipse.jdt.core.formatter.indent_switchstatements_compare_to_switch=true
org.eclipse.jdt.core.formatter.indentation.size=4
-org.eclipse.jdt.core.formatter.insert_new_line_after_annotation=insert
org.eclipse.jdt.core.formatter.insert_new_line_after_opening_brace_in_array_initializer=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_at_end_of_file_if_missing=do not insert
org.eclipse.jdt.core.formatter.insert_new_line_before_catch_in_try_statement=do not insert
diff --git a/bundles/org.eclipse.equinox.p2.ui/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.ui/META-INF/MANIFEST.MF
index 8fec353bc..cf41929b8 100644
--- a/bundles/org.eclipse.equinox.p2.ui/META-INF/MANIFEST.MF
+++ b/bundles/org.eclipse.equinox.p2.ui/META-INF/MANIFEST.MF
@@ -4,75 +4,50 @@ Bundle-Name: %bundleName
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-SymbolicName: org.eclipse.equinox.p2.ui;singleton:=true
-Bundle-Version: 1.1.0.qualifier
+Bundle-Version: 2.0.0.qualifier
Bundle-Activator: org.eclipse.equinox.internal.p2.ui.ProvUIActivator
Import-Package: com.ibm.icu.text,
+ javax.xml.parsers,
+ org.eclipse.equinox.internal.p2.artifact.repository,
org.eclipse.equinox.internal.p2.core.helpers,
org.eclipse.equinox.internal.p2.metadata,
+ org.eclipse.equinox.internal.p2.metadata.query,
org.eclipse.equinox.internal.p2.metadata.repository,
+ org.eclipse.equinox.internal.p2.query,
org.eclipse.equinox.internal.p2.repository.helpers,
org.eclipse.equinox.internal.p2.rollback,
org.eclipse.equinox.internal.provisional.configurator,
- org.eclipse.equinox.internal.provisional.p2.artifact.repository,
org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing,
org.eclipse.equinox.internal.provisional.p2.core,
org.eclipse.equinox.internal.provisional.p2.core.eventbus,
- org.eclipse.equinox.internal.provisional.p2.repository,
org.eclipse.equinox.internal.provisional.p2.director,
- org.eclipse.equinox.internal.provisional.p2.engine,
- org.eclipse.equinox.internal.provisional.p2.engine.phases,
org.eclipse.equinox.internal.provisional.p2.metadata,
- org.eclipse.equinox.internal.provisional.p2.metadata.query,
- org.eclipse.equinox.internal.provisional.p2.metadata.repository,
- org.eclipse.equinox.internal.provisional.spi.p2.repository,
+ org.eclipse.equinox.internal.provisional.p2.repository,
+ org.eclipse.equinox.p2.core,
+ org.eclipse.equinox.p2.engine,
+ org.eclipse.equinox.p2.engine.query,
+ org.eclipse.equinox.p2.metadata,
+ org.eclipse.equinox.p2.metadata.expression,
+ org.eclipse.equinox.p2.metadata.query,
+ org.eclipse.equinox.p2.operations,
+ org.eclipse.equinox.p2.query,
+ org.eclipse.equinox.p2.repository,
+ org.eclipse.equinox.p2.repository.artifact,
+ org.eclipse.equinox.p2.repository.metadata,
+ org.eclipse.equinox.p2.repository.spi,
org.eclipse.osgi.service.resolver;version="1.1.0",
org.eclipse.osgi.util;version="1.1.0",
org.osgi.framework;version="1.3.0",
org.osgi.service.packageadmin;version="1.2.0",
- javax.xml.parsers,
org.w3c.dom,
org.xml.sax
-Export-Package: org.eclipse.equinox.internal.p2.ui;x-internal:=true,
- org.eclipse.equinox.internal.p2.ui.dialogs;x-internal:=true,
- org.eclipse.equinox.internal.p2.ui.model;x-internal:=true,
- org.eclipse.equinox.internal.p2.ui.query;x-internal:=true,
- org.eclipse.equinox.internal.p2.ui.viewers;x-internal:=true,
- org.eclipse.equinox.internal.provisional.p2.ui;
- x-friends:="org.eclipse.equinox.p2.ui.admin,
- org.eclipse.equinox.p2.ui.admin.rcp,
- org.eclipse.equinox.p2.ui.sdk,
- org.eclipse.equinox.p2.ui.sdk.scheduler,
- org.eclipse.pde.ui",
- org.eclipse.equinox.internal.provisional.p2.ui.actions;
- x-friends:="org.eclipse.equinox.p2.ui.admin,
- org.eclipse.equinox.p2.ui.admin.rcp,
- org.eclipse.equinox.p2.ui.sdk,
- org.eclipse.equinox.p2.ui.sdk.scheduler,
- org.eclipse.pde.ui",
- org.eclipse.equinox.internal.provisional.p2.ui.dialogs;
- x-friends:="org.eclipse.equinox.p2.ui.admin,
- org.eclipse.equinox.p2.ui.admin.rcp,
- org.eclipse.equinox.p2.ui.sdk,
- org.eclipse.equinox.p2.ui.sdk.scheduler,
- org.eclipse.pde.ui",
- org.eclipse.equinox.internal.provisional.p2.ui.model;
- x-friends:="org.eclipse.equinox.p2.ui.admin,
- org.eclipse.equinox.p2.ui.admin.rcp,
- org.eclipse.equinox.p2.ui.sdk,
- org.eclipse.equinox.p2.ui.sdk.scheduler",
- org.eclipse.equinox.internal.provisional.p2.ui.operations;
- x-friends:="org.eclipse.equinox.p2.ui.admin,
- org.eclipse.equinox.p2.ui.admin.rcp,
- org.eclipse.equinox.p2.ui.sdk,
- org.eclipse.equinox.p2.ui.sdk.scheduler,
- org.eclipse.pde.ui",
- org.eclipse.equinox.internal.provisional.p2.ui.policy;
- x-friends:="org.eclipse.equinox.p2.ui.admin,
- org.eclipse.equinox.p2.ui.admin.rcp,
- org.eclipse.equinox.p2.ui.sdk,
- org.eclipse.equinox.p2.ui.sdk.scheduler,
- org.eclipse.pde.ui",
- org.eclipse.equinox.internal.provisional.p2.ui.viewers;x-friends:="org.eclipse.equinox.p2.ui.admin,org.eclipse.equinox.p2.ui.admin.rcp,org.eclipse.equinox.p2.ui.sdk"
+Export-Package: org.eclipse.equinox.internal.p2.ui;x-friends:="org.eclipse.equinox.p2.ui.admin,org.eclipse.pde.ui",
+ org.eclipse.equinox.internal.p2.ui.actions;x-friends:="org.eclipse.equinox.p2.ui.admin, org.eclipse.equinox.p2.ui.sdk.scheduler",
+ org.eclipse.equinox.internal.p2.ui.dialogs;x-friends:="org.eclipse.equinox.p2.ui.admin, org.eclipse.equinox.p2.ui.sdk.scheduler, org.eclipse.pde.ui",
+ org.eclipse.equinox.internal.p2.ui.model;x-friends:="org.eclipse.equinox.p2.ui.admin, org.eclipse.equinox.p2.ui.sdk.scheduler, org.eclipse.equinox.internal.p2.ui.analysis",
+ org.eclipse.equinox.internal.p2.ui.query;x-friends:="org.eclipse.equinox.p2.ui.admin, org.eclipse.equinox.internal.p2.ui.analysis",
+ org.eclipse.equinox.internal.p2.ui.viewers;x-friends:="org.eclipse.equinox.p2.ui.admin, org.eclipse.equinox.p2.ui.sdk.scheduler",
+ org.eclipse.equinox.p2.ui
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.core.expressions,
@@ -81,5 +56,8 @@ Require-Bundle: org.eclipse.ui,
org.eclipse.equinox.security.ui;bundle-version="[1.0.0,2.0.0)",
org.eclipse.compare
Bundle-ActivationPolicy: lazy
-Bundle-RequiredExecutionEnvironment: J2SE-1.4,
+Bundle-RequiredExecutionEnvironment: J2SE-1.5,
+ J2SE-1.4,
CDC-1.1/Foundation-1.1
+Service-Component: OSGI-INF/serviceui_component.xml, OSGI-INF/repositoryTracker_component.xml
+
diff --git a/bundles/org.eclipse.equinox.p2.ui/OSGI-INF/repositoryTracker_component.xml b/bundles/org.eclipse.equinox.p2.ui/OSGI-INF/repositoryTracker_component.xml
new file mode 100644
index 000000000..f4c2c7386
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/OSGI-INF/repositoryTracker_component.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.equinox.p2.ui.repositoryTracker">
+ <implementation class="org.eclipse.equinox.internal.p2.ui.ColocatedRepositoryTracker"/>
+ <service>
+ <provide interface="org.eclipse.equinox.p2.operations.RepositoryTracker"/>
+ </service>
+</scr:component>
diff --git a/bundles/org.eclipse.equinox.p2.ui/OSGI-INF/serviceui_component.xml b/bundles/org.eclipse.equinox.p2.ui/OSGI-INF/serviceui_component.xml
new file mode 100644
index 000000000..96a25d3dd
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/OSGI-INF/serviceui_component.xml
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.eclipse.equinox.p2.ui.serviceui">
+ <implementation class="org.eclipse.equinox.internal.p2.ui.ValidationDialogServiceUI"/>
+ <service>
+ <provide interface="org.eclipse.equinox.internal.provisional.p2.core.IServiceUI"/>
+ </service>
+</scr:component>
diff --git a/bundles/org.eclipse.equinox.p2.ui/build.properties b/bundles/org.eclipse.equinox.p2.ui/build.properties
index 137776701..8e36e3064 100644
--- a/bundles/org.eclipse.equinox.p2.ui/build.properties
+++ b/bundles/org.eclipse.equinox.p2.ui/build.properties
@@ -13,6 +13,9 @@ bin.includes = plugin.properties,\
.,\
about.html,\
META-INF/,\
- plugin.xml
-src.includes = about.html
+ plugin.xml,\
+ OSGI-INF/
+ssrc.includes = about.html
source.. = src/
+javacTarget=jsr14
+javacSource=1.5
diff --git a/bundles/org.eclipse.equinox.p2.ui/icons/tool/close.gif b/bundles/org.eclipse.equinox.p2.ui/icons/tool/close.gif
deleted file mode 100644
index 1aca259db..000000000
--- a/bundles/org.eclipse.equinox.p2.ui/icons/tool/close.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.ui/icons/tool/close_hot.gif b/bundles/org.eclipse.equinox.p2.ui/icons/tool/close_hot.gif
deleted file mode 100644
index d5360165c..000000000
--- a/bundles/org.eclipse.equinox.p2.ui/icons/tool/close_hot.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.ui/icons/tool/update.gif b/bundles/org.eclipse.equinox.p2.ui/icons/tool/update.gif
deleted file mode 100644
index aa84ebeaa..000000000
--- a/bundles/org.eclipse.equinox.p2.ui/icons/tool/update.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.ui/icons/tool/update_problems.gif b/bundles/org.eclipse.equinox.p2.ui/icons/tool/update_problems.gif
deleted file mode 100644
index c0cfaca34..000000000
--- a/bundles/org.eclipse.equinox.p2.ui/icons/tool/update_problems.gif
+++ /dev/null
Binary files differ
diff --git a/bundles/org.eclipse.equinox.p2.ui/plugin.xml b/bundles/org.eclipse.equinox.p2.ui/plugin.xml
index f2d82005f..6f6031e2e 100644
--- a/bundles/org.eclipse.equinox.p2.ui/plugin.xml
+++ b/bundles/org.eclipse.equinox.p2.ui/plugin.xml
@@ -6,12 +6,45 @@
<factory
adaptableType="org.eclipse.equinox.internal.p2.ui.model.ProvElement"
class="org.eclipse.equinox.internal.p2.ui.ProvUIAdapterFactory">
- <adapter type="org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit"/>
- <adapter type="org.eclipse.equinox.internal.provisional.p2.engine.IProfile"/>
- <adapter type="org.eclipse.equinox.internal.provisional.p2.repository.IRepository"/>
- <adapter type="org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository"/>
- <adapter type="org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository"/>
+ <adapter type="org.eclipse.equinox.p2.metadata.IInstallableUnit"/>
+ <adapter type="org.eclipse.equinox.p2.engine.IProfile"/>
+ <adapter type="org.eclipse.equinox.p2.repository.IRepository"/>
+ <adapter type="org.eclipse.equinox.p2.repository.metadata.IMetadataRepository"/>
+ <adapter type="org.eclipse.equinox.p2.repository.artifact.IArtifactRepository"/>
</factory>
-
</extension>
-</plugin>
+
+ <extension
+ point="org.eclipse.ui.propertyPages">
+ <page
+ name="%IU.copyright"
+ class="org.eclipse.equinox.internal.p2.ui.dialogs.IUCopyrightPropertyPage"
+ id="org.eclipse.equinox.p2.ui.IUCopyrightPropertyPage">
+ <enabledWhen>
+ <adapt
+ type="org.eclipse.equinox.p2.metadata.IInstallableUnit">
+ </adapt>
+ </enabledWhen>
+ </page>
+ <page
+ name="%IU.general"
+ class="org.eclipse.equinox.internal.p2.ui.dialogs.IUGeneralInfoPropertyPage"
+ id="org.eclipse.equinox.p2.ui.IUGeneralInfoPropertyPage">
+ <enabledWhen>
+ <adapt
+ type="org.eclipse.equinox.p2.metadata.IInstallableUnit">
+ </adapt>
+ </enabledWhen>
+ </page>
+ <page
+ name="%IU.license"
+ class="org.eclipse.equinox.internal.p2.ui.dialogs.IULicensePropertyPage"
+ id="org.eclipse.equinox.p2.ui.IULicensePropertyPage">
+ <enabledWhen>
+ <adapt
+ type="org.eclipse.equinox.p2.metadata.IInstallableUnit">
+ </adapt>
+ </enabledWhen>
+ </page>
+ </extension>
+ </plugin>
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/BatchChangeCompleteEvent.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/BatchChangeCompleteEvent.java
deleted file mode 100644
index 33b743842..000000000
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/BatchChangeCompleteEvent.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.equinox.internal.p2.ui;
-
-import java.util.EventObject;
-
-/**
- * Internal UI event used to signify that a batch change in which
- * we were ignoring listeners is done.
- *
- * @since 3.4
- */
-public class BatchChangeCompleteEvent extends EventObject {
-
- private static final long serialVersionUID = -4513769756968621852L;
-
- /**
- * When the batch event is received, do we treat it as notification
- * or ignore it?
- */
- public boolean notify;
-
- /**
- * Construct a new instance of this event.
- * @param source the source of the event
- */
- public BatchChangeCompleteEvent(Object source, boolean notify) {
- super(source);
- this.notify = notify;
- }
-
-}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ColocatedRepositoryTracker.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ColocatedRepositoryTracker.java
new file mode 100644
index 000000000..20336906d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ColocatedRepositoryTracker.java
@@ -0,0 +1,167 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.ui;
+
+import org.eclipse.equinox.p2.core.ProvisionException;
+
+import java.net.URI;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.p2.ui.dialogs.RepositoryNameAndLocationDialog;
+import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent;
+import org.eclipse.equinox.p2.operations.ProvisioningSession;
+import org.eclipse.equinox.p2.operations.RepositoryTracker;
+import org.eclipse.equinox.p2.repository.IRepository;
+import org.eclipse.equinox.p2.repository.IRepositoryManager;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.jface.window.Window;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.statushandlers.StatusManager;
+
+/**
+ * Provides a repository tracker that interprets URLs as colocated
+ * artifact and metadata repositories.
+ *
+ * @since 2.0
+ */
+
+public class ColocatedRepositoryTracker extends RepositoryTracker {
+
+ ProvisioningUI ui;
+
+ public ColocatedRepositoryTracker() {
+ this(ProvisioningUI.getDefaultUI());
+ }
+
+ public ColocatedRepositoryTracker(ProvisioningUI ui) {
+ this.ui = ui;
+ setArtifactRepositoryFlags(IRepositoryManager.REPOSITORIES_NON_SYSTEM);
+ setMetadataRepositoryFlags(IRepositoryManager.REPOSITORIES_NON_SYSTEM);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.equinox.internal.provisional.p2.ui.policy.RepositoryManipulator#getKnownRepositories()
+ */
+ public URI[] getKnownRepositories(ProvisioningSession session) {
+ return session.getMetadataRepositoryManager().getKnownRepositories(getMetadataRepositoryFlags());
+ }
+
+ protected IStatus validateRepositoryLocationWithManager(ProvisioningSession session, URI location, IProgressMonitor monitor) {
+ return session.getMetadataRepositoryManager().validateRepositoryLocation(location, monitor);
+ }
+
+ public void addRepository(URI repoLocation, String nickname, ProvisioningSession session) {
+ ui.signalRepositoryOperationStart();
+ try {
+ session.getMetadataRepositoryManager().addRepository(repoLocation);
+ session.getArtifactRepositoryManager().addRepository(repoLocation);
+ if (nickname != null) {
+ session.getMetadataRepositoryManager().setRepositoryProperty(repoLocation, IRepository.PROP_NICKNAME, nickname);
+ session.getArtifactRepositoryManager().setRepositoryProperty(repoLocation, IRepository.PROP_NICKNAME, nickname);
+
+ }
+ } finally {
+ // We know that the UI only responds to metadata repo events so we cheat...
+ ui.signalRepositoryOperationComplete(new RepositoryEvent(repoLocation, IRepository.TYPE_METADATA, RepositoryEvent.ADDED, true), true);
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.p2.operations.RepositoryTracker#removeRepositories(java.net.URI[], org.eclipse.equinox.p2.operations.ProvisioningSession)
+ */
+ public void removeRepositories(URI[] repoLocations, ProvisioningSession session) {
+ ui.signalRepositoryOperationStart();
+ try {
+ for (int i = 0; i < repoLocations.length; i++) {
+ session.getMetadataRepositoryManager().removeRepository(repoLocations[i]);
+ session.getArtifactRepositoryManager().removeRepository(repoLocations[i]);
+ }
+ } finally {
+ ui.signalRepositoryOperationComplete(null, true);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.equinox.p2.operations.RepositoryTracker#refreshRepositories(java.net.URI[], org.eclipse.equinox.p2.operations.ProvisioningSession, org.eclipse.core.runtime.IProgressMonitor)
+ */
+ public void refreshRepositories(URI[] locations, ProvisioningSession session, IProgressMonitor monitor) {
+ ui.signalRepositoryOperationStart();
+ SubMonitor mon = SubMonitor.convert(monitor, locations.length * 100);
+ for (int i = 0; i < locations.length; i++) {
+ try {
+ session.getArtifactRepositoryManager().refreshRepository(locations[i], mon.newChild(50));
+ session.getMetadataRepositoryManager().refreshRepository(locations[i], mon.newChild(50));
+ } catch (ProvisionException e) {
+ //ignore problematic repositories when refreshing
+ }
+ }
+ // We have no idea how many repos may have been added/removed as a result of
+ // refreshing these, this one, so we do not use a specific repository event to represent it.
+ ui.signalRepositoryOperationComplete(null, true);
+ }
+
+ public void reportLoadFailure(final URI location, ProvisionException e) {
+ int code = e.getStatus().getCode();
+ // If the user doesn't have a way to manage repositories, then don't report failures.
+ if (!ui.getPolicy().getRepositoriesVisible()) {
+ super.reportLoadFailure(location, e);
+ return;
+ }
+
+ // Special handling when the location is bad (not found, etc.) vs. a failure
+ // associated with a known repo.
+ if (code == ProvisionException.REPOSITORY_NOT_FOUND || code == ProvisionException.REPOSITORY_INVALID_LOCATION) {
+ if (!hasNotFoundStatusBeenReported(location)) {
+ addNotFound(location);
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ IWorkbench workbench = PlatformUI.getWorkbench();
+ if (workbench.isClosing())
+ return;
+ Shell shell = ProvUI.getDefaultParentShell();
+ if (MessageDialog.openQuestion(shell, ProvUIMessages.ColocatedRepositoryTracker_SiteNotFoundTitle, NLS.bind(ProvUIMessages.ColocatedRepositoryTracker_PromptForSiteLocationEdit, URIUtil.toUnencodedString(location)))) {
+ RepositoryNameAndLocationDialog dialog = new RepositoryNameAndLocationDialog(shell, ui) {
+ protected String getInitialLocationText() {
+ return URIUtil.toUnencodedString(location);
+ }
+
+ protected String getInitialNameText() {
+ String nickname = ui.getSession().getMetadataRepositoryManager().getRepositoryProperty(location, IRepository.PROP_NICKNAME);
+ return nickname == null ? "" : nickname; //$NON-NLS-1$
+ }
+ };
+ int ret = dialog.open();
+ if (ret == Window.OK) {
+ URI correctedLocation = dialog.getLocation();
+ if (correctedLocation != null) {
+ ui.signalRepositoryOperationStart();
+ try {
+ removeRepositories(new URI[] {location}, ui.getSession());
+ addRepository(correctedLocation, dialog.getName(), ui.getSession());
+ } finally {
+ ui.signalRepositoryOperationComplete(null, true);
+ }
+ }
+ }
+ }
+ }
+ });
+ }
+ } else {
+ ProvUI.handleException(e, null, StatusManager.SHOW | StatusManager.LOG);
+ }
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/DefaultMetadataURLValidator.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/DefaultMetadataURLValidator.java
deleted file mode 100644
index d56c696bb..000000000
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/DefaultMetadataURLValidator.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.equinox.internal.p2.ui;
-
-import java.io.File;
-import java.net.URI;
-import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.p2.repository.helpers.RepositoryHelper;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.RepositoryLocationValidator;
-
-/**
- * @since 3.4
- *
- */
-public class DefaultMetadataURLValidator extends RepositoryLocationValidator {
-
- protected int repoFlag;
-
- public DefaultMetadataURLValidator() {
- repoFlag = IRepositoryManager.REPOSITORIES_ALL;
- }
-
- public void setKnownRepositoriesFlag(int flag) {
- repoFlag = flag;
- }
-
- protected URI[] getKnownLocations() {
- URI[] knownRepositories;
- try {
- knownRepositories = ProvisioningUtil.getMetadataRepositories(repoFlag);
- } catch (ProvisionException e) {
- knownRepositories = new URI[0];
- }
- return knownRepositories;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.p2.ui.dialogs.URLValidator#validateRepositoryURL(boolean)
- */
- public IStatus validateRepositoryLocation(URI location, boolean contactRepositories, IProgressMonitor monitor) {
-
- // First validate syntax issues
- IStatus localValidationStatus = RepositoryHelper.checkRepositoryLocationSyntax(location);
- if (!localValidationStatus.isOK()) {
- // bad syntax, but it could just be non-absolute.
- // In this case, use the helper
- String locationString = URIUtil.toUnencodedString(location);
- if (locationString.length() > 0 && (locationString.charAt(0) == '/' || locationString.charAt(0) == File.separatorChar)) {
- location = RepositoryHelper.localRepoURIHelper(location);
- localValidationStatus = RepositoryHelper.checkRepositoryLocationSyntax(location);
- }
- }
-
- if (!localValidationStatus.isOK())
- return localValidationStatus;
-
- // Syntax was ok, now look for duplicates
- URI[] knownRepositories = getKnownLocations();
- for (int i = 0; i < knownRepositories.length; i++) {
- if (knownRepositories[i].equals(location)) {
- localValidationStatus = new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, LOCAL_VALIDATION_ERROR, ProvUIMessages.AddRepositoryDialog_DuplicateURL, null);
- break;
- }
- }
- if (!localValidationStatus.isOK())
- return localValidationStatus;
-
- if (contactRepositories)
- return ProvisioningUtil.validateMetadataRepositoryLocation(location, monitor);
-
- return localValidationStatus;
- }
-}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/DefaultQueryProvider.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/DefaultQueryProvider.java
deleted file mode 100644
index d16e995f3..000000000
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/DefaultQueryProvider.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * EclipseSource - ongoing development
- *******************************************************************************/
-package org.eclipse.equinox.internal.p2.ui;
-
-import java.net.URI;
-import org.eclipse.equinox.internal.p2.ui.model.*;
-import org.eclipse.equinox.internal.p2.ui.query.*;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
-import org.eclipse.equinox.internal.provisional.p2.engine.IUProfilePropertyQuery;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.*;
-import org.eclipse.equinox.internal.provisional.p2.ui.*;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.MetadataRepositories;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.Updates;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.*;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.ui.statushandlers.StatusManager;
-
-/**
- * Provides a default set of queries to drive the provisioning UI.
- *
- * @since 3.5
- */
-
-public class DefaultQueryProvider extends QueryProvider {
-
- private Policy policy;
-
- private Query allQuery = new MatchQuery() {
- public boolean isMatch(Object candidate) {
- return true;
- }
- };
-
- public DefaultQueryProvider(Policy policy) {
- this.policy = policy;
- }
-
- public ElementQueryDescriptor getQueryDescriptor(final QueriedElement element) {
- // Initialize queryable, queryContext, and queryType from the element.
- // In some cases we override this.
- IQueryable queryable = element.getQueryable();
- int queryType = element.getQueryType();
- IUViewQueryContext context = element.getQueryContext();
- if (context == null) {
- context = policy.getQueryContext();
- }
- switch (queryType) {
- case QueryProvider.ARTIFACT_REPOS :
- queryable = new QueryableArtifactRepositoryManager(context, false);
- return new ElementQueryDescriptor(queryable, new RepositoryLocationQuery(), new Collector() {
- public boolean accept(Object object) {
- if (object instanceof URI)
- return super.accept(new ArtifactRepositoryElement(element, (URI) object));
- return true;
- }
- });
-
- case QueryProvider.AVAILABLE_IUS :
- // Things get more complicated if the user wants to filter out installed items.
- // This involves setting up a secondary query for installed content that the various
- // collectors will use to reject content. We can't use a compound query because the
- // queryables are different (profile for installed content, repo for available content)
- AvailableIUWrapper availableIUWrapper;
- boolean showLatest = context.getShowLatestVersionsOnly();
- boolean hideInstalled = context.getHideAlreadyInstalled();
- IProfile targetProfile = null;
- String profileId = context.getInstalledProfileId();
- if (profileId != null) {
- try {
- targetProfile = ProvisioningUtil.getProfile(profileId);
- } catch (ProvisionException e) {
- // just bail out, we won't try to query the installed
- }
- }
-
- Query topLevelQuery = new IUPropertyQuery(context.getVisibleAvailableIUProperty(), Boolean.TRUE.toString());
- Query categoryQuery = new IUPropertyQuery(IInstallableUnit.PROP_TYPE_CATEGORY, Boolean.toString(true));
-
- // Showing child IU's of a group of repositories, or of a single repository
- if (element instanceof MetadataRepositories || element instanceof MetadataRepositoryElement) {
- if (context.getViewType() == IUViewQueryContext.AVAILABLE_VIEW_FLAT || !context.getUseCategories()) {
- AvailableIUWrapper wrapper = new AvailableIUWrapper(queryable, element, false, context.getShowAvailableChildren());
- if (showLatest)
- topLevelQuery = new CompositeQuery(new Query[] {topLevelQuery, new LatestIUVersionQuery()});
- if (targetProfile != null)
- wrapper.markInstalledIUs(targetProfile, hideInstalled);
- return new ElementQueryDescriptor(queryable, topLevelQuery, new Collector(), wrapper);
- }
- // Installed content not a concern for collecting categories
- return new ElementQueryDescriptor(queryable, categoryQuery, new Collector(), new CategoryElementWrapper(queryable, element));
- }
-
- // If it's a category or some other IUElement to drill down in, we get the requirements and show all requirements
- // that are also visible in the available list.
- if (element instanceof CategoryElement || (element instanceof IIUElement && ((IIUElement) element).shouldShowChildren())) {
- // children of a category should drill down according to the context. If we aren't in a category, we are already drilling down and
- // continue to do so.
- boolean drillDown = element instanceof CategoryElement ? context.getShowAvailableChildren() : true;
- Query meetsAnyRequirementQuery = new AnyRequiredCapabilityQuery(((IIUElement) element).getRequirements());
- availableIUWrapper = new AvailableIUWrapper(queryable, element, true, drillDown);
- if (targetProfile != null)
- availableIUWrapper.markInstalledIUs(targetProfile, hideInstalled);
- // if it's a category, the metadata was specifically set up so that the requirements are the IU's that should
- // be visible in the category.
- if (element instanceof CategoryElement) {
- if (showLatest)
- meetsAnyRequirementQuery = new CompositeQuery(new Query[] {meetsAnyRequirementQuery, new LatestIUVersionQuery()});
- return new ElementQueryDescriptor(queryable, meetsAnyRequirementQuery, new Collector(), availableIUWrapper);
- }
- Query query = CompoundQuery.createCompoundQuery(new Query[] {topLevelQuery, meetsAnyRequirementQuery}, true);
- if (showLatest)
- query = new CompositeQuery(new Query[] {query, new LatestIUVersionQuery()});
- // If it's not a category, these are generic requirements and should be filtered by the visibility property (topLevelQuery)
- return new ElementQueryDescriptor(queryable, query, new Collector(), availableIUWrapper);
- }
- return null;
-
- case QueryProvider.AVAILABLE_UPDATES :
- // This query can be used by the automatic updater in headless cases (checking for updates).
- // We traffic in IU's rather than wrapped elements
- IProfile profile;
- IInstallableUnit[] toUpdate = null;
- if (element instanceof Updates) {
- try {
- profile = ProvisioningUtil.getProfile(((Updates) element).getProfileId());
- } catch (ProvisionException e) {
- ProvUI.handleException(e, NLS.bind(ProvUIMessages.DefaultQueryProvider_ErrorRetrievingProfile, ((Updates) element).getProfileId()), StatusManager.LOG);
- return null;
- }
- toUpdate = ((Updates) element).getIUs();
- } else {
- profile = (IProfile) ProvUI.getAdapter(element, IProfile.class);
- }
- if (profile == null)
- return null;
- if (toUpdate == null) {
- Collector collector = profile.query(new IUProfilePropertyQuery(context.getVisibleInstalledIUProperty(), Boolean.toString(true)), new Collector(), null);
- toUpdate = (IInstallableUnit[]) collector.toArray(IInstallableUnit.class);
- }
- QueryableUpdates updateQueryable = new QueryableUpdates(toUpdate);
- return new ElementQueryDescriptor(updateQueryable, context.getShowLatestVersionsOnly() ? new LatestIUVersionQuery() : allQuery, new Collector());
-
- case QueryProvider.INSTALLED_IUS :
- // Querying of IU's. We are drilling down into the requirements.
- if (element instanceof IIUElement && context.getShowInstallChildren()) {
- Query meetsAnyRequirementQuery = new AnyRequiredCapabilityQuery(((IIUElement) element).getRequirements());
- Query visibleAsAvailableQuery = new IUPropertyQuery(context.getVisibleAvailableIUProperty(), Boolean.TRUE.toString());
- return new ElementQueryDescriptor(queryable, CompoundQuery.createCompoundQuery(new Query[] {visibleAsAvailableQuery, meetsAnyRequirementQuery}, true), new Collector(), new InstalledIUElementWrapper(queryable, element));
- }
- profile = (IProfile) ProvUI.getAdapter(element, IProfile.class);
- if (profile == null)
- return null;
- return new ElementQueryDescriptor(profile, new IUProfilePropertyQuery(context.getVisibleInstalledIUProperty(), Boolean.toString(true)), new Collector(), new InstalledIUElementWrapper(profile, element));
-
- case QueryProvider.METADATA_REPOS :
- if (element instanceof MetadataRepositories) {
- if (queryable == null) {
- queryable = new QueryableMetadataRepositoryManager(context, ((MetadataRepositories) element).getIncludeDisabledRepositories());
- element.setQueryable(queryable);
- }
- return new ElementQueryDescriptor(element.getQueryable(), new RepositoryLocationQuery(), new Collector(), new MetadataRepositoryElementWrapper(element.getQueryable(), element));
- }
- return null;
-
- case QueryProvider.PROFILES :
- queryable = new QueryableProfileRegistry();
- return new ElementQueryDescriptor(queryable, new MatchQuery() {
- public boolean isMatch(Object candidate) {
- return ProvUI.getAdapter(candidate, IProfile.class) != null;
- }
- }, new Collector(), new ProfileElementWrapper(null, element));
-
- default :
- return null;
- }
- }
-}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/ElementQueryDescriptor.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ElementQueryDescriptor.java
index 35d713506..bed3a86cd 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/ElementQueryDescriptor.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ElementQueryDescriptor.java
@@ -9,11 +9,11 @@
* IBM Corporation - initial API and implementation
* EclipseSource - ongoing development
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui;
+package org.eclipse.equinox.internal.p2.ui;
import java.util.Collection;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.*;
+import org.eclipse.equinox.p2.query.*;
/**
* ElementQueryDescriptor represents everything needed to run a query, including
@@ -24,16 +24,16 @@ import org.eclipse.equinox.internal.provisional.p2.metadata.query.*;
*/
public class ElementQueryDescriptor {
- private Query query;
- private Collector collector;
- private IQueryable queryable;
+ private IQuery<Object> query;
+ private Collector<Object> collector;
+ private IQueryable<Object> queryable;
private ElementWrapper wrapper;
/**
* Creates an ElementQueryDescriptor to represent a Query, its collector the queryable
* on which it will run.
*/
- public ElementQueryDescriptor(IQueryable queryable, Query query, Collector collector) {
+ public ElementQueryDescriptor(IQueryable<?> queryable, IQuery<?> query, Collector<?> collector) {
this(queryable, query, collector, null);
}
@@ -41,10 +41,11 @@ public class ElementQueryDescriptor {
* Creates an ElementQueryDescriptor to represent a Query, its collector the queryable
* on which it will run, and the transformer used to transform the results.
*/
- public ElementQueryDescriptor(IQueryable queryable, Query query, Collector collector, ElementWrapper wrapper) {
- this.query = query;
- this.collector = collector;
- this.queryable = queryable;
+ @SuppressWarnings("unchecked")
+ public ElementQueryDescriptor(IQueryable<?> queryable, IQuery<?> query, Collector<?> collector, ElementWrapper wrapper) {
+ this.query = (IQuery<Object>) query;
+ this.collector = (Collector<Object>) collector;
+ this.queryable = (IQueryable<Object>) queryable;
this.wrapper = wrapper;
}
@@ -52,18 +53,18 @@ public class ElementQueryDescriptor {
* Performs the query returning a collection of results.
* @param monitor
*/
- public Collection performQuery(IProgressMonitor monitor) {
- Collector results = this.collector;
+ public Collection<?> performQuery(IProgressMonitor monitor) {
+ Collector<Object> results = this.collector;
// If the query is completely described, perform it
if (query != null && collector != null && queryable != null)
- results = this.queryable.query(this.query, this.collector, monitor);
+ results.addAll(this.queryable.query(this.query, monitor));
else if (results == null)
- results = new Collector();
+ results = new Collector<Object>();
// Let the wrapper analyze the results, even if we didn't perform the query.
// This allows the wrapper to modify the results with explanations.
if (wrapper != null)
return wrapper.getElements(results);
- return results.toCollection();
+ return results.unmodifiableSet();
}
public boolean hasCollector() {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/ElementWrapper.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ElementWrapper.java
index 57c1d223d..df4ebf7ca 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/ElementWrapper.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ElementWrapper.java
@@ -8,25 +8,26 @@
* EclipseSource - initial API and implementation
* IBM Corporation - ongoing development
******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui;
+package org.eclipse.equinox.internal.p2.ui;
import java.util.*;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.Collector;
+import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
+import org.eclipse.equinox.p2.query.Collector;
/**
* Wraps query results inside corresponding UI elements
*/
public abstract class ElementWrapper {
- private Collection collection = null;
+ private Collection<Object> collection = null;
/**
* Transforms a collector returned by a query to a collection
* of UI elements
*/
- public Collection getElements(Collector collector) {
- collection = new ArrayList(collector.size());
- Iterator iter = collector.iterator();
+ public Collection<?> getElements(Collector<?> collector) {
+ collection = new ArrayList<Object>(collector.size());
+ Iterator<?> iter = collector.iterator();
while (iter.hasNext()) {
Object o = iter.next();
if (shouldWrap(o))
@@ -38,8 +39,8 @@ public abstract class ElementWrapper {
/**
* Gets the collection where the elements are being stored.
*/
- protected Collection getCollection() {
- return collection == null ? Collections.EMPTY_LIST : collection;
+ protected Collection<?> getCollection() {
+ return collection == null ? CollectionUtils.emptyList() : collection;
}
/**
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/IProvHelpContextIds.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/IProvHelpContextIds.java
index 3e138d402..4a11ad1e3 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/IProvHelpContextIds.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/IProvHelpContextIds.java
@@ -8,9 +8,8 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui;
+package org.eclipse.equinox.internal.p2.ui;
-import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
/**
* Help context ids for the P2 UI
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/PlanAnalyzer.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/PlanAnalyzer.java
deleted file mode 100644
index a4fed80a4..000000000
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/PlanAnalyzer.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.equinox.internal.p2.ui;
-
-import java.util.Iterator;
-import java.util.Map;
-import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.provisional.p2.director.*;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.ui.*;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.ui.PlatformUI;
-
-/**
- * This class analyzes a profile change request and the resultant provisioning plan,
- * and reports problems in a way that can be communicated to a user.
- *
- * @since 3.5
- */
-public class PlanAnalyzer {
-
- public static IStatus getStatus(int statusCode, IInstallableUnit affectedIU) {
- switch (statusCode) {
- case IStatusCodes.PROFILE_CHANGE_ALTERED :
- return new MultiStatus(ProvUIActivator.PLUGIN_ID, statusCode, ProvUIMessages.PlanStatusHelper_RequestAltered, null);
- case IStatusCodes.ALTERED_IMPLIED_UPDATE :
- return new Status(IStatus.INFO, ProvUIActivator.PLUGIN_ID, statusCode, NLS.bind(ProvUIMessages.PlanStatusHelper_ImpliedUpdate, getIUString(affectedIU)), null);
- case IStatusCodes.ALTERED_IGNORED_IMPLIED_UPDATE :
- return new Status(IStatus.WARNING, ProvUIActivator.PLUGIN_ID, statusCode, NLS.bind(ProvUIMessages.PlanAnalyzer_LockedImpliedUpdate0, getIUString(affectedIU)), null);
- case IStatusCodes.ALTERED_IGNORED_IMPLIED_DOWNGRADE :
- return new Status(IStatus.WARNING, ProvUIActivator.PLUGIN_ID, statusCode, NLS.bind(ProvUIMessages.PlanStatusHelper_IgnoringImpliedDowngrade, getIUString(affectedIU)), null);
- case IStatusCodes.ALTERED_IGNORED_ALREADY_INSTALLED :
- return new Status(IStatus.WARNING, ProvUIActivator.PLUGIN_ID, statusCode, NLS.bind(ProvUIMessages.PlanStatusHelper_AlreadyInstalled, getIUString(affectedIU)), null);
- case IStatusCodes.ALTERED_PARTIAL_INSTALL :
- return new Status(IStatus.INFO, ProvUIActivator.PLUGIN_ID, statusCode, NLS.bind(ProvUIMessages.PlanAnalyzer_PartialInstall, getIUString(affectedIU)), null);
- case IStatusCodes.ALTERED_PARTIAL_UNINSTALL :
- return new Status(IStatus.INFO, ProvUIActivator.PLUGIN_ID, statusCode, NLS.bind(ProvUIMessages.PlanAnalyzer_PartialUninstall, getIUString(affectedIU)), null);
- case IStatusCodes.UNEXPECTED_NOTHING_TO_DO :
- return new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, statusCode, NLS.bind(ProvUIMessages.PlanStatusHelper_NothingToDo, getIUString(affectedIU)), null);
- case IStatusCodes.NOTHING_TO_UPDATE :
- return new Status(IStatus.INFO, ProvUIActivator.PLUGIN_ID, statusCode, ProvUIMessages.UpdateOperation_NothingToUpdate, null);
- case IStatusCodes.OPERATION_ALREADY_IN_PROGRESS :
- return new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, statusCode, ProvUIMessages.PlanStatusHelper_AnotherOperationInProgress, null);
- default :
- return new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, statusCode, NLS.bind(ProvUIMessages.PlanStatusHelper_UnexpectedError, new Integer(statusCode), getIUString(affectedIU)), null);
- }
- }
-
- public static MultiStatus getProfileChangeAlteredStatus() {
- return (MultiStatus) getStatus(IStatusCodes.PROFILE_CHANGE_ALTERED, null);
- }
-
- public static ResolutionResult computeResolutionResult(ProfileChangeRequest originalRequest, ProvisioningPlan plan, MultiStatus originalStatus) {
- Assert.isNotNull(originalRequest);
- Assert.isNotNull(plan);
- Assert.isNotNull(originalStatus);
-
- ResolutionResult report = new ResolutionResult();
-
- // If the plan was canceled, no further analysis is needed
- if (plan.getStatus().getSeverity() == IStatus.CANCEL) {
- report.addSummaryStatus(plan.getStatus());
- return report;
- }
-
- // If the plan requires install handler support, we want to open the old update UI and
- // cancel this operation
- if (UpdateManagerCompatibility.requiresInstallHandlerSupport(plan)) {
- PlatformUI.getWorkbench().getDisplay().syncExec(new Runnable() {
- public void run() {
- Shell shell = ProvUI.getDefaultParentShell();
- MessageDialog dialog = new MessageDialog(shell, ProvUIMessages.PlanStatusHelper_UpdateManagerPromptTitle, null, ProvUIMessages.PlanStatusHelper_PromptForUpdateManagerUI, MessageDialog.WARNING, new String[] {ProvUIMessages.PlanStatusHelper_Launch, IDialogConstants.CANCEL_LABEL}, 0);
- if (dialog.open() == 0)
- BusyIndicator.showWhile(shell.getDisplay(), new Runnable() {
- public void run() {
- UpdateManagerCompatibility.openInstaller();
- }
- });
- }
- });
- report.addSummaryStatus(new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, ProvUIMessages.PlanStatusHelper_RequiresUpdateManager));
- }
-
- if (nothingToDo(originalRequest)) {
- report.addSummaryStatus(getStatus(IStatusCodes.UNEXPECTED_NOTHING_TO_DO, null));
- IStatus[] details = originalStatus.getChildren();
- for (int i = 0; i < details.length; i++)
- report.addSummaryStatus(details[i]);
- return report;
- }
-
- // If there was already some status supplied before resolution, this should get included
- // with the report. For example, this might contain information about the profile request
- // being altered before resolution began.
- if (originalStatus != null && originalStatus.getChildren().length > 0) {
- report.addSummaryStatus(originalStatus);
- }
-
- // If the overall plan had a non-OK status, capture that in the report.
- if (!plan.getStatus().isOK())
- report.addSummaryStatus(plan.getStatus());
-
- // Now we compare what was requested with what is going to happen.
- // In the long run, when a RequestStatus can provide actual explanation/status
- // about failures, we might want to add this information to the overall status.
- // As it stands now, if the provisioning plan is in error, that info is more detailed
- // than the request status. So we will only add request status info to the overall
- // status when the overall status is not in error.
- if (plan.getStatus().getSeverity() != IStatus.ERROR) {
- IInstallableUnit[] iusAdded = originalRequest.getAddedInstallableUnits();
- for (int i = 0; i < iusAdded.length; i++) {
- RequestStatus rs = plan.getRequestStatus(iusAdded[i]);
- if (rs.getSeverity() == IStatus.ERROR) {
- // This is a serious error so it must also appear in the overall status
- IStatus fail = new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, IStatusCodes.ALTERED_IGNORED_INSTALL_REQUEST, NLS.bind(ProvUIMessages.PlanAnalyzer_IgnoringInstall, getIUString(iusAdded[i])), null);
- report.addStatus(iusAdded[i], fail);
- report.addSummaryStatus(fail);
- }
- }
- IInstallableUnit[] iusRemoved = originalRequest.getRemovedInstallableUnits();
- for (int i = 0; i < iusRemoved.length; i++) {
- RequestStatus rs = plan.getRequestStatus(iusRemoved[i]);
- if (rs.getSeverity() == IStatus.ERROR) {
- // TODO see https://bugs.eclipse.org/bugs/show_bug.cgi?id=255984
- // We are making assumptions here about why the planner chose to ignore an uninstall.
- // Assume it could not be uninstalled because of some other dependency, yet the planner did not view
- // this as an error. So we inform the user that we can only uninstall parts of it. The root property will be
- // removed per the original change request.
- IStatus fail = new Status(IStatus.INFO, ProvUIActivator.PLUGIN_ID, IStatusCodes.ALTERED_PARTIAL_UNINSTALL, NLS.bind(ProvUIMessages.PlanAnalyzer_PartialUninstall, getIUString(iusRemoved[i])), null);
- report.addStatus(iusRemoved[i], fail);
- report.addSummaryStatus(fail);
- }
- }
- }
-
- // Now process the side effects
- Map sideEffects = plan.getSideEffectChanges();
- Iterator iusWithSideEffects = sideEffects.keySet().iterator();
- while (iusWithSideEffects.hasNext()) {
- IInstallableUnit iu = (IInstallableUnit) iusWithSideEffects.next();
- RequestStatus rs = (RequestStatus) sideEffects.get(iu);
- if (rs.getInitialRequestType() == RequestStatus.ADDED) {
- report.addStatus(iu, new Status(rs.getSeverity(), ProvUIActivator.PLUGIN_ID, IStatusCodes.ALTERED_SIDE_EFFECT_INSTALL, NLS.bind(ProvUIMessages.PlanAnalyzer_SideEffectInstall, getIUString(iu)), null));
- } else {
- report.addStatus(iu, new Status(rs.getSeverity(), ProvUIActivator.PLUGIN_ID, IStatusCodes.ALTERED_SIDE_EFFECT_REMOVE, NLS.bind(ProvUIMessages.PlanAnalyzer_SideEffectUninstall, getIUString(iu)), null));
- }
- }
-
- return report;
-
- }
-
- private static String getIUString(IInstallableUnit iu) {
- if (iu == null)
- return ProvUIMessages.PlanStatusHelper_Items;
- // Get the iu name in the default locale
- String name = IUPropertyUtils.getIUProperty(iu, IInstallableUnit.PROP_NAME);
- if (name != null)
- return name;
- return iu.getId();
- }
-
- private static boolean nothingToDo(ProfileChangeRequest request) {
- return request.getAddedInstallableUnits().length == 0 && request.getRemovedInstallableUnits().length == 0 && request.getInstallableUnitProfilePropertiesToAdd().size() == 0 && request.getInstallableUnitProfilePropertiesToRemove().size() == 0;
- }
-}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/ProvUI.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUI.java
index 3b9f8f4b6..d8417a094 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/ProvUI.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUI.java
@@ -9,28 +9,19 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui;
+package org.eclipse.equinox.internal.p2.ui;
-import java.net.URI;
-import java.util.*;
import org.eclipse.core.commands.*;
import org.eclipse.core.commands.common.NotDefinedException;
-import org.eclipse.core.commands.operations.ObjectUndoContext;
import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
-import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
import org.eclipse.equinox.internal.p2.ui.dialogs.ILayoutConstants;
-import org.eclipse.equinox.internal.p2.ui.dialogs.RepositoryNameAndLocationDialog;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningOperation;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.RepositoryManipulator;
-import org.eclipse.equinox.internal.provisional.p2.ui.viewers.IUColumnConfig;
+import org.eclipse.equinox.internal.p2.ui.query.IUViewQueryContext;
+import org.eclipse.equinox.internal.p2.ui.viewers.IUColumnConfig;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.query.CategoryQuery;
+import org.eclipse.equinox.p2.operations.ProvisioningSession;
+import org.eclipse.equinox.p2.ui.Policy;
import org.eclipse.jface.dialogs.MessageDialog;
-import org.eclipse.jface.window.Window;
-import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Shell;
@@ -56,12 +47,8 @@ public class ProvUI {
public static final String REVERT_COMMAND_LABEL = ProvUIMessages.RevertIUCommandLabel;
public static final String REVERT_COMMAND_TOOLTIP = ProvUIMessages.RevertIUCommandTooltip;
- static ObjectUndoContext provisioningUndoContext;
-
- /**
- * List<URI> of repositories that have already been reported to the user as not found.
- */
- private static final List reposNotFound = Collections.synchronizedList(new ArrayList());
+ private static IUColumnConfig[] columnConfig;
+ private static QueryProvider queryProvider;
// These values rely on the command markup in org.eclipse.ui.ide that defines the update commands
private static final String UPDATE_MANAGER_FIND_AND_INSTALL = "org.eclipse.ui.update.findAndInstallUpdates"; //$NON-NLS-1$
@@ -78,88 +65,6 @@ public class ProvUI {
return status;
}
- public static void reportLoadFailure(final URI location, IStatus status, int style, final RepositoryManipulator repoManipulator) {
- int code = status.getCode();
- // Special handling when the location is bad (not found, etc.) vs. a failure
- // associated with a known repo.
- if (code == ProvisionException.REPOSITORY_NOT_FOUND || code == ProvisionException.REPOSITORY_INVALID_LOCATION) {
- if (!hasNotFoundStatusBeenReported(location)) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- IWorkbench workbench = PlatformUI.getWorkbench();
- if (workbench.isClosing())
- return;
- Shell shell = ProvUI.getDefaultParentShell();
- if (MessageDialog.openQuestion(shell, ProvUIMessages.ProvUI_LoadErrorTitle, NLS.bind(ProvUIMessages.ProvUI_PromptForSiteEdit, URIUtil.toUnencodedString(location)))) {
- RepositoryNameAndLocationDialog dialog = new RepositoryNameAndLocationDialog(shell, Policy.getDefault()) {
- protected String getInitialLocationText() {
- return URIUtil.toUnencodedString(location);
- }
-
- protected String getInitialNameText() {
- String nickname = null;
- try {
- nickname = ProvisioningUtil.getMetadataRepositoryProperty(location, IRepository.PROP_NICKNAME);
- } catch (ProvisionException e) {
- // nickname remains null
- }
- return nickname == null ? "" : nickname; //$NON-NLS-1$
- }
- };
- int ret = dialog.open();
- if (ret == Window.OK) {
- URI correctedLocation = dialog.getLocation();
- if (correctedLocation != null) {
- ProvUI.startBatchOperation();
- try {
- RepositoryManipulator repoMan = repoManipulator;
- if (repoManipulator == null)
- repoMan = Policy.getDefault().getRepositoryManipulator();
- ProvisioningOperation op = repoMan.getRemoveOperation(new URI[] {location});
- op.execute(null);
- ProvUI.endBatchOperation(false);
- op = repoMan.getAddOperation(correctedLocation);
- op.execute(null);
- String nickname = dialog.getName();
- if (nickname != null && nickname.length() > 0)
- ProvisioningUtil.setMetadataRepositoryProperty(correctedLocation, IRepository.PROP_NICKNAME, nickname);
- } catch (ProvisionException e) {
- ProvUI.handleException(e, null, StatusManager.SHOW | StatusManager.LOG);
- ProvUI.endBatchOperation(true);
- }
- }
- }
- }
- }
- });
- reposNotFound.add(location);
- }
- } else {
- reportStatus(status, style);
- }
- }
-
- // This assumes that callers already checked whether it *should*
- // be reported so that we don't need to loop through the list
- // when the caller just has done so in order to know whether to report.
- public static void notFoundStatusReported(URI location) {
- reposNotFound.add(location);
- }
-
- // We don't check for things like case variants or end slash variants
- // because we know that the repository managers already did this.
- public static boolean hasNotFoundStatusBeenReported(URI location) {
- return reposNotFound.contains(location);
- }
-
- public static void clearRepositoriesNotFound() {
- reposNotFound.clear();
- }
-
- public static void clearRepositoryNotFound(URI location) {
- reposNotFound.remove(location);
- }
-
public static void reportStatus(IStatus status, int style) {
// workaround for
// https://bugs.eclipse.org/bugs/show_bug.cgi?id=211933
@@ -174,7 +79,7 @@ public class ProvUI {
// unset logging for statuses that should never be logged.
// Ideally the caller would do this but this bug keeps coming back.
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=274074
- if (status.getCode() == IStatusCodes.NOTHING_TO_UPDATE)
+ if (status.getCode() == ProvisioningSession.STATUS_NOTHING_TO_UPDATE)
style = 0;
} else if (status.getSeverity() == IStatus.WARNING) {
MessageDialog.openWarning(ProvUI.getDefaultParentShell(), ProvUIMessages.ProvUI_WarningTitle, status.getMessage());
@@ -188,17 +93,31 @@ public class ProvUI {
}
public static IUColumnConfig[] getIUColumnConfig() {
- return new IUColumnConfig[] {new IUColumnConfig(ProvUIMessages.ProvUI_NameColumnTitle, IUColumnConfig.COLUMN_NAME, ILayoutConstants.DEFAULT_PRIMARY_COLUMN_WIDTH), new IUColumnConfig(ProvUIMessages.ProvUI_VersionColumnTitle, IUColumnConfig.COLUMN_VERSION, ILayoutConstants.DEFAULT_COLUMN_WIDTH)};
+ if (columnConfig == null)
+ columnConfig = new IUColumnConfig[] {new IUColumnConfig(ProvUIMessages.ProvUI_NameColumnTitle, IUColumnConfig.COLUMN_NAME, ILayoutConstants.DEFAULT_PRIMARY_COLUMN_WIDTH), new IUColumnConfig(ProvUIMessages.ProvUI_VersionColumnTitle, IUColumnConfig.COLUMN_VERSION, ILayoutConstants.DEFAULT_COLUMN_WIDTH)};
+ return columnConfig;
+
+ }
+ public static IUViewQueryContext getQueryContext(Policy policy) {
+ IUViewQueryContext queryContext = new IUViewQueryContext(policy.getGroupByCategory() ? IUViewQueryContext.AVAILABLE_VIEW_BY_CATEGORY : IUViewQueryContext.AVAILABLE_VIEW_FLAT);
+ queryContext.setShowLatestVersionsOnly(policy.getShowLatestVersionsOnly());
+ queryContext.setShowInstallChildren(policy.getShowDrilldownRequirements());
+ queryContext.setShowProvisioningPlanChildren(policy.getShowDrilldownRequirements());
+ queryContext.setUseCategories(policy.getGroupByCategory());
+ return queryContext;
}
- public static Object getAdapter(Object object, Class adapterType) {
+ @SuppressWarnings("unchecked")
+ public static <T> T getAdapter(Object object, Class<T> adapterType) {
if (object == null)
return null;
if (adapterType.isInstance(object))
- return object;
+ // Ideally, we would use Class.cast here but it was introduced in Java 1.5
+ return (T) object;
if (object instanceof IAdaptable)
- return ((IAdaptable) object).getAdapter(adapterType);
+ // Ideally, we would use Class.cast here but it was introduced in Java 1.5
+ return (T) ((IAdaptable) object).getAdapter(adapterType);
return null;
}
@@ -271,14 +190,6 @@ public class ProvUI {
ProvUIActivator.getDefault().removeProvisioningListener(listener);
}
- public static void startBatchOperation() {
- ProvUIActivator.getDefault().signalBatchOperationStart();
- }
-
- public static void endBatchOperation(boolean notify) {
- ProvUIActivator.getDefault().signalBatchOperationComplete(notify);
- }
-
public static void openUpdateManagerInstaller(Event event) {
runCommand(UPDATE_MANAGER_FIND_AND_INSTALL, ProvUIMessages.UpdateManagerCompatibility_UnableToOpenFindAndInstall, event);
}
@@ -291,6 +202,12 @@ public class ProvUI {
runCommand(INSTALLATION_DIALOG, ProvUIMessages.ProvUI_InstallDialogError, event);
}
+ public static QueryProvider getQueryProvider() {
+ if (queryProvider == null)
+ queryProvider = new QueryProvider(ProvUIActivator.getDefault().getProvisioningUI());
+ return queryProvider;
+ }
+
private static void runCommand(String commandId, String errorMessage, Event event) {
ICommandService commandService = (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
Command command = commandService.getCommand(commandId);
@@ -311,9 +228,21 @@ public class ProvUI {
}
}
+ public static boolean isCategory(IInstallableUnit iu) {
+ return CategoryQuery.isCategory(iu);
+ }
+
private static void reportFail(String message, Throwable t) {
Status failStatus = new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, message, t);
reportStatus(failStatus, StatusManager.BLOCK | StatusManager.LOG);
+ }
+ /**
+ * For testing only
+ * @noreference
+ * @param provider
+ */
+ public static void setQueryProvider(QueryProvider provider) {
+ queryProvider = provider;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIActivator.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIActivator.java
index 04a5498d2..f049f96ce 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIActivator.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIActivator.java
@@ -11,14 +11,15 @@
package org.eclipse.equinox.internal.p2.ui;
import java.net.URL;
-import java.util.EventObject;
import org.eclipse.core.runtime.FileLocator;
import org.eclipse.core.runtime.Path;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.core.eventbus.*;
-import org.eclipse.equinox.internal.provisional.p2.engine.*;
-import org.eclipse.equinox.internal.provisional.p2.ui.*;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
+import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
+import org.eclipse.equinox.internal.provisional.p2.core.eventbus.IProvisioningEventBus;
+import org.eclipse.equinox.p2.core.IProvisioningAgent;
+import org.eclipse.equinox.p2.engine.IProfileRegistry;
+import org.eclipse.equinox.p2.operations.ProvisioningSession;
+import org.eclipse.equinox.p2.ui.Policy;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.ui.plugin.AbstractUIPlugin;
@@ -36,10 +37,11 @@ public class ProvUIActivator extends AbstractUIPlugin {
private static PackageAdmin packageAdmin = null;
private static ServiceReference packageAdminRef = null;
private static ProvUIActivator plugin;
- private ProvisioningListener profileChangeListener;
-
public static final String PLUGIN_ID = "org.eclipse.equinox.p2.ui"; //$NON-NLS-1$
+ private ProvisioningSession session;
+ private ProvisioningUI ui;
+
public static BundleContext getContext() {
return context;
}
@@ -85,71 +87,41 @@ public class ProvUIActivator extends AbstractUIPlugin {
packageAdminRef = bundleContext.getServiceReference(PackageAdmin.class.getName());
packageAdmin = (PackageAdmin) bundleContext.getService(packageAdminRef);
+ initializeProvisioningUI();
+ }
+
+ private void initializeProvisioningUI() {
// TODO for now we need to manually start up the provisioning infrastructure
// because the Eclipse Application launch config won't let me specify bundles to start.
- getBundle("org.eclipse.equinox.p2.exemplarysetup").start(Bundle.START_TRANSIENT); //$NON-NLS-1$
- getBundle("org.eclipse.equinox.frameworkadmin.equinox").start(Bundle.START_TRANSIENT); //$NON-NLS-1$
- getBundle("org.eclipse.equinox.simpleconfigurator.manipulator").start(Bundle.START_TRANSIENT); //$NON-NLS-1$
+ try {
+ getBundle("org.eclipse.equinox.p2.exemplarysetup").start(Bundle.START_TRANSIENT); //$NON-NLS-1$
+ } catch (BundleException e) {
+ ProvUI.handleException(e, "Error initializing provisioning UI", StatusManager.LOG); //$NON-NLS-1$
+ }
+ IProvisioningAgent agent = (IProvisioningAgent) ServiceHelper.getService(getContext(), IProvisioningAgent.class.getName());
+ session = new ProvisioningSession(agent);
- addProfileChangeListener();
+ Policy policy = (Policy) ServiceHelper.getService(ProvUIActivator.getContext(), Policy.class.getName());
+ if (policy == null)
+ policy = new Policy();
+
+ ui = new ProvisioningUI(session, IProfileRegistry.SELF, policy);
}
public void stop(BundleContext bundleContext) throws Exception {
try {
- removeProfileChangeListener();
plugin = null;
ProvUIActivator.context = null;
+ ui = null;
} finally {
super.stop(bundleContext);
}
}
- private void addProfileChangeListener() {
- if (profileChangeListener == null) {
- profileChangeListener = new SynchronousProvisioningListener() {
- public void notify(EventObject o) {
- if (o instanceof ProfileEvent) {
- ProfileEvent event = (ProfileEvent) o;
- try {
- IProfile selfProfile = ProvisioningUtil.getProfile(IProfileRegistry.SELF);
- if (selfProfile != null && (selfProfile.getProfileId().equals(event.getProfileId()))) {
- if (event.getReason() == ProfileEvent.CHANGED)
- ProvisioningOperationRunner.requestRestart(false);
-
- }
- } catch (ProvisionException e) {
- ProvUI.handleException(e, ProvUIMessages.ProvUIActivator_ExceptionDuringProfileChange, StatusManager.LOG);
-
- }
- }
- }
- };
- }
- IProvisioningEventBus bus = getProvisioningEventBus();
- if (bus != null)
- bus.addListener(profileChangeListener);
- }
-
- private void removeProfileChangeListener() {
- if (profileChangeListener != null) {
- IProvisioningEventBus bus = getProvisioningEventBus();
- if (bus != null)
- bus.removeListener(profileChangeListener);
- }
- }
-
public void addProvisioningListener(ProvUIProvisioningListener listener) {
getProvisioningEventBus().addListener(listener);
}
- public void signalBatchOperationStart() {
- getProvisioningEventBus().publishEvent(new BatchChangeBeginningEvent(this));
- }
-
- public void signalBatchOperationComplete(boolean notify) {
- getProvisioningEventBus().publishEvent(new BatchChangeCompleteEvent(this, notify));
- }
-
public IProvisioningEventBus getProvisioningEventBus() {
ServiceReference busReference = context.getServiceReference(IProvisioningEventBus.SERVICE_NAME);
if (busReference == null)
@@ -169,10 +141,6 @@ public class ProvUIActivator extends AbstractUIPlugin {
createImageDescriptor(ProvUIImages.IMG_UPDATED_IU, reg);
createImageDescriptor(ProvUIImages.IMG_CATEGORY, reg);
createImageDescriptor(ProvUIImages.IMG_PROFILE, reg);
- createImageDescriptor(ProvUIImages.IMG_TOOL_UPDATE, reg);
- createImageDescriptor(ProvUIImages.IMG_TOOL_UPDATE_PROBLEMS, reg);
- createImageDescriptor(ProvUIImages.IMG_TOOL_CLOSE, reg);
- createImageDescriptor(ProvUIImages.IMG_TOOL_CLOSE_HOT, reg);
createImageDescriptor(ProvUIImages.WIZARD_BANNER_INSTALL, reg);
createImageDescriptor(ProvUIImages.WIZARD_BANNER_REVERT, reg);
createImageDescriptor(ProvUIImages.WIZARD_BANNER_UNINSTALL, reg);
@@ -187,4 +155,12 @@ public class ProvUIActivator extends AbstractUIPlugin {
ImageDescriptor desc = ImageDescriptor.createFromURL(url);
reg.put(id, desc);
}
+
+ public ProvisioningUI getProvisioningUI() {
+ return ui;
+ }
+
+ public ProvisioningSession getSession() {
+ return session;
+ }
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIAdapterFactory.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIAdapterFactory.java
index 729dad386..922e7390d 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIAdapterFactory.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIAdapterFactory.java
@@ -11,12 +11,11 @@
package org.eclipse.equinox.internal.p2.ui;
import org.eclipse.core.runtime.IAdapterFactory;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
-import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
-import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUI;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.repository.IRepository;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
+import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
/**
* Adapter factory for provisioning elements
@@ -26,13 +25,14 @@ import org.eclipse.equinox.internal.provisional.p2.ui.ProvUI;
*/
public class ProvUIAdapterFactory implements IAdapterFactory {
- private static final Class[] CLASSES = new Class[] {IInstallableUnit.class, IProfile.class, IRepository.class, IMetadataRepository.class, IArtifactRepository.class};
+ private static final Class<?>[] CLASSES = new Class[] {IInstallableUnit.class, IProfile.class, IRepository.class, IMetadataRepository.class, IArtifactRepository.class};
+ @SuppressWarnings({"rawtypes", "unchecked"})
public Object getAdapter(Object adaptableObject, Class adapterType) {
return ProvUI.getAdapter(adaptableObject, adapterType);
}
- public Class[] getAdapterList() {
+ public Class<?>[] getAdapterList() {
return CLASSES;
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/ProvUIImages.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIImages.java
index 587d70800..40ab3feb6 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/ProvUIImages.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIImages.java
@@ -8,9 +8,8 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui;
+package org.eclipse.equinox.internal.p2.ui;
-import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.graphics.Image;
@@ -42,11 +41,6 @@ public class ProvUIImages {
public final static String IMG_UPDATED_IU = "obj/iu_update_obj.gif"; //$NON-NLS-1$
public final static String IMG_PROFILE = "obj/profile_obj.gif"; //$NON-NLS-1$
public final static String IMG_CATEGORY = "obj/category_obj.gif"; //$NON-NLS-1$
- // tools
- public final static String IMG_TOOL_UPDATE = "tool/update.gif"; //$NON-NLS-1$
- public final static String IMG_TOOL_UPDATE_PROBLEMS = "tool/update_problems.gif"; //$NON-NLS-1$
- public final static String IMG_TOOL_CLOSE = "tool/close.gif"; //$NON-NLS-1$
- public final static String IMG_TOOL_CLOSE_HOT = "tool/close_hot.gif"; //$NON-NLS-1$
// wizard graphics
public final static String WIZARD_BANNER_INSTALL = "wizban/install_wiz.gif"; //$NON-NLS-1$
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIMessages.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIMessages.java
index f7f9ac8d3..f8d6d1035 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIMessages.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIMessages.java
@@ -38,10 +38,11 @@ public class ProvUIMessages extends NLS {
public static String AcceptLicensesWizardPage_Title;
public static String ApplicationInRestartDialog;
public static String ApplyProfileChangesDialog_ApplyChanges;
+ public static String ApplyProfileChangesDialog_Restart;
+ public static String ApplyProfileChangesDialog_NotYet;
public static String ColocatedRepositoryManipulator_AddSiteOperationLabel;
- public static String ColocatedRepositoryManipulator_GotoPrefs;
- public static String ColocatedRepositoryManipulator_ManageSites;
- public static String ColocatedRepositoryManipulator_RemoveSiteOperationLabel;
+ public static String ColocatedRepositoryTracker_PromptForSiteLocationEdit;
+ public static String ColocatedRepositoryTracker_SiteNotFoundTitle;
public static String RevertProfilePage_ConfirmDeleteMultipleConfigs;
public static String RevertProfilePage_ConfirmDeleteSingleConfig;
public static String RevertProfilePage_Delete;
@@ -69,24 +70,9 @@ public class ProvUIMessages extends NLS {
public static String IUGeneralInfoPropertyPage_VersionLabel;
public static String IULicensePropertyPage_NoLicense;
public static String IULicensePropertyPage_ViewLicenseLabel;
- public static String ProfileChangeRequestBuildingRequest;
- public static String ProfileElement_InvalidProfile;
public static String ProfileModificationAction_InvalidSelections;
- public static String ProfileModificationAction_NoChangeRequestProvided;
- public static String ProfileModificationAction_NoExplanationProvided;
- public static String ProfileModificationAction_ResolutionOperationLabel;
public static String ProfileModificationWizardPage_DetailsLabel;
- public static String ProfileModificationWizardPage_ResolutionOperationLabel;
- public static String ProfileModificationWizardPage_UnexpectedError;
public static String ProfileSnapshots_Label;
- public static String ProvisioningUtil_InstallPlanConfigurationError;
- // utility error messages
- public static String ProvisioningUtil_NoRepositoryManager;
- public static String ProvisioningUtil_LoadRepositoryFailure;
- public static String ProvisioningUtil_NoProfileRegistryFound;
- public static String ProvisioningUtil_NoPlannerFound;
- public static String ProvisioningUtil_NoDirectorFound;
- public static String ProvisioningUtil_NoEngineFound;
// viewer support
public static String ProvDropAdapter_InvalidDropTarget;
@@ -96,13 +82,12 @@ public class ProvUIMessages extends NLS {
// Provisioning operations
public static String ProvisioningOperationRunner_CannotApplyChanges;
- public static String ProvisioningOperationRunner_ErrorExecutingOperation;
+ public static String ProvisioningOperationWizard_UnexpectedFailureToResolve;
public static String InstalledSoftwarePage_NoProfile;
public static String InstallIUOperationLabel;
public static String InstallIUOperationTask;
public static String InstallIUCommandLabel;
public static String InstallIUCommandTooltip;
- public static String InstallIUProgress;
public static String InstallWizardPage_NoCheckboxDescription;
public static String InstallWizardPage_Title;
public static String PreselectedIUInstallWizard_Title;
@@ -123,7 +108,6 @@ public class ProvUIMessages extends NLS {
public static String RefreshAction_Label;
public static String RefreshAction_Tooltip;
public static String RemoveColocatedRepositoryAction_Label;
- public static String RemoveColocatedRepositoryAction_OperationLabel;
public static String RemoveColocatedRepositoryAction_Tooltip;
public static String RevertIUCommandLabel;
public static String RevertIUCommandTooltip;
@@ -164,19 +148,19 @@ public class ProvUIMessages extends NLS {
public static String RepositoryManipulatorDropTarget_DragSourceNotValid;
public static String RepositoryNameAndLocationDialog_Title;
- public static String ResolutionReport_SummaryStatus;
+ public static String RepositorySelectionGroup_GenericSiteLinkTitle;
+ public static String RepositorySelectionGroup_PrefPageLink;
+ public static String RepositorySelectionGroup_PrefPageName;
public static String ResolutionWizardPage_Canceled;
public static String ResolutionWizardPage_ErrorStatus;
public static String ResolutionWizardPage_NoSelections;
public static String ResolutionWizardPage_WarningInfoStatus;
// Dialogs
- public static String AddRepositoryDialog_DuplicateURL;
public static String AddRepositoryDialog_InvalidURL;
public static String AddRepositoryDialog_LocationLabel;
public static String AddRepositoryDialog_NameLabel;
public static String AddRepositoryDialog_Title;
- public static String AvailableIUElement_ProfileNotFound;
public static String AvailableIUGroup_LoadingRepository;
public static String AvailableIUGroup_NoSitesConfiguredDescription;
public static String AvailableIUGroup_NoSitesConfiguredExplanation;
@@ -200,47 +184,28 @@ public class ProvUIMessages extends NLS {
public static String AvailableIUsPage_Title;
public static String AvailableIUWrapper_AllAreInstalled;
public static String IUViewQueryContext_AllAreInstalledDescription;
- public static String DefaultQueryProvider_ErrorRetrievingProfile;
public static String DeferredFetchFilteredTree_RetrievingList;
public static String ElementUtils_UpdateJobTitle;
public static String Label_Profiles;
public static String Label_Repositories;
+ public static String LaunchUpdateManagerButton;
+ public static String LoadMetadataRepositoryJob_ContactSitesProgress;
+ public static String LoadMetadataRepositoryJob_SitesMissingError;
public static String MetadataRepositoryElement_NotFound;
public static String MetadataRepositoryElement_RepositoryLoadError;
public static String UpdateAction_UpdatesAvailableMessage;
public static String UpdateAction_UpdatesAvailableTitle;
- public static String PlanAnalyzer_IgnoringInstall;
- public static String PlanAnalyzer_LockedImpliedUpdate0;
- public static String PlanAnalyzer_PartialInstall;
- public static String PlanAnalyzer_PartialUninstall;
- public static String PlanAnalyzer_SideEffectInstall;
- public static String PlanAnalyzer_SideEffectUninstall;
- public static String PlannerResolutionOperation_UnexpectedError;
- public static String PlanStatusHelper_IgnoringImpliedDowngrade;
- public static String PlanStatusHelper_ImpliedUpdate;
- public static String PlanStatusHelper_Items;
- public static String PlanStatusHelper_NothingToDo;
- public static String PlanStatusHelper_AlreadyInstalled;
- public static String PlanStatusHelper_AnotherOperationInProgress;
- public static String PlanStatusHelper_Launch;
- public static String PlanStatusHelper_RequestAltered;
- public static String PlanStatusHelper_RequiresUpdateManager;
- public static String PlanStatusHelper_UnexpectedError;
- public static String PlanStatusHelper_UpdateManagerPromptTitle;
- public static String PlanStatusHelper_PromptForUpdateManagerUI;
public static String PlatformUpdateTitle;
public static String PlatformRestartMessage;
+ public static String Policy_RequiresUpdateManagerMessage;
+ public static String Policy_RequiresUpdateManagerTitle;
public static String ProvUI_ErrorDuringApplyConfig;
public static String ProvUI_InformationTitle;
public static String ProvUI_InstallDialogError;
public static String ProvUI_NameColumnTitle;
public static String ProvUI_IdColumnTitle;
- public static String ProvUI_LoadErrorTitle;
- public static String ProvUI_PromptForSiteEdit;
public static String ProvUI_VersionColumnTitle;
public static String ProvUI_WarningTitle;
- public static String ProvUIActivator_ExceptionDuringProfileChange;
- public static String ProvUILicenseManager_ParsingError;
public static String ProvUIMessages_NotAccepted_EnterFor_0;
public static String ProvUIMessages_SavedNotAccepted_EnterFor_0;
public static String OptionalPlatformRestartMessage;
@@ -248,38 +213,33 @@ public class ProvUIMessages extends NLS {
public static String QueriedElementWrapper_NoCategorizedItemsExplanation;
public static String QueriedElementWrapper_NoItemsExplanation;
public static String QueriedElementWrapper_SiteNotFound;
- public static String ColocatedRepositoryManipulator_SiteNotFoundDescription;
public static String QueryableMetadataRepositoryManager_LoadRepositoryProgress;
public static String QueryableMetadataRepositoryManager_MultipleRepositoriesNotFound;
public static String QueryableProfileRegistry_QueryProfileProgress;
+ public static String QueryableRepositoryManager_LoadFailure;
public static String QueryableUpdates_UpdateListProgress;
public static String SizeComputingWizardPage_SizeJobTitle;
- public static String SizingPhaseSet_PhaseSetName;
public static String RevertDialog_ConfigContentsLabel;
public static String RevertDialog_ConfigsLabel;
public static String RevertDialog_ConfirmRestartMessage;
public static String RevertDialog_RevertOperationLabel;
public static String RevertDialog_Title;
public static String RollbackProfileElement_CurrentInstallation;
- public static String RollbackProfileElement_InvalidSnapshot;
public static String SelectableIUsPage_Select_All;
public static String SelectableIUsPage_Deselect_All;
public static String TrustCertificateDialog_Details;
public static String TrustCertificateDialog_Title;
// Operations
- public static String URLValidator_UnrecognizedURL;
public static String UpdateManagerCompatibility_ExportSitesTitle;
public static String UpdateManagerCompatibility_ImportSitesTitle;
public static String UpdateManagerCompatibility_InvalidSiteFileMessage;
public static String UpdateManagerCompatibility_InvalidSitesTitle;
public static String UpdateManagerCompatibility_UnableToOpenFindAndInstall;
public static String UpdateManagerCompatibility_UnableToOpenManageConfiguration;
- public static String UpdateOperation_NothingToUpdate;
public static String ServiceUI_LoginDetails;
public static String ServiceUI_LoginRequired;
public static String ServiceUI_unsigned_message;
- public static String ServiceUI_unsigned_title;
public static String ServiceUI_warning_title;
public static String UpdateOrInstallWizardPage_Size;
public static String Updates_Label;
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/ProvUIProvisioningListener.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIProvisioningListener.java
index 397fbfacd..fa88b20bc 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/ProvUIProvisioningListener.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIProvisioningListener.java
@@ -9,15 +9,13 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui;
+package org.eclipse.equinox.internal.p2.ui;
import java.util.EventObject;
-import org.eclipse.equinox.internal.p2.ui.BatchChangeBeginningEvent;
-import org.eclipse.equinox.internal.p2.ui.BatchChangeCompleteEvent;
-import org.eclipse.equinox.internal.provisional.p2.core.eventbus.ProvisioningListener;
-import org.eclipse.equinox.internal.provisional.p2.engine.ProfileEvent;
-import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
+import org.eclipse.equinox.internal.provisional.p2.core.eventbus.SynchronousProvisioningListener;
import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent;
+import org.eclipse.equinox.p2.engine.ProfileEvent;
+import org.eclipse.equinox.p2.repository.IRepository;
/**
* ProvisioningListener which handles event batching and other
@@ -26,7 +24,7 @@ import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent;
*
* @since 3.5
*/
-public abstract class ProvUIProvisioningListener implements ProvisioningListener {
+public abstract class ProvUIProvisioningListener implements SynchronousProvisioningListener {
public static final int PROV_EVENT_METADATA_REPOSITORY = 0x0001;
public static final int PROV_EVENT_IU = 0x0002;
@@ -41,14 +39,18 @@ public abstract class ProvUIProvisioningListener implements ProvisioningListener
}
public void notify(EventObject o) {
- if (o instanceof BatchChangeBeginningEvent) {
+ if (o instanceof RepositoryOperationBeginningEvent) {
batchCount++;
- } else if (o instanceof BatchChangeCompleteEvent) {
+ } else if (o instanceof RepositoryOperationEndingEvent) {
batchCount--;
- // A batch operation completed. Refresh if we are
- // to honor it.
- if (batchCount <= 0 && ((BatchChangeCompleteEvent) o).notify)
- refreshAll();
+ // A batch operation completed. Refresh.
+ if (batchCount <= 0) {
+ RepositoryOperationEndingEvent event = (RepositoryOperationEndingEvent) o;
+ if (event.getEvent() == null && event.update())
+ refreshAll();
+ else if (event.update())
+ notify(event.getEvent());
+ }
} else if (batchCount > 0) {
// We are in the middle of a batch operation
return;
@@ -65,9 +67,9 @@ public abstract class ProvUIProvisioningListener implements ProvisioningListener
RepositoryEvent event = (RepositoryEvent) o;
// Do not handle unless this is the type of repo that we are interested in
if ((event.getRepositoryType() == IRepository.TYPE_METADATA && (eventTypes & PROV_EVENT_METADATA_REPOSITORY) == PROV_EVENT_METADATA_REPOSITORY) || (event.getRepositoryType() == IRepository.TYPE_ARTIFACT && (eventTypes & PROV_EVENT_ARTIFACT_REPOSITORY) == PROV_EVENT_ARTIFACT_REPOSITORY)) {
- if (event.getKind() == RepositoryEvent.ADDED) {
+ if (event.getKind() == RepositoryEvent.ADDED && event.isRepositoryEnabled()) {
repositoryAdded(event);
- } else if (event.getKind() == RepositoryEvent.REMOVED) {
+ } else if (event.getKind() == RepositoryEvent.REMOVED && event.isRepositoryEnabled()) {
repositoryRemoved(event);
} else if (event.getKind() == RepositoryEvent.DISCOVERED) {
repositoryDiscovered(event);
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvisioningOperationRunner.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvisioningOperationRunner.java
new file mode 100644
index 000000000..65b907823
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvisioningOperationRunner.java
@@ -0,0 +1,143 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.internal.p2.ui;
+
+import java.io.IOException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.*;
+import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
+import org.eclipse.equinox.internal.p2.ui.dialogs.ApplyProfileChangesDialog;
+import org.eclipse.equinox.internal.provisional.configurator.Configurator;
+import org.eclipse.equinox.p2.operations.ProvisioningJob;
+import org.eclipse.equinox.p2.ui.Policy;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.progress.IProgressConstants;
+import org.eclipse.ui.statushandlers.StatusManager;
+
+/**
+ * Utility methods for running provisioning operations. Operations can either
+ * be run synchronously or in a job. When scheduled as a job, the operation
+ * determines whether the job is run in
+ * the background or in the UI.
+ *
+ * @since 3.4
+ */
+public class ProvisioningOperationRunner {
+
+ boolean suppressRestart = false;
+ ProvisioningUI ui;
+
+ public ProvisioningOperationRunner(ProvisioningUI ui) {
+ this.ui = ui;
+ }
+
+ /**
+ * Schedule a job to execute the supplied ProvisioningOperation.
+ *
+ * @param job The operation to execute
+ * @param errorStyle the flags passed to the StatusManager for error reporting
+ */
+ public void schedule(final ProvisioningJob job, final int errorStyle) {
+ final boolean noPrompt = (errorStyle & (StatusManager.BLOCK | StatusManager.SHOW)) == 0;
+ if (noPrompt) {
+ job.setProperty(IProgressConstants.KEEP_PROPERTY, Boolean.TRUE);
+ job.setProperty(IProgressConstants.NO_IMMEDIATE_ERROR_PROMPT_PROPERTY, Boolean.TRUE);
+ }
+ job.setProperty(IProgressConstants.ICON_PROPERTY, ProvUIImages.getImageDescriptor(ProvUIImages.IMG_PROFILE));
+ manageJob(job, job.getRestartPolicy());
+ job.schedule();
+ }
+
+ /**
+ * Request a restart of the platform according to the specified
+ * restart policy.
+ *
+ * @param restartPolicy
+ */
+ private void requestRestart(final int restartPolicy) {
+ // Global override of restart (used in test cases).
+ if (suppressRestart)
+ return;
+ if (restartPolicy == Policy.RESTART_POLICY_FORCE) {
+ PlatformUI.getWorkbench().restart();
+ return;
+ }
+ if (restartPolicy == Policy.RESTART_POLICY_FORCE_APPLY) {
+ applyProfileChanges();
+ return;
+ }
+
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ if (PlatformUI.getWorkbench().isClosing())
+ return;
+ int retCode = ApplyProfileChangesDialog.promptForRestart(ProvUI.getDefaultParentShell(), restartPolicy == Policy.RESTART_POLICY_PROMPT);
+ if (retCode == ApplyProfileChangesDialog.PROFILE_APPLYCHANGES) {
+ applyProfileChanges();
+ } else if (retCode == ApplyProfileChangesDialog.PROFILE_RESTART) {
+ PlatformUI.getWorkbench().restart();
+ }
+ }
+ });
+ }
+
+ void applyProfileChanges() {
+ Configurator configurator = (Configurator) ServiceHelper.getService(ProvUIActivator.getContext(), Configurator.class.getName());
+ try {
+ configurator.applyConfiguration();
+ } catch (IOException e) {
+ ProvUI.handleException(e, ProvUIMessages.ProvUI_ErrorDuringApplyConfig, StatusManager.LOG | StatusManager.BLOCK);
+ } catch (IllegalStateException e) {
+ IStatus illegalApplyStatus = new Status(IStatus.WARNING, ProvUIActivator.PLUGIN_ID, 0, ProvUIMessages.ProvisioningOperationRunner_CannotApplyChanges, e);
+ ProvUI.reportStatus(illegalApplyStatus, StatusManager.LOG | StatusManager.BLOCK);
+ }
+ }
+
+ public void manageJob(Job job, final int jobRestartPolicy) {
+ ui.getSession().rememberJob(job);
+ job.addJobChangeListener(new JobChangeAdapter() {
+ public void done(IJobChangeEvent event) {
+ int severity = event.getResult().getSeverity();
+ // If the job finished without error, see if restart is needed
+ if (severity != IStatus.CANCEL && severity != IStatus.ERROR) {
+ if (jobRestartPolicy == ProvisioningJob.RESTART_NONE) {
+ return;
+ }
+ int globalRestartPolicy = ui.getPolicy().getRestartPolicy();
+ // If the global policy allows apply changes, check the job policy to see if it supports it.
+ if (globalRestartPolicy == Policy.RESTART_POLICY_PROMPT_RESTART_OR_APPLY) {
+ if (jobRestartPolicy == ProvisioningJob.RESTART_OR_APPLY)
+ requestRestart(Policy.RESTART_POLICY_PROMPT_RESTART_OR_APPLY);
+ else
+ requestRestart(Policy.RESTART_POLICY_PROMPT);
+ } else
+ requestRestart(globalRestartPolicy);
+ }
+ }
+ });
+ }
+
+ /**
+ * This method is provided for use in automated test case. It should
+ * no longer be needed to be used by clients.
+ *
+ * @param suppress <code>true</code> to suppress all restarts and <code>false</code>
+ * to stop suppressing restarts.
+ *
+ * @noreference This method is not intended to be referenced by clients.
+ */
+ public void suppressRestart(boolean suppress) {
+ suppressRestart = suppress;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryProvider.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryProvider.java
new file mode 100644
index 000000000..51e516a01
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryProvider.java
@@ -0,0 +1,200 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * EclipseSource - ongoing development
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.ui;
+
+import java.net.URI;
+import java.util.Collection;
+import org.eclipse.equinox.internal.p2.metadata.query.LatestIUVersionQuery;
+import org.eclipse.equinox.internal.p2.ui.model.*;
+import org.eclipse.equinox.internal.p2.ui.query.*;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.IRequirement;
+import org.eclipse.equinox.p2.metadata.expression.*;
+import org.eclipse.equinox.p2.metadata.query.*;
+import org.eclipse.equinox.p2.operations.RepositoryTracker;
+import org.eclipse.equinox.p2.query.*;
+import org.eclipse.equinox.p2.repository.artifact.ArtifactKeyQuery;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
+import org.eclipse.equinox.p2.ui.Policy;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
+
+/**
+ * Provides a default set of queries to drive the provisioning UI.
+ *
+ * @since 3.5
+ */
+
+public class QueryProvider {
+
+ private ProvisioningUI ui;
+
+ public static final int METADATA_REPOS = 1;
+ public static final int ARTIFACT_REPOS = 2;
+ public static final int PROFILES = 3;
+ public static final int AVAILABLE_IUS = 4;
+ public static final int AVAILABLE_UPDATES = 5;
+ public static final int INSTALLED_IUS = 6;
+ public static final int AVAILABLE_ARTIFACTS = 7;
+
+ private IQuery<IInstallableUnit> allQuery = new MatchQuery<IInstallableUnit>() {
+ public boolean isMatch(IInstallableUnit candidate) {
+ return true;
+ }
+ };
+
+ public QueryProvider(ProvisioningUI ui) {
+ this.ui = ui;
+ }
+
+ public ElementQueryDescriptor getQueryDescriptor(final QueriedElement element) {
+ // Initialize queryable, queryContext, and queryType from the element.
+ // In some cases we override this.
+ Policy policy = ui.getPolicy();
+ IQueryable<?> queryable = element.getQueryable();
+ int queryType = element.getQueryType();
+ IUViewQueryContext context = element.getQueryContext();
+ if (context == null) {
+ context = ProvUI.getQueryContext(policy);
+ }
+ RepositoryTracker tracker = ui.getRepositoryTracker();
+ switch (queryType) {
+ case ARTIFACT_REPOS :
+ queryable = new QueryableArtifactRepositoryManager(ui, false).locationsQueriable();
+ return new ElementQueryDescriptor(queryable, new RepositoryLocationQuery(), new Collector<URI>(), new ArtifactRepositoryElementWrapper(null, element));
+
+ case AVAILABLE_IUS :
+ // Things get more complicated if the user wants to filter out installed items.
+ // This involves setting up a secondary query for installed content that the various
+ // collectors will use to reject content. We can't use a compound query because the
+ // queryables are different (profile for installed content, repo for available content)
+ AvailableIUWrapper availableIUWrapper;
+ boolean showLatest = context.getShowLatestVersionsOnly();
+ boolean hideInstalled = context.getHideAlreadyInstalled();
+ IProfile targetProfile = null;
+ String profileId = context.getInstalledProfileId();
+ if (profileId != null) {
+ targetProfile = ui.getSession().getProfileRegistry().getProfile(profileId);
+ }
+
+ IQuery<IInstallableUnit> topLevelQuery = policy.getVisibleAvailableIUQuery();
+ IQuery<IInstallableUnit> categoryQuery = new CategoryQuery();
+
+ // Showing child IU's of a group of repositories, or of a single repository
+ if (element instanceof MetadataRepositories || element instanceof MetadataRepositoryElement) {
+ if (context.getViewType() == IUViewQueryContext.AVAILABLE_VIEW_FLAT || !context.getUseCategories()) {
+ AvailableIUWrapper wrapper = new AvailableIUWrapper(queryable, element, false, context.getShowAvailableChildren());
+ if (showLatest)
+ topLevelQuery = new PipedQuery<IInstallableUnit>(topLevelQuery, new LatestIUVersionQuery<IInstallableUnit>());
+ if (targetProfile != null)
+ wrapper.markInstalledIUs(targetProfile, hideInstalled);
+ return new ElementQueryDescriptor(queryable, topLevelQuery, new Collector<Object>(), wrapper);
+ }
+ // Installed content not a concern for collecting categories
+ return new ElementQueryDescriptor(queryable, categoryQuery, new Collector<Object>(), new CategoryElementWrapper(queryable, element));
+ }
+
+ // If it's a category or some other IUElement to drill down in, we get the requirements and show all requirements
+ // that are also visible in the available list.
+ if (element instanceof CategoryElement || (element instanceof IIUElement && ((IIUElement) element).shouldShowChildren())) {
+ // children of a category should drill down according to the context. If we aren't in a category, we are already drilling down and
+ // continue to do so.
+ boolean drillDown = element instanceof CategoryElement ? context.getShowAvailableChildren() : true;
+ IQuery<IInstallableUnit> memberOfCategoryQuery = new CategoryMemberQuery(((IIUElement) element).getIU());
+ availableIUWrapper = new AvailableIUWrapper(queryable, element, true, drillDown);
+ if (targetProfile != null)
+ availableIUWrapper.markInstalledIUs(targetProfile, hideInstalled);
+ // if it's a category, the metadata was specifically set up so that the requirements are the IU's that should
+ // be visible in the category.
+ if (element instanceof CategoryElement) {
+ if (showLatest)
+ memberOfCategoryQuery = new PipedQuery<IInstallableUnit>(memberOfCategoryQuery, new LatestIUVersionQuery<IInstallableUnit>());
+ return new ElementQueryDescriptor(queryable, memberOfCategoryQuery, new Collector<Object>(), availableIUWrapper);
+ }
+ @SuppressWarnings("unchecked")
+ IQuery<IInstallableUnit> query = CompoundQuery.createCompoundQuery(new IQuery[] {topLevelQuery, memberOfCategoryQuery}, true);
+ if (showLatest)
+ query = new PipedQuery<IInstallableUnit>(query, new LatestIUVersionQuery<IInstallableUnit>());
+ // If it's not a category, these are generic requirements and should be filtered by the visibility property (topLevelQuery)
+ return new ElementQueryDescriptor(queryable, query, new Collector<Object>(), availableIUWrapper);
+ }
+ return null;
+
+ case AVAILABLE_UPDATES :
+ // This query can be used by the automatic updater in headless cases (checking for updates).
+ // We traffic in IU's rather than wrapped elements
+ IProfile profile;
+ IInstallableUnit[] toUpdate = null;
+ if (element instanceof Updates) {
+ profile = ui.getSession().getProfileRegistry().getProfile(((Updates) element).getProfileId());
+ toUpdate = ((Updates) element).getIUs();
+ } else {
+ profile = ProvUI.getAdapter(element, IProfile.class);
+ }
+ if (profile == null)
+ return null;
+ if (toUpdate == null) {
+ IQueryResult<IInstallableUnit> queryResult = profile.query(policy.getVisibleInstalledIUQuery(), null);
+ toUpdate = queryResult.toArray(IInstallableUnit.class);
+ }
+ QueryableUpdates updateQueryable = new QueryableUpdates(ui, toUpdate);
+ return new ElementQueryDescriptor(updateQueryable, context.getShowLatestVersionsOnly() ? new LatestIUVersionQuery<IInstallableUnit>() : allQuery, new Collector<Object>());
+
+ case INSTALLED_IUS :
+ // Querying of IU's. We are drilling down into the requirements.
+ if (element instanceof IIUElement && context.getShowInstallChildren()) {
+ Collection<IRequirement> reqs = ((IIUElement) element).getRequirements();
+ IExpression[] requirementExpressions = new IExpression[reqs.size()];
+ int i = 0;
+ for (IRequirement req : reqs) {
+ requirementExpressions[i++] = req.getMatches();
+ }
+ IExpressionFactory factory = ExpressionUtil.getFactory();
+ IQuery<IInstallableUnit> meetsAnyRequirementQuery = new ExpressionQuery<IInstallableUnit>(IInstallableUnit.class, factory.or(requirementExpressions));
+ IQuery<IInstallableUnit> visibleAsAvailableQuery = policy.getVisibleAvailableIUQuery();
+ @SuppressWarnings("unchecked")
+ CompoundQuery<IInstallableUnit> createCompoundQuery = CompoundQuery.createCompoundQuery(new IQuery[] {visibleAsAvailableQuery, meetsAnyRequirementQuery}, true);
+ return new ElementQueryDescriptor(queryable, createCompoundQuery, new Collector<IInstallableUnit>(), new InstalledIUElementWrapper(queryable, element));
+ }
+ profile = ProvUI.getAdapter(element, IProfile.class);
+ if (profile == null)
+ return null;
+ return new ElementQueryDescriptor(profile, policy.getVisibleInstalledIUQuery(), new Collector<IInstallableUnit>(), new InstalledIUElementWrapper(profile, element));
+
+ case METADATA_REPOS :
+ if (element instanceof MetadataRepositories) {
+ if (queryable == null) {
+ queryable = new QueryableMetadataRepositoryManager(ui, ((MetadataRepositories) element).getIncludeDisabledRepositories()).locationsQueriable();
+ element.setQueryable(queryable);
+ }
+ return new ElementQueryDescriptor(element.getQueryable(), new RepositoryLocationQuery(), new Collector<URI>(), new MetadataRepositoryElementWrapper(null, element));
+ }
+ return null;
+
+ case PROFILES :
+ queryable = new QueryableProfileRegistry(ui);
+ return new ElementQueryDescriptor(queryable, new MatchQuery<Object>() {
+ public boolean isMatch(Object candidate) {
+ return ProvUI.getAdapter(candidate, IProfile.class) != null;
+ }
+ }, new Collector<Object>(), new ProfileElementWrapper(null, element));
+
+ case AVAILABLE_ARTIFACTS :
+ if (!(queryable instanceof IArtifactRepository))
+ return null;
+ return new ElementQueryDescriptor(queryable, ArtifactKeyQuery.ALL_KEYS, new Collector<Object>(), new ArtifactKeyWrapper((IArtifactRepository) queryable, element));
+
+ default :
+ return null;
+ }
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableArtifactRepositoryManager.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableArtifactRepositoryManager.java
new file mode 100644
index 000000000..2ddade3c7
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableArtifactRepositoryManager.java
@@ -0,0 +1,57 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * EclipseSource - ongoing development
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.ui;
+
+import org.eclipse.equinox.p2.core.ProvisionException;
+
+import java.net.URI;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.equinox.internal.p2.artifact.repository.ArtifactRepositoryManager;
+import org.eclipse.equinox.p2.metadata.IArtifactKey;
+import org.eclipse.equinox.p2.operations.RepositoryTracker;
+import org.eclipse.equinox.p2.repository.IRepositoryManager;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
+
+/**
+ * An object that queries a particular set of artifact repositories.
+ */
+public class QueryableArtifactRepositoryManager extends QueryableRepositoryManager<IArtifactKey> {
+
+ public QueryableArtifactRepositoryManager(ProvisioningUI ui, boolean includeDisabledRepos) {
+ super(ui, includeDisabledRepos);
+ }
+
+ protected IArtifactRepositoryManager getRepositoryManager() {
+ return getSession().getArtifactRepositoryManager();
+ }
+
+ protected IArtifactRepository doLoadRepository(IRepositoryManager<IArtifactKey> manager, URI location, IProgressMonitor monitor) throws ProvisionException {
+ return ui.loadArtifactRepository(location, false, monitor);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.internal.p2.ui.QueryableRepositoryManager#getRepositoryFlags(org.eclipse.equinox.p2.ui.RepositoryManipulator)
+ */
+ protected int getRepositoryFlags(RepositoryTracker repositoryManipulator) {
+ return repositoryManipulator.getArtifactRepositoryFlags();
+ }
+
+ protected IArtifactRepository getRepository(IRepositoryManager<IArtifactKey> manager, URI location) {
+ // note the use of ArtifactRepositoryManager (the concrete implementation).
+ if (manager instanceof ArtifactRepositoryManager) {
+ return ((ArtifactRepositoryManager) manager).getRepository(location);
+ }
+ return null;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableMetadataRepositoryManager.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableMetadataRepositoryManager.java
new file mode 100644
index 000000000..ce65c8cce
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableMetadataRepositoryManager.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.ui;
+
+import org.eclipse.equinox.p2.core.ProvisionException;
+
+import java.net.URI;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.operations.RepositoryTracker;
+import org.eclipse.equinox.p2.repository.IRepositoryManager;
+import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
+import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
+
+/**
+ * An object that queries a particular set of metadata repositories.
+ */
+public class QueryableMetadataRepositoryManager extends QueryableRepositoryManager<IInstallableUnit> {
+
+ public QueryableMetadataRepositoryManager(ProvisioningUI ui, boolean includeDisabledRepos) {
+ super(ui, includeDisabledRepos);
+ }
+
+ protected IMetadataRepository getRepository(IRepositoryManager<IInstallableUnit> manager, URI location) {
+ // note the use of MetadataRepositoryManager (the concrete implementation).
+ if (manager instanceof MetadataRepositoryManager) {
+ return ((MetadataRepositoryManager) manager).getRepository(location);
+ }
+ return null;
+ }
+
+ protected IMetadataRepositoryManager getRepositoryManager() {
+ return getSession().getMetadataRepositoryManager();
+ }
+
+ protected IMetadataRepository doLoadRepository(IRepositoryManager<IInstallableUnit> manager, URI location, IProgressMonitor monitor) throws ProvisionException {
+ return ui.loadMetadataRepository(location, false, monitor);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.internal.p2.ui.QueryableRepositoryManager#getRepositoryFlags(org.eclipse.equinox.p2.ui.RepositoryManipulator)
+ */
+ protected int getRepositoryFlags(RepositoryTracker repositoryManipulator) {
+ return repositoryManipulator.getMetadataRepositoryFlags();
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableRepositoryManager.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableRepositoryManager.java
new file mode 100644
index 000000000..e26c67842
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableRepositoryManager.java
@@ -0,0 +1,172 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.ui;
+
+import java.net.URI;
+import java.util.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.p2.core.ProvisionException;
+import org.eclipse.equinox.p2.operations.ProvisioningSession;
+import org.eclipse.equinox.p2.operations.RepositoryTracker;
+import org.eclipse.equinox.p2.query.*;
+import org.eclipse.equinox.p2.repository.IRepository;
+import org.eclipse.equinox.p2.repository.IRepositoryManager;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * An object that provides query support for a specified
+ * set of repositories. The repository tracker flags determine which repositories
+ * are included in the query. Callers interested in only the resulting repository URIs
+ * should specify a {@link RepositoryLocationQuery}, in which case the
+ * query is performed over the URI's. Otherwise the repositories are loaded and
+ * the query is performed over the repositories themselves.
+ */
+public abstract class QueryableRepositoryManager<T> implements IQueryable<T> {
+ private ProvisioningSession session;
+ protected boolean includeDisabledRepos;
+ protected RepositoryTracker tracker;
+ protected int repositoryFlags;
+ protected ProvisioningUI ui;
+
+ public QueryableRepositoryManager(ProvisioningUI ui, boolean includeDisabledRepos) {
+ this.includeDisabledRepos = includeDisabledRepos;
+ this.ui = ui;
+ this.tracker = ui.getRepositoryTracker();
+ this.session = ui.getSession();
+ repositoryFlags = getRepositoryFlags(tracker);
+ }
+
+ protected ProvisioningSession getSession() {
+ return session;
+ }
+
+ /**
+ * Iterates over the repositories configured in this queryable.
+ * For most queries, the query is run on each repository, passing any objects that satisfy the
+ * query.
+ * <p>
+ * This method is long-running; progress and cancellation are provided
+ * by the given progress monitor.
+ * </p>
+ *
+ * @param query The query to perform..
+ * @param monitor a progress monitor, or <code>null</code> if progress
+ * reporting is not desired
+ * @return The QueryResult argument
+ */
+ public IQueryResult<T> query(IQuery<T> query, IProgressMonitor monitor) {
+ IRepositoryManager<T> manager = getRepositoryManager();
+ if (monitor == null)
+ monitor = new NullProgressMonitor();
+ return query(getRepoLocations(manager), query, monitor);
+ }
+
+ public IQueryable<URI> locationsQueriable() {
+ return new IQueryable<URI>() {
+
+ public IQueryResult<URI> query(IQuery<URI> query, IProgressMonitor monitor) {
+ return query.perform(Arrays.asList(getRepoLocations(getRepositoryManager())).iterator());
+ }
+ };
+ }
+
+ protected URI[] getRepoLocations(IRepositoryManager<T> manager) {
+ Set<URI> locations = new HashSet<URI>();
+ locations.addAll(Arrays.asList(manager.getKnownRepositories(repositoryFlags)));
+ if (includeDisabledRepos) {
+ locations.addAll(Arrays.asList(manager.getKnownRepositories(IRepositoryManager.REPOSITORIES_DISABLED | repositoryFlags)));
+ }
+ return locations.toArray(new URI[locations.size()]);
+ }
+
+ /**
+ * Return a boolean indicating whether all the repositories that
+ * can be queried by the receiver are already loaded. If a repository
+ * is not loaded because it was not found, this will not return false,
+ * because this repository cannot be queried.
+ *
+ * @return <code>true</code> if all repositories to be queried by the
+ * receiver are loaded, <code>false</code> if they
+ * are not.
+ */
+ public boolean areRepositoriesLoaded() {
+ IRepositoryManager<T> mgr = getRepositoryManager();
+ if (mgr == null)
+ return false;
+ URI[] repoURIs = getRepoLocations(mgr);
+ for (int i = 0; i < repoURIs.length; i++) {
+ IRepository<T> repo = getRepository(mgr, repoURIs[i]);
+ // A not-loaded repo doesn't count if it's considered missing (not found)
+ if (repo == null && !tracker.hasNotFoundStatusBeenReported(repoURIs[i]))
+ return false;
+ }
+ return true;
+ }
+
+ protected abstract IRepository<T> getRepository(IRepositoryManager<T> manager, URI location);
+
+ protected IRepository<T> loadRepository(IRepositoryManager<T> manager, URI location, IProgressMonitor monitor) throws ProvisionException {
+ monitor.setTaskName(NLS.bind(ProvUIMessages.QueryableMetadataRepositoryManager_LoadRepositoryProgress, URIUtil.toUnencodedString(location)));
+ IRepository<T> repo = doLoadRepository(manager, location, monitor);
+ return repo;
+ }
+
+ /**
+ * Return the appropriate repository manager, or <code>null</code> if none could be found.
+ * @return the repository manager
+ */
+ protected abstract IRepositoryManager<T> getRepositoryManager();
+
+ /**
+ * Return the flags that should be used to access repositories given the
+ * manipulator.
+ */
+ protected abstract int getRepositoryFlags(RepositoryTracker repositoryManipulator);
+
+ /**
+ * Load the repository located at the specified location.
+ *
+ * @param manager the manager
+ * @param location the repository location
+ * @param monitor the progress monitor
+ * @return the repository that was loaded, or <code>null</code> if no repository could
+ * be found at that location.
+ */
+ protected abstract IRepository<T> doLoadRepository(IRepositoryManager<T> manager, URI location, IProgressMonitor monitor) throws ProvisionException;
+
+ protected IQueryResult<T> query(URI uris[], IQuery<T> query, IProgressMonitor monitor) {
+ SubMonitor sub = SubMonitor.convert(monitor, (uris.length + 1) * 100);
+ ArrayList<IRepository<T>> loadedRepos = new ArrayList<IRepository<T>>(uris.length);
+ for (int i = 0; i < uris.length; i++) {
+ IRepository<T> repo = null;
+ try {
+ repo = loadRepository(getRepositoryManager(), uris[i], sub.newChild(100));
+ } catch (ProvisionException e) {
+ tracker.reportLoadFailure(uris[i], e);
+ } catch (OperationCanceledException e) {
+ // user has canceled
+ repo = null;
+ }
+ if (repo != null)
+ loadedRepos.add(repo);
+ }
+ if (loadedRepos.size() > 0) {
+ return new CompoundQueryable<T>(loadedRepos).query(query, sub.newChild(100));
+ }
+ return Collector.emptyCollector();
+ }
+
+ public void setRespositoryFlags(int flags) {
+ this.repositoryFlags = flags;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/RepositoryLocationQuery.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/RepositoryLocationQuery.java
index e5398c4fd..778da7710 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/RepositoryLocationQuery.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/RepositoryLocationQuery.java
@@ -9,15 +9,13 @@
* IBM Corporation - initial API and implementation
******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui;
-
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.QueryHelpers;
+package org.eclipse.equinox.internal.p2.ui;
import java.net.URI;
import java.util.Iterator;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.Collector;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.Query;
-import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
+import org.eclipse.equinox.internal.p2.query.QueryHelpers;
+import org.eclipse.equinox.p2.query.*;
+import org.eclipse.equinox.p2.repository.IRepository;
/**
* RepositoryLocationQuery is a query that gathers repository
@@ -27,7 +25,7 @@ import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
*
* @since 3.5
*/
-public class RepositoryLocationQuery implements Query {
+public class RepositoryLocationQuery implements IQuery<URI> {
/**
* Gets the ID for this Query.
@@ -44,10 +42,8 @@ public class RepositoryLocationQuery implements Query {
return QueryHelpers.getProperty(this, property);
}
- /* (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.p2.query.Query#perform(java.util.Iterator, org.eclipse.equinox.internal.provisional.p2.query.Collector)
- */
- public Collector perform(Iterator iterator, Collector result) {
+ public IQueryResult<URI> perform(Iterator<URI> iterator) {
+ Collector<URI> result = new Collector<URI>();
while (iterator.hasNext()) {
Object candidate = iterator.next();
URI location = getLocation(candidate);
@@ -61,8 +57,8 @@ public class RepositoryLocationQuery implements Query {
private URI getLocation(Object o) {
if (o instanceof URI)
return (URI) o;
- if (o instanceof IRepository)
- return ((IRepository) o).getLocation();
+ if (o instanceof IRepository<?>)
+ return ((IRepository<?>) o).getLocation();
return null;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/BatchChangeBeginningEvent.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/RepositoryOperationBeginningEvent.java
index 012f9af78..66aca16db 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/BatchChangeBeginningEvent.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/RepositoryOperationBeginningEvent.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2008 IBM Corporation and others.
+ * Copyright (c) 2008, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -14,14 +14,13 @@ package org.eclipse.equinox.internal.p2.ui;
import java.util.EventObject;
/**
- *
- * Event used to signify that a batch change is about
- * to begin. We should ignore listeners until it is
- * done.
- *
- * @since 3.4
+ * Event used to signal that a repository operation is about
+ * to begin. This event can be used to ignore lower-level repository events
+ * until the operation is complete.
+ *
+ * @since 2.0
*/
-public class BatchChangeBeginningEvent extends EventObject {
+public class RepositoryOperationBeginningEvent extends EventObject {
private static final long serialVersionUID = -7529156836242774280L;
@@ -29,7 +28,7 @@ public class BatchChangeBeginningEvent extends EventObject {
* Construct a new instance of this event.
* @param source the source of the event
*/
- public BatchChangeBeginningEvent(Object source) {
+ public RepositoryOperationBeginningEvent(Object source) {
super(source);
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/RepositoryOperationEndingEvent.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/RepositoryOperationEndingEvent.java
new file mode 100644
index 000000000..ec3b13a91
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/RepositoryOperationEndingEvent.java
@@ -0,0 +1,79 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.internal.p2.ui;
+
+import java.util.EventObject;
+import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent;
+
+/**
+ * Event used to signal that a repository operation has completed.
+ *
+ * @since 2.0
+ */
+public class RepositoryOperationEndingEvent extends EventObject {
+
+ private static final long serialVersionUID = -4513769756968621852L;
+
+ /**
+ * A repository event describing the nature of the operation.
+ */
+ private RepositoryEvent event;
+
+ /**
+ * A boolean indicating whether the UI should be updated in response
+ * to this event.
+ */
+ private boolean update;
+
+ /**
+ * Construct a new instance of this event.
+ *
+ * @param source the source of the event
+ * @param update a boolean indicating whether the UI should be updated in response
+ * to this event.
+ * @param event a {@link RepositoryEvent} describing the underlying event, or <code>null</code>
+ * if no single event can describe the operation. This event may be used by clients to determine
+ * what should be updated after an operation completes.
+ */
+ public RepositoryOperationEndingEvent(Object source, boolean update, RepositoryEvent event) {
+ super(source);
+ this.update = update;
+ this.event = event;
+ }
+
+ /**
+ * Return a {@link RepositoryEvent} that reflects the operation that
+ * occurred. A <code>null</code> return value indicates that there
+ * was not a single underlying repository operation.
+ *
+ * @return the {@link RepositoryEvent} that was involved in the operation. May be
+ * <code>null</code>. This event may be used by clients to determine
+ * what should be updated after an operation completes.
+
+ */
+ public RepositoryEvent getEvent() {
+ return event;
+ }
+
+ /**
+ * Return a boolean that indicates whether the client should update the UI in response
+ * to this event.
+ * event.
+ *
+ * @return <code>true</code> if clients should update to reflect to this event, <code>false</code>
+ * if the client should ignore the entire operation.
+ */
+ public boolean update() {
+ return update;
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/SimpleLicenseManager.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/SimpleLicenseManager.java
deleted file mode 100644
index b92674ad8..000000000
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/SimpleLicenseManager.java
+++ /dev/null
@@ -1,120 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Genuitec, LLC - added license support
- *******************************************************************************/
-package org.eclipse.equinox.internal.p2.ui;
-
-import java.io.*;
-import java.math.BigInteger;
-import java.util.*;
-import javax.xml.parsers.*;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.metadata.ILicense;
-import org.eclipse.equinox.internal.provisional.p2.ui.IUPropertyUtils;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUI;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.LicenseManager;
-import org.eclipse.ui.statushandlers.StatusManager;
-import org.w3c.dom.*;
-import org.xml.sax.SAXException;
-
-/**
- * SimpleLicenseManager is a license manager that keeps track of
- * IInstallableUnit licenses by using the digests of the IU's licenses.
- * It can read and write its accepted list to a stream.
- *
- * @since 3.4
- */
-public class SimpleLicenseManager extends LicenseManager {
- java.util.Set accepted = new HashSet();
-
- public boolean accept(IInstallableUnit iu) {
- ILicense license = IUPropertyUtils.getLicense(iu);
- if (license != null)
- accepted.add(license.getDigest());
- return true;
- }
-
- public boolean reject(IInstallableUnit iu) {
- ILicense license = IUPropertyUtils.getLicense(iu);
- if (license != null)
- accepted.remove(license.getDigest());
- return true;
- }
-
- public boolean isAccepted(IInstallableUnit iu) {
- ILicense license = IUPropertyUtils.getLicense(iu);
- if (license == null)
- return true;
- return accepted.contains(license.getDigest());
- }
-
- public boolean hasAcceptedLicenses() {
- return !accepted.isEmpty();
- }
-
- public void read(InputStream stream) throws IOException {
- try {
- DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
- factory.setNamespaceAware(true);
- DocumentBuilder parser = factory.newDocumentBuilder();
- Document doc = parser.parse(stream);
- Node root = doc.getDocumentElement();
- processRoot(root, accepted);
- } catch (ParserConfigurationException e) {
- ProvUI.handleException(e, ProvUIMessages.ProvUILicenseManager_ParsingError, StatusManager.LOG);
- } catch (SAXException e) {
- ProvUI.handleException(e, ProvUIMessages.ProvUILicenseManager_ParsingError, StatusManager.LOG);
- }
- }
-
- public void write(OutputStream stream) throws IOException {
- OutputStreamWriter osw = null;
- PrintWriter writer = null;
- try {
- osw = new OutputStreamWriter(stream, "UTF8"); //$NON-NLS-1$
- writer = new PrintWriter(osw);
- writer.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>"); //$NON-NLS-1$
- writer.println("<licenses>"); //$NON-NLS-1$
- for (Iterator i = accepted.iterator(); i.hasNext();) {
- BigInteger digest = (BigInteger) i.next();
- writer.print(" " + "<license digest=\"" + digest.toString(16) + "\"/>"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
- }
- } finally {
- writer.println("</licenses>"); //$NON-NLS-1$
- writer.flush();
- writer.close();
- if (osw != null)
- osw.close();
- }
- }
-
- private void processRoot(Node root, Set licenses) {
- if (root.getNodeName().equals("licenses")) { //$NON-NLS-1$
- NodeList children = root.getChildNodes();
- processChildren(children, licenses);
- }
- }
-
- private void processChildren(NodeList children, Set licenses) {
- for (int i = 0; i < children.getLength(); i++) {
- Node child = children.item(i);
- if (child.getNodeType() == Node.ELEMENT_NODE) {
- if (child.getNodeName().equals("license")) { //$NON-NLS-1$
- NamedNodeMap atts = child.getAttributes();
- Node digestAtt = atts.getNamedItem("digest"); //$NON-NLS-1$
- if (digestAtt != null) {
- BigInteger digest = new BigInteger(digestAtt.getNodeValue(), 16);
- licenses.add(digest);
- }
- }
- }
- }
- }
-}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/UIRepositoryEvent.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/UIRepositoryEvent.java
deleted file mode 100644
index 2d4bea23c..000000000
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/UIRepositoryEvent.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.equinox.internal.p2.ui;
-
-import java.net.URI;
-import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent;
-
-/**
- * UIMetadataRepositoryEvent is used to distinguish those metadata repository
- * events of concern to the end user from those that are internal.
- * See https://bugs.eclipse.org/bugs/show_bug.cgi?id=236485
- *
- * @since 3.5
- *
- */
-public class UIRepositoryEvent extends RepositoryEvent {
-
- private static final long serialVersionUID = 820293103398960019L;
-
- /**
- * @param location
- */
- public UIRepositoryEvent(URI location, int type, int kind) {
- super(location, type, kind, true);
- }
-
-}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/UpdateManagerCompatibility.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/UpdateManagerCompatibility.java
index 651ccbb4e..20ae28288 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/UpdateManagerCompatibility.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/UpdateManagerCompatibility.java
@@ -8,22 +8,20 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui;
+package org.eclipse.equinox.internal.p2.ui;
import java.io.*;
import java.net.URI;
import java.net.URISyntaxException;
-import java.util.ArrayList;
+import java.util.Iterator;
import java.util.Vector;
import javax.xml.parsers.*;
import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
-import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
import org.eclipse.equinox.internal.p2.ui.model.MetadataRepositoryElement;
-import org.eclipse.equinox.internal.provisional.p2.director.ProvisioningPlan;
-import org.eclipse.equinox.internal.provisional.p2.engine.InstallableUnitOperand;
-import org.eclipse.equinox.internal.provisional.p2.engine.Operand;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.engine.IProvisioningPlan;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.query.InstallableUnitQuery;
+import org.eclipse.equinox.p2.query.IQueryResult;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.FileDialog;
@@ -44,7 +42,7 @@ public class UpdateManagerCompatibility {
private static final String ECLIPSE_INSTALL_HANDLER_PROP = "org.eclipse.update.installHandler"; //$NON-NLS-1$
private static final DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
- private static void parse(String fileName, Vector bookmarks) {
+ private static void parse(String fileName, Vector<MetadataRepositoryElement> bookmarks) {
File file = new File(fileName);
if (!file.exists())
return;
@@ -64,23 +62,18 @@ public class UpdateManagerCompatibility {
}
}
- private static MetadataRepositoryElement[] getSites(Vector bookmarks) {
- ArrayList result = new ArrayList();
- for (int i = 0; i < bookmarks.size(); i++) {
- if (bookmarks.get(i) instanceof MetadataRepositoryElement)
- result.add(bookmarks.get(i));
- }
- return (MetadataRepositoryElement[]) result.toArray(new MetadataRepositoryElement[result.size()]);
+ private static MetadataRepositoryElement[] getSites(Vector<MetadataRepositoryElement> bookmarks) {
+ return bookmarks.toArray(new MetadataRepositoryElement[bookmarks.size()]);
}
- private static void processRoot(Node root, Vector bookmarks) {
+ private static void processRoot(Node root, Vector<MetadataRepositoryElement> bookmarks) {
if (root.getNodeName().equals("bookmarks")) { //$NON-NLS-1$
NodeList children = root.getChildNodes();
processChildren(children, bookmarks);
}
}
- private static void processChildren(NodeList children, Vector bookmarks) {
+ private static void processChildren(NodeList children, Vector<MetadataRepositoryElement> bookmarks) {
for (int i = 0; i < children.getLength(); i++) {
Node child = children.item(i);
if (child.getNodeType() == Node.ELEMENT_NODE) {
@@ -93,7 +86,7 @@ public class UpdateManagerCompatibility {
}
}
- private static void createSite(Node child, Vector bookmarks) {
+ private static void createSite(Node child, Vector<MetadataRepositoryElement> bookmarks) {
URI uri = null;
try {
uri = URIUtil.fromString((getAttribute(child, "url"))); //$NON-NLS-1$
@@ -112,7 +105,7 @@ public class UpdateManagerCompatibility {
bookmarks.add(element);
}
- private static void createFolder(Node child, Vector bookmarks) {
+ private static void createFolder(Node child, Vector<MetadataRepositoryElement> bookmarks) {
if (child.hasChildNodes())
processChildren(child.getChildNodes(), bookmarks);
}
@@ -126,7 +119,7 @@ public class UpdateManagerCompatibility {
return ""; //$NON-NLS-1$
}
- private static void store(String fileName, Vector bookmarks) {
+ private static void store(String fileName, Vector<MetadataRepositoryElement> bookmarks) {
FileOutputStream fos = null;
OutputStreamWriter osw = null;
PrintWriter writer = null;
@@ -173,14 +166,12 @@ public class UpdateManagerCompatibility {
}
}
- public static boolean requiresInstallHandlerSupport(ProvisioningPlan plan) {
- Operand[] operands = plan.getOperands();
- for (int i = 0; i < operands.length; i++) {
- if (operands[i] instanceof InstallableUnitOperand) {
- IInstallableUnit iu = ((InstallableUnitOperand) operands[i]).second();
- if (iu != null && iu.getProperty(ECLIPSE_INSTALL_HANDLER_PROP) != null)
- return true;
- }
+ public static boolean requiresInstallHandlerSupport(IProvisioningPlan plan) {
+ IQueryResult<IInstallableUnit> result = plan.getAdditions().query(InstallableUnitQuery.ANY, null);
+ for (Iterator<IInstallableUnit> iterator = result.iterator(); iterator.hasNext();) {
+ IInstallableUnit iu = iterator.next();
+ if (iu != null && iu.getProperty(ECLIPSE_INSTALL_HANDLER_PROP) != null)
+ return true;
}
return false;
@@ -211,13 +202,13 @@ public class UpdateManagerCompatibility {
}
public static MetadataRepositoryElement[] readBookmarkFile(File file) {
- Vector bookmarks = new Vector();
+ Vector<MetadataRepositoryElement> bookmarks = new Vector<MetadataRepositoryElement>();
parse(file.getAbsolutePath(), bookmarks);
return getSites(bookmarks);
}
public static void writeBookmarkFile(String filename, MetadataRepositoryElement[] sites) {
- Vector bookmarks = new Vector(sites.length);
+ Vector<MetadataRepositoryElement> bookmarks = new Vector<MetadataRepositoryElement>(sites.length);
for (int i = 0; i < sites.length; i++)
bookmarks.add(sites[i]);
store(filename, bookmarks);
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/ValidationDialogServiceUI.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ValidationDialogServiceUI.java
index b83e7c36d..cd5a5f492 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/ValidationDialogServiceUI.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ValidationDialogServiceUI.java
@@ -8,17 +8,16 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui;
+package org.eclipse.equinox.internal.p2.ui;
import java.security.cert.Certificate;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
-import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
import org.eclipse.equinox.internal.p2.ui.dialogs.TrustCertificateDialog;
import org.eclipse.equinox.internal.p2.ui.dialogs.UserValidationDialog;
import org.eclipse.equinox.internal.p2.ui.viewers.CertificateLabelProvider;
import org.eclipse.equinox.internal.provisional.p2.core.IServiceUI;
+import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob;
import org.eclipse.jface.dialogs.ErrorDialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.viewers.*;
@@ -51,8 +50,6 @@ public class ValidationDialogServiceUI implements IServiceUI {
}
}
- public static final QualifiedName SUPPRESS_AUTHENTICATION_JOB_MARKER = new QualifiedName(ProvUIActivator.PLUGIN_ID, "SUPPRESS_AUTHENTICATION_REQUESTS"); //$NON-NLS-1$
-
/*
* (non-Javadoc)
* @see org.eclipse.equinox.internal.provisional.p2.core.IServiceUI#getUsernamePassword(java.lang.String)
@@ -79,7 +76,7 @@ public class ValidationDialogServiceUI implements IServiceUI {
private boolean suppressAuthentication() {
Job job = Job.getJobManager().currentJob();
if (job != null) {
- return job.getProperty(SUPPRESS_AUTHENTICATION_JOB_MARKER) != null;
+ return job.getProperty(LoadMetadataRepositoryJob.SUPPRESS_AUTHENTICATION_JOB_MARKER) != null;
}
return false;
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/actions/ColocatedRepositoryAction.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/ColocatedRepositoryAction.java
index 2dd1e6bcf..2bbcacca5 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/actions/ColocatedRepositoryAction.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/ColocatedRepositoryAction.java
@@ -9,38 +9,30 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.actions;
+package org.eclipse.equinox.internal.p2.ui.actions;
import java.net.URI;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.equinox.internal.p2.ui.model.MetadataRepositoryElement;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvisioningOperationRunner;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningOperation;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.ui.statushandlers.StatusManager;
public abstract class ColocatedRepositoryAction extends ProvisioningAction {
- public ColocatedRepositoryAction(String label, String tooltipText, ISelectionProvider selectionProvider) {
- super(label, selectionProvider);
+ public ColocatedRepositoryAction(ProvisioningUI ui, String label, String tooltipText, ISelectionProvider selectionProvider) {
+ super(ui, label, selectionProvider);
setToolTipText(tooltipText);
init();
}
- public void run() {
- ProvisioningOperationRunner.schedule(getOperation(), StatusManager.SHOW | StatusManager.LOG);
- }
-
- protected abstract ProvisioningOperation getOperation();
-
protected URI[] getSelectedLocations(Object[] selectionArray) {
- List urls = new ArrayList();
+ List<URI> urls = new ArrayList<URI>();
for (int i = 0; i < selectionArray.length; i++) {
if (selectionArray[i] instanceof MetadataRepositoryElement)
urls.add(((MetadataRepositoryElement) selectionArray[i]).getLocation());
}
- return (URI[]) urls.toArray(new URI[urls.size()]);
+ return urls.toArray(new URI[urls.size()]);
}
protected void checkEnablement(Object[] selectionArray) {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/actions/ExistingIUInProfileAction.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/ExistingIUInProfileAction.java
index 7ee6d03cd..6f2431b0e 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/actions/ExistingIUInProfileAction.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/ExistingIUInProfileAction.java
@@ -9,15 +9,16 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.actions;
+package org.eclipse.equinox.internal.p2.ui.actions;
+import org.eclipse.equinox.internal.p2.ui.ProvUI;
import org.eclipse.equinox.internal.p2.ui.model.IIUElement;
-import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUI;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.InstalledIUElement;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
+import org.eclipse.equinox.internal.p2.ui.model.InstalledIUElement;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.query.InstallableUnitQuery;
+import org.eclipse.equinox.p2.query.PipedQuery;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
import org.eclipse.jface.viewers.ISelectionProvider;
/**
@@ -31,46 +32,33 @@ import org.eclipse.jface.viewers.ISelectionProvider;
*/
public abstract class ExistingIUInProfileAction extends ProfileModificationAction {
- private String lastValidatedProfileId;
-
- public ExistingIUInProfileAction(String label, Policy policy, ISelectionProvider selectionProvider, String profileId) {
- super(policy, label, selectionProvider, profileId);
+ public ExistingIUInProfileAction(ProvisioningUI ui, String label, ISelectionProvider selectionProvider, String profileId) {
+ super(ui, label, selectionProvider, profileId);
}
protected boolean isEnabledFor(Object[] selectionArray) {
Object parent = null;
- lastValidatedProfileId = null;
// We don't want to prompt for a profile during validation,
// so we only consider the profile id that was set, or the profile
// referred to by the element itself..
- IProfile profile = getProfile(false);
+ IProfile profile = getProfile();
if (selectionArray.length > 0) {
for (int i = 0; i < selectionArray.length; i++) {
if (selectionArray[i] instanceof InstalledIUElement) {
InstalledIUElement element = (InstalledIUElement) selectionArray[i];
- // If we couldn't find a profile in the action itself, check the element's queryable
- if (profile == null) {
- IQueryable queryable = element.getQueryable();
- if (queryable instanceof IProfile) {
- profile = (IProfile) queryable;
- lastValidatedProfileId = profile.getProfileId();
- } else
- return false;
- }
// If the parents are different, then they are either from
// different profiles or are nested in different parts of the tree.
// Either way, this makes the selection invalid.
if (parent == null) {
parent = element.getParent(element);
} else if (parent != element.getParent(element)) {
- lastValidatedProfileId = null;
return false;
}
// Now consider the validity of the element on its own
if (!isSelectable(element.getIU(), profile))
return false;
} else {
- IInstallableUnit iu = (IInstallableUnit) ProvUI.getAdapter(selectionArray[i], IInstallableUnit.class);
+ IInstallableUnit iu = ProvUI.getAdapter(selectionArray[i], IInstallableUnit.class);
if (iu == null || !isSelectable(iu))
return false;
}
@@ -85,7 +73,7 @@ public abstract class ExistingIUInProfileAction extends ProfileModificationActio
return false;
Object parent = element.getParent(element);
if (parent != null) {
- IProfile profile = (IProfile) ProvUI.getAdapter(parent, IProfile.class);
+ IProfile profile = ProvUI.getAdapter(parent, IProfile.class);
if (profile != null)
return isSelectable(element.getIU(), profile);
}
@@ -95,34 +83,14 @@ public abstract class ExistingIUInProfileAction extends ProfileModificationActio
protected boolean isSelectable(IInstallableUnit iu) {
if (!super.isSelectable(iu))
return false;
- IProfile profile = getProfile(false);
- if (profile != null) {
- return isSelectable(iu, profile);
- }
- return false;
+ return isSelectable(iu, getProfile());
}
private boolean isSelectable(IInstallableUnit iu, IProfile profile) {
int lock = getLock(profile, iu);
if ((lock & getLockConstant()) == getLockConstant())
return false;
- String propName = getPolicy().getQueryContext().getVisibleInstalledIUProperty();
- if (propName != null && getProfileProperty(profile, iu, propName) == null) {
- return false;
- }
- return true;
- }
-
- /*
- * Overridden to consider the profile parent of the elements
- * if one was not specified in the actions.
- * (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.p2.ui.actions.ProfileModificationAction#getProfileId(boolean)
- */
- protected String getProfileId(boolean chooseProfile) {
- if (profileId == null && lastValidatedProfileId != null)
- return lastValidatedProfileId;
- return super.getProfileId(chooseProfile);
+ return !profile.query(new PipedQuery<IInstallableUnit>(new InstallableUnitQuery(iu), getPolicy().getVisibleInstalledIUQuery()), null).isEmpty();
}
protected abstract int getLockConstant();
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/InstallAction.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/InstallAction.java
new file mode 100644
index 000000000..c74f19f66
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/InstallAction.java
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.internal.p2.ui.actions;
+
+import org.eclipse.equinox.internal.p2.ui.ProvUI;
+import org.eclipse.equinox.internal.p2.ui.model.*;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.operations.InstallOperation;
+import org.eclipse.equinox.p2.operations.ProfileChangeOperation;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
+import org.eclipse.jface.viewers.ISelectionProvider;
+
+public class InstallAction extends ProfileModificationAction {
+
+ public InstallAction(ProvisioningUI ui, ISelectionProvider selectionProvider, String profileId) {
+ super(ui, ProvUI.INSTALL_COMMAND_LABEL, selectionProvider, profileId);
+ setToolTipText(ProvUI.INSTALL_COMMAND_TOOLTIP);
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.equinox.internal.provisional.p2.ui.actions.ProfileModificationAction#isEnabledFor(java.lang.Object[])
+ */
+ protected boolean isEnabledFor(Object[] selectionArray) {
+ if (selectionArray.length == 0)
+ return false;
+ // We allow non-IU's to be selected at this point, but there
+ // must be at least one installable unit selected that is
+ // selectable
+ for (int i = 0; i < selectionArray.length; i++) {
+ if (selectionArray[i] instanceof InstalledIUElement && isSelectable((IIUElement) selectionArray[i]))
+ return true;
+ IInstallableUnit iu = ProvUI.getAdapter(selectionArray[i], IInstallableUnit.class);
+ if (iu != null && isSelectable(iu))
+ return true;
+ }
+ return false;
+ }
+
+ /*
+ * Overridden to reject categories and nested IU's (parent is a non-category IU)
+ * (non-Javadoc)
+ * @see org.eclipse.equinox.internal.provisional.p2.ui.actions.ProfileModificationAction#isSelectable(org.eclipse.equinox.internal.p2.ui.model.IUElement)
+ */
+ protected boolean isSelectable(IIUElement element) {
+ return super.isSelectable(element) && !(element.getParent(element) instanceof AvailableIUElement);
+ }
+
+ protected int performAction(ProfileChangeOperation operation, IInstallableUnit[] ius) {
+ return getProvisioningUI().openInstallWizard(getShell(), ius, (InstallOperation) operation, null);
+ }
+
+ protected ProfileChangeOperation getProfileChangeOperation(IInstallableUnit[] ius) {
+ InstallOperation op = new InstallOperation(getSession(), ius);
+ op.setProfileId(profileId);
+ // op.setRootMarkerKey(getPolicy().getQueryContext().getVisibleInstalledIUProperty());
+ return op;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/ProfileModificationAction.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/ProfileModificationAction.java
new file mode 100644
index 000000000..70b4ba85d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/ProfileModificationAction.java
@@ -0,0 +1,212 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.internal.p2.ui.actions;
+
+import org.eclipse.equinox.p2.ui.LicenseManager;
+
+import java.util.ArrayList;
+import java.util.List;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.JobChangeAdapter;
+import org.eclipse.equinox.internal.p2.ui.*;
+import org.eclipse.equinox.internal.p2.ui.model.CategoryElement;
+import org.eclipse.equinox.internal.p2.ui.model.IIUElement;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.operations.ProfileChangeOperation;
+import org.eclipse.equinox.p2.operations.ProvisioningJob;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
+import org.eclipse.jface.viewers.ISelectionProvider;
+import org.eclipse.jface.window.Window;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.statushandlers.StatusManager;
+
+public abstract class ProfileModificationAction extends ProvisioningAction {
+ public static final int ACTION_NOT_RUN = -1;
+ String profileId;
+ String userChosenProfileId;
+ int result = ACTION_NOT_RUN;
+
+ protected ProfileModificationAction(ProvisioningUI ui, String text, ISelectionProvider selectionProvider, String profileId) {
+ super(ui, text, selectionProvider);
+ this.ui = ui;
+ this.profileId = profileId;
+ init();
+ }
+
+ public void run() {
+ IInstallableUnit[] ius = getSelectedIUs();
+ // No ius or no profile?
+ if (profileId == null || ius.length == 0) {
+ ProvUI.reportStatus(getNoProfileOrSelectionStatus(profileId, ius), StatusManager.BLOCK);
+ runCanceled();
+ return;
+ }
+ run(ius, profileId);
+ }
+
+ public IProfile getProfile() {
+ String id = profileId == null ? ui.getProfileId() : profileId;
+ return ui.getSession().getProfileRegistry().getProfile(id);
+ }
+
+ protected IStatus getNoProfileOrSelectionStatus(String id, IInstallableUnit[] ius) {
+ return new Status(IStatus.WARNING, ProvUIActivator.PLUGIN_ID, NLS.bind(ProvUIMessages.ProfileModificationAction_InvalidSelections, id, new Integer(ius.length)));
+ }
+
+ protected abstract ProfileChangeOperation getProfileChangeOperation(IInstallableUnit[] ius);
+
+ protected void run(final IInstallableUnit[] ius, final String id) {
+ final ProfileChangeOperation operation = getProfileChangeOperation(ius);
+ ProvisioningJob job = operation.getResolveJob(null);
+ if (job == null) {
+ ProvUI.reportStatus(operation.getResolutionResult(), StatusManager.SHOW);
+ } else {
+ job.addJobChangeListener(new JobChangeAdapter() {
+ public void done(IJobChangeEvent event) {
+
+ if (PlatformUI.isWorkbenchRunning()) {
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ if (validateOperation(operation))
+ performAction(operation, ius);
+ userChosenProfileId = null;
+ }
+ });
+ }
+
+ }
+
+ });
+ getProvisioningUI().schedule(job, StatusManager.SHOW | StatusManager.LOG);
+ }
+ // Since we are resolving asynchronously, our job is done. Setting this allows
+ // callers to decide to close the launching window.
+ // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=236495
+ result = Window.OK;
+ }
+
+ /**
+ * Get the integer return code returned by any wizards launched by this
+ * action. If the action has not been run, return ACTION_NOT_RUN. If the
+ * action does not open a wizard, return Window.OK if the operation was performed,
+ * and Window.CANCEL if it was canceled.
+ *
+ * @return integer return code
+ */
+ public int getReturnCode() {
+ return result;
+ }
+
+ /**
+ * Validate the operation and return true if the operation should
+ * be performed with plan. Report any errors to the user before returning false.
+ * @param operation
+ * @return a boolean indicating whether the operation should be used in a
+ * provisioning operation.
+ */
+ protected boolean validateOperation(ProfileChangeOperation operation) {
+ if (operation != null) {
+ return getPolicy().continueWorkingWithOperation(operation, getShell());
+ }
+ return false;
+ }
+
+ protected abstract int performAction(ProfileChangeOperation operation, IInstallableUnit[] ius);
+
+ protected IInstallableUnit getIU(Object element) {
+ return ProvUI.getAdapter(element, IInstallableUnit.class);
+
+ }
+
+ /**
+ * Return an array of the selected and valid installable units.
+ * The number of IInstallableUnits in the array may be different than
+ * the actual number of selections in the action's selection provider.
+ * That is, if the action is disabled due to invalid selections,
+ * this method will return those selections that were valid.
+ *
+ * @return an array of selected IInstallableUnit that meet the
+ * enablement criteria for the action.
+ */
+ protected IInstallableUnit[] getSelectedIUs() {
+ List<?> elements = getStructuredSelection().toList();
+ List<IInstallableUnit> iusList = new ArrayList<IInstallableUnit>(elements.size());
+
+ for (int i = 0; i < elements.size(); i++) {
+ if (elements.get(i) instanceof IIUElement) {
+ IIUElement element = (IIUElement) elements.get(i);
+ if (isSelectable(element))
+ iusList.add(getIU(element));
+ } else {
+ IInstallableUnit iu = ProvUI.getAdapter(elements.get(i), IInstallableUnit.class);
+ if (iu != null && isSelectable(iu))
+ iusList.add(iu);
+ }
+ }
+ return iusList.toArray(new IInstallableUnit[iusList.size()]);
+ }
+
+ protected boolean isSelectable(IIUElement element) {
+ return !(element instanceof CategoryElement);
+ }
+
+ protected boolean isSelectable(IInstallableUnit iu) {
+ return !ProvUI.isCategory(iu);
+ }
+
+ protected LicenseManager getLicenseManager() {
+ return getProvisioningUI().getLicenseManager();
+ }
+
+ protected QueryProvider getQueryProvider() {
+ return ProvUI.getQueryProvider();
+ }
+
+ protected final void checkEnablement(Object[] selections) {
+ if (isEnabledFor(selections)) {
+ setEnabled(!getProvisioningUI().hasScheduledOperations());
+ } else
+ setEnabled(false);
+ }
+
+ protected abstract boolean isEnabledFor(Object[] selections);
+
+ protected int getLock(IProfile profile, IInstallableUnit iu) {
+ if (profile == null)
+ return IProfile.LOCK_NONE;
+ try {
+ String value = profile.getInstallableUnitProperty(iu, IProfile.PROP_PROFILE_LOCKED_IU);
+ if (value != null)
+ return Integer.parseInt(value);
+ } catch (NumberFormatException e) {
+ // ignore and assume no lock
+ }
+ return IProfile.LOCK_NONE;
+ }
+
+ protected String getProfileProperty(IProfile profile, IInstallableUnit iu, String propertyName) {
+ if (profile == null || iu == null)
+ return null;
+ return profile.getInstallableUnitProperty(iu, propertyName);
+ }
+
+ private void runCanceled() {
+ // The action was canceled, do any cleanup needed before
+ // it is run again.
+ userChosenProfileId = null;
+ result = Window.CANCEL;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/actions/PropertyDialogAction.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/PropertyDialogAction.java
index 917fd0253..b521e1796 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/actions/PropertyDialogAction.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/PropertyDialogAction.java
@@ -9,7 +9,7 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.actions;
+package org.eclipse.equinox.internal.p2.ui.actions;
import org.eclipse.jface.viewers.*;
import org.eclipse.jface.window.IShellProvider;
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/actions/ProvisioningAction.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/ProvisioningAction.java
index 315116440..00a40e2d9 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/actions/ProvisioningAction.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/ProvisioningAction.java
@@ -9,17 +9,22 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.actions;
+package org.eclipse.equinox.internal.p2.ui.actions;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUI;
+import org.eclipse.equinox.internal.p2.ui.ProvUI;
+import org.eclipse.equinox.p2.operations.ProvisioningSession;
+import org.eclipse.equinox.p2.ui.Policy;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
import org.eclipse.jface.viewers.*;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.actions.SelectionProviderAction;
public abstract class ProvisioningAction extends SelectionProviderAction {
+ ProvisioningUI ui;
- protected ProvisioningAction(String text, ISelectionProvider selectionProvider) {
+ protected ProvisioningAction(ProvisioningUI ui, String text, ISelectionProvider selectionProvider) {
super(selectionProvider, text);
+ this.ui = ui;
}
/*
@@ -71,4 +76,16 @@ public abstract class ProvisioningAction extends SelectionProviderAction {
selectionChanged(selection);
}
}
+
+ protected ProvisioningSession getSession() {
+ return ui.getSession();
+ }
+
+ protected Policy getPolicy() {
+ return ui.getPolicy();
+ }
+
+ protected ProvisioningUI getProvisioningUI() {
+ return ui;
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/actions/RefreshAction.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/RefreshAction.java
index 95d52276c..d3061acaf 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/actions/RefreshAction.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/RefreshAction.java
@@ -9,9 +9,10 @@
* IBM Corporation - initial API and implementation
******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.actions;
+package org.eclipse.equinox.internal.p2.ui.actions;
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.KeyAdapter;
@@ -26,8 +27,8 @@ public abstract class RefreshAction extends ProvisioningAction {
/**
*/
- public RefreshAction(ISelectionProvider selectionProvider, Control control) {
- super(ProvUIMessages.RefreshAction_Label, selectionProvider);
+ public RefreshAction(ProvisioningUI ui, ISelectionProvider selectionProvider, Control control) {
+ super(ui, ProvUIMessages.RefreshAction_Label, selectionProvider);
setToolTipText(ProvUIMessages.RefreshAction_Tooltip);
hookKeyListener(control);
init();
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/actions/RemoveColocatedRepositoryAction.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/RemoveColocatedRepositoryAction.java
index 00e008ce6..f794bb9a6 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/actions/RemoveColocatedRepositoryAction.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/RemoveColocatedRepositoryAction.java
@@ -9,21 +9,20 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.actions;
+package org.eclipse.equinox.internal.p2.ui.actions;
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningOperation;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.RemoveColocatedRepositoryOperation;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
import org.eclipse.jface.viewers.ISelectionProvider;
public class RemoveColocatedRepositoryAction extends ColocatedRepositoryAction {
- public RemoveColocatedRepositoryAction(ISelectionProvider selectionProvider) {
- super(ProvUIMessages.RemoveColocatedRepositoryAction_Label, ProvUIMessages.RemoveColocatedRepositoryAction_Tooltip, selectionProvider);
+ public RemoveColocatedRepositoryAction(ProvisioningUI ui, ISelectionProvider selectionProvider) {
+ super(ui, ProvUIMessages.RemoveColocatedRepositoryAction_Label, ProvUIMessages.RemoveColocatedRepositoryAction_Tooltip, selectionProvider);
}
- protected ProvisioningOperation getOperation() {
- return new RemoveColocatedRepositoryOperation(ProvUIMessages.RemoveColocatedRepositoryAction_OperationLabel, getSelectedLocations(getStructuredSelection().toArray()));
+ public void run() {
+ ui.getRepositoryTracker().removeRepositories(getSelectedLocations(getStructuredSelection().toArray()), ui.getSession());
}
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/UninstallAction.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/UninstallAction.java
new file mode 100644
index 000000000..6ee186140
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/UninstallAction.java
@@ -0,0 +1,54 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.internal.p2.ui.actions;
+
+import org.eclipse.equinox.internal.p2.ui.ProvUI;
+import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.operations.ProfileChangeOperation;
+import org.eclipse.equinox.p2.operations.UninstallOperation;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
+import org.eclipse.jface.viewers.ISelectionProvider;
+
+public class UninstallAction extends ExistingIUInProfileAction {
+
+ public UninstallAction(ProvisioningUI ui, ISelectionProvider selectionProvider, String profileId) {
+ super(ui, ProvUI.UNINSTALL_COMMAND_LABEL, selectionProvider, profileId);
+ setToolTipText(ProvUI.UNINSTALL_COMMAND_TOOLTIP);
+ }
+
+ protected String getTaskName() {
+ return ProvUIMessages.UninstallIUProgress;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.internal.provisional.p2.ui.actions.AlterExistingProfileIUAction#getLockConstant()
+ */
+ protected int getLockConstant() {
+ return IProfile.LOCK_UNINSTALL;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.internal.p2.ui.actions.ProfileModificationAction#getProfileChangeOperation(org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit[])
+ */
+ protected ProfileChangeOperation getProfileChangeOperation(IInstallableUnit[] ius) {
+ return ui.getUninstallOperation(ius, null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.internal.p2.ui.actions.ProfileModificationAction#performAction(org.eclipse.equinox.p2.operations.ProfileChangeOperation, org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit[])
+ */
+ protected int performAction(ProfileChangeOperation operation, IInstallableUnit[] ius) {
+ return ui.openUninstallWizard(getShell(), ius, (UninstallOperation) operation, null);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/UpdateAction.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/UpdateAction.java
new file mode 100644
index 000000000..4b848e5f8
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/actions/UpdateAction.java
@@ -0,0 +1,70 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.internal.p2.ui.actions;
+
+import java.util.ArrayList;
+import org.eclipse.equinox.internal.p2.ui.ProvUI;
+import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
+import org.eclipse.equinox.internal.p2.ui.model.IUElementListRoot;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.operations.ProfileChangeOperation;
+import org.eclipse.equinox.p2.operations.UpdateOperation;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
+import org.eclipse.jface.viewers.ISelectionProvider;
+
+public class UpdateAction extends ExistingIUInProfileAction {
+
+ protected IUElementListRoot root; // root that will be used to seed the wizard
+ protected ArrayList<?> initialSelections; // the elements that should be selected in the wizard
+ boolean resolveIsVisible = true;
+ boolean skipSelectionPage = false;
+
+ public UpdateAction(ProvisioningUI ui, ISelectionProvider selectionProvider, String profileId, boolean resolveIsVisible) {
+ super(ui, ProvUI.UPDATE_COMMAND_LABEL, selectionProvider, profileId);
+ setToolTipText(ProvUI.UPDATE_COMMAND_TOOLTIP);
+ this.resolveIsVisible = resolveIsVisible;
+ }
+
+ public void setSkipSelectionPage(boolean skipSelectionPage) {
+ this.skipSelectionPage = skipSelectionPage;
+ }
+
+ protected String getTaskName() {
+ return ProvUIMessages.UpdateIUProgress;
+ }
+
+ protected boolean isResolveUserVisible() {
+ return resolveIsVisible;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.internal.provisional.p2.ui.actions.AlterExistingProfileIUAction#getLockConstant()
+ */
+ protected int getLockConstant() {
+ return IProfile.LOCK_UPDATE;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.internal.p2.ui.actions.ProfileModificationAction#getProfileChangeOperation(org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit[])
+ */
+ protected ProfileChangeOperation getProfileChangeOperation(IInstallableUnit[] ius) {
+ return ui.getUpdateOperation(ius, null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.internal.p2.ui.actions.ProfileModificationAction#performAction(org.eclipse.equinox.p2.operations.ProfileChangeOperation, org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit[])
+ */
+ protected int performAction(ProfileChangeOperation operation, IInstallableUnit[] ius) {
+ return ui.openUpdateWizard(getShell(), skipSelectionPage, (UpdateOperation) operation, null);
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/AddRepositoryDialog.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AddRepositoryDialog.java
index a659f749c..4f3fc876d 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/AddRepositoryDialog.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AddRepositoryDialog.java
@@ -8,19 +8,17 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.dialogs;
+package org.eclipse.equinox.internal.p2.ui.dialogs;
import java.net.URI;
import java.net.URISyntaxException;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.URIUtil;
import org.eclipse.equinox.internal.p2.repository.helpers.RepositoryHelper;
+import org.eclipse.equinox.internal.p2.ui.IProvHelpContextIds;
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.p2.ui.dialogs.RepositoryNameAndLocationDialog;
-import org.eclipse.equinox.internal.provisional.p2.ui.IProvHelpContextIds;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvisioningOperationRunner;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.AddRepositoryOperation;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
+import org.eclipse.equinox.p2.ui.Policy;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.SWT;
@@ -30,7 +28,6 @@ import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.statushandlers.StatusManager;
/**
* Abstract dialog class for adding repositories of different types. This class
@@ -42,16 +39,14 @@ import org.eclipse.ui.statushandlers.StatusManager;
*/
public abstract class AddRepositoryDialog extends RepositoryNameAndLocationDialog {
- Button okButton;
- Text url, nickname;
URI addedLocation;
static final String[] ARCHIVE_EXTENSIONS = new String[] {"*.jar;*.zip"}; //$NON-NLS-1$
static String lastLocalLocation = null;
static String lastArchiveLocation = null;
Policy policy;
- public AddRepositoryDialog(Shell parentShell, Policy policy) {
- super(parentShell, policy);
+ public AddRepositoryDialog(Shell parentShell, ProvisioningUI ui) {
+ super(parentShell, ui);
setTitle(ProvUIMessages.AddRepositoryDialog_Title);
PlatformUI.getWorkbench().getHelpSystem().setHelp(parentShell, IProvHelpContextIds.ADD_REPOSITORY_DIALOG);
}
@@ -141,23 +136,11 @@ public abstract class AddRepositoryDialog extends RepositoryNameAndLocationDialo
IStatus status = validateRepositoryURL(false);
if (status.isOK()) {
addedLocation = getUserLocation();
- AddRepositoryOperation op = getOperation(addedLocation);
String nick = nickname.getText().trim();
- if (nick.length() > 0)
- op.setNicknames(new String[] {nick});
- ProvisioningOperationRunner.schedule(op, StatusManager.SHOW | StatusManager.LOG);
+ if (nick.length() == 0)
+ nick = null;
+ getRepositoryTracker().addRepository(addedLocation, nick, getProvisioningUI().getSession());
}
return status;
}
-
- /**
- * Get an add operation appropriate for this dialog. The default behavior
- * is to retrieve it from the policy, but subclasses may override.
- *
- * @param repositoryLocation to be added
- * @return the add operation
- */
- protected AddRepositoryOperation getOperation(URI repositoryLocation) {
- return getRepositoryManipulator().getAddOperation(repositoryLocation);
- }
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ApplyProfileChangesDialog.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ApplyProfileChangesDialog.java
index 9e8eb8411..57cd024cf 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ApplyProfileChangesDialog.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ApplyProfileChangesDialog.java
@@ -29,7 +29,7 @@ public class ApplyProfileChangesDialog extends MessageDialog {
public static final int PROFILE_APPLYCHANGES = 1;
public static final int PROFILE_RESTART = 2;
private final static String[] yesNo = new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL};
- private final static String[] yesNoApply = new String[] {IDialogConstants.YES_LABEL, IDialogConstants.NO_LABEL, ProvUIMessages.ApplyProfileChangesDialog_ApplyChanges};
+ private final static String[] yesNoApply = new String[] {ProvUIMessages.ApplyProfileChangesDialog_Restart, ProvUIMessages.ApplyProfileChangesDialog_NotYet, ProvUIMessages.ApplyProfileChangesDialog_ApplyChanges};
private int returnCode = PROFILE_IGNORE;
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/AvailableIUGroup.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUGroup.java
index 3dfae1d29..1a9eae71b 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/AvailableIUGroup.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUGroup.java
@@ -8,28 +8,22 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.dialogs;
+package org.eclipse.equinox.internal.p2.ui.dialogs;
+
+import org.eclipse.equinox.p2.core.ProvisionException;
import java.net.URI;
import java.util.ArrayList;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.*;
import org.eclipse.equinox.internal.p2.ui.*;
-import org.eclipse.equinox.internal.p2.ui.dialogs.*;
import org.eclipse.equinox.internal.p2.ui.model.*;
-import org.eclipse.equinox.internal.p2.ui.viewers.DeferredQueryContentProvider;
-import org.eclipse.equinox.internal.p2.ui.viewers.IUDetailsLabelProvider;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
+import org.eclipse.equinox.internal.p2.ui.query.IUViewQueryContext;
+import org.eclipse.equinox.internal.p2.ui.viewers.*;
import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent;
-import org.eclipse.equinox.internal.provisional.p2.ui.*;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.IRepositoryElement;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.MetadataRepositories;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.IUViewQueryContext;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
-import org.eclipse.equinox.internal.provisional.p2.ui.viewers.*;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.repository.IRepositoryManager;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
import org.eclipse.jface.viewers.*;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
@@ -70,17 +64,17 @@ public class AvailableIUGroup extends StructuredIUGroup {
*/
public static final int AVAILABLE_SPECIFIED = 4;
- QueryableMetadataRepositoryManager queryableManager;
-
IUViewQueryContext queryContext;
int filterConstant = AVAILABLE_ALL;
URI repositoryFilter;
+ QueryableMetadataRepositoryManager queryableManager;
// We restrict the type of the filter used because PatternFilter does
// unnecessary accesses of children that cause problems with the deferred
// tree.
AvailableIUPatternFilter filter;
private boolean useBold = false;
private IUDetailsLabelProvider labelProvider;
+ private int repoFlags;
Display display;
DelayedFilterCheckboxTree filteredTree;
Job lastRequestedLoadJob;
@@ -92,8 +86,8 @@ public class AvailableIUGroup extends StructuredIUGroup {
*
* @param parent the parent composite for the group
*/
- public AvailableIUGroup(final Composite parent) {
- this(Policy.getDefault(), parent, parent.getFont(), null, null, getDefaultColumnConfig(), AVAILABLE_ALL);
+ public AvailableIUGroup(ProvisioningUI ui, final Composite parent) {
+ this(ui, parent, parent.getFont(), null, getDefaultColumnConfig(), AVAILABLE_ALL);
}
private static IUColumnConfig[] getDefaultColumnConfig() {
@@ -106,29 +100,25 @@ public class AvailableIUGroup extends StructuredIUGroup {
/**
* Create a group that represents the available IU's.
*
- * @param policy the policy to use for deciding what should be shown
+ * @param ui the policy to use for deciding what should be shown
* @param parent the parent composite for the group
* @param font The font to use for calculating pixel sizes. This font is
* not managed by the receiver.
- * @param queryable the queryable repository manager that should be used. Used
- * by clients who want to preload repositories.
* @param queryContext the IUViewQueryContext that determines additional
* information about what is shown, such as the visible repositories
* @param columnConfig the description of the columns that should be shown. If <code>null</code>, a default
* will be used.
* @param filterConstant a constant specifying which repositories are used when showing content
*/
- public AvailableIUGroup(Policy policy, final Composite parent, Font font, QueryableMetadataRepositoryManager queryable, IUViewQueryContext queryContext, IUColumnConfig[] columnConfig, int filterConstant) {
- super(policy, parent, font, columnConfig);
+ public AvailableIUGroup(ProvisioningUI ui, final Composite parent, Font font, IUViewQueryContext queryContext, IUColumnConfig[] columnConfig, int filterConstant) {
+ super(ui, parent, font, columnConfig);
this.display = parent.getDisplay();
if (queryContext == null)
- this.queryContext = policy.getQueryContext();
+ this.queryContext = ProvUI.getQueryContext(getPolicy());
else
this.queryContext = queryContext;
- if (queryable == null)
- this.queryableManager = new QueryableMetadataRepositoryManager(this.queryContext, false);
- else
- this.queryableManager = queryable;
+ repoFlags = ui.getRepositoryTracker().getMetadataRepositoryFlags();
+ this.queryableManager = new QueryableMetadataRepositoryManager(ui, false);
this.filterConstant = filterConstant;
this.filter = new AvailableIUPatternFilter(getColumnConfig());
this.filter.setIncludeLeadingWildcard(true);
@@ -179,14 +169,6 @@ public class AvailableIUGroup extends StructuredIUGroup {
final StructuredViewerProvisioningListener listener = new StructuredViewerProvisioningListener(availableIUViewer, ProvUIProvisioningListener.PROV_EVENT_METADATA_REPOSITORY) {
protected void repositoryAdded(final RepositoryEvent event) {
- // Only make the repo visible if the UI triggered this event.
- // This allows us to ignore the addition of system repositories, as
- // well as recognize specifically a user-add that resulted in
- // the enablement of a repository.
- // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=248989
- if (!(event instanceof UIRepositoryEvent)) {
- return;
- }
makeRepositoryVisible(event.getRepositoryLocation());
}
@@ -227,7 +209,7 @@ public class AvailableIUGroup extends StructuredIUGroup {
Object getNewInput() {
if (repositoryFilter != null) {
- return new MetadataRepositoryElement(queryContext, getPolicy(), repositoryFilter, true);
+ return new MetadataRepositoryElement(queryContext, getProvisioningUI(), repositoryFilter, true);
} else if (filterConstant == AVAILABLE_NONE) {
// Dummy object that explains empty site list
return new ProvElement(null) {
@@ -235,8 +217,8 @@ public class AvailableIUGroup extends StructuredIUGroup {
String description;
String name;
int severity;
- if (getPolicy().getRepositoryManipulator() == null) {
- // shouldn't get here ideally. No sites and no way to add.
+ if (!getPolicy().getRepositoriesVisible()) {
+ // shouldn't get here ideally. No sites and no way to add any.
severity = IStatus.ERROR;
name = ProvUIMessages.AvailableIUGroup_NoSitesConfiguredExplanation;
description = ProvUIMessages.AvailableIUGroup_NoSitesConfiguredDescription;
@@ -254,8 +236,8 @@ public class AvailableIUGroup extends StructuredIUGroup {
}
};
} else {
- queryableManager.setQueryContext(queryContext);
- return new MetadataRepositories(queryContext, getPolicy(), queryableManager);
+ queryableManager.setRespositoryFlags(repoFlags);
+ return new MetadataRepositories(queryContext, getProvisioningUI(), queryableManager);
}
}
@@ -298,7 +280,7 @@ public class AvailableIUGroup extends StructuredIUGroup {
// overridden to weed out non-IU elements, such as repositories or empty explanations
public Object[] getSelectedIUElements() {
Object[] elements = ((IStructuredSelection) viewer.getSelection()).toArray();
- ArrayList list = new ArrayList(elements.length);
+ ArrayList<Object> list = new ArrayList<Object>(elements.length);
for (int i = 0; i < elements.length; i++)
if (ElementUtils.getIU(elements[i]) != null)
list.add(elements[i]);
@@ -317,15 +299,15 @@ public class AvailableIUGroup extends StructuredIUGroup {
Object[] selections = filteredTree.getCheckboxTreeViewer().getCheckedElements();
if (selections.length == 0)
return new IInstallableUnit[0];
- ArrayList leaves = new ArrayList(selections.length);
+ ArrayList<IInstallableUnit> leaves = new ArrayList<IInstallableUnit>(selections.length);
for (int i = 0; i < selections.length; i++) {
if (!getCheckboxTreeViewer().getGrayed(selections[i])) {
- IInstallableUnit iu = (IInstallableUnit) ProvUI.getAdapter(selections[i], IInstallableUnit.class);
- if (iu != null && !ProvisioningUtil.isCategory(iu) && !leaves.contains(iu))
+ IInstallableUnit iu = ProvUI.getAdapter(selections[i], IInstallableUnit.class);
+ if (iu != null && !ProvUI.isCategory(iu) && !leaves.contains(iu))
leaves.add(iu);
}
}
- return (IInstallableUnit[]) leaves.toArray(new IInstallableUnit[leaves.size()]);
+ return leaves.toArray(new IInstallableUnit[leaves.size()]);
}
public Tree getTree() {
@@ -340,10 +322,19 @@ public class AvailableIUGroup extends StructuredIUGroup {
void makeRepositoryVisible(final URI location) {
// If we are viewing by anything other than site, there is no specific way
// to make a repo visible.
- if (!(queryContext.getViewType() == IUViewQueryContext.AVAILABLE_VIEW_BY_REPO))
+ if (!(queryContext.getViewType() == IUViewQueryContext.AVAILABLE_VIEW_BY_REPO)) {
+ if (Display.getCurrent() == null)
+ display.asyncExec(new Runnable() {
+ public void run() {
+ updateAvailableViewState();
+ }
+ });
+ else
+ updateAvailableViewState();
return;
+ }
// First reset the input so that the new repo shows up
- display.asyncExec(new Runnable() {
+ Runnable runnable = new Runnable() {
public void run() {
final TreeViewer treeViewer = filteredTree.getViewer();
final Tree tree = treeViewer.getTree();
@@ -354,15 +345,18 @@ public class AvailableIUGroup extends StructuredIUGroup {
updateAvailableViewState();
}
}
- });
-
+ };
+ if (Display.getCurrent() == null)
+ display.asyncExec(runnable);
+ else
+ runnable.run();
// We don't know if loading will be a fast or slow operation.
// We do it in a job to be safe, and when it's done, we update
// the UI.
Job job = new Job(NLS.bind(ProvUIMessages.AvailableIUGroup_LoadingRepository, URIUtil.toUnencodedString(location))) {
protected IStatus run(IProgressMonitor monitor) {
try {
- ProvisioningUtil.loadMetadataRepository(location, monitor);
+ getProvisioningUI().loadMetadataRepository(location, true, monitor);
return Status.OK_STATUS;
} catch (ProvisionException e) {
return e.getStatus();
@@ -465,11 +459,11 @@ public class AvailableIUGroup extends StructuredIUGroup {
case AVAILABLE_ALL :
case AVAILABLE_NONE :
repositoryFilter = null;
- queryContext.setMetadataRepositoryFlags(queryContext.getMetadataRepositoryFlags() & ~IRepositoryManager.REPOSITORIES_LOCAL);
+ repoFlags &= ~IRepositoryManager.REPOSITORIES_LOCAL;
break;
case AVAILABLE_LOCAL :
repositoryFilter = null;
- queryContext.setMetadataRepositoryFlags(queryContext.getMetadataRepositoryFlags() | IRepositoryManager.REPOSITORIES_LOCAL);
+ repoFlags |= IRepositoryManager.REPOSITORIES_LOCAL;
break;
default :
repositoryFilter = repoLocation;
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUPatternFilter.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUPatternFilter.java
index 90d29f16b..502f86aeb 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUPatternFilter.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUPatternFilter.java
@@ -12,9 +12,8 @@ package org.eclipse.equinox.internal.p2.ui.dialogs;
import org.eclipse.equinox.internal.p2.ui.model.CategoryElement;
import org.eclipse.equinox.internal.p2.ui.model.IIUElement;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.ui.IUPropertyUtils;
-import org.eclipse.equinox.internal.provisional.p2.ui.viewers.IUColumnConfig;
+import org.eclipse.equinox.internal.p2.ui.viewers.IUColumnConfig;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.ui.dialogs.PatternFilter;
@@ -91,7 +90,7 @@ public class AvailableIUPatternFilter extends PatternFilter {
IInstallableUnit iu = ((IIUElement) element).getIU();
if (checkName) {
// Get the iu name in the default locale
- text = IUPropertyUtils.getIUProperty(iu, IInstallableUnit.PROP_NAME);
+ text = iu.getProperty(IInstallableUnit.PROP_NAME, null);
if (text != null && wordMatches(text))
return true;
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUsPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUsPage.java
index 5abc0cfc7..fee436ce4 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUsPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/AvailableIUsPage.java
@@ -12,18 +12,13 @@
package org.eclipse.equinox.internal.p2.ui.dialogs;
import java.net.URI;
-import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
-import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
+import org.eclipse.equinox.internal.p2.ui.*;
import org.eclipse.equinox.internal.p2.ui.model.EmptyElementExplanation;
-import org.eclipse.equinox.internal.p2.ui.viewers.IUDetailsLabelProvider;
-import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningContext;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.ui.*;
-import org.eclipse.equinox.internal.provisional.p2.ui.dialogs.*;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.IUViewQueryContext;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
-import org.eclipse.equinox.internal.provisional.p2.ui.viewers.IUColumnConfig;
-import org.eclipse.equinox.internal.provisional.p2.ui.viewers.StructuredViewerProvisioningListener;
+import org.eclipse.equinox.internal.p2.ui.query.IUViewQueryContext;
+import org.eclipse.equinox.internal.p2.ui.viewers.*;
+import org.eclipse.equinox.p2.engine.ProvisioningContext;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.IDialogConstants;
@@ -50,10 +45,7 @@ public class AvailableIUsPage extends ProvisioningWizardPage implements ISelecta
private static final String DETAILS_WEIGHT = "AvailableDetailsSashWeight"; //$NON-NLS-1$
private static final String LINKACTION = "linkAction"; //$NON-NLS-1$
- String profileId;
- Policy policy;
Object[] initialSelections;
- QueryableMetadataRepositoryManager manager;
IUViewQueryContext queryContext;
AvailableIUGroup availableIUGroup;
Composite availableIUButtonBar;
@@ -67,11 +59,8 @@ public class AvailableIUsPage extends ProvisioningWizardPage implements ISelecta
RepositorySelectionGroup repoSelector;
IUDetailsGroup iuDetailsGroup;
- public AvailableIUsPage(Policy policy, String profileId, QueryableMetadataRepositoryManager manager) {
- super("AvailableSoftwarePage"); //$NON-NLS-1$
- this.policy = policy;
- this.profileId = profileId;
- this.manager = manager;
+ public AvailableIUsPage(ProvisioningUI ui, ProvisioningOperationWizard wizard) {
+ super("AvailableSoftwarePage", ui, wizard); //$NON-NLS-1$
makeQueryContext();
setTitle(ProvUIMessages.AvailableIUsPage_Title);
setDescription(ProvUIMessages.AvailableIUsPage_Description);
@@ -103,15 +92,15 @@ public class AvailableIUsPage extends ProvisioningWizardPage implements ISelecta
sashForm.setLayoutData(data);
// Now the available group
- // If we have a repository manipulator, we want to default to showing no repos. Otherwise all.
+ // If repositories are visible, we want to default to showing no repos. Otherwise all.
int filterConstant = AvailableIUGroup.AVAILABLE_NONE;
- if (policy.getRepositoryManipulator() == null)
+ if (!getPolicy().getRepositoriesVisible())
filterConstant = AvailableIUGroup.AVAILABLE_ALL;
nameColumn = new IUColumnConfig(ProvUIMessages.ProvUI_NameColumnTitle, IUColumnConfig.COLUMN_NAME, ILayoutConstants.DEFAULT_PRIMARY_COLUMN_WIDTH + 15);
versionColumn = new IUColumnConfig(ProvUIMessages.ProvUI_VersionColumnTitle, IUColumnConfig.COLUMN_VERSION, ILayoutConstants.DEFAULT_COLUMN_WIDTH);
getColumnWidthsFromSettings();
- availableIUGroup = new AvailableIUGroup(policy, sashForm, JFaceResources.getDialogFont(), manager, queryContext, new IUColumnConfig[] {nameColumn, versionColumn}, filterConstant);
+ availableIUGroup = new AvailableIUGroup(getProvisioningUI(), sashForm, JFaceResources.getDialogFont(), queryContext, new IUColumnConfig[] {nameColumn, versionColumn}, filterConstant);
// Selection listeners must be registered on both the normal selection
// events and the check mark events. Must be done after buttons
@@ -216,7 +205,7 @@ public class AvailableIUsPage extends ProvisioningWizardPage implements ISelecta
}, ProvUIMessages.AvailableIUsPage_GotoInstallInfo);
installLink.setLayoutData(gd);
- if (policy.getRepositoryManipulator() != null) {
+ if (getPolicy().getRepositoriesVisible()) {
// Checkbox
resolveAllCheckbox = new Button(parent, SWT.CHECK);
resolveAllCheckbox.setText(ProvUIMessages.AvailableIUsPage_ResolveAllCheckbox);
@@ -229,8 +218,8 @@ public class AvailableIUsPage extends ProvisioningWizardPage implements ISelecta
private void createRepoArea(Composite parent) {
// Site controls are only available if a repository manipulator
// is specified.
- if (policy.getRepositoryManipulator() != null) {
- repoSelector = new RepositorySelectionGroup(getContainer(), parent, policy, queryContext);
+ if (getPolicy().getRepositoriesVisible()) {
+ repoSelector = new RepositorySelectionGroup(getProvisioningUI(), getContainer(), parent, queryContext);
repoSelector.addRepositorySelectionListener(new IRepositorySelectionListener() {
public void repositorySelectionChanged(int repoChoice, URI repoLocation) {
repoComboSelectionChanged(repoChoice, repoLocation);
@@ -256,10 +245,10 @@ public class AvailableIUsPage extends ProvisioningWizardPage implements ISelecta
void updateQueryContext() {
queryContext.setShowLatestVersionsOnly(showLatestVersionsCheckbox.getSelection());
if (hideInstalledCheckbox.getSelection())
- queryContext.hideAlreadyInstalled(profileId);
+ queryContext.hideAlreadyInstalled(getProfileId());
else {
queryContext.showAlreadyInstalled();
- queryContext.setInstalledProfileId(profileId);
+ queryContext.setInstalledProfileId(getProfileId());
}
if (useCategoriesCheckbox.getSelection())
queryContext.setViewType(IUViewQueryContext.AVAILABLE_VIEW_BY_CATEGORY);
@@ -293,10 +282,10 @@ public class AvailableIUsPage extends ProvisioningWizardPage implements ISelecta
}
private void setDropTarget(Control control) {
- if (policy.getRepositoryManipulator() != null) {
+ if (getPolicy().getRepositoriesVisible()) {
DropTarget target = new DropTarget(control, DND.DROP_MOVE | DND.DROP_COPY | DND.DROP_LINK);
target.setTransfer(new Transfer[] {URLTransfer.getInstance(), FileTransfer.getInstance()});
- target.addDropListener(new RepositoryManipulatorDropTarget(policy.getRepositoryManipulator(), control));
+ target.addDropListener(new RepositoryManipulatorDropTarget(getProvisioningUI(), control));
}
}
@@ -342,18 +331,14 @@ public class AvailableIUsPage extends ProvisioningWizardPage implements ISelecta
private void makeQueryContext() {
// Make a local query context that is based on the default.
- IUViewQueryContext defaultQueryContext = policy.getQueryContext();
+ IUViewQueryContext defaultQueryContext = ProvUI.getQueryContext(getPolicy());
queryContext = new IUViewQueryContext(defaultQueryContext.getViewType());
- queryContext.setArtifactRepositoryFlags(defaultQueryContext.getArtifactRepositoryFlags());
- queryContext.setMetadataRepositoryFlags(defaultQueryContext.getMetadataRepositoryFlags());
if (defaultQueryContext.getHideAlreadyInstalled()) {
- queryContext.hideAlreadyInstalled(profileId);
+ queryContext.hideAlreadyInstalled(getProfileId());
} else {
- queryContext.setInstalledProfileId(profileId);
+ queryContext.setInstalledProfileId(getProfileId());
}
queryContext.setShowLatestVersionsOnly(defaultQueryContext.getShowLatestVersionsOnly());
- queryContext.setVisibleAvailableIUProperty(defaultQueryContext.getVisibleAvailableIUProperty());
- queryContext.setVisibleInstalledIUProperty(defaultQueryContext.getVisibleInstalledIUProperty());
// Now check for saved away dialog settings
IDialogSettings settings = ProvUIActivator.getDefault().getDialogSettings();
IDialogSettings section = settings.getSection(DIALOG_SETTINGS_SECTION);
@@ -377,9 +362,9 @@ public class AvailableIUsPage extends ProvisioningWizardPage implements ISelecta
// Hide installed content
boolean hideContent = section.getBoolean(HIDE_INSTALLED_IUS);
if (hideContent)
- queryContext.hideAlreadyInstalled(profileId);
+ queryContext.hideAlreadyInstalled(getProfileId());
else {
- queryContext.setInstalledProfileId(profileId);
+ queryContext.setInstalledProfileId(getProfileId());
queryContext.showAlreadyInstalled();
}
}
@@ -459,11 +444,11 @@ public class AvailableIUsPage extends ProvisioningWizardPage implements ISelecta
IInstallableUnit[] selected = getSelectedIUs();
if (selected.length == 1) {
StringBuffer result = new StringBuffer();
- String description = IUPropertyUtils.getIUProperty(selected[0], IInstallableUnit.PROP_DESCRIPTION);
+ String description = selected[0].getProperty(IInstallableUnit.PROP_DESCRIPTION, null);
if (description != null) {
result.append(description);
} else {
- String name = IUPropertyUtils.getIUProperty(selected[0], IInstallableUnit.PROP_NAME);
+ String name = selected[0].getProperty(IInstallableUnit.PROP_NAME, null);
if (name != null)
result.append(name);
else
@@ -547,8 +532,8 @@ public class AvailableIUsPage extends ProvisioningWizardPage implements ISelecta
}
protected void profileChanged(String id) {
- if (id.equals(profileId)) {
- asyncRefresh();
+ if (id.equals(getProfileId())) {
+ safeRefresh();
}
}
};
@@ -572,7 +557,7 @@ public class AvailableIUsPage extends ProvisioningWizardPage implements ISelecta
public ProvisioningContext getProvisioningContext() {
// If the user can't manipulate repos, always resolve against everything
- if (policy.getRepositoryManipulator() == null || repoSelector == null) {
+ if (!getPolicy().getRepositoriesVisible() || repoSelector == null) {
return new ProvisioningContext();
}
// Consult the checkbox to see if we should resolve against everything,
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ComboAutoCompleteField.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ComboAutoCompleteField.java
index 34cb29a84..62d1124ee 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ComboAutoCompleteField.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ComboAutoCompleteField.java
@@ -54,7 +54,7 @@ public class ComboAutoCompleteField {
if (contents.length() == 0 || items.length == 0)
return new IContentProposal[0];
StringMatcher matcher = new StringMatcher("*" + contents + "*", true, false); //$NON-NLS-1$ //$NON-NLS-2$
- ArrayList matches = new ArrayList();
+ ArrayList<String> matches = new ArrayList<String>();
for (int i = 0; i < items.length; i++)
if (matcher.match(items[i]))
matches.add(items[i]);
@@ -63,7 +63,7 @@ public class ComboAutoCompleteField {
// what is in the combo. This prevents the popup from
// opening when the user is merely scrolling through the combo values or
// has accepted a combo value.
- if (matches.size() == 1 && ((String) matches.get(0)).equals(combo.getText()))
+ if (matches.size() == 1 && matches.get(0).equals(combo.getText()))
return new IContentProposal[0];
if (matches.isEmpty())
@@ -72,7 +72,7 @@ public class ComboAutoCompleteField {
// Make the proposals
IContentProposal[] proposals = new IContentProposal[matches.size()];
for (int i = 0; i < matches.size(); i++) {
- final String proposal = (String) matches.get(i);
+ final String proposal = matches.get(i);
proposals[i] = new IContentProposal() {
public String getContent() {
@@ -367,7 +367,7 @@ public class ComboAutoCompleteField {
}
}
- Vector temp = new Vector();
+ Vector<String> temp = new Vector<String>();
int pos = 0;
StringBuffer buf = new StringBuffer();
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ContainerCheckedTreeViewer.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ContainerCheckedTreeViewer.java
index b130cf45b..fef8274d3 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ContainerCheckedTreeViewer.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ContainerCheckedTreeViewer.java
@@ -52,7 +52,7 @@ import org.eclipse.swt.widgets.*;
public class ContainerCheckedTreeViewer extends CheckboxTreeViewer {
private boolean rippleCheckMarks = true;
- private ArrayList savedCheckState;
+ private ArrayList<Object> savedCheckState;
/**
* Constructor for ContainerCheckedTreeViewer.
@@ -219,7 +219,7 @@ public class ContainerCheckedTreeViewer extends CheckboxTreeViewer {
public Object[] getCheckedElements() {
Object[] checked = super.getCheckedElements();
// add all items that are children of a checked node but not created yet
- ArrayList result = new ArrayList();
+ ArrayList<Object> result = new ArrayList<Object>();
for (int i = 0; i < checked.length; i++) {
Object curr = checked[i];
result.add(curr);
@@ -241,7 +241,7 @@ public class ContainerCheckedTreeViewer extends CheckboxTreeViewer {
* @param element
* @param result
*/
- private void collectChildren(Object element, ArrayList result) {
+ private void collectChildren(Object element, ArrayList<Object> result) {
Object[] filteredChildren = getFilteredChildren(element);
for (int i = 0; i < filteredChildren.length; i++) {
Object curr = filteredChildren[i];
@@ -276,7 +276,7 @@ public class ContainerCheckedTreeViewer extends CheckboxTreeViewer {
// problem.
private void saveCheckedState() {
Object[] checked = getCheckedElements();
- savedCheckState = new ArrayList(checked.length);
+ savedCheckState = new ArrayList<Object>(checked.length);
for (int i = 0; i < checked.length; i++)
if (!isExpandable(checked[i]) && !getGrayed(checked[i]))
savedCheckState.add(checked[i]);
@@ -288,7 +288,7 @@ public class ContainerCheckedTreeViewer extends CheckboxTreeViewer {
setGrayedElements(new Object[0]);
Object element = null;
// We are assuming that once a leaf, always a leaf.
- Iterator iter = savedCheckState.iterator();
+ Iterator<Object> iter = savedCheckState.iterator();
while (iter.hasNext()) {
element = iter.next();
setChecked(element, true);
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/CopyHandler.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/CopyHandler.java
index 1337a8d73..65025680f 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/CopyHandler.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/CopyHandler.java
@@ -13,6 +13,7 @@ package org.eclipse.equinox.internal.p2.ui.dialogs;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.equinox.p2.ui.ICopyable;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.ISources;
import org.eclipse.ui.handlers.HandlerUtil;
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/CopyPopup.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/CopyPopup.java
index 98cf8248a..daa80f769 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/CopyPopup.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/CopyPopup.java
@@ -11,6 +11,7 @@
package org.eclipse.equinox.internal.p2.ui.dialogs;
+import org.eclipse.equinox.p2.ui.ICopyable;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionEvent;
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/CopyUtils.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/CopyUtils.java
index b34874a66..d3e03e5e9 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/CopyUtils.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/CopyUtils.java
@@ -14,6 +14,7 @@ package org.eclipse.equinox.internal.p2.ui.dialogs;
import org.eclipse.core.expressions.*;
import org.eclipse.equinox.internal.p2.ui.model.ProvElement;
import org.eclipse.equinox.internal.p2.ui.viewers.IUDetailsLabelProvider;
+import org.eclipse.equinox.p2.ui.ICopyable;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.widgets.Control;
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/DelayedFilterCheckboxTree.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/DelayedFilterCheckboxTree.java
index 56de63a8d..7ab3f775d 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/DelayedFilterCheckboxTree.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/DelayedFilterCheckboxTree.java
@@ -11,14 +11,12 @@
package org.eclipse.equinox.internal.p2.ui.dialogs;
import java.util.*;
-import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.*;
-import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.p2.ui.model.QueriedElement;
+import org.eclipse.equinox.internal.p2.ui.model.RootElement;
import org.eclipse.equinox.internal.p2.ui.viewers.DeferredQueryContentProvider;
import org.eclipse.equinox.internal.p2.ui.viewers.IInputChangeListener;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvisioningOperationRunner;
-import org.eclipse.equinox.internal.provisional.p2.ui.QueryableMetadataRepositoryManager;
+import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
import org.eclipse.jface.viewers.*;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
@@ -39,7 +37,6 @@ import org.eclipse.ui.progress.WorkbenchJob;
*/
public class DelayedFilterCheckboxTree extends FilteredTree {
- private static final String LOAD_JOB_NAME = ProvUIMessages.DeferredFetchFilteredTree_RetrievingList;
private static final long FILTER_DELAY = 400;
ToolBar toolBar;
@@ -51,8 +48,8 @@ public class DelayedFilterCheckboxTree extends FilteredTree {
WorkbenchJob filterJob;
boolean ignoreFiltering = true;
Object viewerInput;
- ArrayList checkState = new ArrayList();
- Set expanded = new HashSet();
+ ArrayList<Object> checkState = new ArrayList<Object>();
+ Set<Object> expanded = new HashSet<Object>();
ContainerCheckedTreeViewer checkboxViewer;
public DelayedFilterCheckboxTree(Composite parent, int treeStyle, PatternFilter filter) {
@@ -69,10 +66,8 @@ public class DelayedFilterCheckboxTree extends FilteredTree {
// We use an additive check state cache so we need to remove
// previously checked items if the user unchecked them.
if (!event.getChecked() && checkState != null) {
- Iterator iter = checkState.iterator();
- ArrayList toRemove = new ArrayList(1);
- while (iter.hasNext()) {
- Object element = iter.next();
+ ArrayList<Object> toRemove = new ArrayList<Object>(1);
+ for (Object element : checkState) {
if (checkboxViewer.getComparer().equals(element, event.getElement())) {
toRemove.add(element);
// Do not break out of the loop. We may have duplicate equal
@@ -122,6 +117,8 @@ public class DelayedFilterCheckboxTree extends FilteredTree {
checkboxViewer.getTree().setRedraw(false);
display.asyncExec(new Runnable() {
public void run() {
+ if (checkboxViewer.getTree().isDisposed())
+ return;
rememberExpansions();
restoreLeafCheckState();
rememberExpansions();
@@ -195,6 +192,9 @@ public class DelayedFilterCheckboxTree extends FilteredTree {
if (event.getResult().isOK()) {
display.asyncExec(new Runnable() {
public void run() {
+ if (checkboxViewer.getTree().isDisposed())
+ return;
+
checkboxViewer.getTree().setRedraw(false);
// remember things expanded by the filter
rememberExpansions();
@@ -214,22 +214,12 @@ public class DelayedFilterCheckboxTree extends FilteredTree {
void scheduleLoadJob() {
if (loadJob != null)
return;
- loadJob = new Job(LOAD_JOB_NAME) {
- protected IStatus run(IProgressMonitor monitor) {
- QueryableMetadataRepositoryManager q = null;
- if (viewerInput instanceof QueryableMetadataRepositoryManager)
- q = (QueryableMetadataRepositoryManager) viewerInput;
- else if (viewerInput instanceof QueriedElement && ((QueriedElement) viewerInput).getQueryable() instanceof QueryableMetadataRepositoryManager)
- q = (QueryableMetadataRepositoryManager) ((QueriedElement) viewerInput).getQueryable();
- if (q != null) {
- q.loadAll(monitor);
- q.reportAccumulatedStatus();
- }
- if (monitor.isCanceled())
- return Status.CANCEL_STATUS;
- return Status.OK_STATUS;
- }
- };
+ ProvisioningUI ui;
+ if (viewerInput instanceof RootElement)
+ ui = ((RootElement) viewerInput).getProvisioningUI();
+ else
+ ui = ProvisioningUI.getDefaultUI();
+ loadJob = new LoadMetadataRepositoryJob(ui);
loadJob.addJobChangeListener(new JobChangeAdapter() {
public void done(IJobChangeEvent event) {
if (event.getResult().isOK()) {
@@ -243,9 +233,6 @@ public class DelayedFilterCheckboxTree extends FilteredTree {
});
loadJob.setSystem(true);
loadJob.setUser(false);
- // Telling the operation runner about it ensures that listeners know we are running
- // a provisioning-related job.
- ProvisioningOperationRunner.manageJob(loadJob);
loadJob.schedule();
}
@@ -267,7 +254,7 @@ public class DelayedFilterCheckboxTree extends FilteredTree {
ContainerCheckedTreeViewer v = (ContainerCheckedTreeViewer) getViewer();
Object[] checked = v.getCheckedElements();
if (checkState == null)
- checkState = new ArrayList(checked.length);
+ checkState = new ArrayList<Object>(checked.length);
for (int i = 0; i < checked.length; i++)
if (!v.getGrayed(checked[i]) && contentProvider.getChildren(checked[i]).length == 0)
if (!checkState.contains(checked[i]))
@@ -284,7 +271,7 @@ public class DelayedFilterCheckboxTree extends FilteredTree {
checkboxViewer.setGrayedElements(new Object[0]);
// Now we are only going to set the check state of the leaf nodes
// and rely on our container checked code to update the parents properly.
- Iterator iter = checkState.iterator();
+ Iterator<Object> iter = checkState.iterator();
Object element = null;
if (iter.hasNext())
checkboxViewer.expandAll();
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/IRepositorySelectionListener.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IRepositorySelectionListener.java
index acbcdfaa6..fdbdd1925 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/IRepositorySelectionListener.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IRepositorySelectionListener.java
@@ -8,7 +8,7 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.dialogs;
+package org.eclipse.equinox.internal.p2.ui.dialogs;
import java.net.URI;
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IResolutionErrorReportingPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IResolutionErrorReportingPage.java
index 7c38efd84..9b62a6c30 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IResolutionErrorReportingPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IResolutionErrorReportingPage.java
@@ -11,8 +11,8 @@
package org.eclipse.equinox.internal.p2.ui.dialogs;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.IUElementListRoot;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.PlannerResolutionOperation;
+import org.eclipse.equinox.internal.p2.ui.model.IUElementListRoot;
+import org.eclipse.equinox.p2.operations.ProfileChangeOperation;
/**
*
@@ -23,5 +23,5 @@ import org.eclipse.equinox.internal.provisional.p2.ui.operations.PlannerResoluti
*
*/
public interface IResolutionErrorReportingPage extends ISelectableIUsPage {
- public void updateStatus(IUElementListRoot root, PlannerResolutionOperation resolvedOperation);
+ public void updateStatus(IUElementListRoot root, ProfileChangeOperation operation);
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/IUCopyrightPropertyPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IUCopyrightPropertyPage.java
index e53b5cf0e..6eebf3e56 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/IUCopyrightPropertyPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IUCopyrightPropertyPage.java
@@ -8,15 +8,13 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.dialogs;
+package org.eclipse.equinox.internal.p2.ui.dialogs;
import java.net.MalformedURLException;
import org.eclipse.core.runtime.URIUtil;
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.p2.ui.dialogs.IUPropertyPage;
-import org.eclipse.equinox.internal.provisional.p2.metadata.ICopyright;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.ui.IUPropertyUtils;
+import org.eclipse.equinox.p2.metadata.ICopyright;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
@@ -34,7 +32,7 @@ public class IUCopyrightPropertyPage extends IUPropertyPage {
protected Control createIUPage(Composite parent, IInstallableUnit iu) {
// Get the copyright in the current locale
- final ICopyright copyright = IUPropertyUtils.getCopyright(iu);
+ final ICopyright copyright = iu.getCopyright(null);
if (copyright != null && copyright.getBody().length() > 0) {
Composite composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IUDetailsGroup.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IUDetailsGroup.java
index 733c36c4b..8ae5ffefb 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IUDetailsGroup.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IUDetailsGroup.java
@@ -11,7 +11,7 @@
package org.eclipse.equinox.internal.p2.ui.dialogs;
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.provisional.p2.ui.actions.PropertyDialogAction;
+import org.eclipse.equinox.internal.p2.ui.actions.PropertyDialogAction;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/IUGeneralInfoPropertyPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IUGeneralInfoPropertyPage.java
index adafc76ac..cca891543 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/IUGeneralInfoPropertyPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IUGeneralInfoPropertyPage.java
@@ -8,14 +8,12 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.dialogs;
+package org.eclipse.equinox.internal.p2.ui.dialogs;
import java.net.MalformedURLException;
import java.net.URL;
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.p2.ui.dialogs.IUPropertyPage;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.ui.IUPropertyUtils;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
@@ -54,17 +52,17 @@ public class IUGeneralInfoPropertyPage extends IUPropertyPage {
composite.setLayout(layout);
composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
// Get general info in the default locale
- addField(composite, ProvUIMessages.IUGeneralInfoPropertyPage_NameLabel, IUPropertyUtils.getIUProperty(iu, IInstallableUnit.PROP_NAME));
+ addField(composite, ProvUIMessages.IUGeneralInfoPropertyPage_NameLabel, iu.getProperty(IInstallableUnit.PROP_NAME, null));
addField(composite, ProvUIMessages.IUGeneralInfoPropertyPage_IdentifierLabel, iu.getId());
addField(composite, ProvUIMessages.IUGeneralInfoPropertyPage_VersionLabel, iu.getVersion().toString());
- addField(composite, ProvUIMessages.IUGeneralInfoPropertyPage_ProviderLabel, IUPropertyUtils.getIUProperty(iu, IInstallableUnit.PROP_PROVIDER));
- addField(composite, ProvUIMessages.IUGeneralInfoPropertyPage_ContactLabel, IUPropertyUtils.getIUProperty(iu, IInstallableUnit.PROP_CONTACT));
+ addField(composite, ProvUIMessages.IUGeneralInfoPropertyPage_ProviderLabel, iu.getProperty(IInstallableUnit.PROP_PROVIDER, null));
+ addField(composite, ProvUIMessages.IUGeneralInfoPropertyPage_ContactLabel, iu.getProperty(IInstallableUnit.PROP_CONTACT, null));
}
private void createDescriptionSection(Composite parent, IInstallableUnit iu) {
// Get the iu description in the default locale
- String description = IUPropertyUtils.getIUProperty(iu, IInstallableUnit.PROP_DESCRIPTION);
+ String description = iu.getProperty(IInstallableUnit.PROP_DESCRIPTION, null);
if (description != null && description.length() > 0) {
Group group = new Group(parent, SWT.NONE);
group.setText(ProvUIMessages.IUGeneralInfoPropertyPage_DescriptionLabel);
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/IULicensePropertyPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IULicensePropertyPage.java
index 01d06465f..685e654c0 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/IULicensePropertyPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IULicensePropertyPage.java
@@ -8,14 +8,13 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.dialogs;
+package org.eclipse.equinox.internal.p2.ui.dialogs;
+
+import org.eclipse.equinox.p2.metadata.ILicense;
import org.eclipse.core.runtime.URIUtil;
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.p2.ui.dialogs.IUPropertyPage;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.metadata.ILicense;
-import org.eclipse.equinox.internal.provisional.p2.ui.IUPropertyUtils;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
@@ -33,8 +32,11 @@ public class IULicensePropertyPage extends IUPropertyPage {
protected Control createIUPage(Composite parent, IInstallableUnit iu) {
// Get the license in the default locale
- final ILicense license = IUPropertyUtils.getLicense(iu);
- if (license != null && license.getBody().length() > 0) {
+ ILicense[] licenses = iu.getLicenses(null);
+ final ILicense license;
+ //FIXME
+ if (licenses.length > 0 && licenses[0].getBody() != null && licenses[0].getBody().length() > 0) {
+ license = licenses[0];
Composite composite = new Composite(parent, SWT.NONE);
GridLayout layout = new GridLayout();
layout.marginWidth = 0;
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IUPropertyPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IUPropertyPage.java
index 4c1a33c53..5109868fd 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IUPropertyPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/IUPropertyPage.java
@@ -11,9 +11,9 @@
package org.eclipse.equinox.internal.p2.ui.dialogs;
import java.net.URL;
+import org.eclipse.equinox.internal.p2.ui.ProvUI;
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUI;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.FontMetrics;
@@ -35,7 +35,7 @@ public abstract class IUPropertyPage extends PropertyPage {
protected Control createContents(Composite parent) {
noDefaultAndApplyButton();
- IInstallableUnit iu = (IInstallableUnit) ProvUI.getAdapter(getElement(), IInstallableUnit.class);
+ IInstallableUnit iu = ProvUI.getAdapter(getElement(), IInstallableUnit.class);
Control control;
if (iu == null) {
Label label = new Label(parent, SWT.DEFAULT);
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/InstallWizard.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/InstallWizard.java
new file mode 100644
index 000000000..1bf65a96d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/InstallWizard.java
@@ -0,0 +1,144 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.ui.dialogs;
+
+import org.eclipse.equinox.internal.p2.ui.model.AvailableIUElement;
+
+import java.util.ArrayList;
+import org.eclipse.equinox.internal.p2.ui.ProvUIImages;
+import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
+import org.eclipse.equinox.internal.p2.ui.model.*;
+import org.eclipse.equinox.p2.engine.ProvisioningContext;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.operations.InstallOperation;
+import org.eclipse.equinox.p2.operations.ProfileChangeOperation;
+import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * An install wizard that allows the users to browse all of the repositories
+ * and search/select for items to install.
+ *
+ * @since 3.6
+ */
+public class InstallWizard extends WizardWithLicenses {
+
+ SelectableIUsPage errorReportingPage;
+ IUElementListRoot originalRoot;
+
+ public InstallWizard(ProvisioningUI ui, InstallOperation operation, IInstallableUnit[] initialSelections, LoadMetadataRepositoryJob preloadJob) {
+ super(ui, operation, initialSelections, preloadJob);
+ setWindowTitle(ProvUIMessages.InstallIUOperationLabel);
+ setDefaultPageImageDescriptor(ProvUIImages.getImageDescriptor(ProvUIImages.WIZARD_BANNER_INSTALL));
+ }
+
+ protected ResolutionResultsWizardPage createResolutionPage() {
+ return new InstallWizardPage(ui, this, root, (InstallOperation) operation);
+ }
+
+ protected ISelectableIUsPage createMainPage(IUElementListRoot input, Object[] selections) {
+ mainPage = new AvailableIUsPage(ui, this);
+ if (selections != null && selections.length > 0)
+ mainPage.setCheckedElements(selections);
+ return mainPage;
+
+ }
+
+ protected void initializeResolutionModelElements(Object[] selectedElements) {
+ if (selectedElements == null)
+ return;
+ root = new IUElementListRoot();
+ ArrayList<AvailableIUElement> list = new ArrayList<AvailableIUElement>(selectedElements.length);
+ ArrayList<AvailableIUElement> selections = new ArrayList<AvailableIUElement>(selectedElements.length);
+ for (int i = 0; i < selectedElements.length; i++) {
+ IInstallableUnit iu = ElementUtils.getIU(selectedElements[i]);
+ if (iu != null) {
+ AvailableIUElement element = new AvailableIUElement(root, iu, getProfileId(), shouldShowProvisioningPlanChildren());
+ list.add(element);
+ selections.add(element);
+ }
+ }
+ root.setChildren(list.toArray());
+ planSelections = selections.toArray();
+ }
+
+ public void createPageControls(Composite pageContainer) {
+ super.createPageControls(pageContainer);
+ if (repoPreloadJob != null)
+ // async exec since we are in the middle of opening
+ pageContainer.getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ repoPreloadJob.reportAccumulatedStatus();
+ }
+ });
+ }
+
+ protected ProvisioningContext getProvisioningContext() {
+ return ((AvailableIUsPage) mainPage).getProvisioningContext();
+ }
+
+ protected IResolutionErrorReportingPage createErrorReportingPage() {
+ if (root == null)
+ errorReportingPage = new SelectableIUsPage(ui, this, null, null);
+ else
+ errorReportingPage = new SelectableIUsPage(ui, this, root, root.getChildren(root));
+ errorReportingPage.setTitle(ProvUIMessages.InstallWizardPage_Title);
+ errorReportingPage.setDescription(ProvUIMessages.PreselectedIUInstallWizard_Description);
+ errorReportingPage.updateStatus(root, operation);
+ return errorReportingPage;
+ }
+
+ protected void planChanged() {
+ // the superclass may change the page root when we don't wish this to happen.
+ // The code below will correct that case. We set redraw to avoid a big flash.
+ errorReportingPage.getControl().setRedraw(false);
+ try {
+ super.planChanged();
+ // We don't want the root of the error page to change unless we are on the
+ // main page. For example, if we are on the error page, change checkmarks, and
+ // resolve again with an error, we wouldn't want the root items to change in the
+ // error page.
+ if (getContainer().getCurrentPage() == mainPage) {
+ originalRoot = root;
+ } else {
+ errorReportingPage.updateStatus(originalRoot, operation);
+ }
+ // we always update the checkmarks to the current root
+ errorReportingPage.setCheckedElements(root.getChildren(root));
+ } finally {
+ errorReportingPage.getControl().setRedraw(true);
+ }
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#getPreviousPage(org.eclipse.jface.wizard.IWizardPage)
+ */
+ public IWizardPage getPreviousPage(IWizardPage page) {
+ if (page == errorReportingPage) {
+ mainPage.setCheckedElements(errorReportingPage.getCheckedIUElements());
+ return mainPage;
+ }
+ return super.getPreviousPage(page);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.internal.p2.ui.dialogs.ProvisioningOperationWizard#getProfileChangeOperation(java.lang.Object[])
+ */
+ protected ProfileChangeOperation getProfileChangeOperation(Object[] elements) {
+ InstallOperation op = new InstallOperation(ui.getSession(), ElementUtils.elementsToIUs(elements));
+ op.setProfileId(getProfileId());
+ // op.setRootMarkerKey(getRootMarkerKey());
+ return op;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/InstallWizardPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/InstallWizardPage.java
index 46078100d..8c260697f 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/InstallWizardPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/InstallWizardPage.java
@@ -11,14 +11,14 @@
package org.eclipse.equinox.internal.p2.ui.dialogs;
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.IUElementListRoot;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.PlannerResolutionOperation;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
+import org.eclipse.equinox.internal.p2.ui.model.IUElementListRoot;
+import org.eclipse.equinox.p2.operations.InstallOperation;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
public class InstallWizardPage extends SizeComputingWizardPage {
- public InstallWizardPage(Policy policy, String profileId, IUElementListRoot root, PlannerResolutionOperation initialResolution) {
- super(policy, root, profileId, initialResolution);
+ public InstallWizardPage(ProvisioningUI ui, ProvisioningOperationWizard wizard, IUElementListRoot root, InstallOperation operation) {
+ super(ui, wizard, root, operation);
setTitle(ProvUIMessages.InstallWizardPage_Title);
setDescription(ProvUIMessages.InstallWizardPage_NoCheckboxDescription);
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/InstalledIUGroup.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/InstalledIUGroup.java
index 6be850b41..ceb7ab4fc 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/InstalledIUGroup.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/InstalledIUGroup.java
@@ -8,17 +8,13 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.dialogs;
+package org.eclipse.equinox.internal.p2.ui.dialogs;
import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
-import org.eclipse.equinox.internal.p2.ui.dialogs.StructuredIUGroup;
-import org.eclipse.equinox.internal.p2.ui.viewers.DeferredQueryContentProvider;
-import org.eclipse.equinox.internal.p2.ui.viewers.IUDetailsLabelProvider;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUI;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUIProvisioningListener;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.ProfileElement;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
-import org.eclipse.equinox.internal.provisional.p2.ui.viewers.*;
+import org.eclipse.equinox.internal.p2.ui.ProvUIProvisioningListener;
+import org.eclipse.equinox.internal.p2.ui.model.ProfileElement;
+import org.eclipse.equinox.internal.p2.ui.viewers.*;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.swt.SWT;
@@ -46,10 +42,10 @@ public class InstalledIUGroup extends StructuredIUGroup {
* @param profileId the id of the profile whose content is being shown.
* @param columnConfig the columns to be shown
*/
- public InstalledIUGroup(Policy policy, final Composite parent, Font font, String profileId, IUColumnConfig[] columnConfig) {
- super(policy, parent, font, columnConfig);
+ public InstalledIUGroup(ProvisioningUI ui, final Composite parent, Font font, String profileId, IUColumnConfig[] columnConfig) {
+ super(ui, parent, font, columnConfig);
if (profileId == null)
- this.profileId = policy.getProfileChooser().getProfileId(ProvUI.getDefaultParentShell());
+ this.profileId = ProvisioningUI.getDefaultUI().getProfileId();
else
this.profileId = profileId;
createGroupComposite(parent);
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/PreselectedIUInstallWizard.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/PreselectedIUInstallWizard.java
new file mode 100644
index 000000000..45d4f22dc
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/PreselectedIUInstallWizard.java
@@ -0,0 +1,85 @@
+/*******************************************************************************
+ * Copyright (c) 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.ui.dialogs;
+
+import org.eclipse.equinox.internal.p2.ui.model.AvailableIUElement;
+
+import java.util.ArrayList;
+import org.eclipse.equinox.internal.p2.ui.*;
+import org.eclipse.equinox.internal.p2.ui.model.*;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.operations.InstallOperation;
+import org.eclipse.equinox.p2.operations.ProfileChangeOperation;
+import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
+
+/**
+ * An Install wizard that is invoked when the user has already selected which
+ * IUs should be installed and does not need to browse the available software.
+ *
+ * @since 3.5
+ */
+public class PreselectedIUInstallWizard extends WizardWithLicenses {
+
+ QueryableMetadataRepositoryManager manager;
+
+ public PreselectedIUInstallWizard(ProvisioningUI ui, InstallOperation operation, IInstallableUnit[] initialSelections, LoadMetadataRepositoryJob job) {
+ super(ui, operation, initialSelections, job);
+ setWindowTitle(ProvUIMessages.InstallIUOperationLabel);
+ setDefaultPageImageDescriptor(ProvUIImages.getImageDescriptor(ProvUIImages.WIZARD_BANNER_INSTALL));
+ }
+
+ protected ISelectableIUsPage createMainPage(IUElementListRoot input, Object[] selections) {
+ mainPage = new SelectableIUsPage(ui, this, input, selections);
+ mainPage.setTitle(ProvUIMessages.PreselectedIUInstallWizard_Title);
+ mainPage.setDescription(ProvUIMessages.PreselectedIUInstallWizard_Description);
+ ((SelectableIUsPage) mainPage).updateStatus(input, operation);
+ return mainPage;
+ }
+
+ protected ResolutionResultsWizardPage createResolutionPage() {
+ return new InstallWizardPage(ui, this, root, (InstallOperation) operation);
+ }
+
+ protected void initializeResolutionModelElements(Object[] selectedElements) {
+ root = new IUElementListRoot();
+ ArrayList<AvailableIUElement> list = new ArrayList<AvailableIUElement>(selectedElements.length);
+ ArrayList<AvailableIUElement> selected = new ArrayList<AvailableIUElement>(selectedElements.length);
+ for (int i = 0; i < selectedElements.length; i++) {
+ IInstallableUnit iu = ElementUtils.getIU(selectedElements[i]);
+ if (iu != null) {
+ AvailableIUElement element = new AvailableIUElement(root, iu, getProfileId(), shouldShowProvisioningPlanChildren());
+ list.add(element);
+ selected.add(element);
+ }
+ }
+ root.setChildren(list.toArray());
+ planSelections = selected.toArray();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.internal.p2.ui.dialogs.ProvisioningOperationWizard#getErrorReportingPage()
+ */
+ protected IResolutionErrorReportingPage createErrorReportingPage() {
+ return (IResolutionErrorReportingPage) mainPage;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.internal.p2.ui.dialogs.ProvisioningOperationWizard#getProfileChangeOperation(java.lang.Object[])
+ */
+ protected ProfileChangeOperation getProfileChangeOperation(Object[] elements) {
+ InstallOperation op = new InstallOperation(ui.getSession(), ElementUtils.elementsToIUs(elements));
+ op.setProfileId(getProfileId());
+ // op.setRootMarkerKey(getRootMarkerKey());
+ op.setProvisioningContext(getProvisioningContext());
+ return op;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningOperationWizard.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningOperationWizard.java
index cf39d0cd4..f2d38fe8c 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningOperationWizard.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningOperationWizard.java
@@ -10,19 +10,18 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.ui.dialogs;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+
import java.lang.reflect.InvocationTargetException;
import java.util.Arrays;
import java.util.HashSet;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.ui.*;
import org.eclipse.equinox.internal.p2.ui.model.ElementUtils;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.director.ProfileChangeRequest;
-import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningContext;
-import org.eclipse.equinox.internal.provisional.p2.ui.*;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.IUElementListRoot;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.PlannerResolutionOperation;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
+import org.eclipse.equinox.internal.p2.ui.model.IUElementListRoot;
+import org.eclipse.equinox.p2.engine.ProvisioningContext;
+import org.eclipse.equinox.p2.operations.ProfileChangeOperation;
+import org.eclipse.equinox.p2.ui.*;
import org.eclipse.jface.operation.IRunnableContext;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.jface.wizard.IWizardPage;
@@ -39,30 +38,25 @@ public abstract class ProvisioningOperationWizard extends Wizard {
private static final String WIZARD_SETTINGS_SECTION = "WizardSettings"; //$NON-NLS-1$
- protected Policy policy;
- protected String profileId;
- protected IUElementListRoot root, originalRoot;
- protected PlannerResolutionOperation resolutionOperation;
- private Object[] planSelections;
+ protected ProvisioningUI ui;
+ protected IUElementListRoot root;
+ protected ProfileChangeOperation operation;
+ protected Object[] planSelections;
protected ISelectableIUsPage mainPage;
protected IResolutionErrorReportingPage errorPage;
protected ResolutionResultsWizardPage resolutionPage;
private ProvisioningContext provisioningContext;
- boolean couldNotResolve;
+ protected LoadMetadataRepositoryJob repoPreloadJob;
+ IStatus couldNotResolveStatus = Status.OK_STATUS; // we haven't tried and failed
boolean waitingForOtherJobs = false;
- public ProvisioningOperationWizard(Policy policy, String profileId, IUElementListRoot root, Object[] initialSelections, PlannerResolutionOperation initialResolution) {
+ public ProvisioningOperationWizard(ProvisioningUI ui, ProfileChangeOperation operation, Object[] initialSelections, LoadMetadataRepositoryJob job) {
super();
- this.policy = policy;
- this.profileId = profileId;
- this.root = root;
- this.originalRoot = root;
- this.resolutionOperation = initialResolution;
- if (initialSelections == null)
- planSelections = new Object[0];
- else
- planSelections = initialSelections;
+ this.ui = ui;
+ initializeResolutionModelElements(initialSelections);
+ this.operation = operation;
+ this.repoPreloadJob = job;
setForcePreviousAndNextButtons(true);
setNeedsProgressMonitor(true);
}
@@ -74,9 +68,14 @@ public abstract class ProvisioningOperationWizard extends Wizard {
public void addPages() {
mainPage = createMainPage(root, planSelections);
addPage(mainPage);
+ errorPage = createErrorReportingPage();
+ if (errorPage != mainPage)
+ addPage(errorPage);
+ resolutionPage = createResolutionPage();
+ addPage(resolutionPage);
}
- protected abstract IResolutionErrorReportingPage getErrorReportingPage();
+ protected abstract IResolutionErrorReportingPage createErrorReportingPage();
protected abstract ISelectableIUsPage createMainPage(IUElementListRoot input, Object[] selections);
@@ -86,23 +85,8 @@ public abstract class ProvisioningOperationWizard extends Wizard {
return resolutionPage.performFinish();
}
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#canFinish()
- */
- public boolean canFinish() {
- if (resolutionPage == null)
- return false;
- if (!super.canFinish())
- return false;
- // Special case. The error reporting page has to be complete in
- // order to press next and perform a resolution. But that doesn't
- // mean the wizard can finish.
- if (resolutionOperation != null) {
- int severity = resolutionOperation.getResolutionResult().getSummaryStatus().getSeverity();
- return severity != IStatus.ERROR && severity != IStatus.CANCEL;
- }
- return false;
+ protected LoadMetadataRepositoryJob getRepositoryPreloadJob() {
+ return repoPreloadJob;
}
/*
@@ -110,75 +94,43 @@ public abstract class ProvisioningOperationWizard extends Wizard {
* @see org.eclipse.jface.wizard.Wizard#getNextPage(org.eclipse.jface.wizard.IWizardPage)
*/
public IWizardPage getNextPage(IWizardPage page) {
+ // If we are moving from the main page or error page, we may need to resolve before
+ // advancing.
if (page == mainPage || page == errorPage) {
ISelectableIUsPage currentPage = (ISelectableIUsPage) page;
// Do we need to resolve?
- boolean weResolved = false;
- if (resolutionOperation == null || (resolutionOperation != null && shouldRecomputePlan(currentPage))) {
- resolutionOperation = null;
- provisioningContext = getProvisioningContext();
- planSelections = currentPage.getCheckedIUElements();
- root = makeResolutionElementRoot(planSelections);
+ if (operation == null || (operation != null && shouldRecomputePlan(currentPage))) {
recomputePlan(getContainer());
- planChanged();
- weResolved = true;
} else {
- planSelections = currentPage.getCheckedIUElements();
- root = makeResolutionElementRoot(planSelections);
+ // the selections have not changed from an IU point of view, but we want
+ // to reinitialize the resolution model elements to ensure they are up to
+ // date.
+ initializeResolutionModelElements(planSelections);
}
- return selectNextPage(page, getCurrentStatus(), weResolved);
- }
- return super.getNextPage(page);
- }
-
- protected IWizardPage selectNextPage(IWizardPage currentPage, IStatus status, boolean hasResolved) {
- // We have already established before calling this method that the
- // current page is either the main page or the error page.
- if (status.getSeverity() == IStatus.CANCEL)
- return currentPage;
- else if (status.getSeverity() == IStatus.ERROR) {
- if (errorPage == null)
- errorPage = getErrorReportingPage();
- if (currentPage == errorPage) {
- updateErrorPageStatus(errorPage);
- return null;
- }
- showingErrorPage();
- return errorPage;
- } else {
- if (resolutionPage == null) {
- resolutionPage = createResolutionPage();
- addPage(resolutionPage);
+ IStatus status = operation.getResolutionResult();
+ if (status == null || status.getSeverity() == IStatus.ERROR) {
+ return errorPage;
+ } else if (status.getSeverity() == IStatus.CANCEL) {
+ return page;
+ } else {
+ return resolutionPage;
}
- // need to clear any previous error status reported so that traversing
- // back to the error page will not show the error
- if (currentPage instanceof IResolutionErrorReportingPage)
- updateErrorPageStatus((IResolutionErrorReportingPage) currentPage);
- return resolutionPage;
}
- }
-
- /**
- * The error page is being shown for the first time given the
- * current plan. Update any information needed before showing
- * the page.
- */
- protected void showingErrorPage() {
- // default is to do nothing
+ return super.getNextPage(page);
}
private boolean shouldRecomputePlan(ISelectableIUsPage page) {
boolean previouslyWaiting = waitingForOtherJobs;
boolean previouslyCanceled = getCurrentStatus().getSeverity() == IStatus.CANCEL;
- waitingForOtherJobs = ProvisioningOperationRunner.hasScheduledOperationsFor(profileId);
+ waitingForOtherJobs = ui.hasScheduledOperations();
return waitingForOtherJobs || previouslyWaiting || previouslyCanceled || pageSelectionsHaveChanged(page) || provisioningContextChanged();
}
private boolean pageSelectionsHaveChanged(ISelectableIUsPage page) {
- HashSet selectedIUs = new HashSet();
+ HashSet<IInstallableUnit> selectedIUs = new HashSet<IInstallableUnit>();
Object[] currentSelections = page.getCheckedIUElements();
selectedIUs.addAll(Arrays.asList(ElementUtils.elementsToIUs(currentSelections)));
- HashSet lastIUSelections = new HashSet();
+ HashSet<IInstallableUnit> lastIUSelections = new HashSet<IInstallableUnit>();
lastIUSelections.addAll(Arrays.asList(ElementUtils.elementsToIUs(planSelections)));
return !(selectedIUs.equals(lastIUSelections));
}
@@ -194,20 +146,13 @@ public abstract class ProvisioningOperationWizard extends Wizard {
}
protected void planChanged() {
- if (resolutionOperation != null) {
- IStatus status = resolutionOperation.getResolutionResult().getSummaryStatus();
- if (status.getSeverity() != IStatus.ERROR && status.getSeverity() != IStatus.CANCEL) {
- if (resolutionPage != null)
- resolutionPage.updateStatus(root, resolutionOperation);
- else {
- resolutionPage = createResolutionPage();
- addPage(resolutionPage);
- }
- }
+ errorPage.updateStatus(root, operation);
+ if (errorPage != resolutionPage) {
+ resolutionPage.updateStatus(root, operation);
}
}
- protected abstract IUElementListRoot makeResolutionElementRoot(Object[] selectedElements);
+ protected abstract void initializeResolutionModelElements(Object[] selectedElements);
protected ProvisioningContext getProvisioningContext() {
return null;
@@ -220,57 +165,46 @@ public abstract class ProvisioningOperationWizard extends Wizard {
* @param runnableContext
*/
public void recomputePlan(IRunnableContext runnableContext) {
- final Object[] elements = root.getChildren(root);
- couldNotResolve = false;
- try {
- if (elements.length == 0) {
- couldNotResolve(ProvUIMessages.ResolutionWizardPage_NoSelections);
- } else
+ couldNotResolveStatus = Status.OK_STATUS;
+ provisioningContext = getProvisioningContext();
+ initializeResolutionModelElements(mainPage.getCheckedIUElements());
+ if (planSelections.length == 0) {
+ operation = null;
+ couldNotResolve(ProvUIMessages.ResolutionWizardPage_NoSelections);
+ } else {
+ operation = getProfileChangeOperation(planSelections);
+ try {
runnableContext.run(true, true, new IRunnableWithProgress() {
public void run(IProgressMonitor monitor) {
- resolutionOperation = null;
- MultiStatus status = PlanAnalyzer.getProfileChangeAlteredStatus();
- ProfileChangeRequest request = computeProfileChangeRequest(elements, status, monitor);
- if (request != null) {
- resolutionOperation = new PlannerResolutionOperation(ProvUIMessages.ProfileModificationWizardPage_ResolutionOperationLabel, profileId, request, provisioningContext, status, false);
- try {
- resolutionOperation.execute(monitor);
- } catch (ProvisionException e) {
- ProvUI.handleException(e, null, StatusManager.SHOW | StatusManager.LOG);
- couldNotResolve(null);
- }
- }
+ operation.resolveModal(monitor);
}
});
- } catch (InterruptedException e) {
- // Nothing to report if thread was interrupted
- } catch (InvocationTargetException e) {
- ProvUI.handleException(e.getCause(), null, StatusManager.SHOW | StatusManager.LOG);
- couldNotResolve(null);
+
+ } catch (InterruptedException e) {
+ // Nothing to report if thread was interrupted
+ } catch (InvocationTargetException e) {
+ ProvUI.handleException(e.getCause(), null, StatusManager.SHOW | StatusManager.LOG);
+ couldNotResolve(null);
+ }
}
- if (errorPage == null)
- errorPage = getErrorReportingPage();
- updateErrorPageStatus(errorPage);
+ planChanged();
}
- void updateErrorPageStatus(IResolutionErrorReportingPage page) {
- page.updateStatus(originalRoot, resolutionOperation);
- }
+ protected abstract ProfileChangeOperation getProfileChangeOperation(Object[] elements);
void couldNotResolve(String message) {
- resolutionOperation = null;
- couldNotResolve = true;
if (message != null) {
- IStatus status = new MultiStatus(ProvUIActivator.PLUGIN_ID, IStatusCodes.UNEXPECTED_NOTHING_TO_DO, message, null);
- StatusManager.getManager().handle(status, StatusManager.LOG);
+ couldNotResolveStatus = new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, message, null);
+ } else {
+ couldNotResolveStatus = new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, ProvUIMessages.ProvisioningOperationWizard_UnexpectedFailureToResolve, null);
}
+ StatusManager.getManager().handle(couldNotResolveStatus, StatusManager.LOG);
}
public IStatus getCurrentStatus() {
- if (couldNotResolve || resolutionOperation == null) {
- return PlanAnalyzer.getStatus(IStatusCodes.UNEXPECTED_NOTHING_TO_DO, null);
- }
- return resolutionOperation.getResolutionResult().getSummaryStatus();
+ if (operation != null && operation.getResolutionResult() != null)
+ return operation.getResolutionResult();
+ return couldNotResolveStatus;
}
public String getDialogSettingsSectionName() {
@@ -285,6 +219,15 @@ public abstract class ProvisioningOperationWizard extends Wizard {
}
}
- protected abstract ProfileChangeRequest computeProfileChangeRequest(Object[] checkedElements, MultiStatus additionalStatus, IProgressMonitor monitor);
+ protected Policy getPolicy() {
+ return ui.getPolicy();
+ }
+ protected String getProfileId() {
+ return ui.getProfileId();
+ }
+
+ protected boolean shouldShowProvisioningPlanChildren() {
+ return ProvUI.getQueryContext(getPolicy()).getShowProvisioningPlanChildren();
+ }
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/ProvisioningWizardDialog.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningWizardDialog.java
index e5282c000..4f650b656 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/ProvisioningWizardDialog.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningWizardDialog.java
@@ -9,10 +9,9 @@
* IBM Corporation - initial API and implementation
******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.dialogs;
+package org.eclipse.equinox.internal.p2.ui.dialogs;
import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
-import org.eclipse.equinox.internal.p2.ui.dialogs.ProvisioningOperationWizard;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.SWT;
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningWizardPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningWizardPage.java
index 085056b08..4418a01e8 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningWizardPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ProvisioningWizardPage.java
@@ -10,6 +10,7 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.ui.dialogs;
+import org.eclipse.equinox.p2.ui.*;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.swt.dnd.*;
import org.eclipse.swt.widgets.Control;
@@ -17,8 +18,13 @@ import org.eclipse.ui.PlatformUI;
abstract class ProvisioningWizardPage extends WizardPage implements ICopyable {
- protected ProvisioningWizardPage(String pageName) {
+ private ProvisioningUI ui;
+ private ProvisioningOperationWizard wizard;
+
+ protected ProvisioningWizardPage(String pageName, ProvisioningUI ui, ProvisioningOperationWizard wizard) {
super(pageName);
+ this.wizard = wizard;
+ this.ui = ui;
}
protected void activateCopy(Control control) {
@@ -26,6 +32,10 @@ abstract class ProvisioningWizardPage extends WizardPage implements ICopyable {
}
+ protected ProvisioningOperationWizard getProvisioningWizard() {
+ return wizard;
+ }
+
public void copyToClipboard(Control activeControl) {
String text = getClipboardText(activeControl);
if (text.length() == 0)
@@ -44,4 +54,16 @@ abstract class ProvisioningWizardPage extends WizardPage implements ICopyable {
public void saveBoundsRelatedSettings() {
// Default is to do nothing
}
+
+ protected ProvisioningUI getProvisioningUI() {
+ return ui;
+ }
+
+ protected Policy getPolicy() {
+ return ui.getPolicy();
+ }
+
+ String getProfileId() {
+ return ui.getProfileId();
+ }
} \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositoryManipulatorDropTarget.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositoryManipulatorDropTarget.java
index cb258f8e8..a44ee11d4 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositoryManipulatorDropTarget.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositoryManipulatorDropTarget.java
@@ -14,13 +14,9 @@ import java.net.URI;
import java.net.URISyntaxException;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
-import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUI;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvisioningOperationRunner;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningOperation;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.RepositoryLocationValidator;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.RepositoryManipulator;
+import org.eclipse.equinox.internal.p2.ui.*;
+import org.eclipse.equinox.p2.operations.RepositoryTracker;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.dnd.DND;
import org.eclipse.swt.dnd.DropTargetEvent;
@@ -38,13 +34,15 @@ import org.eclipse.ui.statushandlers.StatusManager;
*
*/
public class RepositoryManipulatorDropTarget extends URLDropAdapter {
- RepositoryManipulator manipulator;
+ ProvisioningUI ui;
+ RepositoryTracker tracker;
Control control;
- public RepositoryManipulatorDropTarget(RepositoryManipulator manipulator, Control control) {
+ public RepositoryManipulatorDropTarget(ProvisioningUI ui, Control control) {
super(true); // convert file drops to URL
- Assert.isNotNull(manipulator);
- this.manipulator = manipulator;
+ Assert.isNotNull(ui);
+ this.ui = ui;
+ this.tracker = ui.getRepositoryTracker();
this.control = control;
}
@@ -54,7 +52,7 @@ public class RepositoryManipulatorDropTarget extends URLDropAdapter {
try {
location[0] = URIUtil.fromString(urlText);
} catch (URISyntaxException e) {
- ProvUI.reportStatus(RepositoryLocationValidator.getInvalidLocationStatus(urlText), StatusManager.SHOW | StatusManager.LOG);
+ ProvUI.reportStatus(tracker.getInvalidLocationStatus(urlText), StatusManager.SHOW | StatusManager.LOG);
return;
}
if (location[0] == null)
@@ -63,13 +61,10 @@ public class RepositoryManipulatorDropTarget extends URLDropAdapter {
Job job = new WorkbenchJob(ProvUIMessages.RepositoryManipulatorDropTarget_DragAndDropJobLabel) {
public IStatus runInUIThread(IProgressMonitor monitor) {
- IStatus status = manipulator.getRepositoryLocationValidator(control.getShell()).validateRepositoryLocation(location[0], false, monitor);
+ IStatus status = tracker.validateRepositoryLocation(ui.getSession(), location[0], false, monitor);
if (status.isOK()) {
- ProvisioningOperation addOperation = manipulator.getAddOperation(location[0]);
- ProvisioningOperationRunner.schedule(addOperation, StatusManager.SHOW | StatusManager.LOG);
+ tracker.addRepository(location[0], null, ui.getSession());
event.detail = DND.DROP_LINK;
- } else if (status.getCode() == RepositoryLocationValidator.ALTERNATE_ACTION_TAKEN) {
- event.detail = DND.DROP_COPY;
} else if (status.getSeverity() == IStatus.CANCEL) {
event.detail = DND.DROP_NONE;
} else {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositoryNameAndLocationDialog.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositoryNameAndLocationDialog.java
index ddb988360..702d88a51 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositoryNameAndLocationDialog.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositoryNameAndLocationDialog.java
@@ -15,7 +15,9 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.*;
+import org.eclipse.equinox.p2.operations.ProvisioningSession;
+import org.eclipse.equinox.p2.operations.RepositoryTracker;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
import org.eclipse.jface.dialogs.*;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.SWT;
@@ -37,13 +39,13 @@ public class RepositoryNameAndLocationDialog extends StatusDialog {
Button okButton;
Text url, nickname;
- Policy policy;
+ ProvisioningUI ui;
URI location;
String name;
- public RepositoryNameAndLocationDialog(Shell parentShell, Policy policy) {
+ public RepositoryNameAndLocationDialog(Shell parentShell, ProvisioningUI ui) {
super(parentShell);
- this.policy = policy;
+ this.ui = ui;
setTitle(ProvUIMessages.RepositoryNameAndLocationDialog_Title);
}
@@ -71,25 +73,13 @@ public class RepositoryNameAndLocationDialog extends StatusDialog {
}
/**
- * Return a location validator appropriate for this dialog. The
- * default is to retrieve it from the repository manipulator.
- * Subclasses may override.
- *
- * @return the validator
- */
- protected RepositoryLocationValidator getRepositoryLocationValidator() {
- return getRepositoryManipulator().getRepositoryLocationValidator(getShell());
- }
-
- /**
- * Return a RepositoryManipulator appropriate for validating and adding the
+ * Return a RepositoryTracker appropriate for validating and adding the
* repository.
*
- * The default manipulator is described by the policy. Subclasses may override.
- * @return the repository manipulator
+ * @return the Repository Tracker
*/
- protected RepositoryManipulator getRepositoryManipulator() {
- return policy.getRepositoryManipulator();
+ protected RepositoryTracker getRepositoryTracker() {
+ return ui.getRepositoryTracker();
}
protected void okPressed() {
@@ -111,7 +101,7 @@ public class RepositoryNameAndLocationDialog extends StatusDialog {
* @return the URL currently typed in by the user.
*/
protected URI getUserLocation() {
- return RepositoryLocationValidator.locationFromString(url.getText().trim());
+ return getRepositoryTracker().locationFromString(url.getText().trim());
}
/**
@@ -144,16 +134,16 @@ public class RepositoryNameAndLocationDialog extends StatusDialog {
if (url == null || url.isDisposed())
return Status.OK_STATUS;
final IStatus[] status = new IStatus[1];
- status[0] = RepositoryLocationValidator.getInvalidLocationStatus(url.getText().trim());
+ status[0] = getRepositoryTracker().getInvalidLocationStatus(url.getText().trim());
final URI userLocation = getUserLocation();
if (url.getText().length() == 0)
- status[0] = new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, RepositoryLocationValidator.LOCAL_VALIDATION_ERROR, ProvUIMessages.RepositoryGroup_URLRequired, null);
+ status[0] = new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, ProvisioningSession.STATUS_INVALID_REPOSITORY_LOCATION, ProvUIMessages.RepositoryGroup_URLRequired, null);
else if (userLocation == null)
- status[0] = new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, RepositoryLocationValidator.LOCAL_VALIDATION_ERROR, ProvUIMessages.AddRepositoryDialog_InvalidURL, null);
+ status[0] = new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, ProvisioningSession.STATUS_INVALID_REPOSITORY_LOCATION, ProvUIMessages.AddRepositoryDialog_InvalidURL, null);
else {
BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
public void run() {
- status[0] = getRepositoryLocationValidator().validateRepositoryLocation(userLocation, contactRepositories, null);
+ status[0] = getRepositoryTracker().validateRepositoryLocation(ui.getSession(), userLocation, contactRepositories, null);
}
});
}
@@ -219,4 +209,8 @@ public class RepositoryNameAndLocationDialog extends StatusDialog {
url.setSelection(0, url.getText().length());
return url;
}
+
+ protected ProvisioningUI getProvisioningUI() {
+ return ui;
+ }
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/RepositorySelectionGroup.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositorySelectionGroup.java
index 2d1ca3901..25d2a612f 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/RepositorySelectionGroup.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/RepositorySelectionGroup.java
@@ -9,7 +9,7 @@
* IBM Corporation - initial API and implementation
* Yury Chernikov <Yury.Chernikov@borland.com> - Bug 271447 [ui] Bad layout in 'Install available software' dialog
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.dialogs;
+package org.eclipse.equinox.internal.p2.ui.dialogs;
import com.ibm.icu.text.Collator;
import java.lang.reflect.InvocationTargetException;
@@ -17,17 +17,14 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.util.*;
import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.p2.ui.UIRepositoryEvent;
-import org.eclipse.equinox.internal.p2.ui.dialogs.ComboAutoCompleteField;
-import org.eclipse.equinox.internal.p2.ui.dialogs.URLDropAdapter;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningContext;
-import org.eclipse.equinox.internal.provisional.p2.repository.*;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUI;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUIProvisioningListener;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.*;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.*;
+import org.eclipse.equinox.internal.p2.ui.*;
+import org.eclipse.equinox.internal.p2.ui.query.IUViewQueryContext;
+import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent;
+import org.eclipse.equinox.p2.engine.ProvisioningContext;
+import org.eclipse.equinox.p2.operations.RepositoryTracker;
+import org.eclipse.equinox.p2.repository.IRepository;
+import org.eclipse.equinox.p2.repository.IRepositoryManager;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.Dialog;
@@ -45,7 +42,6 @@ import org.eclipse.swt.graphics.*;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.*;
-import org.eclipse.ui.statushandlers.StatusManager;
/**
* A RepositorySelectionGroup is a reusable UI component that displays
@@ -66,7 +62,7 @@ public class RepositorySelectionGroup {
// see https://bugs.eclipse.org/bugs/show_bug.cgi?id=245569
private static final int COUNT_VISIBLE_ITEMS = 20;
IWizardContainer container;
- Policy policy;
+ ProvisioningUI ui;
IUViewQueryContext queryContext;
ListenerList listeners = new ListenerList();
@@ -79,12 +75,12 @@ public class RepositorySelectionGroup {
Image info, warning, error;
URI[] comboRepos; // the URIs shown in the combo, kept in sync with combo items
- HashMap disabledRepoProposals = new HashMap(); // proposal string -> disabled URI
+ HashMap<String, URI> disabledRepoProposals = new HashMap<String, URI>(); // proposal string -> disabled URI
- public RepositorySelectionGroup(IWizardContainer container, Composite parent, Policy policy, IUViewQueryContext queryContext) {
+ public RepositorySelectionGroup(ProvisioningUI ui, IWizardContainer container, Composite parent, IUViewQueryContext queryContext) {
this.container = container;
this.queryContext = queryContext;
- this.policy = policy;
+ this.ui = ui;
createControl(parent);
}
@@ -97,6 +93,7 @@ public class RepositorySelectionGroup {
}
protected void createControl(Composite parent) {
+ final RepositoryTracker tracker = ProvisioningUI.getDefaultUI().getRepositoryTracker();
// Get the possible field error indicators
info = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_INFORMATION).getImage();
warning = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_WARNING).getImage();
@@ -160,12 +157,11 @@ public class RepositorySelectionGroup {
int index = getComboIndex(text);
// only validate text that doesn't match existing text in combo
if (index < 0) {
- location = RepositoryLocationValidator.locationFromString(repoCombo.getText());
+ location = tracker.locationFromString(repoCombo.getText());
if (location == null) {
- status = RepositoryLocationValidator.getInvalidLocationStatus(repoCombo.getText());
+ status = tracker.getInvalidLocationStatus(repoCombo.getText());
} else {
- RepositoryLocationValidator validator = policy.getRepositoryManipulator().getRepositoryLocationValidator(repoCombo.getShell());
- status = validator.validateRepositoryLocation(location, false, new NullProgressMonitor());
+ status = tracker.validateRepositoryLocation(ui.getSession(), location, false, new NullProgressMonitor());
}
} else {
// user typed or pasted an existing location. Select it.
@@ -207,9 +203,9 @@ public class RepositorySelectionGroup {
// Link to repository manipulator
repoManipulatorLink = createLink(comboComposite, new Action() {
public void runWithEvent(Event event) {
- policy.getRepositoryManipulator().manipulateRepositories(repoCombo.getShell());
+ ui.manipulateRepositories(repoCombo.getShell());
}
- }, policy.getRepositoryManipulator().getManipulatorLinkLabel());
+ }, getLinkLabel());
gd = new GridData(SWT.END, SWT.FILL, true, false);
gd.horizontalSpan = 3;
repoManipulatorLink.setLayoutData(gd);
@@ -223,6 +219,16 @@ public class RepositorySelectionGroup {
});
}
+ private String getLinkLabel() {
+ if (ui.getPolicy().getRepositoryPreferencePageId() != null) {
+ String pageName = ui.getPolicy().getRepositoryPreferencePageName();
+ if (pageName == null)
+ pageName = ProvUIMessages.RepositorySelectionGroup_PrefPageName;
+ return NLS.bind(ProvUIMessages.RepositorySelectionGroup_PrefPageLink, pageName);
+ }
+ return ProvUIMessages.RepositorySelectionGroup_GenericSiteLinkTitle;
+ }
+
private void setButtonLayoutData(Button button) {
GridData data = new GridData(SWT.FILL, SWT.CENTER, false, false);
GC gc = new GC(button);
@@ -291,7 +297,8 @@ public class RepositorySelectionGroup {
* current selection should be preserved if applicable.
*/
void fillRepoCombo(final String selection) {
- URI[] sites = policy.getRepositoryManipulator().getKnownRepositories();
+ RepositoryTracker tracker = ui.getRepositoryTracker();
+ URI[] sites = tracker.getKnownRepositories(ui.getSession());
boolean hasLocalSites = getLocalSites().length > 0;
final String[] items;
if (hasLocalSites) {
@@ -346,8 +353,6 @@ public class RepositorySelectionGroup {
repoComboSelectionChanged();
}
};
- // Only run the UI code async if we have to. If we always async the code,
- // the automated tests (which are in the UI thread) can get out of sync
if (Display.getCurrent() == null)
repoCombo.getDisplay().asyncExec(runnable);
else
@@ -355,13 +360,9 @@ public class RepositorySelectionGroup {
}
String getSiteString(URI uri) {
- try {
- String nickname = ProvisioningUtil.getMetadataRepositoryProperty(uri, IRepository.PROP_NICKNAME);
- if (nickname != null && nickname.length() > 0)
- return NLS.bind(ProvUIMessages.AvailableIUsPage_NameWithLocation, nickname, URIUtil.toUnencodedString(uri));
- } catch (ProvisionException e) {
- // No error, just use the location string
- }
+ String nickname = ui.getSession().getMetadataRepositoryManager().getRepositoryProperty(uri, IRepository.PROP_NICKNAME);
+ if (nickname != null && nickname.length() > 0)
+ return NLS.bind(ProvUIMessages.AvailableIUsPage_NameWithLocation, nickname, URIUtil.toUnencodedString(uri));
return URIUtil.toUnencodedString(uri);
}
@@ -395,18 +396,18 @@ public class RepositorySelectionGroup {
int sortEnd = hasLocalSites ? strings.length - 2 : strings.length - 1;
if (sortStart >= sortEnd)
return;
- final HashMap uriToString = new HashMap();
+ final HashMap<URI, String> uriToString = new HashMap<URI, String>();
for (int i = sortStart; i <= sortEnd; i++) {
uriToString.put(locations[i], strings[i]);
}
final Collator collator = Collator.getInstance(Locale.getDefault());
- Comparator stringComparator = new Comparator() {
- public int compare(Object a, Object b) {
+ Comparator<String> stringComparator = new Comparator<String>() {
+ public int compare(String a, String b) {
return collator.compare(a, b);
}
};
- Comparator uriComparator = new Comparator() {
- public int compare(Object a, Object b) {
+ Comparator<URI> uriComparator = new Comparator<URI>() {
+ public int compare(URI a, URI b) {
return collator.compare(uriToString.get(a), uriToString.get(b));
}
};
@@ -417,34 +418,25 @@ public class RepositorySelectionGroup {
private URI[] getLocalSites() {
// use our current visibility flags plus the local filter
- int flags = queryContext.getMetadataRepositoryFlags() | IRepositoryManager.REPOSITORIES_LOCAL;
- try {
- return ProvisioningUtil.getMetadataRepositories(flags);
- } catch (ProvisionException e) {
- return null;
- }
+ int flags = ui.getRepositoryTracker().getMetadataRepositoryFlags() | IRepositoryManager.REPOSITORIES_LOCAL;
+ return ui.getSession().getMetadataRepositoryManager().getKnownRepositories(flags);
}
String[] getComboProposals() {
- // Include all the combo items plus disabled sites
- try {
- int flags = queryContext.getMetadataRepositoryFlags() | IRepositoryManager.REPOSITORIES_DISABLED;
- String[] items = repoCombo.getItems();
- // Clear any previously remembered disabled repos
- disabledRepoProposals = new HashMap();
- URI[] disabled = ProvisioningUtil.getMetadataRepositories(flags);
- String[] disabledItems = new String[disabled.length];
- for (int i = 0; i < disabledItems.length; i++) {
- disabledItems[i] = getSiteString(disabled[i]);
- disabledRepoProposals.put(disabledItems[i], disabled[i]);
- }
- String[] both = new String[items.length + disabledItems.length];
- System.arraycopy(items, 0, both, 0, items.length);
- System.arraycopy(disabledItems, 0, both, items.length, disabledItems.length);
- return both;
- } catch (ProvisionException e) {
- return new String[0];
+ int flags = ui.getRepositoryTracker().getMetadataRepositoryFlags() | IRepositoryManager.REPOSITORIES_DISABLED;
+ String[] items = repoCombo.getItems();
+ // Clear any previously remembered disabled repos
+ disabledRepoProposals = new HashMap<String, URI>();
+ URI[] disabled = ui.getSession().getMetadataRepositoryManager().getKnownRepositories(flags);
+ String[] disabledItems = new String[disabled.length];
+ for (int i = 0; i < disabledItems.length; i++) {
+ disabledItems[i] = getSiteString(disabled[i]);
+ disabledRepoProposals.put(disabledItems[i], disabled[i]);
}
+ String[] both = new String[items.length + disabledItems.length];
+ System.arraycopy(items, 0, both, 0, items.length);
+ System.arraycopy(disabledItems, 0, both, items.length, disabledItems.length);
+ return both;
}
int getComboIndex(String repoText) {
@@ -478,9 +470,7 @@ public class RepositorySelectionGroup {
// We need to monitor repository events so that we can adjust the repo combo.
comboRepoListener = new ProvUIProvisioningListener(ProvUIProvisioningListener.PROV_EVENT_METADATA_REPOSITORY) {
protected void repositoryAdded(RepositoryEvent e) {
- if (e instanceof UIRepositoryEvent) {
- fillRepoCombo(getSiteString(e.getRepositoryLocation()));
- }
+ fillRepoCombo(getSiteString(e.getRepositoryLocation()));
}
protected void repositoryRemoved(RepositoryEvent e) {
@@ -510,7 +500,7 @@ public class RepositorySelectionGroup {
* filter as soon as the new repo is added.
*/
void addRepository(boolean alwaysPrompt) {
- final RepositoryManipulator manipulator = policy.getRepositoryManipulator();
+ final RepositoryTracker manipulator = ui.getRepositoryTracker();
final String selectedRepo = repoCombo.getText().trim();
int selectionIndex = getComboIndex(selectedRepo);
final boolean isNewText = selectionIndex < 0;
@@ -519,12 +509,7 @@ public class RepositorySelectionGroup {
if (!alwaysPrompt && !isNewText && selectionIndex != repoCombo.getSelectionIndex()) {
repoComboSelectionChanged();
} else if (alwaysPrompt) {
- AddRepositoryDialog dialog = new AddRepositoryDialog(repoCombo.getShell(), policy) {
- protected AddRepositoryOperation getOperation(URI repositoryLocation) {
- AddRepositoryOperation op = manipulator.getAddOperation(repositoryLocation);
- op.setNotify(false);
- return op;
- }
+ AddRepositoryDialog dialog = new AddRepositoryDialog(repoCombo.getShell(), ui) {
protected String getInitialLocationText() {
if (isNewText)
@@ -533,7 +518,7 @@ public class RepositorySelectionGroup {
}
};
- dialog.setTitle(manipulator.getAddOperationLabel());
+ dialog.setTitle(ProvUIMessages.AddRepositoryDialog_Title);
dialog.open();
URI location = dialog.getAddedLocation();
if (location != null)
@@ -546,27 +531,18 @@ public class RepositorySelectionGroup {
IStatus status;
// This might be a disabled repo. If so, no need to validate further.
if (disabledRepoProposals.containsKey(selectedRepo)) {
- location = (URI) disabledRepoProposals.get(selectedRepo);
+ location = disabledRepoProposals.get(selectedRepo);
status = Status.OK_STATUS;
} else {
- location = RepositoryLocationValidator.locationFromString(selectedRepo);
+ location = manipulator.locationFromString(selectedRepo);
if (location == null)
- status = RepositoryLocationValidator.getInvalidLocationStatus(selectedRepo);
+ status = manipulator.getInvalidLocationStatus(selectedRepo);
else {
- RepositoryLocationValidator validator = manipulator.getRepositoryLocationValidator(repoCombo.getShell());
- status = validator.validateRepositoryLocation(location, false, monitor);
+ status = manipulator.validateRepositoryLocation(ui.getSession(), location, false, monitor);
}
}
if (status.isOK() && location != null) {
- try {
- RepositoryOperation op = manipulator.getAddOperation(location);
- op.setNotify(false);
- op.execute(monitor);
- fillRepoCombo(getSiteString(location));
- } catch (ProvisionException e) {
- // TODO Auto-generated catch block
- ProvUI.handleException(e, null, StatusManager.SHOW);
- }
+ manipulator.addRepository(location, null, ui.getSession());
}
setRepoComboDecoration(status);
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionResultsWizardPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionResultsWizardPage.java
index 7283048dc..5ee5043e3 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionResultsWizardPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionResultsWizardPage.java
@@ -11,20 +11,15 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.ui.dialogs;
-import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.equinox.internal.p2.ui.model.ElementUtils;
-import org.eclipse.equinox.internal.p2.ui.model.QueriedElement;
-import org.eclipse.equinox.internal.p2.ui.viewers.IUDetailsLabelProvider;
-import org.eclipse.equinox.internal.provisional.p2.director.ProvisioningPlan;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvisioningOperationRunner;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.IUElementListRoot;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.PlannerResolutionOperation;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProfileModificationOperation;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
-import org.eclipse.equinox.internal.provisional.p2.ui.viewers.*;
+import org.eclipse.equinox.internal.p2.ui.model.*;
+import org.eclipse.equinox.internal.p2.ui.viewers.*;
+import org.eclipse.equinox.p2.engine.IProvisioningPlan;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.operations.ProfileChangeOperation;
+import org.eclipse.equinox.p2.operations.ProvisioningJob;
+import org.eclipse.equinox.p2.query.IQueryable;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.viewers.*;
import org.eclipse.swt.SWT;
@@ -45,8 +40,7 @@ public abstract class ResolutionResultsWizardPage extends ResolutionStatusPage {
private static final String DIALOG_SETTINGS_SECTION = "ResolutionResultsPage"; //$NON-NLS-1$
protected IUElementListRoot input;
- PlannerResolutionOperation resolvedOperation;
- protected Policy policy;
+ ProfileChangeOperation resolvedOperation;
TreeViewer treeViewer;
ProvElementContentProvider contentProvider;
IUDetailsLabelProvider labelProvider;
@@ -54,15 +48,18 @@ public abstract class ResolutionResultsWizardPage extends ResolutionStatusPage {
private IUDetailsGroup iuDetailsGroup;
SashForm sashForm;
- protected ResolutionResultsWizardPage(Policy policy, IUElementListRoot input, String profileID, PlannerResolutionOperation resolvedOperation) {
- super("ResolutionPage", profileID); //$NON-NLS-1$
- this.policy = policy;
- Assert.isNotNull(resolvedOperation);
- this.resolvedOperation = resolvedOperation;
+ protected ResolutionResultsWizardPage(ProvisioningUI ui, ProvisioningOperationWizard wizard, IUElementListRoot input, ProfileChangeOperation operation) {
+ super("ResolutionPage", ui, wizard); //$NON-NLS-1$
+ // We can exist as an empty page, but if there is an operation, we need to know that it's resolved.
+ if (operation != null && !operation.hasResolved()) {
+ operation.resolveModal(null);
+ }
+ this.resolvedOperation = operation;
if (input == null)
this.input = new IUElementListRoot();
else
this.input = input;
+ updateStatus(input, resolvedOperation);
}
/*
@@ -117,7 +114,7 @@ public abstract class ResolutionResultsWizardPage extends ResolutionStatusPage {
labelProvider = new IUDetailsLabelProvider(null, getColumnConfig(), getShell());
treeViewer.setLabelProvider(labelProvider);
- setDrilldownElements(input, resolvedOperation.getProvisioningPlan());
+ setDrilldownElements(input, resolvedOperation);
treeViewer.setInput(input);
// Optional area to show the size
@@ -137,9 +134,8 @@ public abstract class ResolutionResultsWizardPage extends ResolutionStatusPage {
}
public boolean performFinish() {
- if (resolvedOperation.getResolutionResult().getSummaryStatus().getSeverity() != IStatus.ERROR) {
- ProfileModificationOperation op = createProfileModificationOperation(resolvedOperation);
- ProvisioningOperationRunner.schedule(op, StatusManager.SHOW | StatusManager.LOG);
+ if (resolvedOperation.getResolutionResult().getSeverity() != IStatus.ERROR) {
+ getProvisioningUI().schedule(resolvedOperation.getProvisioningJob(null), StatusManager.SHOW | StatusManager.LOG);
return true;
}
return false;
@@ -149,8 +145,10 @@ public abstract class ResolutionResultsWizardPage extends ResolutionStatusPage {
return treeViewer;
}
- public ProvisioningPlan getCurrentPlan() {
- return resolvedOperation.getProvisioningPlan();
+ public IProvisioningPlan getCurrentPlan() {
+ if (resolvedOperation != null)
+ return resolvedOperation.getProvisioningPlan();
+ return null;
}
protected Object[] getSelectedElements() {
@@ -164,34 +162,39 @@ public abstract class ResolutionResultsWizardPage extends ResolutionStatusPage {
return units[0];
}
- protected String getProfileId() {
- return profileId;
- }
-
protected IInstallableUnit[] getIUs() {
return ElementUtils.elementsToIUs(input.getChildren(input));
}
- void setDrilldownElements(IUElementListRoot root, ProvisioningPlan plan) {
- if (plan == null)
+ void setDrilldownElements(IUElementListRoot root, ProfileChangeOperation operation) {
+ if (operation == null || operation.getProvisioningPlan() == null)
return;
Object[] elements = root.getChildren(root);
for (int i = 0; i < elements.length; i++) {
if (elements[i] instanceof QueriedElement) {
- ((QueriedElement) elements[i]).setQueryable(getQueryable(plan));
+ ((QueriedElement) elements[i]).setQueryable(getQueryable(operation.getProvisioningPlan()));
}
}
}
- private ProfileModificationOperation createProfileModificationOperation(PlannerResolutionOperation op) {
- ProfileModificationOperation pmo = new ProfileModificationOperation(getOperationLabel(), profileId, op.getProvisioningPlan(), op.getProvisioningContext());
- pmo.setTaskName(getOperationTaskName());
- return pmo;
- }
-
protected abstract String getOperationLabel();
/**
+ * Returns the restart policy for this operation.
+ *
+ * @return an integer constant describing whether the running profile
+ * needs to be restarted.
+ *
+ * @see ProvisioningJob#RESTART_NONE
+ * @see ProvisioningJob#RESTART_ONLY
+ * @see ProvisioningJob#RESTART_OR_APPLY
+ *
+ */
+ protected int getRestartPolicy() {
+ return ProvisioningJob.RESTART_OR_APPLY;
+ }
+
+ /**
* Returns the task name for this operation, or <code>null</code> to display
* a generic task name.
*/
@@ -203,7 +206,7 @@ public abstract class ResolutionResultsWizardPage extends ResolutionStatusPage {
return new TreeViewer(parent, SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION);
}
- protected abstract IQueryable getQueryable(ProvisioningPlan plan);
+ protected abstract IQueryable<IInstallableUnit> getQueryable(IProvisioningPlan plan);
protected String getClipboardText(Control control) {
return CopyUtils.getIndentedClipboardText(getSelectedElements(), labelProvider);
@@ -217,9 +220,9 @@ public abstract class ResolutionResultsWizardPage extends ResolutionStatusPage {
return treeViewer != null;
}
- protected void updateCaches(IUElementListRoot newRoot, PlannerResolutionOperation op) {
+ protected void updateCaches(IUElementListRoot newRoot, ProfileChangeOperation op) {
resolvedOperation = op;
- setDrilldownElements(newRoot, resolvedOperation.getProvisioningPlan());
+ setDrilldownElements(newRoot, resolvedOperation);
if (treeViewer != null) {
if (input != newRoot)
treeViewer.setInput(newRoot);
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionStatusPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionStatusPage.java
index 1fd3b1e07..442759296 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionStatusPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/ResolutionStatusPage.java
@@ -11,16 +11,13 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.ui.dialogs;
-import org.eclipse.core.runtime.Assert;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
-import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.ui.IUPropertyUtils;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUI;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.IUElementListRoot;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.PlannerResolutionOperation;
-import org.eclipse.equinox.internal.provisional.p2.ui.viewers.IUColumnConfig;
+import org.eclipse.equinox.internal.p2.ui.*;
+import org.eclipse.equinox.internal.p2.ui.model.IUElementListRoot;
+import org.eclipse.equinox.internal.p2.ui.viewers.IUColumnConfig;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.operations.ProfileChangeOperation;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.swt.custom.SashForm;
@@ -42,17 +39,15 @@ public abstract class ResolutionStatusPage extends ProvisioningWizardPage {
private static final String VERSION_COLUMN_WIDTH = "VersionColumnWidth"; //$NON-NLS-1$
private static final String ID_COLUMN_WIDTH = "IDColumnWidth"; //$NON-NLS-1$
private IUColumnConfig nameColumn, versionColumn, idColumn;
- protected String profileId;
/**
* @param pageName
*/
- protected ResolutionStatusPage(String pageName, String profileId) {
- super(pageName);
- this.profileId = profileId;
+ protected ResolutionStatusPage(String pageName, ProvisioningUI ui, ProvisioningOperationWizard wizard) {
+ super(pageName, ui, wizard);
}
- protected abstract void updateCaches(IUElementListRoot root, PlannerResolutionOperation resolvedOperation);
+ protected abstract void updateCaches(IUElementListRoot root, ProfileChangeOperation resolvedOperation);
protected abstract boolean isCreated();
@@ -64,17 +59,14 @@ public abstract class ResolutionStatusPage extends ProvisioningWizardPage {
* Update the status area of the wizard to report the results of the operation.
*
* @param newRoot the root that describes the root IUs involved in creating the plan
- * @param op the PlannerResolutionOperation that describes the plan that was created.
- * Should not be <code>null</code>, but subclasses can be more forgiving.
+ * @param op the ProfileChangeOperation that describes the operation
*/
- public void updateStatus(IUElementListRoot newRoot, PlannerResolutionOperation op) {
- Assert.isNotNull(op);
+ public void updateStatus(IUElementListRoot newRoot, ProfileChangeOperation op) {
+ IStatus currentStatus = getProvisioningWizard().getCurrentStatus();
updateCaches(newRoot, op);
- IStatus currentStatus;
int messageType = IMessageProvider.NONE;
- boolean pageComplete = true;
- currentStatus = op.getResolutionResult().getSummaryStatus();
+ boolean pageComplete = op != null;
if (currentStatus != null && !currentStatus.isOK()) {
messageType = IMessageProvider.INFORMATION;
int severity = currentStatus.getSeverity();
@@ -99,7 +91,7 @@ public abstract class ResolutionStatusPage extends ProvisioningWizardPage {
protected String getIUDescription(IInstallableUnit iu) {
// Get the iu description in the default locale
- String description = IUPropertyUtils.getIUProperty(iu, IInstallableUnit.PROP_DESCRIPTION);
+ String description = iu.getProperty(IInstallableUnit.PROP_DESCRIPTION, null);
if (description == null)
description = ""; //$NON-NLS-1$
return description;
@@ -115,14 +107,14 @@ public abstract class ResolutionStatusPage extends ProvisioningWizardPage {
return ProvUIMessages.ResolutionWizardPage_WarningInfoStatus;
}
- void setDetailText(PlannerResolutionOperation resolvedOperation) {
+ void setDetailText(ProfileChangeOperation resolvedOperation) {
String detail = null;
IInstallableUnit selectedIU = getSelectedIU();
IUDetailsGroup detailsGroup = getDetailsGroup();
// We either haven't resolved, or we failed to resolve and reported some error
// while doing so. Since the specific error was already reported, the description
// text can be used for the selected IU.
- if (resolvedOperation == null) {
+ if (resolvedOperation == null || !resolvedOperation.hasResolved()) {
if (selectedIU != null) {
detail = getIUDescription(selectedIU);
detailsGroup.enablePropertyLink(true);
@@ -136,15 +128,15 @@ public abstract class ResolutionStatusPage extends ProvisioningWizardPage {
// An IU is selected and we have resolved. Look for information about the specific IU.
if (selectedIU != null) {
- detail = resolvedOperation.getResolutionResult().getDetailedReport(new IInstallableUnit[] {selectedIU});
+ detail = resolvedOperation.getResolutionDetails(selectedIU);
if (detail != null) {
detailsGroup.enablePropertyLink(false);
detailsGroup.setDetailText(detail);
return;
}
// No specific error about this IU. Show the overall error if it is in error.
- if (resolvedOperation.getResolutionResult().getSummaryStatus().getSeverity() == IStatus.ERROR) {
- detail = resolvedOperation.getResolutionResult().getSummaryReport();
+ if (resolvedOperation.getResolutionResult().getSeverity() == IStatus.ERROR) {
+ detail = resolvedOperation.getResolutionDetails();
detailsGroup.enablePropertyLink(false);
detailsGroup.setDetailText(detail);
return;
@@ -157,7 +149,7 @@ public abstract class ResolutionStatusPage extends ProvisioningWizardPage {
}
//No IU is selected, give the overall report
- detail = resolvedOperation.getResolutionResult().getSummaryReport();
+ detail = resolvedOperation.getResolutionDetails();
detailsGroup.enablePropertyLink(false);
if (detail == null)
detail = ""; //$NON-NLS-1$
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/SelectableIUsPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/SelectableIUsPage.java
index 91ce7ab4b..7e83e395f 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/SelectableIUsPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/SelectableIUsPage.java
@@ -11,19 +11,17 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.ui.dialogs;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.equinox.internal.p2.ui.*;
+import org.eclipse.equinox.internal.p2.ui.ProvUI;
+import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
import org.eclipse.equinox.internal.p2.ui.model.ElementUtils;
-import org.eclipse.equinox.internal.p2.ui.viewers.IUDetailsLabelProvider;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.ui.*;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.IUElementListRoot;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.PlannerResolutionOperation;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
-import org.eclipse.equinox.internal.provisional.p2.ui.viewers.*;
-import org.eclipse.jface.dialogs.*;
+import org.eclipse.equinox.internal.p2.ui.model.IUElementListRoot;
+import org.eclipse.equinox.internal.p2.ui.viewers.*;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.operations.ProfileChangeOperation;
+import org.eclipse.equinox.p2.ui.Policy;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.viewers.*;
import org.eclipse.jface.wizard.IWizardPage;
import org.eclipse.swt.SWT;
@@ -46,7 +44,7 @@ public class SelectableIUsPage extends ResolutionStatusPage implements IResoluti
IUElementListRoot root;
Object[] initialSelections;
- PlannerResolutionOperation resolvedOperation;
+ ProfileChangeOperation resolvedOperation;
CheckboxTableViewer tableViewer;
IUDetailsGroup iuDetailsGroup;
ProvElementContentProvider contentProvider;
@@ -55,12 +53,14 @@ public class SelectableIUsPage extends ResolutionStatusPage implements IResoluti
protected Policy policy;
SashForm sashForm;
- public SelectableIUsPage(Policy policy, IUElementListRoot root, Object[] initialSelections, String profileId) {
- super("IUSelectionPage", profileId); //$NON-NLS-1$
+ public SelectableIUsPage(ProvisioningUI ui, ProvisioningOperationWizard wizard, IUElementListRoot root, Object[] initialSelections) {
+ super("IUSelectionPage", ui, wizard); //$NON-NLS-1$
this.root = root;
- this.policy = policy;
+ if (root == null)
+ root = new IUElementListRoot();
this.initialSelections = initialSelections;
- this.profileId = profileId;
+ if (initialSelections == null)
+ initialSelections = new IInstallableUnit[0];
}
/*
@@ -201,13 +201,14 @@ public class SelectableIUsPage extends ResolutionStatusPage implements IResoluti
protected IInstallableUnit[] elementsToIUs(Object[] elements) {
IInstallableUnit[] theIUs = new IInstallableUnit[elements.length];
for (int i = 0; i < elements.length; i++) {
- theIUs[i] = (IInstallableUnit) ProvUI.getAdapter(elements[i], IInstallableUnit.class);
+ theIUs[i] = ProvUI.getAdapter(elements[i], IInstallableUnit.class);
}
return theIUs;
}
protected void setInitialCheckState() {
- tableViewer.setCheckedElements(initialSelections);
+ if (initialSelections != null)
+ tableViewer.setCheckedElements(initialSelections);
}
/*
@@ -252,31 +253,6 @@ public class SelectableIUsPage extends ResolutionStatusPage implements IResoluti
return units[0];
}
- /*
- * Overridden to handle conditions where continuing with the operation should not be allowed.
- * (non-Javadoc)
- * @see org.eclipse.equinox.internal.p2.ui.dialogs.ResolutionStatusPage#updateStatus(org.eclipse.equinox.internal.p2.ui.model.IUElementListRoot, org.eclipse.equinox.internal.provisional.p2.ui.operations.PlannerResolutionOperation)
- */
- public void updateStatus(IUElementListRoot newRoot, PlannerResolutionOperation op) {
- IStatus specialStatus = null;
- if (ProvisioningOperationRunner.hasScheduledOperationsFor(profileId)) {
- specialStatus = PlanAnalyzer.getStatus(IStatusCodes.OPERATION_ALREADY_IN_PROGRESS, null);
- } else if (op == null) {
- specialStatus = new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, 0, ProvUIMessages.ProfileModificationWizardPage_UnexpectedError, null);
- }
- if (specialStatus == null) {
- super.updateStatus(newRoot, op);
- } else {
- updateCaches(newRoot, op);
- setPageComplete(false);
- if (!isCreated())
- return;
- getDetailsGroup().setDetailText(specialStatus.getMessage());
- setMessage(getMessageText(specialStatus), IMessageProvider.ERROR);
-
- }
- }
-
protected IUDetailsGroup getDetailsGroup() {
return iuDetailsGroup;
}
@@ -285,7 +261,7 @@ public class SelectableIUsPage extends ResolutionStatusPage implements IResoluti
return tableViewer != null;
}
- protected void updateCaches(IUElementListRoot newRoot, PlannerResolutionOperation op) {
+ protected void updateCaches(IUElementListRoot newRoot, ProfileChangeOperation op) {
resolvedOperation = op;
if (root != newRoot && tableViewer != null)
tableViewer.setInput(newRoot);
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/SizeComputingWizardPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/SizeComputingWizardPage.java
index da87ce46f..a95451df7 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/SizeComputingWizardPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/SizeComputingWizardPage.java
@@ -14,16 +14,15 @@ import java.text.NumberFormat;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.*;
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.p2.ui.model.IIUElement;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.director.ProvisioningPlan;
-import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningContext;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
-import org.eclipse.equinox.internal.provisional.p2.ui.ValidationDialogServiceUI;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.IUElementListRoot;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.PlannerResolutionOperation;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
+import org.eclipse.equinox.internal.p2.ui.model.IUElementListRoot;
+import org.eclipse.equinox.p2.engine.IProvisioningPlan;
+import org.eclipse.equinox.p2.engine.ProvisioningContext;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.operations.ProfileChangeOperation;
+import org.eclipse.equinox.p2.operations.ProvisioningSession;
+import org.eclipse.equinox.p2.query.IQueryable;
+import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
@@ -38,34 +37,30 @@ public abstract class SizeComputingWizardPage extends ResolutionResultsWizardPag
protected Label sizeInfo;
protected long size;
Job sizingJob;
- private ProvisioningPlan lastComputedPlan = null;
+ private IProvisioningPlan lastComputedPlan = null;
- protected SizeComputingWizardPage(Policy policy, IUElementListRoot root, String profileID, PlannerResolutionOperation initialResolution) {
- super(policy, root, profileID, initialResolution);
+ protected SizeComputingWizardPage(ProvisioningUI ui, ProvisioningOperationWizard wizard, IUElementListRoot root, ProfileChangeOperation initialResolution) {
+ super(ui, wizard, root, initialResolution);
// Compute size immediately if a plan is available. This may or may not finish before
// the widgetry is created.
- if (initialResolution != null)
- computeSizing(initialResolution.getProvisioningPlan(), profileID, initialResolution.getProvisioningContext());
+ if (initialResolution != null && initialResolution.hasResolved())
+ computeSizing(initialResolution.getProvisioningPlan(), initialResolution.getProvisioningContext());
else
// Set the size to indicate there is no size yet.
- size = IIUElement.SIZE_NOTAPPLICABLE;
+ size = ProvisioningSession.SIZE_NOTAPPLICABLE;
}
- protected void computeSizing(final ProvisioningPlan plan, final String id, final ProvisioningContext provisioningContext) {
+ protected void computeSizing(final IProvisioningPlan plan, final ProvisioningContext provisioningContext) {
if (plan == lastComputedPlan)
return;
lastComputedPlan = plan;
- size = IIUElement.SIZE_UNKNOWN;
+ size = ProvisioningSession.SIZE_UNKNOWN;
updateSizingInfo();
if (sizingJob != null)
sizingJob.cancel();
sizingJob = new Job(ProvUIMessages.SizeComputingWizardPage_SizeJobTitle) {
protected IStatus run(IProgressMonitor monitor) {
- try {
- size = ProvisioningUtil.getSize(plan, id, provisioningContext, monitor);
- } catch (ProvisionException e) {
- return e.getStatus();
- }
+ size = getProvisioningUI().getSession().getSize(plan, provisioningContext, monitor);
if (monitor.isCanceled())
return Status.CANCEL_STATUS;
if (display != null) {
@@ -81,13 +76,13 @@ public abstract class SizeComputingWizardPage extends ResolutionResultsWizardPag
};
sizingJob.setUser(false);
sizingJob.setSystem(true);
- sizingJob.setProperty(ValidationDialogServiceUI.SUPPRESS_AUTHENTICATION_JOB_MARKER, Boolean.toString(true));
- sizingJob.schedule();
+ sizingJob.setProperty(LoadMetadataRepositoryJob.SUPPRESS_AUTHENTICATION_JOB_MARKER, Boolean.toString(true));
sizingJob.addJobChangeListener(new JobChangeAdapter() {
public void done(IJobChangeEvent event) {
sizingJob = null;
}
});
+ sizingJob.schedule();
}
protected void createSizingInfo(Composite parent) {
@@ -99,7 +94,7 @@ public abstract class SizeComputingWizardPage extends ResolutionResultsWizardPag
protected void updateSizingInfo() {
if (sizeInfo != null && !sizeInfo.isDisposed()) {
- if (size == IIUElement.SIZE_NOTAPPLICABLE)
+ if (size == ProvisioningSession.SIZE_NOTAPPLICABLE)
sizeInfo.setVisible(false);
else {
sizeInfo.setText(NLS.bind(ProvUIMessages.UpdateOrInstallWizardPage_Size, getFormattedSize()));
@@ -109,7 +104,7 @@ public abstract class SizeComputingWizardPage extends ResolutionResultsWizardPag
}
protected String getFormattedSize() {
- if (size == IIUElement.SIZE_UNKNOWN || size == IIUElement.SIZE_UNAVAILABLE)
+ if (size == ProvisioningSession.SIZE_UNKNOWN || size == ProvisioningSession.SIZE_UNAVAILABLE)
return ProvUIMessages.IUDetailsLabelProvider_Unknown;
if (size > 1000L) {
long kb = size / 1000L;
@@ -125,13 +120,13 @@ public abstract class SizeComputingWizardPage extends ResolutionResultsWizardPag
}
}
- public void updateStatus(IUElementListRoot root, PlannerResolutionOperation op) {
+ public void updateStatus(IUElementListRoot root, ProfileChangeOperation op) {
super.updateStatus(root, op);
- if (op.getProvisioningPlan() != null)
- computeSizing(op.getProvisioningPlan(), getProfileId(), op.getProvisioningContext());
+ if (op != null && op.getProvisioningPlan() != null)
+ computeSizing(op.getProvisioningPlan(), op.getProvisioningContext());
}
- protected IQueryable getQueryable(ProvisioningPlan plan) {
+ protected IQueryable<IInstallableUnit> getQueryable(IProvisioningPlan plan) {
return plan.getAdditions();
}
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/StructuredIUGroup.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/StructuredIUGroup.java
index 5564df78c..44ffabc05 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/StructuredIUGroup.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/StructuredIUGroup.java
@@ -10,12 +10,14 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.ui.dialogs;
+import org.eclipse.equinox.internal.p2.ui.ProvUI;
+import org.eclipse.equinox.internal.p2.ui.QueryProvider;
import org.eclipse.equinox.internal.p2.ui.model.ElementUtils;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUI;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.QueryProvider;
-import org.eclipse.equinox.internal.provisional.p2.ui.viewers.IUColumnConfig;
+import org.eclipse.equinox.internal.p2.ui.viewers.IUColumnConfig;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.operations.ProvisioningSession;
+import org.eclipse.equinox.p2.ui.Policy;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredViewer;
@@ -36,21 +38,22 @@ public abstract class StructuredIUGroup {
private FontMetrics fm;
protected StructuredViewer viewer;
private Composite composite;
- private Policy policy;
+ private ProvisioningUI ui;
private IUColumnConfig[] columnConfig;
+ private QueryProvider queryProvider;
/**
* Create a group that represents the available IU's.
*
- * @param policy The application policy to use in the group
+ * @param ui The application policy to use in the group
* @param parent the parent composite for the group
* to retrieve elements in the viewer.
* @param font The font to use for calculating pixel sizes. This font is
* not managed by the receiver.
* @param columnConfig the columns to be shown
*/
- protected StructuredIUGroup(Policy policy, Composite parent, Font font, IUColumnConfig[] columnConfig) {
- this.policy = policy;
+ protected StructuredIUGroup(ProvisioningUI ui, Composite parent, Font font, IUColumnConfig[] columnConfig) {
+ this.ui = ui;
if (columnConfig == null)
this.columnConfig = ProvUI.getIUColumnConfig();
else
@@ -127,11 +130,21 @@ public abstract class StructuredIUGroup {
}
protected QueryProvider getQueryProvider() {
- return policy.getQueryProvider();
+ if (queryProvider == null)
+ queryProvider = new QueryProvider(ui);
+ return queryProvider;
}
protected Policy getPolicy() {
- return policy;
+ return ui.getPolicy();
+ }
+
+ protected ProvisioningSession getSession() {
+ return ui.getSession();
+ }
+
+ protected ProvisioningUI getProvisioningUI() {
+ return ui;
}
protected Control getDefaultFocusControl() {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UninstallWizard.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UninstallWizard.java
new file mode 100644
index 000000000..e5cb26203
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UninstallWizard.java
@@ -0,0 +1,91 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.ui.dialogs;
+
+import org.eclipse.equinox.internal.p2.ui.model.InstalledIUElement;
+
+import java.util.ArrayList;
+import org.eclipse.equinox.internal.p2.ui.ProvUIImages;
+import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
+import org.eclipse.equinox.internal.p2.ui.model.*;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.operations.ProfileChangeOperation;
+import org.eclipse.equinox.p2.operations.UninstallOperation;
+import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
+import org.eclipse.jface.wizard.IWizardPage;
+
+/**
+ * @since 3.4
+ */
+public class UninstallWizard extends ProvisioningOperationWizard {
+
+ public UninstallWizard(ProvisioningUI ui, UninstallOperation operation, IInstallableUnit[] initialSelections, LoadMetadataRepositoryJob job) {
+ super(ui, operation, initialSelections, job);
+ setWindowTitle(ProvUIMessages.UninstallIUOperationLabel);
+ setDefaultPageImageDescriptor(ProvUIImages.getImageDescriptor(ProvUIImages.WIZARD_BANNER_UNINSTALL));
+ }
+
+ protected ISelectableIUsPage createMainPage(IUElementListRoot input, Object[] selections) {
+ mainPage = new SelectableIUsPage(ui, this, input, selections);
+ mainPage.setTitle(ProvUIMessages.UninstallIUOperationLabel);
+ mainPage.setDescription(ProvUIMessages.UninstallDialog_UninstallMessage);
+ ((SelectableIUsPage) mainPage).updateStatus(input, operation);
+ return mainPage;
+ }
+
+ protected ResolutionResultsWizardPage createResolutionPage() {
+ return new UninstallWizardPage(ui, this, root, (UninstallOperation) operation);
+ }
+
+ protected void initializeResolutionModelElements(Object[] selectedElements) {
+ root = new IUElementListRoot();
+ ArrayList<InstalledIUElement> list = new ArrayList<InstalledIUElement>(selectedElements.length);
+ ArrayList<InstalledIUElement> selections = new ArrayList<InstalledIUElement>(selectedElements.length);
+ for (int i = 0; i < selectedElements.length; i++) {
+ IInstallableUnit iu = ElementUtils.getIU(selectedElements[i]);
+ if (iu != null) {
+ InstalledIUElement element = new InstalledIUElement(root, getProfileId(), iu);
+ list.add(element);
+ selections.add(element);
+ }
+ }
+ root.setChildren(list.toArray());
+ planSelections = selections.toArray();
+ }
+
+ protected IResolutionErrorReportingPage createErrorReportingPage() {
+ return (SelectableIUsPage) mainPage;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#getStartingPage()
+ */
+ public IWizardPage getStartingPage() {
+ if (getCurrentStatus().isOK()) {
+ ((SelectableIUsPage) mainPage).setPageComplete(true);
+ return resolutionPage;
+ }
+ return super.getStartingPage();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.internal.p2.ui.dialogs.ProvisioningOperationWizard#getProfileChangeOperation(java.lang.Object[])
+ */
+ protected ProfileChangeOperation getProfileChangeOperation(Object[] elements) {
+ UninstallOperation op = new UninstallOperation(ui.getSession(), ElementUtils.elementsToIUs(elements));
+ op.setProfileId(getProfileId());
+ // op.setRootMarkerKey(getRootMarkerKey());
+ op.setProvisioningContext(getProvisioningContext());
+ return op;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UninstallWizardPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UninstallWizardPage.java
index e43caae2c..376bbed82 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UninstallWizardPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UninstallWizardPage.java
@@ -11,16 +11,17 @@
package org.eclipse.equinox.internal.p2.ui.dialogs;
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.provisional.p2.director.ProvisioningPlan;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.IUElementListRoot;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.PlannerResolutionOperation;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
+import org.eclipse.equinox.internal.p2.ui.model.IUElementListRoot;
+import org.eclipse.equinox.p2.engine.IProvisioningPlan;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.operations.UninstallOperation;
+import org.eclipse.equinox.p2.query.IQueryable;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
public class UninstallWizardPage extends ResolutionResultsWizardPage {
- public UninstallWizardPage(Policy policy, IUElementListRoot root, String profileId, PlannerResolutionOperation initialResolution) {
- super(policy, root, profileId, initialResolution);
+ public UninstallWizardPage(ProvisioningUI ui, ProvisioningOperationWizard wizard, IUElementListRoot root, UninstallOperation initialResolution) {
+ super(ui, wizard, root, initialResolution);
setTitle(ProvUIMessages.UninstallWizardPage_Title);
setDescription(ProvUIMessages.UninstallWizardPage_Description);
}
@@ -33,7 +34,7 @@ public class UninstallWizardPage extends ResolutionResultsWizardPage {
return ProvUIMessages.UninstallIUOperationTask;
}
- protected IQueryable getQueryable(ProvisioningPlan plan) {
+ protected IQueryable<IInstallableUnit> getQueryable(IProvisioningPlan plan) {
return plan.getRemovals();
}
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UpdateWizard.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UpdateWizard.java
new file mode 100644
index 000000000..46b375868
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UpdateWizard.java
@@ -0,0 +1,146 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Genuitec, LLC - added license support
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.ui.dialogs;
+
+import java.util.*;
+import org.eclipse.equinox.internal.p2.ui.ProvUIImages;
+import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
+import org.eclipse.equinox.internal.p2.ui.model.AvailableUpdateElement;
+import org.eclipse.equinox.internal.p2.ui.model.IUElementListRoot;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.operations.*;
+import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.swt.widgets.Composite;
+
+/**
+ * @since 3.4
+ */
+public class UpdateWizard extends WizardWithLicenses {
+ IInstallableUnit[] iusToReplace;
+ boolean skipSelectionsPage = false;
+
+ public static IInstallableUnit[] getIUsToReplace(Object[] elements) {
+ Set<IInstallableUnit> iusToReplace = new HashSet<IInstallableUnit>();
+ for (int i = 0; i < elements.length; i++) {
+ if (elements[i] instanceof AvailableUpdateElement) {
+ iusToReplace.add(((AvailableUpdateElement) elements[i]).getIUToBeUpdated());
+ }
+ }
+ return iusToReplace.toArray(new IInstallableUnit[iusToReplace.size()]);
+ }
+
+ public static IInstallableUnit[] getReplacementIUs(Object[] elements) {
+ Set<IInstallableUnit> replacements = new HashSet<IInstallableUnit>();
+ for (int i = 0; i < elements.length; i++) {
+ if (elements[i] instanceof AvailableUpdateElement) {
+ replacements.add(((AvailableUpdateElement) elements[i]).getIU());
+ }
+ }
+ return replacements.toArray(new IInstallableUnit[replacements.size()]);
+ }
+
+ public static Update[] makeUpdatesFromElements(Object[] elements) {
+ Set<Update> updates = new HashSet<Update>();
+ for (int i = 0; i < elements.length; i++) {
+ if (elements[i] instanceof AvailableUpdateElement) {
+ updates.add(((AvailableUpdateElement) elements[i]).getUpdate());
+ }
+ }
+ return updates.toArray(new Update[updates.size()]);
+ }
+
+ public UpdateWizard(ProvisioningUI ui, UpdateOperation operation, Object[] initialSelections, LoadMetadataRepositoryJob preloadJob) {
+ super(ui, operation, initialSelections, preloadJob);
+ setWindowTitle(ProvUIMessages.UpdateAction_UpdatesAvailableTitle);
+ setDefaultPageImageDescriptor(ProvUIImages.getImageDescriptor(ProvUIImages.WIZARD_BANNER_UPDATE));
+ }
+
+ protected ISelectableIUsPage createMainPage(IUElementListRoot input, Object[] selections) {
+ mainPage = new SelectableIUsPage(ui, this, input, selections);
+ mainPage.setTitle(ProvUIMessages.UpdateAction_UpdatesAvailableTitle);
+ mainPage.setDescription(ProvUIMessages.UpdateAction_UpdatesAvailableMessage);
+ ((SelectableIUsPage) mainPage).updateStatus(input, operation);
+ return mainPage;
+ }
+
+ protected ResolutionResultsWizardPage createResolutionPage() {
+ return new UpdateWizardPage(ui, this, root, (UpdateOperation) operation);
+ }
+
+ protected void initializeResolutionModelElements(Object[] selectedElements) {
+ root = new IUElementListRoot();
+ ArrayList<AvailableUpdateElement> list = new ArrayList<AvailableUpdateElement>(selectedElements.length);
+ ArrayList<AvailableUpdateElement> selected = new ArrayList<AvailableUpdateElement>(selectedElements.length);
+ for (int i = 0; i < selectedElements.length; i++) {
+ if (selectedElements[i] instanceof AvailableUpdateElement) {
+ AvailableUpdateElement element = (AvailableUpdateElement) selectedElements[i];
+ AvailableUpdateElement newElement = new AvailableUpdateElement(root, element.getIU(), element.getIUToBeUpdated(), getProfileId(), shouldShowProvisioningPlanChildren());
+ list.add(newElement);
+ selected.add(newElement);
+ } else if (selectedElements[i] instanceof Update) {
+ Update update = (Update) selectedElements[i];
+ AvailableUpdateElement newElement = new AvailableUpdateElement(root, update.replacement, update.toUpdate, getProfileId(), shouldShowProvisioningPlanChildren());
+ list.add(newElement);
+ selected.add(newElement);
+ }
+ }
+ root.setChildren(list.toArray());
+ planSelections = selected.toArray();
+ }
+
+ public void createPageControls(Composite pageContainer) {
+ super.createPageControls(pageContainer);
+ if (getRepositoryPreloadJob() != null)
+ // async exec since we are in the middle of opening
+ pageContainer.getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ getRepositoryPreloadJob().reportAccumulatedStatus();
+ }
+ });
+ }
+
+ protected IResolutionErrorReportingPage createErrorReportingPage() {
+ return (SelectableIUsPage) mainPage;
+ }
+
+ public void setSkipSelectionsPage(boolean skipSelectionsPage) {
+ this.skipSelectionsPage = skipSelectionsPage;
+ }
+
+ public IWizardPage getStartingPage() {
+ if (skipSelectionsPage) {
+ // TODO see https://bugs.eclipse.org/bugs/show_bug.cgi?id=276963
+ IWizardPage page = getNextPage(mainPage);
+ if (page != null)
+ return page;
+ }
+ return mainPage;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.internal.p2.ui.dialogs.ProvisioningOperationWizard#getProfileChangeOperation(java.lang.Object[])
+ */
+ protected ProfileChangeOperation getProfileChangeOperation(Object[] elements) {
+ if (operation == null) {
+ operation = new UpdateOperation(ui.getSession(), getIUsToReplace(elements));
+ operation.setProfileId(getProfileId());
+ // operation.setRootMarkerKey(getRootMarkerKey());
+ operation.setProvisioningContext(getProvisioningContext());
+
+ } else {
+ ((UpdateOperation) operation).setSelectedUpdates(makeUpdatesFromElements(elements));
+ }
+ return operation;
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UpdateWizardPage.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UpdateWizardPage.java
index eafb86b29..c8bf6dd31 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UpdateWizardPage.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/UpdateWizardPage.java
@@ -10,17 +10,18 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.ui.dialogs;
+import org.eclipse.equinox.p2.metadata.IUpdateDescriptor;
+
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IUpdateDescriptor;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.IUElementListRoot;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.PlannerResolutionOperation;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
+import org.eclipse.equinox.internal.p2.ui.model.IUElementListRoot;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.operations.UpdateOperation;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
public class UpdateWizardPage extends SizeComputingWizardPage {
- public UpdateWizardPage(Policy policy, IUElementListRoot root, String profileId, PlannerResolutionOperation initialResolution) {
- super(policy, root, profileId, initialResolution);
+ public UpdateWizardPage(ProvisioningUI ui, ProvisioningOperationWizard wizard, IUElementListRoot root, UpdateOperation operation) {
+ super(ui, wizard, root, operation);
setTitle(ProvUIMessages.UpdateWizardPage_Title);
setDescription(ProvUIMessages.UpdateWizardPage_Description);
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/WizardWithLicenses.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/WizardWithLicenses.java
index 221786295..a8b7e0646 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/WizardWithLicenses.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/dialogs/WizardWithLicenses.java
@@ -12,15 +12,10 @@
package org.eclipse.equinox.internal.p2.ui.dialogs;
import org.eclipse.equinox.internal.p2.ui.model.ElementUtils;
-import org.eclipse.equinox.internal.provisional.p2.director.ProvisioningPlan;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.ui.dialogs.AcceptLicensesWizardPage;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.IUElementListRoot;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.PlannerResolutionOperation;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
-import org.eclipse.jface.wizard.IWizardContainer;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.operations.ProfileChangeOperation;
+import org.eclipse.equinox.p2.ui.*;
import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.swt.widgets.Display;
/**
* Common superclass for wizards that need to show licenses.
@@ -30,62 +25,52 @@ public abstract class WizardWithLicenses extends ProvisioningOperationWizard {
AcceptLicensesWizardPage licensePage;
- public WizardWithLicenses(Policy policy, String profileId, IUElementListRoot root, Object[] initialSelections, PlannerResolutionOperation initialResolution) {
- super(policy, profileId, root, initialSelections, initialResolution);
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#addPages()
+ */
+ public void addPages() {
+ super.addPages();
+ licensePage = createLicensesPage();
+ addPage(licensePage);
}
- protected AcceptLicensesWizardPage createLicensesPage(IInstallableUnit[] ius, ProvisioningPlan plan) {
- return new AcceptLicensesWizardPage(policy, ius, plan);
+ public WizardWithLicenses(ProvisioningUI ui, ProfileChangeOperation operation, Object[] initialSelections, LoadMetadataRepositoryJob job) {
+ super(ui, operation, initialSelections, job);
}
- public void addPages() {
- super.addPages();
+ protected AcceptLicensesWizardPage createLicensesPage() {
+ IInstallableUnit[] ius = new IInstallableUnit[0];
+ if (planSelections != null)
+ ius = ElementUtils.elementsToIUs(planSelections);
+ return new AcceptLicensesWizardPage(ui.getLicenseManager(), ius, operation);
}
+ /*
+ * Overridden to determine whether the license page should be shown.
+ * (non-Javadoc)
+ * @see org.eclipse.equinox.internal.p2.ui.dialogs.ProvisioningOperationWizard#getNextPage(org.eclipse.jface.wizard.IWizardPage)
+ */
public IWizardPage getNextPage(IWizardPage page) {
- if (page == resolutionPage) {
- if (licensePage == null) {
- licensePage = createLicensesPage(ElementUtils.elementsToIUs(mainPage.getCheckedIUElements()), resolutionPage.getCurrentPlan());
- addPage(licensePage);
- Display.getDefault().asyncExec(new Runnable() {
- public void run() {
- IWizardContainer container = getContainer();
- if (container != null)
- container.updateButtons();
- }
- });
-
- }
- if (licensePage.hasLicensesToAccept()) {
- return licensePage;
- }
- return null;
- } else if (page == licensePage) {
- // we are done. We explicitly code this because it's possible
- // that the license page is added to the wizard before a dynamic page that
- // gets added afterward, but should appear before.
+ // If the license page is supposed to be the next page,
+ // ensure there are actually licenses that need acceptance.
+ IWizardPage proposedPage = super.getNextPage(page);
+ if (proposedPage != licensePage)
+ return proposedPage;
+ if (!licensePage.hasLicensesToAccept())
return null;
- }
- return super.getNextPage(page);
+ return licensePage;
}
protected void planChanged() {
super.planChanged();
- if (resolutionOperation == null)
- return;
- if (licensePage == null) {
- licensePage = createLicensesPage(ElementUtils.elementsToIUs(mainPage.getCheckedIUElements()), resolutionOperation.getProvisioningPlan());
- addPage(licensePage);
- } else
- licensePage.update(ElementUtils.elementsToIUs(mainPage.getCheckedIUElements()), resolutionOperation.getProvisioningPlan());
- // Status of license page could change status of wizard next button
- // If no current page has been set yet (ie, we are still being created)
- // then the updateButtons() method will NPE. This check is needed in
- // order to run the automated test cases.
- if (getContainer().getCurrentPage() != null)
- getContainer().updateButtons();
+ licensePage.update(ElementUtils.elementsToIUs(planSelections), operation);
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.equinox.internal.p2.ui.dialogs.ProvisioningOperationWizard#performFinish()
+ */
public boolean performFinish() {
licensePage.performFinish();
return super.performFinish();
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/messages.properties b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/messages.properties
index a34c3c84d..6ee7196b3 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/messages.properties
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/messages.properties
@@ -9,32 +9,17 @@
# IBM Corporation - initial API and implementation
###############################################################################
-ProfileChangeRequestBuildingRequest=Processing request
-ProfileElement_InvalidProfile=Invalid profile ID {0}
ProfileModificationAction_InvalidSelections=Problem determining user request. Profile id: {0}, Selection count: {1}
-ProfileModificationAction_NoChangeRequestProvided=Could not interpret the request
-ProfileModificationAction_NoExplanationProvided=Unexpected error while processing the request.
-ProfileModificationAction_ResolutionOperationLabel=Calculating Requirements
ProfileModificationWizardPage_DetailsLabel=Details
-ProfileModificationWizardPage_ResolutionOperationLabel=Calculating Requirements
-ProfileModificationWizardPage_UnexpectedError=An unexpected error occurred. This wizard is no longer valid with the current selections.
ProfileSnapshots_Label=Installation History
-ProvisioningUtil_InstallPlanConfigurationError=A problem was encountered while preparing the system for the installation
-ProvisioningUtil_NoRepositoryManager=No repository manager was found
-ProvisioningUtil_LoadRepositoryFailure=Unable to load the repository {0}
-ProvisioningUtil_NoProfileRegistryFound=No profile registry was found
-ProvisioningUtil_NoPlannerFound=No provisioning planner was found
-ProvisioningUtil_NoDirectorFound=No provisioning director was found
-ProvisioningUtil_NoEngineFound=No provisioning engine was found
ProvisioningOperationRunner_CannotApplyChanges=The changes could not be applied while the application is running. You must restart the application for the changes to take effect.
-ProvisioningOperationRunner_ErrorExecutingOperation=Unexpected error while trying to run {0}
+ProvisioningOperationWizard_UnexpectedFailureToResolve=Unexpected error
InstalledSoftwarePage_NoProfile=This installation has not been configured for showing the installed software. See the error log for details.
InstallIUOperationLabel=Install
InstallIUOperationTask=Software installation in progress...
InstallIUCommandLabel=&Install...
InstallIUCommandTooltip=Install the selected items
-InstallIUProgress=Installing...
UninstallDialog_UninstallMessage=Check the items that you wish to uninstall.
UninstallIUOperationLabel=Uninstall
UninstallIUOperationTask=Uninstall is in progress...
@@ -46,7 +31,6 @@ UninstallWizardPage_Title=Uninstall Details
ServiceUI_LoginDetails=Please provide login details for {0}
ServiceUI_LoginRequired=Login required
ServiceUI_unsigned_message=Warning: You are installing software that contains unsigned content. The authenticity or validity of this software cannot be established. Do you want to continue with the installation?
-ServiceUI_unsigned_title=Installing unsigned content
ServiceUI_warning_title=Security Warning
UpdateIUOperationLabel=Update
UpdateIUOperationTask=Software update is in progress...
@@ -56,7 +40,6 @@ UpdateIUProgress=Updating...
RefreshAction_Label=Refres&h
RefreshAction_Tooltip=Refresh
RemoveColocatedRepositoryAction_Label=&Remove Sites...
-RemoveColocatedRepositoryAction_OperationLabel=Remove
RemoveColocatedRepositoryAction_Tooltip=Remove selected sites from the available software site list
RevertIUCommandLabel=&Revert...
RevertIUCommandTooltip=Revert to a previously installed configuration
@@ -114,7 +97,9 @@ RepositoryManipulationPage_Title=Available Software Sites
RepositoryManipulatorDropTarget_DragAndDropJobLabel=Drag and Drop Operation
RepositoryManipulatorDropTarget_DragSourceNotValid={0} was not accepted as a valid software site location. Check the details.
RepositoryNameAndLocationDialog_Title=Edit Site
-ResolutionReport_SummaryStatus=Operation details
+RepositorySelectionGroup_GenericSiteLinkTitle=<a>Work with the list of software sites</a>
+RepositorySelectionGroup_PrefPageLink=Find more software by working with the <a>'{0}'</a> preferences.
+RepositorySelectionGroup_PrefPageName=Software Sites
ResolutionWizardPage_Canceled=The operation was cancelled.
ResolutionWizardPage_ErrorStatus=The operation cannot be completed. See the details.
ResolutionWizardPage_NoSelections=There were no installable units selected when the plan was computed.
@@ -132,16 +117,13 @@ AcceptLicensesWizardPage_ReviewLicensesDescription=Licenses must be reviewed and
AcceptLicensesWizardPage_SingleLicenseTextLabel=License &text (for {0}):
AcceptLicensesWizardPage_Title=Review Licenses
AddRepositoryDialog_Title=Add Repository
-AddRepositoryDialog_DuplicateURL=Duplicate location
AddRepositoryDialog_InvalidURL=The provided location is not valid
AddRepositoryDialog_LocationLabel=&Location:
AddRepositoryDialog_NameLabel=&Name:
UpdateAction_UpdatesAvailableMessage=Check the updates that you wish to install.
UpdateAction_UpdatesAvailableTitle=Available Updates
-UpdateOperation_NothingToUpdate=There is nothing to update.
UpdateOrInstallWizardPage_Size=Size: {0}
-URLValidator_UnrecognizedURL=The location {0} is not a valid software site location.
UpdateManagerCompatibility_ExportSitesTitle=Export Sites
UpdateManagerCompatibility_ImportSitesTitle=Import Sites
UpdateManagerCompatibility_InvalidSiteFileMessage=The selected file does not contain any updates sites. Please select another file.
@@ -155,9 +137,6 @@ UserValidationDialog_PasswordLabel=&Password:
UserValidationDialog_SavePasswordButton=&Save password
UserValidationDialog_UsernameLabel=&Username:
ColocatedRepositoryManipulator_AddSiteOperationLabel=Add Site
-ColocatedRepositoryManipulator_GotoPrefs=Go to the <a>Available Software Sites</a> preferences
-ColocatedRepositoryManipulator_ManageSites=&Manage Sites...
-ColocatedRepositoryManipulator_RemoveSiteOperationLabel=Remove Site
RevertProfilePage_ConfirmDeleteMultipleConfigs=Deleting the selected configurations from the installation history will free up the disk space used to store the configurations. However, you will no longer be able to revert your installation to these configurations. Are you sure you want to delete the configurations?
RevertProfilePage_ConfirmDeleteSingleConfig=Deleting the configuration from the installation history will free up the disk space used to store it. However, you will no longer be able to revert your installation to this configuration. Are you sure you want to delete it?
RevertProfilePage_Delete=&Delete
@@ -173,52 +152,36 @@ InstallWizardPage_NoCheckboxDescription=Review the items to be installed.
InstallWizardPage_Title=Install Details
PreselectedIUInstallWizard_Title=Install
PreselectedIUInstallWizard_Description=Check the items that you wish to install.
-
-PlanAnalyzer_IgnoringInstall="{0}" is not applicable to the current configuration and will not be installed.
-PlanAnalyzer_LockedImpliedUpdate0={0} will be ignored because it is already installed, and updates are not permitted.
-PlanAnalyzer_PartialInstall="{0}" is already present because other installed software requires it. It will be added to the installed software list.
-PlanAnalyzer_PartialUninstall= "{0}" cannot be fully uninstalled because other installed software requires it. The parts that are not required will be uninstalled.
-PlanAnalyzer_SideEffectInstall="{0}" will also be installed in order to complete this operation.
-PlanAnalyzer_SideEffectUninstall="{0}" must be uninstalled in order to complete this operation.
-PlannerResolutionOperation_UnexpectedError=Unexpected error. Unable to calculate requirements and dependencies.
-PlanStatusHelper_IgnoringImpliedDowngrade="{0}" will be ignored because a newer version is already installed.
-PlanStatusHelper_ImpliedUpdate="{0}" is already installed, so an update will be performed instead.
-PlanStatusHelper_Items=Items
-PlanStatusHelper_NothingToDo=Cannot complete the request. See the error log for details.
-PlanStatusHelper_AlreadyInstalled="{0}" will be ignored because it is already installed.
-PlanStatusHelper_AnotherOperationInProgress=Cannot continue the operation. There is another install operation in progress.
-PlanStatusHelper_Launch=Launch...
-PlanStatusHelper_RequestAltered=Your original request has been modified.
-PlanStatusHelper_RequiresUpdateManager=Cannot continue the operation. One or more items requires support from the old Update Manager.
-PlanStatusHelper_UnexpectedError=Unexpected error code {0} encountered for {1}.
-PlanStatusHelper_UpdateManagerPromptTitle=Unsupported Install
PlatformUpdateTitle = Software Updates
PlatformRestartMessage = You will need to restart {0} for the changes to take effect. \
Would you like to restart now?
+Policy_RequiresUpdateManagerMessage=A feature that you have selected uses install procedures that are not compatible with the current installation support. This feature can only be installed by the older Update Manager. \
+\
+Do you want to launch the older Update Manager?
+Policy_RequiresUpdateManagerTitle=Unsupported Install
ApplicationInRestartDialog = the application
ProvUI_ErrorDuringApplyConfig=Error while attempting to apply changes. You must restart the application for changes to take effect.
ProvUI_InformationTitle=Information
ProvUI_InstallDialogError=Unable to open the Installation Information.
ProvUI_NameColumnTitle=Name
ProvUI_IdColumnTitle=Id
-ProvUI_LoadErrorTitle=Error Contacting Site
-ProvUI_PromptForSiteEdit=No software site found at {0}. Do you wish to edit the location?
ProvUI_VersionColumnTitle=Version
ProvUI_WarningTitle=Warning
-ProvUIActivator_ExceptionDuringProfileChange=Exception while handling profile change event.
-ProvUILicenseManager_ParsingError=Error parsing the accepted license registry
ProvUIMessages_NotAccepted_EnterFor_0=Login details were not accepted. Please provide login details for {0}
ProvUIMessages_SavedNotAccepted_EnterFor_0=Saved login details were not accepted. Please provide login details for {0}
-OptionalPlatformRestartMessage = It is strongly recommended you restart {0} for the changes to take effect. \
-For some add-ons, it may be possible to apply the changes you have made without restarting. \
-Would you like to restart now?
-ApplyProfileChangesDialog_ApplyChanges=Apply Changes
-AvailableIUElement_ProfileNotFound=Could not find profile to use for size computation.
+OptionalPlatformRestartMessage = You will need to restart {0} for the installation changes to take effect. \
+\
+You may try to apply the changes without restarting, but this may cause errors.
+ApplyProfileChangesDialog_Restart=&Restart Now
+ApplyProfileChangesDialog_NotYet=&Not Now
+ApplyProfileChangesDialog_ApplyChanges=&Apply Changes Now
AvailableIUGroup_LoadingRepository=Loading {0}
AvailableIUGroup_NoSitesConfiguredDescription=This product was not configured with any software sites. Contact your systems administrator.
AvailableIUGroup_NoSitesConfiguredExplanation=There are no software sites available.
ColocatedRepositoryManipulator_NoContentExplanation=You may select a site in the combo box at the top. You may also type or paste a site name into the combo box and press Enter. You may also drag a site URL into the combo box or software list.
+ColocatedRepositoryTracker_PromptForSiteLocationEdit=No software site found at {0}. Do you wish to edit the location?
+ColocatedRepositoryTracker_SiteNotFoundTitle=Error Contacting Site
AvailableIUGroup_NoSitesExplanation=There is no site selected.
AvailableIUsPage_AddButton=&Add...
AvailableIUsPage_AllSites=--All Available Sites--
@@ -239,26 +202,27 @@ AvailableIUsPage_ShowLatestVersions=Show only the &latest versions of available
AvailableIUsPage_Title=Available Software
AvailableIUWrapper_AllAreInstalled=All items are installed
IUViewQueryContext_AllAreInstalledDescription=You can uncheck the 'Hide items that are already installed' check box to see all items.
-DefaultQueryProvider_ErrorRetrievingProfile=Error retrieving profile {0}
DeferredFetchFilteredTree_RetrievingList=Retrieving List
ElementUtils_UpdateJobTitle=Updating Repository Information
Label_Profiles=All Software Profiles
Label_Repositories=Known Repositories
+LaunchUpdateManagerButton=Launch...
+LoadMetadataRepositoryJob_ContactSitesProgress=Contacting Software Sites
+LoadMetadataRepositoryJob_SitesMissingError=Some sites could not be found. See the error log for more detail.
MetadataRepositoryElement_NotFound=This repository is currently not available.
MetadataRepositoryElement_RepositoryLoadError=Error loading repository {0}
IUViewQueryContext_NoCategorizedItemsDescription=You can uncheck the 'Group items by category' check box to see items without categories.
QueriedElementWrapper_NoCategorizedItemsExplanation=There are no categorized items
QueriedElementWrapper_NoItemsExplanation=There are no items available
QueriedElementWrapper_SiteNotFound=Could not find {0}
-ColocatedRepositoryManipulator_SiteNotFoundDescription=The site's location may be entered incorrectly, or the site might be offline. You can correct the location in the 'Available Software Sites' preferences by removing the site and adding it with the proper location. If the site name appears to be correct, you can test the connection in the 'Available Software Sites' preferences. The site may be unreachable, or you may have a problem with your network connection.
QueryableMetadataRepositoryManager_LoadRepositoryProgress=Contacting {0}
QueryableMetadataRepositoryManager_MultipleRepositoriesNotFound=Some sites could not be found. See the error log for more detail.
QueryableProfileRegistry_QueryProfileProgress=Getting profiles
+QueryableRepositoryManager_LoadFailure=Could not load {0}
QueryableUpdates_UpdateListProgress=Assembling list of updates
SelectableIUsPage_Select_All=Select &All
SelectableIUsPage_Deselect_All=&Deselect All
SizeComputingWizardPage_SizeJobTitle=Computing size
-SizingPhaseSet_PhaseSetName=Compute sizes
RevertDialog_ConfigContentsLabel=Con&figuration contents:
RevertDialog_ConfigsLabel=&Previous configurations:
@@ -267,10 +231,6 @@ RevertDialog_RevertOperationLabel=Revert configuration
RevertDialog_Title=Revert Software Configuration
RollbackProfileElement_CurrentInstallation=Current Installation
-RollbackProfileElement_InvalidSnapshot=The configuration snapshot is no longer valid.
TrustCertificateDialog_Details=Details
TrustCertificateDialog_Title=Do you trust these certificates?
-PlanStatusHelper_PromptForUpdateManagerUI=A feature that you have selected uses install procedures that are not compatible with the current installation support. This feature can only be installed by the older Update Manager. \
-\
-Do you want to launch the older Update Manager?
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactElement.java
index dfbca544d..9ba9f4a7b 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactElement.java
@@ -10,8 +10,8 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.ui.model;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
+import org.eclipse.equinox.p2.metadata.IArtifactKey;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
/**
* Element wrapper class for an artifact key and its repository
@@ -46,6 +46,7 @@ public class ArtifactElement extends ProvElement {
return repo.getArtifactDescriptors(key);
}
+ @SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
if (adapter == IArtifactRepository.class)
return getArtifactRepository();
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/model/ArtifactRepositories.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactRepositories.java
index be7ebe875..4b12392b8 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/model/ArtifactRepositories.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactRepositories.java
@@ -8,12 +8,10 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.model;
+package org.eclipse.equinox.internal.p2.ui.model;
-import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.p2.ui.model.RootElement;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.QueryProvider;
+import org.eclipse.equinox.internal.p2.ui.*;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
/**
* Element class that represents the root of an artifact
@@ -25,8 +23,9 @@ import org.eclipse.equinox.internal.provisional.p2.ui.policy.QueryProvider;
*/
public class ArtifactRepositories extends RootElement {
- public ArtifactRepositories(Policy policy) {
- super(policy);
+ public ArtifactRepositories(ProvisioningUI ui, QueryableArtifactRepositoryManager queryable) {
+ super(ui);
+ this.queryable = queryable;
}
protected int getDefaultQueryType() {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactRepositoryElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactRepositoryElement.java
index 03d709fd9..d137ed847 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactRepositoryElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ArtifactRepositoryElement.java
@@ -12,18 +12,14 @@ package org.eclipse.equinox.internal.p2.ui.model;
import java.net.URI;
import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IArtifactKey;
-import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUIImages;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.IRepositoryElement;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
+import org.eclipse.equinox.internal.p2.ui.*;
+import org.eclipse.equinox.p2.core.ProvisionException;
+import org.eclipse.equinox.p2.metadata.IArtifactKey;
+import org.eclipse.equinox.p2.query.IQueryable;
+import org.eclipse.equinox.p2.repository.IRepository;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
import org.eclipse.osgi.util.NLS;
-import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
-import org.eclipse.ui.progress.IElementCollector;
/**
* Element wrapper class for a artifact repository that gets its
@@ -31,11 +27,12 @@ import org.eclipse.ui.progress.IElementCollector;
*
* @since 3.4
*/
-public class ArtifactRepositoryElement extends ProvElement implements IDeferredWorkbenchAdapter, IRepositoryElement {
+public class ArtifactRepositoryElement extends RemoteQueriedElement implements IRepositoryElement<IArtifactKey> {
URI location;
IArtifactRepository repo;
boolean isEnabled;
+ ProvisioningUI ui;
public ArtifactRepositoryElement(Object parent, URI location) {
this(parent, location, true);
@@ -45,8 +42,10 @@ public class ArtifactRepositoryElement extends ProvElement implements IDeferredW
super(parent);
this.location = location;
this.isEnabled = isEnabled;
+ ui = ProvUIActivator.getDefault().getProvisioningUI();
}
+ @SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
if (adapter == IArtifactRepository.class)
return getRepository(null);
@@ -59,18 +58,6 @@ public class ArtifactRepositoryElement extends ProvElement implements IDeferredW
return ProvUIImages.IMG_ARTIFACT_REPOSITORY;
}
- protected Object[] fetchChildren(Object o, IProgressMonitor monitor) {
- IArtifactRepository repository = (IArtifactRepository) getRepository(monitor);
- if (repository == null)
- return new ArtifactElement[0];
- IArtifactKey[] keys = repository.getArtifactKeys();
- ArtifactElement[] elements = new ArtifactElement[keys.length];
- for (int i = 0; i < keys.length; i++) {
- elements[i] = new ArtifactElement(this, keys[i], repo);
- }
- return elements;
- }
-
public String getLabel(Object o) {
String name = getName();
if (name != null && name.length() > 0) {
@@ -79,10 +66,10 @@ public class ArtifactRepositoryElement extends ProvElement implements IDeferredW
return URIUtil.toUnencodedString(getLocation());
}
- public IRepository getRepository(IProgressMonitor monitor) {
+ public IArtifactRepository getRepository(IProgressMonitor monitor) {
if (repo == null)
try {
- repo = ProvisioningUtil.loadArtifactRepository(location, monitor);
+ repo = ui.getSession().getArtifactRepositoryManager().loadRepository(location, monitor);
} catch (ProvisionException e) {
handleException(e, NLS.bind(ProvUIMessages.MetadataRepositoryElement_RepositoryLoadError, location));
} catch (OperationCanceledException e) {
@@ -91,22 +78,6 @@ public class ArtifactRepositoryElement extends ProvElement implements IDeferredW
return repo;
}
- public ISchedulingRule getRule(Object object) {
- return null;
- }
-
- public boolean isContainer() {
- return true;
- }
-
- public void fetchDeferredChildren(Object o, IElementCollector collector, IProgressMonitor monitor) {
- collector.add(fetchChildren(o, monitor), monitor);
- }
-
- public Object[] getChildren(Object o) {
- return fetchChildren(o, null);
- }
-
/* (non-Javadoc)
* @see org.eclipse.equinox.internal.provisional.p2.ui.model.RepositoryElement#getURL()
*/
@@ -119,16 +90,12 @@ public class ArtifactRepositoryElement extends ProvElement implements IDeferredW
* @see org.eclipse.equinox.internal.provisional.p2.ui.model.RepositoryElement#getName()
*/
public String getName() {
- try {
- String name = ProvisioningUtil.getArtifactRepositoryProperty(location, IRepository.PROP_NICKNAME);
- if (name == null)
- name = ProvisioningUtil.getArtifactRepositoryProperty(location, IRepository.PROP_NAME);
- if (name == null)
- name = ""; //$NON-NLS-1$
- return name;
- } catch (ProvisionException e) {
- return ""; //$NON-NLS-1$
- }
+ String name = ui.getSession().getArtifactRepositoryManager().getRepositoryProperty(location, IRepository.PROP_NICKNAME);
+ if (name == null)
+ name = ui.getSession().getArtifactRepositoryManager().getRepositoryProperty(location, IRepository.PROP_NAME);
+ if (name == null)
+ name = ""; //$NON-NLS-1$
+ return name;
}
/*
@@ -136,14 +103,10 @@ public class ArtifactRepositoryElement extends ProvElement implements IDeferredW
* @see org.eclipse.equinox.internal.provisional.p2.ui.model.RepositoryElement#getDescription()
*/
public String getDescription() {
- try {
- String description = ProvisioningUtil.getArtifactRepositoryProperty(location, IRepository.PROP_DESCRIPTION);
- if (description == null)
- return ""; //$NON-NLS-1$
- return description;
- } catch (ProvisionException e) {
+ String description = ui.getSession().getArtifactRepositoryManager().getRepositoryProperty(location, IRepository.PROP_DESCRIPTION);
+ if (description == null)
return ""; //$NON-NLS-1$
- }
+ return description;
}
/* (non-Javadoc)
@@ -159,4 +122,22 @@ public class ArtifactRepositoryElement extends ProvElement implements IDeferredW
public void setEnabled(boolean enabled) {
isEnabled = enabled;
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.equinox.internal.p2.ui.model.QueriedElement#getDefaultQueryType()
+ */
+ protected int getDefaultQueryType() {
+ return QueryProvider.AVAILABLE_ARTIFACTS;
+ }
+
+ /*
+ * overridden to lazily fetch repository
+ * (non-Javadoc)
+ * @see org.eclipse.equinox.internal.provisional.p2.ui.query.QueriedElement#getQueryable()
+ */
+ public IQueryable<?> getQueryable() {
+ if (queryable == null)
+ queryable = getRepository(new NullProgressMonitor());
+ return queryable;
+ }
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableIUElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableIUElement.java
index 878057512..f1d826c7f 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableIUElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableIUElement.java
@@ -11,21 +11,17 @@
package org.eclipse.equinox.internal.p2.ui.model;
import java.net.URI;
+import java.util.Collection;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubMonitor;
-import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
+import org.eclipse.equinox.internal.p2.ui.ProvUIImages;
+import org.eclipse.equinox.internal.p2.ui.QueryProvider;
import org.eclipse.equinox.internal.provisional.p2.director.ProfileChangeRequest;
-import org.eclipse.equinox.internal.provisional.p2.director.ProvisioningPlan;
-import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
-import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningContext;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IRequiredCapability;
-import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUIImages;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.QueryProvider;
+import org.eclipse.equinox.p2.engine.*;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.IRequirement;
+import org.eclipse.equinox.p2.operations.ProvisioningSession;
+import org.eclipse.equinox.p2.repository.IRepository;
/**
* Element wrapper class for IU's that are available for installation.
@@ -37,7 +33,7 @@ import org.eclipse.equinox.internal.provisional.p2.ui.policy.QueryProvider;
public class AvailableIUElement extends QueriedElement implements IIUElement {
IInstallableUnit iu;
- boolean shouldShowChildren = Policy.getDefault().getQueryContext().getShowAvailableChildren();
+ boolean shouldShowChildren;
boolean isInstalled = false;
boolean isUpdate = false;
@@ -47,7 +43,7 @@ public class AvailableIUElement extends QueriedElement implements IIUElement {
// probably refer to some preference or policy to decide what to do.
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=221087
private static boolean shouldShowSize = false;
- long size = IIUElement.SIZE_UNKNOWN;
+ long size = ProvisioningSession.SIZE_UNKNOWN;
String profileID;
public AvailableIUElement(Object parent, IInstallableUnit iu, String profileID, boolean showChildren) {
@@ -74,6 +70,7 @@ public class AvailableIUElement extends QueriedElement implements IIUElement {
return iu.getId();
}
+ @SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
if (adapter == IInstallableUnit.class)
return iu;
@@ -87,24 +84,19 @@ public class AvailableIUElement extends QueriedElement implements IIUElement {
public void computeSize(IProgressMonitor monitor) {
if (profileID == null)
return;
- try {
- SubMonitor mon = SubMonitor.convert(monitor, 100);
- ProvisioningPlan plan = getSizingPlan(mon.newChild(50));
- size = ProvisioningUtil.getSize(plan, profileID, getProvisioningContext(), mon.newChild(50));
- } catch (ProvisionException e) {
- handleException(e, ProvUIMessages.AvailableIUElement_ProfileNotFound);
- size = IIUElement.SIZE_UNAVAILABLE;
- }
+ SubMonitor mon = SubMonitor.convert(monitor, 100);
+ IProvisioningPlan plan = getSizingPlan(mon.newChild(50));
+ size = getProvisioningUI().getSession().getSize(plan, getProvisioningContext(), mon.newChild(50));
}
- protected IProfile getProfile() throws ProvisionException {
- return ProvisioningUtil.getProfile(profileID);
+ protected IProfile getProfile() {
+ return getProvisioningUI().getSession().getProfileRegistry().getProfile(profileID);
}
- protected ProvisioningPlan getSizingPlan(IProgressMonitor monitor) throws ProvisionException {
+ protected IProvisioningPlan getSizingPlan(IProgressMonitor monitor) {
ProfileChangeRequest request = ProfileChangeRequest.createByProfileId(profileID);
request.addInstallableUnits(new IInstallableUnit[] {getIU()});
- return ProvisioningUtil.getProvisioningPlan(request, getProvisioningContext(), monitor);
+ return getProvisioningUI().getSession().getPlanner().getProvisioningPlan(request, getProvisioningContext(), monitor);
}
public IInstallableUnit getIU() {
@@ -129,7 +121,7 @@ public class AvailableIUElement extends QueriedElement implements IIUElement {
/* (non-Javadoc)
* @see org.eclipse.equinox.internal.p2.ui.model.IUElement#getRequirements()
*/
- public IRequiredCapability[] getRequirements() {
+ public Collection<IRequirement> getRequirements() {
return iu.getRequiredCapabilities();
}
@@ -181,8 +173,8 @@ public class AvailableIUElement extends QueriedElement implements IIUElement {
}
private ProvisioningContext getProvisioningContext() {
- if (hasQueryable() && getQueryable() instanceof IRepository)
- return new ProvisioningContext(new URI[] {((IRepository) getQueryable()).getLocation()});
+ if (hasQueryable() && getQueryable() instanceof IRepository<?>)
+ return new ProvisioningContext(new URI[] {((IRepository<?>) getQueryable()).getLocation()});
return new ProvisioningContext();
}
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableUpdateElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableUpdateElement.java
index d6c946e30..439625b9a 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableUpdateElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/AvailableUpdateElement.java
@@ -11,12 +11,12 @@
package org.eclipse.equinox.internal.p2.ui.model;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
+import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
import org.eclipse.equinox.internal.provisional.p2.director.ProfileChangeRequest;
-import org.eclipse.equinox.internal.provisional.p2.director.ProvisioningPlan;
-import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningContext;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
+import org.eclipse.equinox.p2.engine.IProvisioningPlan;
+import org.eclipse.equinox.p2.engine.ProvisioningContext;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.operations.Update;
/**
* Element wrapper class for IU's that are available for installation.
@@ -39,12 +39,12 @@ public class AvailableUpdateElement extends AvailableIUElement {
return iuToBeUpdated;
}
- protected ProvisioningPlan getSizingPlan(IProgressMonitor monitor) throws ProvisionException {
+ protected IProvisioningPlan getSizingPlan(IProgressMonitor monitor) {
ProfileChangeRequest request = ProfileChangeRequest.createByProfileId(profileID);
if (iuToBeUpdated.getId().equals(getIU().getId()))
- request.removeInstallableUnits(new IInstallableUnit[] {iuToBeUpdated});
- request.addInstallableUnits(new IInstallableUnit[] {getIU()});
- return ProvisioningUtil.getProvisioningPlan(request, new ProvisioningContext(), monitor);
+ request.removeInstallableUnit(iuToBeUpdated);
+ request.addInstallableUnits(getIU());
+ return ProvUIActivator.getDefault().getSession().getPlanner().getProvisioningPlan(request, new ProvisioningContext(), monitor);
}
public boolean equals(Object obj) {
@@ -69,4 +69,8 @@ public class AvailableUpdateElement extends AvailableIUElement {
result = prime * result + ((iuToBeUpdated == null) ? 0 : iuToBeUpdated.hashCode());
return result;
}
+
+ public Update getUpdate() {
+ return new Update(iuToBeUpdated, getIU());
+ }
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/CategoryElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/CategoryElement.java
index d94d8219b..639af85c4 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/CategoryElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/CategoryElement.java
@@ -10,13 +10,15 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.ui.model;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IRequiredCapability;
-import org.eclipse.equinox.internal.provisional.p2.ui.IUPropertyUtils;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUIImages;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.QueryProvider;
+import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
+import org.eclipse.equinox.internal.p2.ui.ProvUIImages;
+import org.eclipse.equinox.internal.p2.ui.QueryProvider;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.IRequirement;
+import org.eclipse.equinox.p2.operations.ProvisioningSession;
/**
* Element wrapper class for IU's that represent categories of
@@ -26,8 +28,8 @@ import org.eclipse.equinox.internal.provisional.p2.ui.policy.QueryProvider;
*/
public class CategoryElement extends RemoteQueriedElement implements IIUElement {
- private ArrayList ius = new ArrayList(1);
- private IRequiredCapability[] requirements;
+ private ArrayList<IInstallableUnit> ius = new ArrayList<IInstallableUnit>(1);
+ private Collection<IRequirement> requirements;
public CategoryElement(Object parent, IInstallableUnit iu) {
super(parent);
@@ -50,6 +52,7 @@ public class CategoryElement extends RemoteQueriedElement implements IIUElement
return null;
}
+ @SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
if (adapter == IInstallableUnit.class)
return getIU();
@@ -63,11 +66,11 @@ public class CategoryElement extends RemoteQueriedElement implements IIUElement
public IInstallableUnit getIU() {
if (ius == null || ius.isEmpty())
return null;
- return (IInstallableUnit) ius.get(0);
+ return ius.get(0);
}
public long getSize() {
- return SIZE_UNKNOWN;
+ return ProvisioningSession.SIZE_UNKNOWN;
}
public boolean shouldShowSize() {
@@ -94,27 +97,25 @@ public class CategoryElement extends RemoteQueriedElement implements IIUElement
}
private String getMergeKey(IInstallableUnit iu) {
- String mergeKey = IUPropertyUtils.getIUProperty(iu, IInstallableUnit.PROP_NAME);
+ String mergeKey = iu.getProperty(IInstallableUnit.PROP_NAME, null);
if (mergeKey == null || mergeKey.length() == 0) {
mergeKey = iu.getId();
}
return mergeKey;
}
- public IRequiredCapability[] getRequirements() {
+ public Collection<IRequirement> getRequirements() {
if (ius == null || ius.isEmpty())
- return new IRequiredCapability[0];
+ return CollectionUtils.emptyList();
if (requirements == null) {
if (ius.size() == 1)
requirements = getIU().getRequiredCapabilities();
else {
- ArrayList capabilities = new ArrayList();
- Iterator iter = ius.iterator();
- while (iter.hasNext()) {
- IInstallableUnit iu = (IInstallableUnit) iter.next();
- capabilities.addAll(Arrays.asList(iu.getRequiredCapabilities()));
+ ArrayList<IRequirement> capabilities = new ArrayList<IRequirement>();
+ for (IInstallableUnit iu : ius) {
+ capabilities.addAll(iu.getRequiredCapabilities());
}
- requirements = (IRequiredCapability[]) capabilities.toArray(new IRequiredCapability[capabilities.size()]);
+ requirements = capabilities;
}
}
return requirements;
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ElementUtils.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ElementUtils.java
index 809645601..b75a0d8ee 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ElementUtils.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ElementUtils.java
@@ -15,14 +15,13 @@ import java.net.URI;
import java.util.*;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
-import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUI;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
+import org.eclipse.equinox.internal.p2.ui.*;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.repository.IRepository;
+import org.eclipse.equinox.p2.repository.IRepositoryManager;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepositoryManager;
+import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
import org.eclipse.swt.widgets.Shell;
/**
@@ -36,60 +35,61 @@ public class ElementUtils {
public static void updateRepositoryUsingElements(final MetadataRepositoryElement[] elements, final Shell shell) {
Job job = new Job(ProvUIMessages.ElementUtils_UpdateJobTitle) {
public IStatus run(IProgressMonitor monitor) {
- ProvUI.startBatchOperation();
+ final ProvisioningUI ui = ProvUIActivator.getDefault().getProvisioningUI();
+ ui.signalRepositoryOperationStart();
+ IMetadataRepositoryManager metaManager = ui.getSession().getMetadataRepositoryManager();
+ IArtifactRepositoryManager artManager = ui.getSession().getArtifactRepositoryManager();
try {
- int visibilityFlags = Policy.getDefault().getQueryContext().getMetadataRepositoryFlags();
- URI[] currentlyEnabled = ProvisioningUtil.getMetadataRepositories(visibilityFlags);
- URI[] currentlyDisabled = ProvisioningUtil.getMetadataRepositories(IRepositoryManager.REPOSITORIES_DISABLED | visibilityFlags);
+ int visibilityFlags = ui.getRepositoryTracker().getMetadataRepositoryFlags();
+ URI[] currentlyEnabled = metaManager.getKnownRepositories(visibilityFlags);
+ URI[] currentlyDisabled = metaManager.getKnownRepositories(IRepositoryManager.REPOSITORIES_DISABLED | visibilityFlags);
for (int i = 0; i < elements.length; i++) {
URI location = elements[i].getLocation();
if (elements[i].isEnabled()) {
if (containsURI(currentlyDisabled, location))
// It should be enabled and is not currently
- ProvisioningUtil.setColocatedRepositoryEnablement(location, true);
+ setColocatedRepositoryEnablement(ui, location, true);
else if (!containsURI(currentlyEnabled, location)) {
// It is not known as enabled or disabled. Add it.
- ProvisioningUtil.addMetadataRepository(location, false);
- ProvisioningUtil.addArtifactRepository(location, false);
+ metaManager.addRepository(location);
+ artManager.addRepository(location);
}
} else {
if (containsURI(currentlyEnabled, location))
// It should be disabled, and is currently enabled
- ProvisioningUtil.setColocatedRepositoryEnablement(location, false);
+ setColocatedRepositoryEnablement(ui, location, false);
else if (!containsURI(currentlyDisabled, location)) {
// It is not known as enabled or disabled. Add it and then disable it.
- ProvisioningUtil.addMetadataRepository(location, false);
- ProvisioningUtil.addArtifactRepository(location, false);
- ProvisioningUtil.setColocatedRepositoryEnablement(location, false);
+ metaManager.addRepository(location);
+ artManager.addRepository(location);
+ setColocatedRepositoryEnablement(ui, location, false);
}
}
String name = elements[i].getName();
if (name != null && name.length() > 0) {
- ProvisioningUtil.setMetadataRepositoryProperty(location, IRepository.PROP_NICKNAME, name);
- ProvisioningUtil.setArtifactRepositoryProperty(location, IRepository.PROP_NICKNAME, name);
+ metaManager.setRepositoryProperty(location, IRepository.PROP_NICKNAME, name);
+ artManager.setRepositoryProperty(location, IRepository.PROP_NICKNAME, name);
}
}
// Are there any elements that need to be deleted? Go over the original state
// and remove any elements that weren't in the elements we were given
- Set nowKnown = new HashSet();
+ Set<String> nowKnown = new HashSet<String>();
for (int i = 0; i < elements.length; i++)
nowKnown.add(URIUtil.toUnencodedString(elements[i].getLocation()));
for (int i = 0; i < currentlyEnabled.length; i++) {
if (!nowKnown.contains(URIUtil.toUnencodedString(currentlyEnabled[i]))) {
- ProvisioningUtil.removeMetadataRepository(currentlyEnabled[i]);
- ProvisioningUtil.removeArtifactRepository(currentlyEnabled[i]);
+ metaManager.removeRepository(currentlyEnabled[i]);
+ artManager.removeRepository(currentlyEnabled[i]);
}
}
for (int i = 0; i < currentlyDisabled.length; i++) {
if (!nowKnown.contains(URIUtil.toUnencodedString(currentlyDisabled[i]))) {
- ProvisioningUtil.removeMetadataRepository(currentlyDisabled[i]);
- ProvisioningUtil.removeArtifactRepository(currentlyDisabled[i]);
+ metaManager.removeRepository(currentlyDisabled[i]);
+ artManager.removeRepository(currentlyDisabled[i]);
}
}
- } catch (ProvisionException e) {
- return e.getStatus();
} finally {
- ProvUI.endBatchOperation(true);
+ ui.signalRepositoryOperationComplete(null, true);
}
return Status.OK_STATUS;
}
@@ -97,22 +97,27 @@ public class ElementUtils {
job.schedule();
}
+ private static void setColocatedRepositoryEnablement(ProvisioningUI ui, URI location, boolean enable) {
+ ProvUIActivator.getDefault().getSession().getArtifactRepositoryManager().setEnabled(location, enable);
+ ProvUIActivator.getDefault().getSession().getMetadataRepositoryManager().setEnabled(location, enable);
+ }
+
public static IInstallableUnit getIU(Object element) {
if (element instanceof IInstallableUnit)
return (IInstallableUnit) element;
if (element instanceof IIUElement)
return ((IIUElement) element).getIU();
- return (IInstallableUnit) ProvUI.getAdapter(element, IInstallableUnit.class);
+ return ProvUI.getAdapter(element, IInstallableUnit.class);
}
public static IInstallableUnit[] elementsToIUs(Object[] elements) {
- ArrayList theIUs = new ArrayList(elements.length);
+ ArrayList<IInstallableUnit> theIUs = new ArrayList<IInstallableUnit>(elements.length);
for (int i = 0; i < elements.length; i++) {
- IInstallableUnit iu = (IInstallableUnit) ProvUI.getAdapter(elements[i], IInstallableUnit.class);
+ IInstallableUnit iu = ProvUI.getAdapter(elements[i], IInstallableUnit.class);
if (iu != null)
theIUs.add(iu);
}
- return (IInstallableUnit[]) theIUs.toArray(new IInstallableUnit[theIUs.size()]);
+ return theIUs.toArray(new IInstallableUnit[theIUs.size()]);
}
static boolean containsURI(URI[] locations, URI url) {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/IIUElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/IIUElement.java
index 7429ff412..06f419b1b 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/IIUElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/IIUElement.java
@@ -10,9 +10,10 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.ui.model;
+import java.util.Collection;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IRequiredCapability;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.IRequirement;
/**
* Interface for elements that represent IU's.
@@ -21,24 +22,6 @@ import org.eclipse.equinox.internal.provisional.p2.metadata.IRequiredCapability;
*/
public interface IIUElement {
- /**
- * Indicates that the size is currently unknown
- */
- public static final long SIZE_UNKNOWN = -1L;
-
- /**
- * Indicates that the size is unavailable (an
- * attempt was made to compute size but it failed)
- */
- public static final long SIZE_UNAVAILABLE = -2L;
-
- /**
- * Indicates that there was nothing to size (there
- * was no valid plan that could be used to compute
- * size).
- */
- public static final long SIZE_NOTAPPLICABLE = -3L;
-
public IInstallableUnit getIU();
public boolean shouldShowSize();
@@ -49,7 +32,7 @@ public interface IIUElement {
public void computeSize(IProgressMonitor monitor);
- public IRequiredCapability[] getRequirements();
+ public Collection<IRequirement> getRequirements();
public Object getParent(Object obj);
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/model/IRepositoryElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/IRepositoryElement.java
index fa02492bd..f2890b704 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/model/IRepositoryElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/IRepositoryElement.java
@@ -8,18 +8,18 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.model;
+package org.eclipse.equinox.internal.p2.ui.model;
import java.net.URI;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
+import org.eclipse.equinox.p2.repository.IRepository;
/**
* Interface for elements that represent repositories.
*
* @since 3.4
*/
-public interface IRepositoryElement {
+public interface IRepositoryElement<T> {
public URI getLocation();
@@ -31,5 +31,5 @@ public interface IRepositoryElement {
public void setEnabled(boolean enabled);
- public IRepository getRepository(IProgressMonitor monitor);
+ public IRepository<T> getRepository(IProgressMonitor monitor);
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/model/IUElementListRoot.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/IUElementListRoot.java
index 0c43cf157..5689beea3 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/model/IUElementListRoot.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/IUElementListRoot.java
@@ -8,9 +8,8 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.model;
+package org.eclipse.equinox.internal.p2.ui.model;
-import org.eclipse.equinox.internal.p2.ui.model.ProvElement;
/**
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/model/InstalledIUElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/InstalledIUElement.java
index 107be0eae..0b180a4d0 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/model/InstalledIUElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/InstalledIUElement.java
@@ -8,15 +8,15 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.model;
+package org.eclipse.equinox.internal.p2.ui.model;
+import java.util.Collection;
import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.equinox.internal.p2.ui.model.IIUElement;
-import org.eclipse.equinox.internal.p2.ui.model.QueriedElement;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IRequiredCapability;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUIImages;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.QueryProvider;
+import org.eclipse.equinox.internal.p2.ui.ProvUIImages;
+import org.eclipse.equinox.internal.p2.ui.QueryProvider;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.IRequirement;
+import org.eclipse.equinox.p2.operations.ProvisioningSession;
/**
* Element wrapper class for installed IU's. Used instead of the plain IU when
@@ -48,6 +48,7 @@ public class InstalledIUElement extends QueriedElement implements IIUElement {
return iu.getId();
}
+ @SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
if (adapter == IInstallableUnit.class)
return iu;
@@ -65,7 +66,7 @@ public class InstalledIUElement extends QueriedElement implements IIUElement {
// TODO Later we might consider showing this in the installed views,
// but it is less important than before install.
public long getSize() {
- return SIZE_UNKNOWN;
+ return ProvisioningSession.SIZE_UNKNOWN;
}
public boolean shouldShowSize() {
@@ -83,7 +84,7 @@ public class InstalledIUElement extends QueriedElement implements IIUElement {
/* (non-Javadoc)
* @see org.eclipse.equinox.internal.p2.ui.model.IUElement#getRequirements()
*/
- public IRequiredCapability[] getRequirements() {
+ public Collection<IRequirement> getRequirements() {
return iu.getRequiredCapabilities();
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/model/MetadataRepositories.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/MetadataRepositories.java
index 93441aa51..df87eea75 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/model/MetadataRepositories.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/MetadataRepositories.java
@@ -8,12 +8,11 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.model;
+package org.eclipse.equinox.internal.p2.ui.model;
-import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.p2.ui.model.RootElement;
-import org.eclipse.equinox.internal.provisional.p2.ui.QueryableMetadataRepositoryManager;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.*;
+import org.eclipse.equinox.internal.p2.ui.*;
+import org.eclipse.equinox.internal.p2.ui.query.IUViewQueryContext;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
/**
* Element class that represents some collection of metadata repositories.
@@ -29,12 +28,12 @@ public class MetadataRepositories extends RootElement {
private boolean includeDisabled = false;
- public MetadataRepositories(Policy policy) {
- this(policy.getQueryContext(), policy, null);
+ public MetadataRepositories(ProvisioningUI ui) {
+ this(ProvUI.getQueryContext(ui.getPolicy()), ui, null);
}
- public MetadataRepositories(IUViewQueryContext queryContext, Policy policy, QueryableMetadataRepositoryManager queryable) {
- super(queryContext, policy);
+ public MetadataRepositories(IUViewQueryContext queryContext, ProvisioningUI ui, QueryableMetadataRepositoryManager queryable) {
+ super(queryContext, ui);
this.queryable = queryable;
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/MetadataRepositoryElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/MetadataRepositoryElement.java
index b6a146cf7..8d8cd5f0b 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/MetadataRepositoryElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/MetadataRepositoryElement.java
@@ -14,19 +14,17 @@ import java.net.URI;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
import org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager;
-import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
-import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
-import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
-import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
-import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUI;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUIImages;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.IRepositoryElement;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.*;
-import org.eclipse.ui.statushandlers.StatusManager;
+import org.eclipse.equinox.internal.p2.ui.*;
+import org.eclipse.equinox.internal.p2.ui.query.IUViewQueryContext;
+import org.eclipse.equinox.p2.core.ProvisionException;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.operations.ProvisioningSession;
+import org.eclipse.equinox.p2.query.IQueryable;
+import org.eclipse.equinox.p2.repository.IRepository;
+import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
+import org.eclipse.equinox.p2.repository.metadata.IMetadataRepositoryManager;
+import org.eclipse.equinox.p2.ui.Policy;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
/**
* Element wrapper class for a metadata repository that gets its
@@ -36,28 +34,27 @@ import org.eclipse.ui.statushandlers.StatusManager;
*
* @since 3.4
*/
-public class MetadataRepositoryElement extends RootElement implements IRepositoryElement {
+public class MetadataRepositoryElement extends RootElement implements IRepositoryElement<IInstallableUnit> {
URI location;
boolean isEnabled;
String name;
public MetadataRepositoryElement(Object parent, URI location, boolean isEnabled) {
- this(parent, null, null, location, isEnabled);
+ this(parent, null, ProvisioningUI.getDefaultUI(), location, isEnabled);
}
- public MetadataRepositoryElement(IUViewQueryContext queryContext, Policy policy, URI location, boolean isEnabled) {
- super(null, queryContext, policy);
- this.location = location;
- this.isEnabled = isEnabled;
+ public MetadataRepositoryElement(IUViewQueryContext queryContext, ProvisioningUI ui, URI location, boolean isEnabled) {
+ this(null, queryContext, ui, location, isEnabled);
}
- private MetadataRepositoryElement(Object parent, IUViewQueryContext queryContext, Policy policy, URI location, boolean isEnabled) {
- super(parent, queryContext, policy);
+ private MetadataRepositoryElement(Object parent, IUViewQueryContext queryContext, ProvisioningUI ui, URI location, boolean isEnabled) {
+ super(parent, queryContext, ui);
this.location = location;
this.isEnabled = isEnabled;
}
+ @SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
if (adapter == IMetadataRepository.class)
return getQueryable();
@@ -76,7 +73,7 @@ public class MetadataRepositoryElement extends RootElement implements IRepositor
//only invoke super if we successfully loaded the repository
return super.fetchChildren(o, sub.newChild(100));
} catch (ProvisionException e) {
- ProvUI.reportLoadFailure(location, e.getStatus(), StatusManager.SHOW, getPolicy().getRepositoryManipulator());
+ getProvisioningUI().getRepositoryTracker().reportLoadFailure(location, e);
// TODO see https://bugs.eclipse.org/bugs/show_bug.cgi?id=276784
return new Object[] {new EmptyElementExplanation(this, IStatus.ERROR, e.getLocalizedMessage(), "")}; //$NON-NLS-1$
}
@@ -103,24 +100,25 @@ public class MetadataRepositoryElement extends RootElement implements IRepositor
* (non-Javadoc)
* @see org.eclipse.equinox.internal.provisional.p2.ui.query.QueriedElement#getQueryable()
*/
- public IQueryable getQueryable() {
+ public IQueryable<?> getQueryable() {
if (queryable == null)
- return (IQueryable) getRepository(new NullProgressMonitor());
+ queryable = getRepository(new NullProgressMonitor());
return queryable;
}
- public IRepository getRepository(IProgressMonitor monitor) {
+ public IMetadataRepository getRepository(IProgressMonitor monitor) {
try {
return getMetadataRepository(monitor);
} catch (ProvisionException e) {
- ProvUI.reportLoadFailure(location, e.getStatus(), StatusManager.SHOW, getPolicy().getRepositoryManipulator());
+ getProvisioningUI().getRepositoryTracker().reportLoadFailure(location, e);
}
return null;
}
private IMetadataRepository getMetadataRepository(IProgressMonitor monitor) throws ProvisionException {
- if (queryable == null)
- queryable = ProvisioningUtil.loadMetadataRepository(location, monitor);
+ if (queryable == null) {
+ queryable = getProvisioningUI().loadMetadataRepository(location, false, monitor);
+ }
return (IMetadataRepository) queryable;
}
@@ -147,16 +145,13 @@ public class MetadataRepositoryElement extends RootElement implements IRepositor
* @see org.eclipse.equinox.internal.provisional.p2.ui.model.RepositoryElement#getName()
*/
public String getName() {
+ ProvisioningSession session = getProvisioningUI().getSession();
if (name == null) {
- try {
- name = ProvisioningUtil.getMetadataRepositoryProperty(location, IRepository.PROP_NICKNAME);
- if (name == null)
- name = ProvisioningUtil.getMetadataRepositoryProperty(location, IRepository.PROP_NAME);
- if (name == null)
- name = ""; //$NON-NLS-1$
- } catch (ProvisionException e) {
+ name = session.getMetadataRepositoryManager().getRepositoryProperty(location, IRepository.PROP_NICKNAME);
+ if (name == null)
+ name = session.getMetadataRepositoryManager().getRepositoryProperty(location, IRepository.PROP_NAME);
+ if (name == null)
name = ""; //$NON-NLS-1$
- }
}
return name;
}
@@ -175,16 +170,13 @@ public class MetadataRepositoryElement extends RootElement implements IRepositor
* @see org.eclipse.equinox.internal.provisional.p2.ui.model.RepositoryElement#getDescription()
*/
public String getDescription() {
- if (ProvUI.hasNotFoundStatusBeenReported(location))
+ ProvisioningSession session = getProvisioningUI().getSession();
+ if (getProvisioningUI().getRepositoryTracker().hasNotFoundStatusBeenReported(location))
return ProvUIMessages.MetadataRepositoryElement_NotFound;
- try {
- String description = ProvisioningUtil.getMetadataRepositoryProperty(location, IRepository.PROP_DESCRIPTION);
- if (description == null)
- return ""; //$NON-NLS-1$
- return description;
- } catch (ProvisionException e) {
+ String description = session.getMetadataRepositoryManager().getRepositoryProperty(location, IRepository.PROP_DESCRIPTION);
+ if (description == null)
return ""; //$NON-NLS-1$
- }
+ return description;
}
/* (non-Javadoc)
@@ -216,7 +208,7 @@ public class MetadataRepositoryElement extends RootElement implements IRepositor
return true;
if (location == null)
return false;
- IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(ProvUIActivator.getContext(), IMetadataRepositoryManager.class.getName());
+ IMetadataRepositoryManager manager = (IMetadataRepositoryManager) ServiceHelper.getService(ProvUIActivator.getContext(), IMetadataRepositoryManager.SERVICE_NAME);
if (manager == null || !(manager instanceof MetadataRepositoryManager))
return false;
IMetadataRepository repo = ((MetadataRepositoryManager) manager).getRepository(location);
@@ -232,7 +224,7 @@ public class MetadataRepositoryElement extends RootElement implements IRepositor
return super.getPolicy();
if (parent instanceof QueriedElement)
return ((QueriedElement) parent).getPolicy();
- return Policy.getDefault();
+ return ProvisioningUI.getDefaultUI().getPolicy();
}
public String toString() {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/model/ProfileElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProfileElement.java
index 584697307..2da19283c 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/model/ProfileElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProfileElement.java
@@ -8,17 +8,12 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.model;
+package org.eclipse.equinox.internal.p2.ui.model;
-import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.p2.ui.model.RemoteQueriedElement;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUIImages;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.QueryProvider;
-import org.eclipse.osgi.util.NLS;
+import org.eclipse.equinox.internal.p2.ui.ProvUIImages;
+import org.eclipse.equinox.internal.p2.ui.QueryProvider;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.query.IQueryable;
/**
* Element wrapper class for a profile that uses the query
@@ -34,6 +29,7 @@ public class ProfileElement extends RemoteQueriedElement {
this.profileId = profileId;
}
+ @SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
if (adapter == IProfile.class)
return getQueryable();
@@ -56,13 +52,8 @@ public class ProfileElement extends RemoteQueriedElement {
return QueryProvider.INSTALLED_IUS;
}
- public IQueryable getQueryable() {
- try {
- return ProvisioningUtil.getProfile(profileId);
- } catch (ProvisionException e) {
- handleException(e, NLS.bind(ProvUIMessages.ProfileElement_InvalidProfile, profileId));
- return null;
- }
+ public IQueryable<?> getQueryable() {
+ return getProvisioningUI().getSession().getProfileRegistry().getProfile(profileId);
}
/*
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProfileSnapshots.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProfileSnapshots.java
index a20faf194..d4b10e1c7 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProfileSnapshots.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProfileSnapshots.java
@@ -12,9 +12,8 @@ package org.eclipse.equinox.internal.p2.ui.model;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
+import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
import org.eclipse.ui.progress.IElementCollector;
@@ -40,32 +39,27 @@ public class ProfileSnapshots extends ProvElement implements IDeferredWorkbenchA
* @see org.eclipse.ui.model.IWorkbenchAdapter#getChildren(java.lang.Object)
*/
public Object[] getChildren(Object o) {
- try {
- long[] timestamps = ProvisioningUtil.getProfileTimestamps(profileId);
- RollbackProfileElement[] elements = new RollbackProfileElement[timestamps.length];
- boolean skipFirst = false;
- for (int i = 0; i < timestamps.length; i++) {
- elements[i] = new RollbackProfileElement(this, profileId, timestamps[i]);
- // Eliminate the first in the list (earliest) if there was no content at all.
- // This doesn't always happen, but can, and we don't want to offer the user an empty profile to
- // revert to.
- if (i == 0) {
- skipFirst = elements[0].getChildren(elements[0]).length == 0;
- }
- if (i == timestamps.length - 1) {
- elements[i].setIsCurrentProfile(true);
- }
+ long[] timestamps = ProvUIActivator.getDefault().getSession().getProfileRegistry().listProfileTimestamps(profileId);
+ RollbackProfileElement[] elements = new RollbackProfileElement[timestamps.length];
+ boolean skipFirst = false;
+ for (int i = 0; i < timestamps.length; i++) {
+ elements[i] = new RollbackProfileElement(this, profileId, timestamps[i]);
+ // Eliminate the first in the list (earliest) if there was no content at all.
+ // This doesn't always happen, but can, and we don't want to offer the user an empty profile to
+ // revert to.
+ if (i == 0) {
+ skipFirst = elements[0].getChildren(elements[0]).length == 0;
}
- if (skipFirst) {
- RollbackProfileElement[] elementsWithoutFirst = new RollbackProfileElement[elements.length - 1];
- System.arraycopy(elements, 1, elementsWithoutFirst, 0, elements.length - 1);
- return elementsWithoutFirst;
+ if (i == timestamps.length - 1) {
+ elements[i].setIsCurrentProfile(true);
}
- return elements;
- } catch (ProvisionException e) {
- handleException(e, null);
}
- return null;
+ if (skipFirst) {
+ RollbackProfileElement[] elementsWithoutFirst = new RollbackProfileElement[elements.length - 1];
+ System.arraycopy(elements, 1, elementsWithoutFirst, 0, elements.length - 1);
+ return elementsWithoutFirst;
+ }
+ return elements;
}
/* (non-Javadoc)
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/model/Profiles.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/Profiles.java
index dc93702e1..3af9eb4eb 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/model/Profiles.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/Profiles.java
@@ -8,12 +8,11 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.model;
+package org.eclipse.equinox.internal.p2.ui.model;
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.p2.ui.model.RootElement;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.QueryProvider;
+import org.eclipse.equinox.internal.p2.ui.QueryProvider;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
/**
* Element class that represents the root of a profile
@@ -25,8 +24,8 @@ import org.eclipse.equinox.internal.provisional.p2.ui.policy.QueryProvider;
*/
public class Profiles extends RootElement {
- public Profiles(Policy policy) {
- super(policy);
+ public Profiles(ProvisioningUI ui) {
+ super(ui);
}
/*
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProvElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProvElement.java
index 3758769da..047bd7034 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProvElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/ProvElement.java
@@ -11,9 +11,7 @@
package org.eclipse.equinox.internal.p2.ui.model;
import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUI;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUIImages;
+import org.eclipse.equinox.internal.p2.ui.*;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.swt.graphics.Image;
@@ -36,6 +34,7 @@ public abstract class ProvElement implements IWorkbenchAdapter, IAdaptable {
this.parent = parent;
}
+ @SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
if (adapter == IWorkbenchAdapter.class)
return this;
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElement.java
index e708f39cc..f4bb6a83e 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElement.java
@@ -13,10 +13,12 @@ package org.eclipse.equinox.internal.p2.ui.model;
import java.util.*;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
-import org.eclipse.equinox.internal.provisional.p2.ui.ElementQueryDescriptor;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.IUElementListRoot;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.*;
+import org.eclipse.equinox.internal.p2.core.helpers.CollectionUtils;
+import org.eclipse.equinox.internal.p2.ui.*;
+import org.eclipse.equinox.internal.p2.ui.query.IUViewQueryContext;
+import org.eclipse.equinox.p2.query.IQueryable;
+import org.eclipse.equinox.p2.ui.Policy;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
/**
* Element class that represents an element that gets its children
@@ -27,11 +29,11 @@ import org.eclipse.equinox.internal.provisional.p2.ui.policy.*;
*/
public abstract class QueriedElement extends ProvElement {
- protected IQueryable queryable;
+ protected IQueryable<?> queryable;
// This cache is used internally to facilitate child elements
// that want to eliminate duplicates from the parent hierarchy.
// This cache is *not* used as a general purpose child cache.
- private Collection cachedChildren;
+ private Collection<?> cachedChildren;
protected QueriedElement(Object parent) {
super(parent);
@@ -41,11 +43,15 @@ public abstract class QueriedElement extends ProvElement {
Object parent = getParent(this);
if (parent instanceof QueriedElement)
return ((QueriedElement) parent).getPolicy();
- return Policy.getDefault();
+ return ProvUIActivator.getDefault().getProvisioningUI().getPolicy();
}
- public QueryProvider getQueryProvider() {
- return getPolicy().getQueryProvider();
+ public ProvisioningUI getProvisioningUI() {
+ Object parent = getParent(this);
+ if (parent instanceof QueriedElement)
+ return ((QueriedElement) parent).getProvisioningUI();
+ return ProvUIActivator.getDefault().getProvisioningUI();
+
}
public IUViewQueryContext getQueryContext() {
@@ -59,6 +65,10 @@ public abstract class QueriedElement extends ProvElement {
return fetchChildren(o, new NullProgressMonitor());
}
+ public QueryProvider getQueryProvider() {
+ return ProvUI.getQueryProvider();
+ }
+
/*
* (non-Javadoc)
* @see org.eclipse.ui.model.IWorkbenchAdapter#getLabel(java.lang.Object)
@@ -86,16 +96,16 @@ public abstract class QueriedElement extends ProvElement {
}
protected Object[] fetchChildren(Object o, IProgressMonitor monitor) {
- cachedChildren = Collections.EMPTY_LIST;
+ cachedChildren = CollectionUtils.emptyList();
if (getQueryProvider() == null)
return new Object[0];
ElementQueryDescriptor queryDescriptor = getQueryProvider().getQueryDescriptor(this);
if (queryDescriptor == null)
return new Object[0];
- Collection results = queryDescriptor.performQuery(monitor);
+ Collection<?> results = queryDescriptor.performQuery(monitor);
cachedChildren = Collections.unmodifiableCollection(results);
if (results.size() > 0) {
- Collection returnedChildren = new HashSet();
+ Collection<Object> returnedChildren = new HashSet<Object>();
returnedChildren.addAll(results);
Object[] siblings = getSiblings();
for (int i = 0; i < siblings.length; i++) {
@@ -106,11 +116,11 @@ public abstract class QueriedElement extends ProvElement {
return new Object[0];
}
- public void setQueryable(IQueryable queryable) {
+ public void setQueryable(IQueryable<?> queryable) {
this.queryable = queryable;
}
- public IQueryable getQueryable() {
+ public IQueryable<?> getQueryable() {
return queryable;
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElementWrapper.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElementWrapper.java
index 2b31deb32..e5085ab66 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElementWrapper.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/QueriedElementWrapper.java
@@ -14,14 +14,12 @@ package org.eclipse.equinox.internal.p2.ui.model;
import java.util.*;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.URIUtil;
-import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.Collector;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
-import org.eclipse.equinox.internal.provisional.p2.ui.ElementWrapper;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUI;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.MetadataRepositories;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.IUViewQueryContext;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
+import org.eclipse.equinox.internal.p2.ui.*;
+import org.eclipse.equinox.internal.p2.ui.query.IUViewQueryContext;
+import org.eclipse.equinox.p2.operations.RepositoryTracker;
+import org.eclipse.equinox.p2.query.Collector;
+import org.eclipse.equinox.p2.query.IQueryable;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
import org.eclipse.osgi.util.NLS;
/**
@@ -33,13 +31,13 @@ import org.eclipse.osgi.util.NLS;
*/
public abstract class QueriedElementWrapper extends ElementWrapper {
- protected IQueryable queryable;
+ protected IQueryable<?> queryable;
protected Object parent;
protected String emptyExplanationString;
protected int emptyExplanationSeverity;
protected String emptyExplanationDescription;
- public QueriedElementWrapper(IQueryable queryable, Object parent) {
+ public QueriedElementWrapper(IQueryable<?> queryable, Object parent) {
this.queryable = queryable;
this.parent = parent;
}
@@ -57,7 +55,7 @@ public abstract class QueriedElementWrapper extends ElementWrapper {
return item;
}
- public Collection getElements(Collector collector) {
+ public Collection<?> getElements(Collector<?> collector) {
// Any previously stored explanations are not valid.
emptyExplanationString = null;
emptyExplanationSeverity = IStatus.INFO;
@@ -68,19 +66,17 @@ public abstract class QueriedElementWrapper extends ElementWrapper {
// is empty and the parent is an IU, then being empty is not a big deal, it means
// we are in drilldown.
if (parent instanceof MetadataRepositoryElement) {
+ RepositoryTracker manipulator = ProvisioningUI.getDefaultUI().getRepositoryTracker();
MetadataRepositoryElement repo = (MetadataRepositoryElement) parent;
- if (ProvUI.hasNotFoundStatusBeenReported(repo.getLocation())) {
- String description = null;
- if (Policy.getDefault().getRepositoryManipulator() != null)
- description = Policy.getDefault().getRepositoryManipulator().getRepositoryNotFoundInstructionString();
- return emptyExplanation(IStatus.ERROR, NLS.bind(ProvUIMessages.QueriedElementWrapper_SiteNotFound, URIUtil.toUnencodedString(repo.getLocation())), description);
+ if (manipulator.hasNotFoundStatusBeenReported(repo.getLocation())) {
+ return emptyExplanation(IStatus.ERROR, NLS.bind(ProvUIMessages.QueriedElementWrapper_SiteNotFound, URIUtil.toUnencodedString(repo.getLocation())), ""); //$NON-NLS-1$
}
}
if (parent instanceof QueriedElement) {
QueriedElement element = (QueriedElement) parent;
IUViewQueryContext context = element.getQueryContext();
if (context == null)
- context = element.getPolicy().getQueryContext();
+ context = ProvUI.getQueryContext(element.getPolicy());
if (parent instanceof MetadataRepositoryElement || parent instanceof MetadataRepositories) {
if (context != null && context.getViewType() == IUViewQueryContext.AVAILABLE_VIEW_BY_CATEGORY && context.getUseCategories()) {
return emptyExplanation(IStatus.INFO, ProvUIMessages.QueriedElementWrapper_NoCategorizedItemsExplanation, context.getUsingCategoriesDescription());
@@ -91,7 +87,7 @@ public abstract class QueriedElementWrapper extends ElementWrapper {
// It is empty, but the parent is an IU, so this could be a drilldown.
return Collections.EMPTY_LIST;
}
- Collection elements = super.getElements(collector);
+ Collection<?> elements = super.getElements(collector);
// We had elements but now they have been filtered out. Hopefully
// we can explain this.
if (elements.isEmpty()) {
@@ -104,8 +100,8 @@ public abstract class QueriedElementWrapper extends ElementWrapper {
return elements;
}
- Collection emptyExplanation(int severity, String explanationString, String explanationDescription) {
- ArrayList collection = new ArrayList(1);
+ Collection<?> emptyExplanation(int severity, String explanationString, String explanationDescription) {
+ ArrayList<Object> collection = new ArrayList<Object>(1);
collection.add(new EmptyElementExplanation(parent, severity, explanationString, explanationDescription));
return collection;
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/RemoteQueriedElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/RemoteQueriedElement.java
index fa346e63e..b84c78b10 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/RemoteQueriedElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/RemoteQueriedElement.java
@@ -13,7 +13,7 @@ package org.eclipse.equinox.internal.p2.ui.model;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.OperationCanceledException;
import org.eclipse.core.runtime.jobs.ISchedulingRule;
-import org.eclipse.equinox.internal.provisional.p2.ui.QueryableMetadataRepositoryManager;
+import org.eclipse.equinox.internal.p2.ui.QueryableMetadataRepositoryManager;
import org.eclipse.ui.progress.IDeferredWorkbenchAdapter;
import org.eclipse.ui.progress.IElementCollector;
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/RollbackProfileElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/RollbackProfileElement.java
index 5e2e01e40..5258326e5 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/RollbackProfileElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/RollbackProfileElement.java
@@ -14,13 +14,9 @@ import com.ibm.icu.text.DateFormat;
import java.util.Date;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUIImages;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.QueryProvider;
+import org.eclipse.equinox.internal.p2.ui.*;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.query.IQueryable;
/**
* Element class for a profile snapshot
@@ -55,19 +51,16 @@ public class RollbackProfileElement extends RemoteQueriedElement {
return DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.LONG).format(new Date(timestamp));
}
+ @SuppressWarnings("rawtypes")
public Object getAdapter(Class adapter) {
if (adapter == IProfile.class)
- try {
- return getProfileSnapshot(new NullProgressMonitor());
- } catch (ProvisionException e) {
- handleException(e, ProvUIMessages.RollbackProfileElement_InvalidSnapshot);
- }
+ return getProfileSnapshot(new NullProgressMonitor());
return super.getAdapter(adapter);
}
- public IProfile getProfileSnapshot(IProgressMonitor monitor) throws ProvisionException {
+ public IProfile getProfileSnapshot(IProgressMonitor monitor) {
if (snapshot == null) {
- snapshot = ProvisioningUtil.getProfile(profileId, timestamp);
+ snapshot = getProvisioningUI().getSession().getProfileRegistry().getProfile(profileId, timestamp);
setQueryable(snapshot);
}
return snapshot;
@@ -97,12 +90,7 @@ public class RollbackProfileElement extends RemoteQueriedElement {
* (non-Javadoc)
* @see org.eclipse.equinox.internal.p2.ui.model.QueriedElement#getQueryable()
*/
- public IQueryable getQueryable() {
- try {
- return getProfileSnapshot(new NullProgressMonitor());
- } catch (ProvisionException e) {
- handleException(e, null);
- return null;
- }
+ public IQueryable<?> getQueryable() {
+ return getProfileSnapshot(new NullProgressMonitor());
}
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/RootElement.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/RootElement.java
index ada55a55c..a9574e8f2 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/RootElement.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/RootElement.java
@@ -10,12 +10,14 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.ui.model;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.IUViewQueryContext;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
+import org.eclipse.equinox.internal.p2.ui.ProvUI;
+import org.eclipse.equinox.internal.p2.ui.query.IUViewQueryContext;
+import org.eclipse.equinox.p2.ui.Policy;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
/**
* Element class that represents the root of a viewer. It can be configured
- * with its own policy and query context.
+ * with its own ui and query context.
*
* @since 3.5
*
@@ -23,23 +25,23 @@ import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
public abstract class RootElement extends RemoteQueriedElement {
private IUViewQueryContext queryContext;
- private Policy policy;
+ private ProvisioningUI ui;
- public RootElement(Policy policy) {
- this(null, policy.getQueryContext(), policy);
+ public RootElement(ProvisioningUI ui) {
+ this(null, ProvUI.getQueryContext(ui.getPolicy()), ui);
}
- public RootElement(IUViewQueryContext queryContext, Policy policy) {
- this(null, queryContext, policy);
+ public RootElement(IUViewQueryContext queryContext, ProvisioningUI ui) {
+ this(null, queryContext, ui);
}
/*
* Special method for subclasses that can sometimes be a root, and sometimes not.
*/
- protected RootElement(Object parent, IUViewQueryContext queryContext, Policy policy) {
+ protected RootElement(Object parent, IUViewQueryContext queryContext, ProvisioningUI ui) {
super(parent);
this.queryContext = queryContext;
- this.policy = policy;
+ this.ui = ui;
}
/**
@@ -56,6 +58,10 @@ public abstract class RootElement extends RemoteQueriedElement {
}
public Policy getPolicy() {
- return policy;
+ return ui.getPolicy();
+ }
+
+ public ProvisioningUI getProvisioningUI() {
+ return ui;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/model/Updates.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/Updates.java
index cbb93eb3c..3f227d0a2 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/model/Updates.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/model/Updates.java
@@ -8,12 +8,11 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.model;
+package org.eclipse.equinox.internal.p2.ui.model;
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.p2.ui.model.QueriedElement;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.QueryProvider;
+import org.eclipse.equinox.internal.p2.ui.QueryProvider;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
/**
* Element class that represents available updates.
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/AnyRequiredCapabilityQuery.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/AnyRequiredCapabilityQuery.java
deleted file mode 100644
index ef3c69840..000000000
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/AnyRequiredCapabilityQuery.java
+++ /dev/null
@@ -1,43 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.equinox.internal.p2.ui.query;
-
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IRequiredCapability;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.MatchQuery;
-
-/**
- * A query that searches a repository for all {@link IInstallableUnit} instances that
- * meet any one of the given capabilities.
- */
-public class AnyRequiredCapabilityQuery extends MatchQuery {
- private IRequiredCapability[] requirements;
-
- /**
- * Creates a new query for the capabilities of the given IU.
- */
- public AnyRequiredCapabilityQuery(IRequiredCapability[] requirements) {
- this.requirements = requirements;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.equinox.p2.query2.Query#isMatch(java.lang.Object)
- */
- public boolean isMatch(Object object) {
- if (!(object instanceof IInstallableUnit))
- return false;
- IInstallableUnit candidate = (IInstallableUnit) object;
- for (int i = 0; i < requirements.length; i++)
- if (candidate.satisfies(requirements[i]))
- return true;
- return false;
- }
-}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/ArtifactKeyWrapper.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/ArtifactKeyWrapper.java
new file mode 100644
index 000000000..27a4304a7
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/ArtifactKeyWrapper.java
@@ -0,0 +1,46 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * EclipseSource - ongoing development
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.ui.query;
+
+import org.eclipse.equinox.internal.p2.ui.model.ArtifactElement;
+import org.eclipse.equinox.internal.p2.ui.model.QueriedElementWrapper;
+import org.eclipse.equinox.p2.metadata.IArtifactKey;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
+
+/**
+ * Wrapper that accepts artifact keys and wraps them in an ArtifactKeyElement.
+ *
+ * @since 3.6
+ */
+public class ArtifactKeyWrapper extends QueriedElementWrapper {
+
+ IArtifactRepository repo;
+
+ public ArtifactKeyWrapper(IArtifactRepository repo, Object parent) {
+ super(repo, parent);
+ this.repo = repo;
+ }
+
+ protected boolean shouldWrap(Object match) {
+ if ((match instanceof IArtifactKey))
+ return true;
+ return false;
+ }
+
+ /**
+ * Transforms the item to a UI element
+ */
+ protected Object wrap(Object item) {
+ return super.wrap(new ArtifactElement(parent, (IArtifactKey) item, repo));
+ }
+
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/ArtifactRepositoryElementWrapper.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/ArtifactRepositoryElementWrapper.java
new file mode 100644
index 000000000..c3cccf152
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/ArtifactRepositoryElementWrapper.java
@@ -0,0 +1,50 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2009 IBM Corporation and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * EclipseSource - ongoing development
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.ui.query;
+
+import java.net.URI;
+import org.eclipse.equinox.internal.p2.ui.model.ArtifactRepositoryElement;
+import org.eclipse.equinox.internal.p2.ui.model.QueriedElementWrapper;
+import org.eclipse.equinox.p2.query.IQueryable;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
+
+/**
+ * ElementWrapper that wraps a URI with an ArtifactRepositoryElement.
+ *
+ * @since 3.4
+ */
+public class ArtifactRepositoryElementWrapper extends QueriedElementWrapper {
+
+ public ArtifactRepositoryElementWrapper(IQueryable<URI> queryable, Object parent) {
+ super(queryable, parent);
+ }
+
+ /**
+ * Accepts a result that matches the query criteria.
+ *
+ * @param match an object matching the query
+ * @return <code>true</code> if the query should continue,
+ * or <code>false</code> to indicate the query should stop.
+ */
+ protected boolean shouldWrap(Object match) {
+ if ((match instanceof URI))
+ return true;
+ return false;
+ }
+
+ /**
+ * Transforms the item to a UI element
+ */
+ protected Object wrap(Object item) {
+ return super.wrap(new ArtifactRepositoryElement(parent, (URI) item, ProvisioningUI.getDefaultUI().getSession().getArtifactRepositoryManager().isEnabled((URI) item)));
+ }
+}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/AvailableIUWrapper.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/AvailableIUWrapper.java
index 3b270f4cd..af3ef4209 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/AvailableIUWrapper.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/AvailableIUWrapper.java
@@ -13,12 +13,15 @@ package org.eclipse.equinox.internal.p2.ui.query;
import java.util.Iterator;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.equinox.internal.p2.ui.ProvUI;
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
import org.eclipse.equinox.internal.p2.ui.model.*;
-import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.*;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUI;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.query.CategoryQuery;
+import org.eclipse.equinox.p2.metadata.query.InstallableUnitQuery;
+import org.eclipse.equinox.p2.query.IQueryResult;
+import org.eclipse.equinox.p2.query.IQueryable;
/**
* A wrapper that examines available IU's and wraps them in an
@@ -33,7 +36,7 @@ public class AvailableIUWrapper extends QueriedElementWrapper {
private boolean hideInstalledIUs = false;
private boolean drillDownChild = false;
- public AvailableIUWrapper(IQueryable queryable, Object parent, boolean makeCategories, boolean makeDrillDownChild) {
+ public AvailableIUWrapper(IQueryable<?> queryable, Object parent, boolean makeCategories, boolean makeDrillDownChild) {
super(queryable, parent);
this.makeCategories = makeCategories;
this.drillDownChild = makeDrillDownChild;
@@ -59,7 +62,7 @@ public class AvailableIUWrapper extends QueriedElementWrapper {
InformationCache cache = null;
protected boolean shouldWrap(Object match) {
- IInstallableUnit iu = (IInstallableUnit) ProvUI.getAdapter(match, IInstallableUnit.class);
+ IInstallableUnit iu = ProvUI.getAdapter(match, IInstallableUnit.class);
cache = computeIUInformation(iu); // Cache the result
// if we are hiding, hide anything that is the same iu or older
@@ -80,11 +83,11 @@ public class AvailableIUWrapper extends QueriedElementWrapper {
boolean isUpdate = false;
boolean isInstalled = false;
if (profile != null && iu != null) {
- Collector collector = profile.query(new InstallableUnitQuery(iu.getId()), new Collector(), null);
- Iterator iter = collector.iterator();
+ IQueryResult<IInstallableUnit> queryResult = profile.query(new InstallableUnitQuery(iu.getId()), null);
+ Iterator<IInstallableUnit> iter = queryResult.iterator();
// We are typically iterating over only one IU unless it's a non-singleton.
while (iter.hasNext()) {
- IInstallableUnit installed = (IInstallableUnit) iter.next();
+ IInstallableUnit installed = iter.next();
if (installed.getVersion().compareTo(iu.getVersion()) < 0)
isUpdate = true;
else {
@@ -98,7 +101,7 @@ public class AvailableIUWrapper extends QueriedElementWrapper {
}
protected Object wrap(Object item) {
- IInstallableUnit iu = (IInstallableUnit) ProvUI.getAdapter(item, IInstallableUnit.class);
+ IInstallableUnit iu = ProvUI.getAdapter(item, IInstallableUnit.class);
boolean isUpdate = false;
boolean isInstalled = false;
if (cache != null && cache.item == item) {
@@ -141,8 +144,7 @@ public class AvailableIUWrapper extends QueriedElementWrapper {
}
protected boolean isCategory(IInstallableUnit iu) {
- String isCategory = iu.getProperty(IInstallableUnit.PROP_TYPE_CATEGORY);
- return isCategory != null && Boolean.valueOf(isCategory).booleanValue();
+ return CategoryQuery.isCategory(iu);
}
protected boolean makeCategory() {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/CategoryElementWrapper.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/CategoryElementWrapper.java
index 049e5fb96..02788d2e2 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/CategoryElementWrapper.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/CategoryElementWrapper.java
@@ -12,12 +12,13 @@
package org.eclipse.equinox.internal.p2.ui.query;
import java.util.*;
+import org.eclipse.equinox.internal.p2.metadata.IRequiredCapability;
import org.eclipse.equinox.internal.p2.ui.model.CategoryElement;
import org.eclipse.equinox.internal.p2.ui.model.QueriedElementWrapper;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IRequiredCapability;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.Collector;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.metadata.IRequirement;
+import org.eclipse.equinox.p2.query.Collector;
+import org.eclipse.equinox.p2.query.IQueryable;
/**
* A collector that converts IU's to category elements as it accepts them.
@@ -28,23 +29,25 @@ import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
public class CategoryElementWrapper extends QueriedElementWrapper {
// Used to track nested categories
- private Set referredIUs = new HashSet();
+ private Set<String> referredIUs = new HashSet<String>();
- public CategoryElementWrapper(IQueryable queryable, Object parent) {
+ public CategoryElementWrapper(IQueryable<?> queryable, Object parent) {
super(queryable, parent);
}
protected boolean shouldWrap(Object match) {
if (match instanceof IInstallableUnit) {
IInstallableUnit iu = (IInstallableUnit) match;
- IRequiredCapability[] requirements = iu.getRequiredCapabilities();
- for (int i = 0; i < requirements.length; i++) {
- if (requirements[i].getNamespace().equals(IInstallableUnit.NAMESPACE_IU_ID)) {
- referredIUs.add(requirements[i].getName());
+ Collection<IRequirement> requirements = iu.getRequiredCapabilities();
+ for (IRequirement requirement : requirements) {
+ if (requirement instanceof IRequiredCapability) {
+ if (((IRequiredCapability) requirement).getNamespace().equals(IInstallableUnit.NAMESPACE_IU_ID)) {
+ referredIUs.add(((IRequiredCapability) requirement).getName());
+ }
}
}
- Iterator iter = super.getCollection().iterator();
+ Iterator<?> iter = super.getCollection().iterator();
// Don't add the same category IU twice.
while (iter.hasNext()) {
CategoryElement element = (CategoryElement) iter.next();
@@ -59,10 +62,10 @@ public class CategoryElementWrapper extends QueriedElementWrapper {
return false;
}
- public Collection getElements(Collector collector) {
+ public Collection<?> getElements(Collector<?> collector) {
if (collector.isEmpty())
return super.getElements(collector);
- Collection results = super.getElements(collector);
+ Collection<?> results = super.getElements(collector);
cleanList();
return results;
}
@@ -77,7 +80,7 @@ public class CategoryElementWrapper extends QueriedElementWrapper {
}
private void removeNestedCategories() {
- CategoryElement[] categoryIUs = (CategoryElement[]) getCollection().toArray(new CategoryElement[getCollection().size()]);
+ CategoryElement[] categoryIUs = getCollection().toArray(new CategoryElement[getCollection().size()]);
// If any other element refers to a category element, remove it from the list
for (int i = 0; i < categoryIUs.length; i++) {
if (referredIUs.contains(categoryIUs[i].getIU().getId())) {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/policy/IUViewQueryContext.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/IUViewQueryContext.java
index 7f5c5a498..0aa3daf34 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/policy/IUViewQueryContext.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/IUViewQueryContext.java
@@ -8,18 +8,17 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.policy;
+package org.eclipse.equinox.internal.p2.ui.query;
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
+import org.eclipse.equinox.internal.p2.ui.QueryProvider;
/**
* IUViewQueryContext defines the different ways
* IUs can be viewed. Clients can use this context to
* control how the various IU views are represented and traversed.
*
- * @since 3.4
+ * @since 2.0
*/
public class IUViewQueryContext {
public static final int AVAILABLE_VIEW_BY_CATEGORY = 1;
@@ -29,8 +28,6 @@ public class IUViewQueryContext {
// Available view settings
// Default available view to repo as this provides the fastest information
private int view = AVAILABLE_VIEW_BY_REPO;
- // What property to use for choosing visible IUs
- private String visibleAvailableIUProperty = IInstallableUnit.PROP_TYPE_GROUP;
// Whether to show latest versions only, defaults to
// true. Clients typically use a pref setting or dialog
// setting to initialize
@@ -49,12 +46,6 @@ public class IUViewQueryContext {
private boolean showProvisioningPlanChildren = true;
private String profileId = null;
- // What repositories to show
- private int artifactRepositoryFlags = IRepositoryManager.REPOSITORIES_NON_SYSTEM;
- private int metadataRepositoryFlags = IRepositoryManager.REPOSITORIES_NON_SYSTEM;
-
- // Installed view settings
- private String visibleInstalledIUProperty = IInstallableUnit.PROP_PROFILE_ROOT_IU;
private String hidingInstalledDescription = ProvUIMessages.IUViewQueryContext_AllAreInstalledDescription;
private String groupingCategoriesDescription = ProvUIMessages.IUViewQueryContext_NoCategorizedItemsDescription;
@@ -109,38 +100,6 @@ public class IUViewQueryContext {
this.profileId = profileId;
}
- public int getArtifactRepositoryFlags() {
- return artifactRepositoryFlags;
- }
-
- public void setArtifactRepositoryFlags(int flags) {
- artifactRepositoryFlags = flags;
- }
-
- public int getMetadataRepositoryFlags() {
- return metadataRepositoryFlags;
- }
-
- public void setMetadataRepositoryFlags(int flags) {
- metadataRepositoryFlags = flags;
- }
-
- public String getVisibleAvailableIUProperty() {
- return visibleAvailableIUProperty;
- }
-
- public void setVisibleAvailableIUProperty(String propertyName) {
- visibleAvailableIUProperty = propertyName;
- }
-
- public String getVisibleInstalledIUProperty() {
- return visibleInstalledIUProperty;
- }
-
- public void setVisibleInstalledIUProperty(String propertyName) {
- visibleInstalledIUProperty = propertyName;
- }
-
/**
* Set a boolean that indicates whether categories should be used when
* viewing by repository.
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/InstalledIUElementWrapper.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/InstalledIUElementWrapper.java
index 87e9c2c0e..9e465a8f8 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/InstalledIUElementWrapper.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/InstalledIUElementWrapper.java
@@ -11,11 +11,11 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.ui.query;
+import org.eclipse.equinox.internal.p2.ui.model.InstalledIUElement;
import org.eclipse.equinox.internal.p2.ui.model.QueriedElementWrapper;
-import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.InstalledIUElement;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.query.IQueryable;
/**
* ElementWrapper that accepts the matched IU's and
@@ -25,7 +25,7 @@ import org.eclipse.equinox.internal.provisional.p2.ui.model.InstalledIUElement;
*/
public class InstalledIUElementWrapper extends QueriedElementWrapper {
- public InstalledIUElementWrapper(IQueryable queryable, Object parent) {
+ public InstalledIUElementWrapper(IQueryable<?> queryable, Object parent) {
super(queryable, parent);
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/MetadataRepositoryElementWrapper.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/MetadataRepositoryElementWrapper.java
index ab4c3b760..245f726be 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/MetadataRepositoryElementWrapper.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/MetadataRepositoryElementWrapper.java
@@ -14,8 +14,8 @@ package org.eclipse.equinox.internal.p2.ui.query;
import java.net.URI;
import org.eclipse.equinox.internal.p2.ui.model.MetadataRepositoryElement;
import org.eclipse.equinox.internal.p2.ui.model.QueriedElementWrapper;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.IQueryable;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
+import org.eclipse.equinox.p2.query.IQueryable;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
/**
* ElementWrapper that accepts the matched repo URLs and
@@ -25,7 +25,7 @@ import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUti
*/
public class MetadataRepositoryElementWrapper extends QueriedElementWrapper {
- public MetadataRepositoryElementWrapper(IQueryable queryable, Object parent) {
+ public MetadataRepositoryElementWrapper(IQueryable<URI> queryable, Object parent) {
super(queryable, parent);
}
@@ -46,6 +46,6 @@ public class MetadataRepositoryElementWrapper extends QueriedElementWrapper {
* Transforms the item to a UI element
*/
protected Object wrap(Object item) {
- return super.wrap(new MetadataRepositoryElement(parent, (URI) item, ProvisioningUtil.getMetadataRepositoryEnablement((URI) item)));
+ return super.wrap(new MetadataRepositoryElement(parent, (URI) item, ProvisioningUI.getDefaultUI().getSession().getMetadataRepositoryManager().isEnabled((URI) item)));
}
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/ProfileElementWrapper.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/ProfileElementWrapper.java
index 060ac32f3..d102bafae 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/ProfileElementWrapper.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/ProfileElementWrapper.java
@@ -11,9 +11,9 @@
*******************************************************************************/
package org.eclipse.equinox.internal.p2.ui.query;
+import org.eclipse.equinox.internal.p2.ui.model.ProfileElement;
import org.eclipse.equinox.internal.p2.ui.model.QueriedElementWrapper;
-import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.ProfileElement;
+import org.eclipse.equinox.p2.engine.IProfile;
/**
* Collector that accepts the matched Profiles and
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/QueryableProfileRegistry.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/QueryableProfileRegistry.java
index fb323f5e2..e14b99a73 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/QueryableProfileRegistry.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/QueryableProfileRegistry.java
@@ -12,34 +12,31 @@
package org.eclipse.equinox.internal.p2.ui.query;
import java.util.Arrays;
-import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
-import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
-import org.eclipse.equinox.internal.provisional.p2.engine.IProfileRegistry;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.*;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUI;
-import org.eclipse.ui.statushandlers.StatusManager;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.query.*;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
/**
* An object that adds queryable support to the profile registry.
*/
-public class QueryableProfileRegistry implements IQueryable {
+public class QueryableProfileRegistry implements IQueryable<IProfile> {
- public Collector query(Query query, Collector result, IProgressMonitor monitor) {
- IProfileRegistry profileRegistry = (IProfileRegistry) ServiceHelper.getService(ProvUIActivator.getContext(), IProfileRegistry.class.getName());
- if (profileRegistry == null) {
- ProvUI.reportStatus(new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, ProvUIMessages.ProvisioningUtil_NoProfileRegistryFound), StatusManager.SHOW | StatusManager.LOG);
- return result;
- }
- IProfile[] profiles = profileRegistry.getProfiles();
+ private ProvisioningUI ui;
+
+ public QueryableProfileRegistry(ProvisioningUI ui) {
+ this.ui = ui;
+ }
+
+ public IQueryResult<IProfile> query(IQuery<IProfile> query, IProgressMonitor monitor) {
+ IProfile[] profiles = ui.getSession().getProfileRegistry().getProfiles();
SubMonitor sub = SubMonitor.convert(monitor, ProvUIMessages.QueryableProfileRegistry_QueryProfileProgress, profiles.length);
try {
- query.perform(Arrays.asList(profiles).iterator(), result);
+ return query.perform(Arrays.asList(profiles).iterator());
} finally {
sub.done();
}
- return result;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/QueryableUpdates.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/QueryableUpdates.java
index 96b00f645..fbcad64ce 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/QueryableUpdates.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/query/QueryableUpdates.java
@@ -13,52 +13,47 @@ package org.eclipse.equinox.internal.p2.ui.query;
import java.util.ArrayList;
import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
-import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
import org.eclipse.equinox.internal.provisional.p2.director.IPlanner;
-import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningContext;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.*;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUI;
-import org.eclipse.ui.statushandlers.StatusManager;
+import org.eclipse.equinox.p2.engine.ProvisioningContext;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.query.*;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
/**
* An object that implements a query for available updates
*/
-public class QueryableUpdates implements IQueryable {
+public class QueryableUpdates implements IQueryable<IInstallableUnit> {
private IInstallableUnit[] iusToUpdate;
+ ProvisioningUI ui;
- public QueryableUpdates(IInstallableUnit[] iusToUpdate) {
+ public QueryableUpdates(ProvisioningUI ui, IInstallableUnit[] iusToUpdate) {
+ this.ui = ui;
this.iusToUpdate = iusToUpdate;
}
- public Collector query(Query query, Collector result, IProgressMonitor monitor) {
+ public IQueryResult<IInstallableUnit> query(IQuery<IInstallableUnit> query, IProgressMonitor monitor) {
if (monitor == null)
monitor = new NullProgressMonitor();
int totalWork = 2000;
monitor.beginTask(ProvUIMessages.QueryableUpdates_UpdateListProgress, totalWork);
- IPlanner planner = (IPlanner) ServiceHelper.getService(ProvUIActivator.getContext(), IPlanner.class.getName());
- if (planner == null) {
- ProvUI.reportStatus(new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, ProvUIMessages.ProvisioningUtil_NoPlannerFound), StatusManager.SHOW | StatusManager.LOG);
- return result;
- }
+ IPlanner planner = ui.getSession().getPlanner();
try {
- ArrayList allUpdates = new ArrayList();
+ ArrayList<IInstallableUnit> allUpdates = new ArrayList<IInstallableUnit>();
for (int i = 0; i < iusToUpdate.length; i++) {
if (monitor.isCanceled())
- return result;
+ return Collector.emptyCollector();
IInstallableUnit[] updates = planner.updatesFor(iusToUpdate[i], new ProvisioningContext(), new SubProgressMonitor(monitor, totalWork / 2 / iusToUpdate.length));
for (int j = 0; j < updates.length; j++)
allUpdates.add(updates[j]);
}
- query.perform(allUpdates.iterator(), result);
+ return query.perform(allUpdates.iterator());
} catch (OperationCanceledException e) {
// Nothing more to do, return result
+ return Collector.emptyCollector();
} finally {
monitor.done();
}
- return result;
}
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/DeferredQueryContentProvider.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/DeferredQueryContentProvider.java
index 163271e05..338acc279 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/DeferredQueryContentProvider.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/DeferredQueryContentProvider.java
@@ -16,7 +16,6 @@ import java.util.HashSet;
import org.eclipse.core.runtime.ListenerList;
import org.eclipse.equinox.internal.p2.ui.model.QueriedElement;
import org.eclipse.equinox.internal.p2.ui.model.RemoteQueriedElement;
-import org.eclipse.equinox.internal.provisional.p2.ui.viewers.ProvElementContentProvider;
import org.eclipse.jface.viewers.AbstractTreeViewer;
import org.eclipse.jface.viewers.Viewer;
@@ -32,8 +31,8 @@ public class DeferredQueryContentProvider extends ProvElementContentProvider {
DeferredQueryTreeContentManager manager;
Object currentInput;
- HashMap alreadyQueried = new HashMap();
- HashSet queryCompleted = new HashSet();
+ HashMap<Object, Object> alreadyQueried = new HashMap<Object, Object>();
+ HashSet<Object> queryCompleted = new HashSet<Object>();
AbstractTreeViewer viewer = null;
ListenerList listeners = new ListenerList();
boolean synchronous = false;
@@ -73,8 +72,8 @@ public class DeferredQueryContentProvider extends ProvElementContentProvider {
});
} else
viewer = null;
- alreadyQueried = new HashMap();
- queryCompleted = new HashSet();
+ alreadyQueried = new HashMap<Object, Object>();
+ queryCompleted = new HashSet<Object>();
currentInput = newInput;
Object[] inputListeners = listeners.getListeners();
for (int i = 0; i < inputListeners.length; i++) {
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/viewers/IUColumnConfig.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUColumnConfig.java
index 9629b5a1f..62cd2860e 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/viewers/IUColumnConfig.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUColumnConfig.java
@@ -9,7 +9,7 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.viewers;
+package org.eclipse.equinox.internal.p2.ui.viewers;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.swt.graphics.FontMetrics;
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/viewers/IUComparator.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUComparator.java
index ca04786c5..e742aeca9 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/viewers/IUComparator.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUComparator.java
@@ -8,11 +8,10 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.viewers;
+package org.eclipse.equinox.internal.p2.ui.viewers;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.ui.IUPropertyUtils;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUI;
+import org.eclipse.equinox.internal.p2.ui.ProvUI;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerComparator;
@@ -43,8 +42,8 @@ public class IUComparator extends ViewerComparator {
}
public int compare(Viewer viewer, Object obj1, Object obj2) {
- IInstallableUnit iu1 = (IInstallableUnit) ProvUI.getAdapter(obj1, IInstallableUnit.class);
- IInstallableUnit iu2 = (IInstallableUnit) ProvUI.getAdapter(obj2, IInstallableUnit.class);
+ IInstallableUnit iu1 = ProvUI.getAdapter(obj1, IInstallableUnit.class);
+ IInstallableUnit iu2 = ProvUI.getAdapter(obj2, IInstallableUnit.class);
if (iu1 == null || iu2 == null)
// If these are not iu's use the super class comparator.
return super.compare(viewer, obj1, obj2);
@@ -55,13 +54,13 @@ public class IUComparator extends ViewerComparator {
// If a name is not defined, we use blank if we know the id is shown in another
// column. If the id is not shown elsewhere, then we are displaying it, so use
// the id instead.
- key1 = IUPropertyUtils.getIUProperty(iu1, IInstallableUnit.PROP_NAME);
+ key1 = iu1.getProperty(IInstallableUnit.PROP_NAME, null);
if (key1 == null)
if (showingId)
key1 = ""; //$NON-NLS-1$
else
key1 = iu1.getId();
- key2 = IUPropertyUtils.getIUProperty(iu2, IInstallableUnit.PROP_NAME);
+ key2 = iu2.getProperty(IInstallableUnit.PROP_NAME, null);
if (key2 == null)
if (showingId)
key2 = ""; //$NON-NLS-1$
@@ -80,5 +79,4 @@ public class IUComparator extends ViewerComparator {
}
return result;
}
-
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUDetailsLabelProvider.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUDetailsLabelProvider.java
index 35bb5d8b3..31214f8f9 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUDetailsLabelProvider.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUDetailsLabelProvider.java
@@ -13,15 +13,13 @@ package org.eclipse.equinox.internal.p2.ui.viewers;
import java.text.NumberFormat;
import java.util.HashMap;
-import java.util.Iterator;
import org.eclipse.core.runtime.*;
import org.eclipse.core.runtime.jobs.*;
-import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
+import org.eclipse.equinox.internal.p2.ui.*;
import org.eclipse.equinox.internal.p2.ui.model.IIUElement;
import org.eclipse.equinox.internal.p2.ui.model.ProvElement;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.ui.*;
-import org.eclipse.equinox.internal.provisional.p2.ui.viewers.IUColumnConfig;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.operations.ProvisioningSession;
import org.eclipse.jface.viewers.*;
import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.graphics.Font;
@@ -45,7 +43,7 @@ public class IUDetailsLabelProvider extends ColumnLabelProvider implements ITabl
private IUColumnConfig[] columnConfig;
Shell shell;
- HashMap jobs = new HashMap();
+ HashMap<IIUElement, Job> jobs = new HashMap<IIUElement, Job>();
public IUDetailsLabelProvider() {
this(null, null, null);
@@ -79,7 +77,7 @@ public class IUDetailsLabelProvider extends ColumnLabelProvider implements ITabl
columnContent = columnConfig[columnIndex].getColumnType();
}
- IInstallableUnit iu = (IInstallableUnit) ProvUI.getAdapter(element, IInstallableUnit.class);
+ IInstallableUnit iu = ProvUI.getAdapter(element, IInstallableUnit.class);
if (iu == null) {
if (columnIndex == 0) {
if (element instanceof ProvElement)
@@ -94,7 +92,7 @@ public class IUDetailsLabelProvider extends ColumnLabelProvider implements ITabl
return iu.getId();
case IUColumnConfig.COLUMN_NAME :
// Get the iu name in the current locale
- String name = IUPropertyUtils.getIUProperty(iu, IInstallableUnit.PROP_NAME);
+ String name = iu.getProperty(IInstallableUnit.PROP_NAME, null);
if (name != null)
return name;
// If the iu name is not available, we return blank if we know know we are
@@ -135,7 +133,7 @@ public class IUDetailsLabelProvider extends ColumnLabelProvider implements ITabl
long size = element.getSize();
// If size is already known, or we already tried
// to get it, don't try again
- if (size != IIUElement.SIZE_UNKNOWN)
+ if (size != ProvisioningSession.SIZE_UNKNOWN)
return getFormattedSize(size);
if (!jobs.containsKey(element)) {
Job resolveJob = new Job(element.getIU().getId()) {
@@ -153,7 +151,7 @@ public class IUDetailsLabelProvider extends ColumnLabelProvider implements ITabl
return Status.CANCEL_STATUS;
// If we still could not compute size, give up
- if (element.getSize() == IIUElement.SIZE_UNKNOWN)
+ if (element.getSize() == ProvisioningSession.SIZE_UNKNOWN)
return Status.OK_STATUS;
if (shell == null || shell.isDisposed())
@@ -183,7 +181,7 @@ public class IUDetailsLabelProvider extends ColumnLabelProvider implements ITabl
}
private String getFormattedSize(long size) {
- if (size == IIUElement.SIZE_UNKNOWN || size == IIUElement.SIZE_UNAVAILABLE)
+ if (size == ProvisioningSession.SIZE_UNKNOWN || size == ProvisioningSession.SIZE_UNAVAILABLE)
return ProvUIMessages.IUDetailsLabelProvider_Unknown;
if (size > 1000L) {
long kb = size / 1000L;
@@ -211,10 +209,10 @@ public class IUDetailsLabelProvider extends ColumnLabelProvider implements ITabl
}
public String getToolTipText(Object element) {
- IInstallableUnit iu = (IInstallableUnit) ProvUI.getAdapter(element, IInstallableUnit.class);
+ IInstallableUnit iu = ProvUI.getAdapter(element, IInstallableUnit.class);
if (iu == null || toolTipProperty == null)
return null;
- return IUPropertyUtils.getIUProperty(iu, toolTipProperty);
+ return iu.getProperty(toolTipProperty, null);
}
/* (non-Javadoc)
@@ -229,11 +227,8 @@ public class IUDetailsLabelProvider extends ColumnLabelProvider implements ITabl
public void dispose() {
super.dispose();
- Iterator iter = jobs.values().iterator();
- while (iter.hasNext()) {
- Job job = (Job) iter.next();
+ for (Job job : jobs.values())
job.cancel();
- }
}
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/viewers/IUDragAdapter.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUDragAdapter.java
index e6fddb88e..57e163043 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/viewers/IUDragAdapter.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/IUDragAdapter.java
@@ -8,11 +8,11 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.viewers;
+package org.eclipse.equinox.internal.p2.ui.viewers;
import java.util.*;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUI;
+import org.eclipse.equinox.internal.p2.ui.ProvUI;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.jface.viewers.*;
import org.eclipse.swt.dnd.*;
@@ -97,7 +97,7 @@ public class IUDragAdapter extends DragSourceAdapter {
}
private IInstallableUnit[] getSelectedIUs() {
- List ius = new ArrayList();
+ List<IInstallableUnit> ius = new ArrayList<IInstallableUnit>();
ISelection selection = selectionProvider.getSelection();
if (!(selection instanceof IStructuredSelection) || selection.isEmpty()) {
@@ -105,20 +105,20 @@ public class IUDragAdapter extends DragSourceAdapter {
}
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
- Iterator iter = structuredSelection.iterator();
+ Iterator<?> iter = structuredSelection.iterator();
while (iter.hasNext()) {
- IInstallableUnit iu = (IInstallableUnit) ProvUI.getAdapter(iter.next(), IInstallableUnit.class);
+ IInstallableUnit iu = ProvUI.getAdapter(iter.next(), IInstallableUnit.class);
if (iu != null) {
ius.add(iu);
}
}
- return (IInstallableUnit[]) ius.toArray(new IInstallableUnit[ius.size()]);
+ return ius.toArray(new IInstallableUnit[ius.size()]);
}
private boolean areOnlyIUsSelected(IStructuredSelection selection) {
- Iterator iter = selection.iterator();
+ Iterator<?> iter = selection.iterator();
while (iter.hasNext()) {
- IInstallableUnit iu = (IInstallableUnit) ProvUI.getAdapter(iter.next(), IInstallableUnit.class);
+ IInstallableUnit iu = ProvUI.getAdapter(iter.next(), IInstallableUnit.class);
if (iu == null) {
return false;
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/viewers/InstallIUDropAdapter.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/InstallIUDropAdapter.java
index 74f503004..bb09719e7 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/viewers/InstallIUDropAdapter.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/InstallIUDropAdapter.java
@@ -8,19 +8,17 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.viewers;
+package org.eclipse.equinox.internal.p2.ui.viewers;
import java.util.*;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Status;
-import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
-import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUI;
-import org.eclipse.equinox.internal.provisional.p2.ui.actions.InstallAction;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.InstalledIUElement;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
+import org.eclipse.equinox.internal.p2.ui.*;
+import org.eclipse.equinox.internal.p2.ui.actions.InstallAction;
+import org.eclipse.equinox.internal.p2.ui.model.InstalledIUElement;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.jface.viewers.*;
import org.eclipse.swt.dnd.*;
@@ -35,7 +33,7 @@ import org.eclipse.swt.dnd.*;
public class InstallIUDropAdapter extends ViewerDropAdapter {
static boolean DEBUG = false;
- Policy policy;
+ ProvisioningUI ui;
/**
* Constructs a new drop adapter.
@@ -43,9 +41,9 @@ public class InstallIUDropAdapter extends ViewerDropAdapter {
* @param viewer
* the navigator's viewer
*/
- public InstallIUDropAdapter(Policy policy, StructuredViewer viewer) {
+ public InstallIUDropAdapter(ProvisioningUI ui, StructuredViewer viewer) {
super(viewer);
- this.policy = policy;
+ this.ui = ui;
}
/**
@@ -67,7 +65,7 @@ public class InstallIUDropAdapter extends ViewerDropAdapter {
* IU, return its parent profile id.
*/
private String getProfileTarget(Object mouseTarget) {
- IProfile profile = (IProfile) ProvUI.getAdapter(mouseTarget, IProfile.class);
+ IProfile profile = ProvUI.getAdapter(mouseTarget, IProfile.class);
if (profile != null) {
return profile.getProfileId();
}
@@ -138,7 +136,7 @@ public class InstallIUDropAdapter extends ViewerDropAdapter {
throw new UnsupportedOperationException("This ISelectionProvider is static, and cannot be modified."); //$NON-NLS-1$
}
};
- InstallAction action = new InstallAction(policy, selectionProvider, profileId);
+ InstallAction action = new InstallAction(ui, selectionProvider, profileId);
if (DEBUG)
System.out.println("Running install action"); //$NON-NLS-1$
action.run();
@@ -199,20 +197,20 @@ public class InstallIUDropAdapter extends ViewerDropAdapter {
*/
private IInstallableUnit[] getSelectedIUs() {
ISelection selection = LocalSelectionTransfer.getTransfer().getSelection();
- List ius = new ArrayList();
+ List<IInstallableUnit> ius = new ArrayList<IInstallableUnit>();
if (!(selection instanceof IStructuredSelection) || selection.isEmpty()) {
return null;
}
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
- Iterator iter = structuredSelection.iterator();
+ Iterator<?> iter = structuredSelection.iterator();
while (iter.hasNext()) {
- IInstallableUnit iu = (IInstallableUnit) ProvUI.getAdapter(iter.next(), IInstallableUnit.class);
+ IInstallableUnit iu = ProvUI.getAdapter(iter.next(), IInstallableUnit.class);
if (iu != null) {
ius.add(iu);
}
}
- return (IInstallableUnit[]) ius.toArray(new IInstallableUnit[ius.size()]);
+ return ius.toArray(new IInstallableUnit[ius.size()]);
}
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/viewers/ProvElementComparer.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/ProvElementComparer.java
index 3f4c11c96..7eddb3b2c 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/viewers/ProvElementComparer.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/ProvElementComparer.java
@@ -8,15 +8,13 @@
* Contributors:
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.viewers;
+package org.eclipse.equinox.internal.p2.ui.viewers;
import java.net.URI;
-import org.eclipse.equinox.internal.p2.ui.model.CategoryElement;
-import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUI;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.IRepositoryElement;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.ProfileElement;
+import org.eclipse.equinox.internal.p2.ui.ProvUI;
+import org.eclipse.equinox.internal.p2.ui.model.*;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
import org.eclipse.jface.viewers.IElementComparer;
public class ProvElementComparer implements IElementComparer {
@@ -58,21 +56,21 @@ public class ProvElementComparer implements IElementComparer {
}
private IInstallableUnit getIU(Object obj) {
- return (IInstallableUnit) ProvUI.getAdapter(obj, IInstallableUnit.class);
+ return ProvUI.getAdapter(obj, IInstallableUnit.class);
}
private String getProfileId(Object obj) {
if (obj instanceof ProfileElement)
return ((ProfileElement) obj).getLabel(obj);
- IProfile profile = (IProfile) ProvUI.getAdapter(obj, IProfile.class);
+ IProfile profile = ProvUI.getAdapter(obj, IProfile.class);
if (profile == null)
return null;
return profile.getProfileId();
}
private URI getRepositoryLocation(Object obj) {
- if (obj instanceof IRepositoryElement)
- return ((IRepositoryElement) obj).getLocation();
+ if (obj instanceof IRepositoryElement<?>)
+ return ((IRepositoryElement<?>) obj).getLocation();
return null;
}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/viewers/ProvElementContentProvider.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/ProvElementContentProvider.java
index 9fe429748..5e0c4bd9b 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/viewers/ProvElementContentProvider.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/ProvElementContentProvider.java
@@ -9,7 +9,7 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.viewers;
+package org.eclipse.equinox.internal.p2.ui.viewers;
import java.util.ArrayList;
import java.util.Arrays;
@@ -55,7 +55,7 @@ public class ProvElementContentProvider implements ITreeContentProvider {
fetchJob = new Job(ProvUIMessages.ProvElementContentProvider_FetchJobTitle) {
protected IStatus run(IProgressMonitor monitor) {
IDeferredWorkbenchAdapter parent = (IDeferredWorkbenchAdapter) input;
- final ArrayList children = new ArrayList();
+ final ArrayList<Object> children = new ArrayList<Object>();
parent.fetchDeferredChildren(parent, new IElementCollector() {
public void add(Object element, IProgressMonitor mon) {
if (mon.isCanceled())
@@ -77,6 +77,8 @@ public class ProvElementContentProvider implements ITreeContentProvider {
display.asyncExec(new Runnable() {
public void run() {
AbstractTableViewer tableViewer = (AbstractTableViewer) viewer;
+ if (viewer == null || viewer.getControl().isDisposed())
+ return;
tableViewer.getControl().setRedraw(false);
tableViewer.remove(pending);
tableViewer.add(children.toArray());
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/viewers/ProvElementLabelProvider.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/ProvElementLabelProvider.java
index ed4e09179..e82f5f841 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/viewers/ProvElementLabelProvider.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/ProvElementLabelProvider.java
@@ -9,20 +9,19 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.viewers;
+package org.eclipse.equinox.internal.p2.ui.viewers;
import org.eclipse.core.runtime.URIUtil;
-import org.eclipse.equinox.internal.p2.ui.model.IIUElement;
-import org.eclipse.equinox.internal.p2.ui.model.ProvElement;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.processing.ProcessingStepDescriptor;
-import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
-import org.eclipse.equinox.internal.provisional.p2.metadata.*;
-import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
-import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUI;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUIImages;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.IRepositoryElement;
+import org.eclipse.equinox.internal.p2.metadata.IRequiredCapability;
+import org.eclipse.equinox.internal.p2.ui.ProvUI;
+import org.eclipse.equinox.internal.p2.ui.ProvUIImages;
+import org.eclipse.equinox.internal.p2.ui.model.*;
+import org.eclipse.equinox.p2.engine.IProfile;
+import org.eclipse.equinox.p2.metadata.*;
+import org.eclipse.equinox.p2.repository.IRepository;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
+import org.eclipse.equinox.p2.repository.artifact.IProcessingStepDescriptor;
+import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;
@@ -50,26 +49,26 @@ public class ProvElementLabelProvider extends LabelProvider implements ITableLab
IInstallableUnit iu = (IInstallableUnit) obj;
return iu.getId();
}
- if (obj instanceof IRepository) {
- String name = ((IRepository) obj).getName();
+ if (obj instanceof IRepository<?>) {
+ String name = ((IRepository<?>) obj).getName();
if (name != null && name.length() > 0) {
return name;
}
- return URIUtil.toUnencodedString(((IRepository) obj).getLocation());
+ return URIUtil.toUnencodedString(((IRepository<?>) obj).getLocation());
}
- if (obj instanceof IRepositoryElement) {
- String name = ((IRepositoryElement) obj).getName();
+ if (obj instanceof IRepositoryElement<?>) {
+ String name = ((IRepositoryElement<?>) obj).getName();
if (name != null && name.length() > 0) {
return name;
}
- return URIUtil.toUnencodedString(((IRepositoryElement) obj).getLocation());
+ return URIUtil.toUnencodedString(((IRepositoryElement<?>) obj).getLocation());
}
if (obj instanceof IArtifactKey) {
IArtifactKey key = (IArtifactKey) obj;
return key.getId() + " [" + key.getClassifier() + "]"; //$NON-NLS-1$//$NON-NLS-2$
}
- if (obj instanceof ProcessingStepDescriptor) {
- ProcessingStepDescriptor descriptor = (ProcessingStepDescriptor) obj;
+ if (obj instanceof IProcessingStepDescriptor) {
+ IProcessingStepDescriptor descriptor = (IProcessingStepDescriptor) obj;
return descriptor.getProcessorId();
}
if (obj instanceof IRequiredCapability) {
@@ -97,7 +96,7 @@ public class ProvElementLabelProvider extends LabelProvider implements ITableLab
if (obj instanceof IArtifactKey) {
return PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_OBJ_FILE);
}
- if (obj instanceof IRequiredCapability) {
+ if (obj instanceof IRequirement) {
return ProvUIImages.getImage(ProvUIImages.IMG_IU);
}
return null;
@@ -123,15 +122,15 @@ public class ProvElementLabelProvider extends LabelProvider implements ITableLab
if (((IIUElement) element).shouldShowVersion())
return ((IIUElement) element).getIU().getVersion().toString();
}
- IInstallableUnit iu = (IInstallableUnit) ProvUI.getAdapter(element, IInstallableUnit.class);
+ IInstallableUnit iu = ProvUI.getAdapter(element, IInstallableUnit.class);
if (iu != null) {
return iu.getVersion().toString();
}
- if (element instanceof IRepository) {
- return URIUtil.toUnencodedString(((IRepository) element).getLocation());
+ if (element instanceof IRepository<?>) {
+ return URIUtil.toUnencodedString(((IRepository<?>) element).getLocation());
}
- if (element instanceof IRepositoryElement) {
- return URIUtil.toUnencodedString(((IRepositoryElement) element).getLocation());
+ if (element instanceof IRepositoryElement<?>) {
+ return URIUtil.toUnencodedString(((IRepositoryElement<?>) element).getLocation());
}
if (element instanceof IArtifactKey) {
IArtifactKey key = (IArtifactKey) element;
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/viewers/RepositoryContentProvider.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/RepositoryContentProvider.java
index 06d1f9c66..1aa1088ea 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/viewers/RepositoryContentProvider.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/RepositoryContentProvider.java
@@ -9,10 +9,9 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.viewers;
+package org.eclipse.equinox.internal.p2.ui.viewers;
-import org.eclipse.equinox.internal.p2.ui.viewers.DeferredQueryContentProvider;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactDescriptor;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactDescriptor;
/**
* Content provider for provisioning repositories. The repositories are the
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/RepositoryDetailsLabelProvider.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/RepositoryDetailsLabelProvider.java
index 6537fabe6..6247d7db2 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/RepositoryDetailsLabelProvider.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/RepositoryDetailsLabelProvider.java
@@ -12,14 +12,12 @@
package org.eclipse.equinox.internal.p2.ui.viewers;
import org.eclipse.core.runtime.URIUtil;
+import org.eclipse.equinox.internal.p2.ui.ProvUIImages;
import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.p2.ui.model.MetadataRepositoryElement;
-import org.eclipse.equinox.internal.p2.ui.model.ProvElement;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepository;
-import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepository;
-import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUIImages;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.IRepositoryElement;
+import org.eclipse.equinox.internal.p2.ui.model.*;
+import org.eclipse.equinox.p2.repository.IRepository;
+import org.eclipse.equinox.p2.repository.artifact.IArtifactRepository;
+import org.eclipse.equinox.p2.repository.metadata.IMetadataRepository;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.osgi.util.TextProcessor;
@@ -60,25 +58,25 @@ public class RepositoryDetailsLabelProvider extends LabelProvider implements ITa
switch (columnIndex) {
case COL_NAME :
- if (element instanceof IRepositoryElement) {
- String name = ((IRepositoryElement) element).getName();
+ if (element instanceof IRepositoryElement<?>) {
+ String name = ((IRepositoryElement<?>) element).getName();
if (name != null) {
return name;
}
}
- if (element instanceof IRepository) {
- String name = ((IRepository) element).getName();
+ if (element instanceof IRepository<?>) {
+ String name = ((IRepository<?>) element).getName();
if (name != null) {
return name;
}
}
return ""; //$NON-NLS-1$
case COL_LOCATION :
- if (element instanceof IRepository) {
- return TextProcessor.process(URIUtil.toUnencodedString(((IRepository) element).getLocation()));
+ if (element instanceof IRepository<?>) {
+ return TextProcessor.process(URIUtil.toUnencodedString(((IRepository<?>) element).getLocation()));
}
- if (element instanceof IRepositoryElement) {
- return TextProcessor.process(URIUtil.toUnencodedString(((IRepositoryElement) element).getLocation()));
+ if (element instanceof IRepositoryElement<?>) {
+ return TextProcessor.process(URIUtil.toUnencodedString(((IRepositoryElement<?>) element).getLocation()));
}
break;
case COL_ENABLEMENT :
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/viewers/StructuredViewerProvisioningListener.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/StructuredViewerProvisioningListener.java
index 056660a47..a907f604e 100644
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/viewers/StructuredViewerProvisioningListener.java
+++ b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/viewers/StructuredViewerProvisioningListener.java
@@ -9,11 +9,11 @@
* IBM Corporation - initial API and implementation
*******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.viewers;
+package org.eclipse.equinox.internal.p2.ui.viewers;
+import org.eclipse.equinox.internal.p2.ui.ProvUIProvisioningListener;
+import org.eclipse.equinox.internal.p2.ui.model.ProfileElement;
import org.eclipse.equinox.internal.provisional.p2.repository.RepositoryEvent;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUIProvisioningListener;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.ProfileElement;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbench;
@@ -47,7 +47,7 @@ public class StructuredViewerProvisioningListener extends ProvUIProvisioningList
* @param event the RepositoryEvent describing the details
*/
protected void repositoryAdded(RepositoryEvent event) {
- asyncRefresh();
+ safeRefresh();
}
/**
@@ -58,7 +58,7 @@ public class StructuredViewerProvisioningListener extends ProvUIProvisioningList
* @param event the RepositoryEvent describing the details
*/
protected void repositoryRemoved(RepositoryEvent event) {
- asyncRefresh();
+ safeRefresh();
}
/**
@@ -111,7 +111,7 @@ public class StructuredViewerProvisioningListener extends ProvUIProvisioningList
* @param profileId the id of the profile that has been added.
*/
protected void profileAdded(final String profileId) {
- asyncRefresh();
+ safeRefresh();
}
/**
@@ -122,10 +122,15 @@ public class StructuredViewerProvisioningListener extends ProvUIProvisioningList
* @param profileId the id of the profile that has been removed.
*/
protected void profileRemoved(final String profileId) {
- asyncRefresh();
+ safeRefresh();
}
- protected void asyncRefresh() {
+ protected void safeRefresh() {
+ if (Display.getCurrent() != null) {
+ refreshViewer();
+ return;
+ }
+
display.asyncExec(new Runnable() {
public void run() {
if (isClosing())
@@ -136,7 +141,7 @@ public class StructuredViewerProvisioningListener extends ProvUIProvisioningList
}
protected void refreshAll() {
- asyncRefresh();
+ safeRefresh();
}
/**
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/IStatusCodes.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/IStatusCodes.java
deleted file mode 100644
index d31aaf01f..000000000
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/IStatusCodes.java
+++ /dev/null
@@ -1,48 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui;
-
-/**
- * IStatusCodes defines codes for common status conditions in the
- * p2 UI.
- *
- * This interface is not intended to be implemented
- *
- * @since 3.4
- * @noimplement This interface is not intended to be implemented by clients.
- */
-public interface IStatusCodes {
-
- //UI status codes [10000-10999] - note these cannot conflict with the core codes
- //in ProvisionException or we'll see strange results.
-
- public static final int NOTHING_TO_UPDATE = 10000;
-
- // Status codes associated with profile change request or plans being altered from the original intent
- public static final int PROFILE_CHANGE_ALTERED = 10001;
- public static final int IU_REQUEST_ALTERED = 10002;
- public static final int ALTERED_IMPLIED_UPDATE = 10003;
- public static final int ALTERED_IGNORED_IMPLIED_DOWNGRADE = 10004;
- public static final int ALTERED_IGNORED_ALREADY_INSTALLED = 10005;
- public static final int ALTERED_PARTIAL_INSTALL = 10006;
- public static final int ALTERED_PARTIAL_UNINSTALL = 10007;
- public static final int ALTERED_SIDE_EFFECT_UPDATE = 10008;
- public static final int ALTERED_SIDE_EFFECT_REMOVE = 10009;
- public static final int ALTERED_SIDE_EFFECT_INSTALL = 10010;
- public static final int ALTERED_IGNORED_INSTALL_REQUEST = 10011;
- public static final int ALTERED_IGNORED_UNINSTALL_REQUEST = 10012;
- public static final int ALTERED_IGNORED_IMPLIED_UPDATE = 10013;
-
- // Status codes associated with inability to perform an operation
- public static final int UNEXPECTED_NOTHING_TO_DO = 10050;
- public static final int EXPECTED_NOTHING_TO_DO = 10051;
- public static final int OPERATION_ALREADY_IN_PROGRESS = 10052;
-}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/IUPropertyUtils.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/IUPropertyUtils.java
deleted file mode 100644
index 9007b3ee7..000000000
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/IUPropertyUtils.java
+++ /dev/null
@@ -1,241 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008-2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * EclipseSource - ongoing development
- *******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui;
-
-import java.lang.ref.SoftReference;
-import java.util.*;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.equinox.internal.p2.core.helpers.LogHelper;
-import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
-import org.eclipse.equinox.internal.p2.metadata.InstallableUnit;
-import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
-import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
-import org.eclipse.equinox.internal.provisional.p2.engine.IProfileRegistry;
-import org.eclipse.equinox.internal.provisional.p2.metadata.*;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.Collector;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.IUPropertyQuery;
-
-public class IUPropertyUtils {
-
- // TODO: these constants should come from API, eg. IInstallableUnit or ???
- static final Locale DEFAULT_LOCALE = new Locale("df", "LT"); //$NON-NLS-1$//$NON-NLS-2$
- static final String NAMESPACE_IU_LOCALIZATION = "org.eclipse.equinox.p2.localization"; //$NON-NLS-1$
-
- // Cache the IU fragments that provide localizations for a given locale.
- // map: locale => soft reference to a collector
- private static Map LocaleCollectorCache = new HashMap(2);
-
- // Get the license in the default locale.
- public static ILicense getLicense(IInstallableUnit iu) {
- return getLicense(iu, getCurrentLocale());
- }
-
- // Get the copyright in the default locale.
- public static ICopyright getCopyright(IInstallableUnit iu) {
- return getCopyright(iu, getCurrentLocale());
- }
-
- // Get a property in the default locale
- public static String getIUProperty(IInstallableUnit iu, String propertyKey) {
- return getIUProperty(iu, propertyKey, getCurrentLocale());
- }
-
- public static ILicense getLicense(IInstallableUnit iu, Locale locale) {
- ILicense license = iu.getLicense();
- String body = (license != null ? license.getBody() : null);
- if (body == null || body.length() <= 1 || body.charAt(0) != '%')
- return license;
- final String actualKey = body.substring(1); // Strip off the %
- body = getLocalizedIUProperty(iu, actualKey, locale);
- return MetadataFactory.createLicense(license.getLocation(), body);
- }
-
- public static ICopyright getCopyright(IInstallableUnit iu, Locale locale) {
- ICopyright copyright = iu.getCopyright();
- String body = (copyright != null ? copyright.getBody() : null);
- if (body == null || body.length() <= 1 || body.charAt(0) != '%')
- return copyright;
- final String actualKey = body.substring(1); // Strip off the %
- body = getLocalizedIUProperty(iu, actualKey, locale);
- return MetadataFactory.createCopyright(copyright.getLocation(), body);
- }
-
- public static String getIUProperty(IInstallableUnit iu, String propertyKey, Locale locale) {
- String value = iu.getProperty(propertyKey);
- if (value == null || value.length() <= 1 || value.charAt(0) != '%')
- return value;
- // else have a localizable property
- final String actualKey = value.substring(1); // Strip off the %
- return getLocalizedIUProperty(iu, actualKey, locale);
- }
-
- private static String getLocalizedIUProperty(IInstallableUnit iu, String actualKey, Locale locale) {
- String localizedKey = makeLocalizedKey(actualKey, locale.toString());
- String localizedValue = null;
-
- //first check for a cached localized value
- if (iu instanceof InstallableUnit)
- localizedValue = ((InstallableUnit) iu).getLocalizedProperty(localizedKey);
- //next check if the localized value is stored in the same IU (common case)
- if (localizedValue == null)
- localizedValue = iu.getProperty(localizedKey);
- if (localizedValue != null)
- return localizedValue;
-
- final List locales = buildLocaleVariants(locale);
- final IInstallableUnit theUnit = iu;
-
- Collector localizationFragments = getLocalizationFragments(locale, locales);
-
- Collector hostLocalizationCollector = new Collector() {
- public boolean accept(Object object) {
- boolean haveHost = false;
- if (object instanceof IInstallableUnitFragment) {
- IInstallableUnitFragment fragment = (IInstallableUnitFragment) object;
- IRequiredCapability[] hosts = fragment.getHost();
- for (int i = 0; i < hosts.length; i++) {
- IRequiredCapability nextHost = hosts[i];
- if (IInstallableUnit.NAMESPACE_IU_ID.equals(nextHost.getNamespace()) && //
- theUnit.getId().equals(nextHost.getName()) && //
- nextHost.getRange() != null && //
- nextHost.getRange().isIncluded(theUnit.getVersion())) {
- haveHost = true;
- break;
- }
- }
- }
- return (haveHost ? super.accept(object) : true);
- }
- };
-
- IUPropertyQuery iuQuery = new IUPropertyQuery(IInstallableUnit.PROP_TYPE_FRAGMENT, "true"); //$NON-NLS-1$
- Collector collected = iuQuery.perform(localizationFragments.iterator(), hostLocalizationCollector);
-
- if (!collected.isEmpty()) {
- String translation = null;
- for (Iterator iter = collected.iterator(); iter.hasNext() && translation == null;) {
- IInstallableUnit localizationIU = (IInstallableUnit) iter.next();
- for (Iterator jter = locales.iterator(); jter.hasNext();) {
- String localeKey = makeLocalizedKey(actualKey, (String) jter.next());
- translation = localizationIU.getProperty(localeKey);
- if (translation != null)
- return cacheResult(iu, localizedKey, translation);
- }
- }
- }
-
- for (Iterator iter = locales.iterator(); iter.hasNext();) {
- String nextLocale = (String) iter.next();
- String localeKey = makeLocalizedKey(actualKey, nextLocale);
- String nextValue = iu.getProperty(localeKey);
- if (nextValue != null)
- return cacheResult(iu, localizedKey, nextValue);
- }
-
- return cacheResult(iu, localizedKey, actualKey);
- }
-
- /**
- * Cache the translated property value to optimize future retrieval of the same value.
- * Currently we just cache on the installable unit object in memory. In future
- * we should push support for localized property retrieval into IInstallableUnit
- * so we aren't required to reach around the API here.
- */
- private static String cacheResult(IInstallableUnit iu, String localizedKey, String localizedValue) {
- if (iu instanceof InstallableUnit)
- ((InstallableUnit) iu).setLocalizedProperty(localizedKey, localizedValue);
- return localizedValue;
- }
-
- /**
- * Collects the installable unit fragments that contain locale data for the given locales.
- */
- private static synchronized Collector getLocalizationFragments(Locale locale, List localeVariants) {
- SoftReference collectorRef = (SoftReference) LocaleCollectorCache.get(locale);
- if (collectorRef != null) {
- Collector cached = (Collector) collectorRef.get();
- if (cached != null)
- return cached;
- }
-
- final List locales = localeVariants;
-
- Collector localeFragmentCollector = new Collector() {
- public boolean accept(Object object) {
- boolean haveLocale = false;
- if (object instanceof IInstallableUnitFragment) {
- IInstallableUnitFragment fragment = (IInstallableUnitFragment) object;
- IProvidedCapability[] provides = fragment.getProvidedCapabilities();
- for (int j = 0; j < provides.length && !haveLocale; j++) {
- IProvidedCapability nextProvide = provides[j];
- if (NAMESPACE_IU_LOCALIZATION.equals(nextProvide.getNamespace())) {
- String providedLocale = nextProvide.getName();
- if (providedLocale != null) {
- for (Iterator iter = locales.iterator(); iter.hasNext();) {
- if (providedLocale.equals(iter.next())) {
- haveLocale = true;
- break;
- }
- }
- }
- }
- }
- }
- return (haveLocale ? super.accept(object) : true);
- }
- };
-
- //Due to performance problems we restrict locale lookup to the current profile (see bug 233958)
- IProfileRegistry profileRegistry = (IProfileRegistry) ServiceHelper.getService(ProvUIActivator.getContext(), IProfileRegistry.class.getName());
- if (profileRegistry == null) {
- LogHelper.log(new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, "Profile registry unavailable. Default language will be used.", new RuntimeException())); //$NON-NLS-1$
- return new Collector();
- }
- IProfile profile = profileRegistry.getProfile(IProfileRegistry.SELF);
- if (profile == null) {
- LogHelper.log(new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, "Profile unavailable. Default language will be used.", new RuntimeException())); //$NON-NLS-1$
- return new Collector();
- }
- IUPropertyQuery iuQuery = new IUPropertyQuery(IInstallableUnit.PROP_TYPE_FRAGMENT, "true"); //$NON-NLS-1$
- Collector collected = profile.query(iuQuery, localeFragmentCollector, null);
- LocaleCollectorCache.put(locale, new SoftReference(collected));
- return collected;
- }
-
- /**
- */
- private static List buildLocaleVariants(Locale locale) {
- String nl = locale.toString();
- ArrayList result = new ArrayList(4);
- int lastSeparator;
- while (true) {
- result.add(nl);
- lastSeparator = nl.lastIndexOf('_');
- if (lastSeparator == -1)
- break;
- nl = nl.substring(0, lastSeparator);
- }
- // Add the default locale (most general)
- result.add(DEFAULT_LOCALE.toString());
- return result;
- }
-
- private static String makeLocalizedKey(String actualKey, String localeImage) {
- return localeImage + '.' + actualKey;
- }
-
- private static Locale getCurrentLocale() {
- return Locale.getDefault();
- }
-
-}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/ProfileFactory.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/ProfileFactory.java
deleted file mode 100644
index c39585a9c..000000000
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/ProfileFactory.java
+++ /dev/null
@@ -1,81 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2008 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui;
-
-import java.util.HashMap;
-import java.util.Map;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
-import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
-import org.eclipse.osgi.service.environment.EnvironmentInfo;
-
-/**
- * Factory class that can create a new profile with the correct
- * default values.
- *
- * @since 3.4
- *
- */
-public class ProfileFactory {
-
- static private String FLAVOR_DEFAULT = "tooling"; //$NON-NLS-1$
- static private String EMPTY = ""; //$NON-NLS-1$
- static private EnvironmentInfo info;
-
- public static IProfile makeProfile(String profileId) {
- Map profileProperties = new HashMap();
- profileProperties.put(IProfile.PROP_INSTALL_FOLDER, getDefaultLocation());
- profileProperties.put(IProfile.PROP_FLAVOR, getDefaultFlavor());
- profileProperties.put(IProfile.PROP_ENVIRONMENTS, getDefaultEnvironments());
- profileProperties.put(IProfile.PROP_NL, getDefaultNL());
-
- try {
- return ProvisioningUtil.addProfile(profileId, profileProperties, null);
- } catch (ProvisionException e) {
- // log
- }
- return null;
- }
-
- public static String getDefaultLocation() {
- return Platform.getUserLocation().getURL().getPath();
- }
-
- public static String getDefaultFlavor() {
- return FLAVOR_DEFAULT;
- }
-
- private static EnvironmentInfo getEnvironmentInfo() {
- if (info == null) {
- info = (EnvironmentInfo) ServiceHelper.getService(ProvUIActivator.getContext(), EnvironmentInfo.class.getName());
- }
- return info;
- }
-
- public static String getDefaultNL() {
- if (getEnvironmentInfo() != null) {
- return info.getNL();
- }
- return EMPTY;
- }
-
- public static String getDefaultEnvironments() {
- if (getEnvironmentInfo() != null) {
- return "osgi.os=" //$NON-NLS-1$
- + info.getOS() + ",osgi.ws=" + info.getWS() //$NON-NLS-1$
- + ",osgi.arch=" + info.getOSArch(); //$NON-NLS-1$
- }
- return EMPTY;
- }
-}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/ProvisioningOperationRunner.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/ProvisioningOperationRunner.java
deleted file mode 100644
index 672828362..000000000
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/ProvisioningOperationRunner.java
+++ /dev/null
@@ -1,251 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.equinox.internal.provisional.p2.ui;
-
-import java.io.IOException;
-import java.util.HashSet;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.*;
-import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
-import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
-import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.p2.ui.dialogs.ApplyProfileChangesDialog;
-import org.eclipse.equinox.internal.provisional.configurator.Configurator;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProfileModificationOperation;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningOperation;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.progress.IProgressConstants;
-import org.eclipse.ui.progress.WorkbenchJob;
-import org.eclipse.ui.statushandlers.StatusManager;
-
-/**
- * Utility methods for running provisioning operations. Operations can either
- * be run synchronously or in a job. When scheduled as a job, the operation
- * determines whether the job is run in
- * the background or in the UI.
- *
- * @since 3.4
- */
-public class ProvisioningOperationRunner {
-
- private static final String PROPERTY_PREFIX = "org.eclipse.equinox.p2.ui"; //$NON-NLS-1$
- private static final QualifiedName OPERATION_KEY = new QualifiedName(PROPERTY_PREFIX, "operationKey"); //$NON-NLS-1$
- static HashSet scheduledJobs = new HashSet();
- static boolean restartRequested = false;
- static boolean restartRequired = false;
- static boolean subsequentRestartsRequested = false;
- // used during automated testing to prevent a restart dialog from interrupting tests
- static boolean suppressRestart = false;
- static ListenerList jobListeners = new ListenerList();
-
- /**
- * This method is temporary and will not appear in the final API.
- *
- * @param suppress
- *
- * @deprecated see https://bugs.eclipse.org/bugs/show_bug.cgi?id=274876
- */
- public static void suppressRestart(boolean suppress) {
- suppressRestart = suppress;
- }
-
- /**
- * Run the provisioning operation synchronously
- * @param op The operation to execute
- * @param errorStyle the flags passed to the StatusManager for error reporting
- */
- public static void run(ProvisioningOperation op, int errorStyle) {
- try {
- op.execute(new NullProgressMonitor());
- } catch (OperationCanceledException e) {
- // nothing to do
- } catch (ProvisionException e) {
- ProvUI.handleException(e, null, errorStyle);
- }
-
- }
-
- /**
- * Schedule a job to execute the supplied ProvisioningOperation.
- *
- * @param op The operation to execute
- * @param errorStyle the flags passed to the StatusManager for error reporting
- */
- public static Job schedule(final ProvisioningOperation op, final int errorStyle) {
- Job job;
- final boolean noPrompt = (errorStyle & (StatusManager.BLOCK | StatusManager.SHOW)) == 0;
-
- if (op.runInBackground()) {
- job = new Job(op.getLabel()) {
- protected IStatus run(IProgressMonitor monitor) {
- final Job thisJob = this;
- try {
- IStatus status = op.execute(monitor);
- if (!status.isOK() && noPrompt) {
- this.setProperty(IProgressConstants.KEEP_PROPERTY, Boolean.TRUE);
- this.setProperty(IProgressConstants.NO_IMMEDIATE_ERROR_PROMPT_PROPERTY, Boolean.TRUE);
- }
- return status;
- } catch (OperationCanceledException e) {
- return Status.CANCEL_STATUS;
- } catch (final ProvisionException e) {
- if (noPrompt) {
- thisJob.setProperty(IProgressConstants.KEEP_PROPERTY, Boolean.TRUE);
- thisJob.setProperty(IProgressConstants.NO_IMMEDIATE_ERROR_PROMPT_PROPERTY, Boolean.TRUE);
- }
- String message = e.getLocalizedMessage();
- if (message == null)
- message = NLS.bind(ProvUIMessages.ProvisioningOperationRunner_ErrorExecutingOperation, op.getLabel());
- return new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, 0, message, e);
- }
- }
- };
- job.setPriority(Job.LONG);
- } else {
- job = new WorkbenchJob(op.getLabel()) {
- public IStatus runInUIThread(IProgressMonitor monitor) {
- try {
- IStatus status = op.execute(monitor);
- if (!status.isOK() && noPrompt) {
- this.setProperty(IProgressConstants.KEEP_PROPERTY, Boolean.TRUE);
- this.setProperty(IProgressConstants.NO_IMMEDIATE_ERROR_PROMPT_PROPERTY, Boolean.TRUE);
- }
- return status;
- } catch (OperationCanceledException e) {
- return Status.CANCEL_STATUS;
- } catch (ProvisionException e) {
- if (noPrompt) {
- this.setProperty(IProgressConstants.KEEP_PROPERTY, Boolean.TRUE);
- this.setProperty(IProgressConstants.NO_IMMEDIATE_ERROR_PROMPT_PROPERTY, Boolean.TRUE);
- }
- return new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, 0, NLS.bind(ProvUIMessages.ProvisioningOperationRunner_ErrorExecutingOperation, op.getLabel()), e);
- }
- }
- };
- job.setPriority(Job.SHORT);
- }
- job.setUser(op.isUser());
- job.setProperty(OPERATION_KEY, op);
- job.setProperty(IProgressConstants.ICON_PROPERTY, ProvUIImages.getImageDescriptor(ProvUIImages.IMG_PROFILE));
- manageJob(job);
- job.schedule();
- return job;
- }
-
- /**
- * This method is temporary and is not intended for the API.
- *
- * @deprecated see https://bugs.eclipse.org/bugs/show_bug.cgi?id=274876
- */
- public static void clearRestartRequests() {
- restartRequired = false;
- restartRequested = false;
- subsequentRestartsRequested = false;
- }
-
- /**
- * This method will not appear in the final API.
- *
- * @param force
- * @deprecated see https://bugs.eclipse.org/bugs/show_bug.cgi?id=274876
-
- */
- public static void requestRestart(boolean force) {
- if (suppressRestart || hasScheduledOperations()) {
- restartRequested = true;
- subsequentRestartsRequested = true;
- restartRequired = restartRequired || force;
- return;
- }
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (PlatformUI.getWorkbench().isClosing())
- return;
- int retCode = ApplyProfileChangesDialog.promptForRestart(ProvUI.getDefaultParentShell(), restartRequired);
- // Now that we have asked, regardless of answer, we won't need to
- // ask again until the next profile changing operation. Don't reset
- // the restart required flag so that the next time we ask, if it
- // was required before, it will still be required.
- restartRequested = false;
- if (retCode == ApplyProfileChangesDialog.PROFILE_APPLYCHANGES) {
- Configurator configurator = (Configurator) ServiceHelper.getService(ProvUIActivator.getContext(), Configurator.class.getName());
- try {
- configurator.applyConfiguration();
- } catch (IOException e) {
- ProvUI.handleException(e, ProvUIMessages.ProvUI_ErrorDuringApplyConfig, StatusManager.LOG | StatusManager.BLOCK);
- } catch (IllegalStateException e) {
- IStatus illegalApplyStatus = new Status(IStatus.WARNING, ProvUIActivator.PLUGIN_ID, 0, ProvUIMessages.ProvisioningOperationRunner_CannotApplyChanges, e);
- ProvUI.reportStatus(illegalApplyStatus, StatusManager.LOG | StatusManager.BLOCK);
- }
- } else if (retCode == ApplyProfileChangesDialog.PROFILE_RESTART) {
- PlatformUI.getWorkbench().restart();
- }
- }
- });
- }
-
- public static boolean hasScheduledOperations() {
- return !scheduledJobs.isEmpty();
- }
-
- public static boolean hasScheduledOperationsFor(String profileId) {
- Job[] jobs = getScheduledJobs();
- for (int i = 0; i < jobs.length; i++) {
- Object op = jobs[i].getProperty(OPERATION_KEY);
- if (op instanceof ProfileModificationOperation) {
- String id = ((ProfileModificationOperation) op).getProfileId();
- if (profileId.equals(id))
- return true;
- }
- }
- return false;
- }
-
- public static void addJobChangeListener(IJobChangeListener listener) {
- jobListeners.add(listener);
- Job[] jobs = getScheduledJobs();
- for (int i = 0; i < jobs.length; i++)
- jobs[i].addJobChangeListener(listener);
- }
-
- public static void removeJobChangeListener(IJobChangeListener listener) {
- jobListeners.remove(listener);
- Job[] jobs = getScheduledJobs();
- for (int i = 0; i < jobs.length; i++)
- jobs[i].removeJobChangeListener(listener);
- }
-
- private static Job[] getScheduledJobs() {
- return (Job[]) scheduledJobs.toArray(new Job[scheduledJobs.size()]);
- }
-
- public static void manageJob(Job job) {
- scheduledJobs.add(job);
- subsequentRestartsRequested = false;
- job.addJobChangeListener(new JobChangeAdapter() {
- public void done(IJobChangeEvent event) {
- scheduledJobs.remove(event.getJob());
- int severity = event.getResult().getSeverity();
- if (severity != IStatus.CANCEL && severity != IStatus.ERROR && restartRequested) {
- requestRestart(restartRequired);
- } else {
- restartRequested = subsequentRestartsRequested;
- }
- }
- });
- Object[] listeners = jobListeners.getListeners();
- for (int i = 0; i < listeners.length; i++)
- job.addJobChangeListener((IJobChangeListener) listeners[i]);
- }
-}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/QueryableArtifactRepositoryManager.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/QueryableArtifactRepositoryManager.java
deleted file mode 100644
index 8d6cab8ca..000000000
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/QueryableArtifactRepositoryManager.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * EclipseSource - ongoing development
- *******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui;
-
-import java.net.URI;
-import java.util.*;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.SubMonitor;
-import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
-import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
-import org.eclipse.equinox.internal.provisional.p2.artifact.repository.IArtifactRepositoryManager;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.Collector;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.Query;
-import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
-import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.IUViewQueryContext;
-
-/**
- * An object that adds provides queryable support
- * for an artifact repository manager. The query context determines which
- * repositories are included in the query. Since artifact repositories
- * do not support queries, the query will be performed over the repository
- * locations.
- */
-public class QueryableArtifactRepositoryManager extends QueryableRepositoryManager {
-
- public QueryableArtifactRepositoryManager(IUViewQueryContext queryContext, boolean includeDisabledRepos) {
- super(queryContext, includeDisabledRepos);
- }
-
- protected URI[] getRepoLocations(IRepositoryManager manager) {
- Set locations = new HashSet();
- int flags = queryContext.getArtifactRepositoryFlags();
- locations.addAll(Arrays.asList(manager.getKnownRepositories(flags)));
- if (includeDisabledRepos) {
- locations.addAll(Arrays.asList(manager.getKnownRepositories(IRepositoryManager.REPOSITORIES_DISABLED | flags)));
- }
- return (URI[]) locations.toArray(new URI[locations.size()]);
- }
-
- protected IRepositoryManager getRepositoryManager() {
- return (IArtifactRepositoryManager) ServiceHelper.getService(ProvUIActivator.getContext(), IArtifactRepositoryManager.class.getName());
- }
-
- protected IRepository doLoadRepository(IRepositoryManager manager, URI location, IProgressMonitor monitor) throws ProvisionException {
- if (manager instanceof IArtifactRepositoryManager) {
- ((IArtifactRepositoryManager) manager).loadRepository(location, monitor);
- }
- return null;
- }
-
- protected Collector query(URI[] uris, Query query, Collector collector, IProgressMonitor monitor) {
- SubMonitor sub = SubMonitor.convert(monitor, uris.length * 100);
-
- if (sub.isCanceled())
- return collector;
- // artifact repositories do not support querying, so we always use the location.
- query.perform(Arrays.asList(uris).iterator(), collector);
-
- return collector;
- }
-}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/QueryableMetadataRepositoryManager.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/QueryableMetadataRepositoryManager.java
deleted file mode 100644
index 9ee400d69..000000000
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/QueryableMetadataRepositoryManager.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui;
-
-import java.net.URI;
-import java.util.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
-import org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager;
-import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.*;
-import org.eclipse.equinox.internal.provisional.p2.metadata.repository.IMetadataRepositoryManager;
-import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
-import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.IUViewQueryContext;
-
-/**
- * An object that adds provides specialized/optimized queryable support
- * for a metadata repository. The query context determines which repositories
- * are included in the query. Callers interested in only the resulting repository URIs
- * should specify a {@link RepositoryLocationQuery}, in which case the
- * query is performed over the URI's. Otherwise the query is performed over
- * the repositories themselves.
- */
-public class QueryableMetadataRepositoryManager extends QueryableRepositoryManager {
-
- public QueryableMetadataRepositoryManager(IUViewQueryContext queryContext, boolean includeDisabledRepos) {
- super(queryContext, includeDisabledRepos);
- }
-
- protected IRepository getRepository(IRepositoryManager manager, URI location) {
- // note the use of MetadataRepositoryManager (the concrete implementation).
- if (manager instanceof MetadataRepositoryManager) {
- return ((MetadataRepositoryManager) manager).getRepository(location);
- }
- return super.getRepository(manager, location);
- }
-
- protected IRepositoryManager getRepositoryManager() {
- return (IMetadataRepositoryManager) ServiceHelper.getService(ProvUIActivator.getContext(), IMetadataRepositoryManager.class.getName());
- }
-
- protected IRepository doLoadRepository(IRepositoryManager manager, URI location, IProgressMonitor monitor) throws ProvisionException {
- if (manager instanceof IMetadataRepositoryManager) {
- return ProvisioningUtil.loadMetadataRepository(location, monitor);
- }
- return null;
- }
-
- protected Collector query(URI uris[], Query query, Collector collector, IProgressMonitor monitor) {
- if (query instanceof RepositoryLocationQuery) {
- query.perform(Arrays.asList(uris).iterator(), collector);
- monitor.done();
- } else {
- SubMonitor sub = SubMonitor.convert(monitor, (uris.length + 1) * 100);
- ArrayList loadedRepos = new ArrayList(uris.length);
- for (int i = 0; i < uris.length; i++) {
- IRepository repo = null;
- try {
- repo = loadRepository(getRepositoryManager(), uris[i], sub.newChild(100));
- } catch (ProvisionException e) {
- handleLoadFailure(e, uris[i]);
- } catch (OperationCanceledException e) {
- // user has canceled
- repo = null;
- }
- if (repo != null)
- loadedRepos.add(repo);
- }
- if (loadedRepos.size() > 0) {
- IQueryable[] queryables = (IQueryable[]) loadedRepos.toArray(new IQueryable[loadedRepos.size()]);
- collector = new CompoundQueryable(queryables).query(query, collector, sub.newChild(100));
- }
- }
- return collector;
- }
-
- protected URI[] getRepoLocations(IRepositoryManager manager) {
- Set locations = new HashSet();
- int flags = queryContext.getMetadataRepositoryFlags();
- locations.addAll(Arrays.asList(manager.getKnownRepositories(flags)));
- if (includeDisabledRepos) {
- locations.addAll(Arrays.asList(manager.getKnownRepositories(IRepositoryManager.REPOSITORIES_DISABLED | flags)));
- }
- return (URI[]) locations.toArray(new URI[locations.size()]);
- }
-}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/QueryableRepositoryManager.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/QueryableRepositoryManager.java
deleted file mode 100644
index fbbd05494..000000000
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/QueryableRepositoryManager.java
+++ /dev/null
@@ -1,238 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui;
-
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.HashMap;
-import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
-import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.*;
-import org.eclipse.equinox.internal.provisional.p2.repository.IRepository;
-import org.eclipse.equinox.internal.provisional.p2.repository.IRepositoryManager;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.IUViewQueryContext;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.ui.statushandlers.StatusManager;
-
-/**
- * An object that provides specialized repository query support in place of
- * a repository manager and its repositories. The repositories to be included
- * can be specified using the repository flags defined in the UI policy. The query
- * itself is run on the the repositories themselves, if supported by the particular
- * kind of repository. If the repository doesn't support queryies, or the query is
- * a {@link RepositoryLocationQuery}, the query is run over
- * the repository locations instead.
- */
-public abstract class QueryableRepositoryManager implements IQueryable {
- /**
- * List<URI> of locations of repositories that were not found
- */
- private ArrayList notFound = new ArrayList();
-
- /**
- * Map<URI,IRepository> of loaded repositories.
- */
- private HashMap loaded = new HashMap();
-
- private MultiStatus accumulatedNotFound = null;
- protected boolean includeDisabledRepos;
- protected IUViewQueryContext queryContext;
-
- public QueryableRepositoryManager(IUViewQueryContext queryContext, boolean includeDisabledRepos) {
- this.includeDisabledRepos = includeDisabledRepos;
- Assert.isNotNull(queryContext);
- this.queryContext = queryContext;
- }
-
- /**
- * Iterates over the repositories configured in this queryable.
- * For most queries, the query is run on each repository, passing any objects that satisfy the
- * query to the provided collector. If the query is a {@link RepositoryLocationQuery}, the query
- * is run on the repository locations instead.
- * <p>
- * This method is long-running; progress and cancellation are provided
- * by the given progress monitor.
- * </p>
- *
- * @param query The query to perform..
- * @param result Collects the results of the query, run on either the repository URIs, or on
- * the repositories themselves.
- * @param monitor a progress monitor, or <code>null</code> if progress
- * reporting is not desired
- * @return The collector argument
- */
- public Collector query(Query query, Collector result, IProgressMonitor monitor) {
- IRepositoryManager manager = getRepositoryManager();
- if (manager == null) {
- ProvUI.reportStatus(new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, ProvUIMessages.ProvisioningUtil_NoRepositoryManager), StatusManager.SHOW | StatusManager.LOG);
- return result;
- }
- if (monitor == null)
- monitor = new NullProgressMonitor();
- query(getRepoLocations(manager), query, result, monitor);
- reportAccumulatedStatus();
- return result;
- }
-
- /**
- * Load all of the repositories referenced by this queryable. This is an expensive operation.
- * The status of any not found repositories is accumulated and must be reported manually
- * using reportAccumulatedStatus()
- *
- * @param monitor the progress monitor that should be used
- */
- public void loadAll(IProgressMonitor monitor) {
- IRepositoryManager manager = getRepositoryManager();
- if (manager == null) {
- ProvUI.reportStatus(new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, ProvUIMessages.ProvisioningUtil_NoRepositoryManager), StatusManager.SHOW | StatusManager.LOG);
- return;
- }
- URI[] repoLocations = getRepoLocations(manager);
- SubMonitor sub = SubMonitor.convert(monitor, repoLocations.length * 100);
- if (sub.isCanceled())
- return;
- for (int i = 0; i < repoLocations.length; i++) {
- if (sub.isCanceled())
- return;
- try {
- loadRepository(manager, repoLocations[i], sub.newChild(100));
- } catch (ProvisionException e) {
- handleLoadFailure(e, repoLocations[i]);
- }
- }
- }
-
- /**
- * Returns an array of repository locations.
- */
- protected abstract URI[] getRepoLocations(IRepositoryManager manager);
-
- protected void handleLoadFailure(ProvisionException e, URI problemRepo) {
- int code = e.getStatus().getCode();
- // special handling when the repo is bad. We don't want to continually report it
- if (code == ProvisionException.REPOSITORY_NOT_FOUND || code == ProvisionException.REPOSITORY_INVALID_LOCATION) {
- // If we thought we had loaded it, get rid of the reference
- loaded.remove(problemRepo);
- // If we've already reported a URL is not found, don't report again.
- if (notFound.contains(problemRepo))
- return;
- // If someone else reported a URL is not found, don't report again.
- if (ProvUI.hasNotFoundStatusBeenReported(problemRepo)) {
- notFound.add(problemRepo);
- return;
- }
- notFound.add(problemRepo);
- ProvUI.notFoundStatusReported(problemRepo);
- }
-
- // Some ProvisionExceptions include an empty multi status with a message.
- // Since empty multi statuses have a severity OK, The platform status handler doesn't handle
- // this well. We correct this by recreating a status with error severity
- // so that the platform status handler does the right thing.
- IStatus status = e.getStatus();
- if (status instanceof MultiStatus && ((MultiStatus) status).getChildren().length == 0)
- status = new Status(IStatus.ERROR, status.getPlugin(), status.getCode(), status.getMessage(), status.getException());
- if (accumulatedNotFound == null) {
- accumulatedNotFound = new MultiStatus(ProvUIActivator.PLUGIN_ID, ProvisionException.REPOSITORY_NOT_FOUND, new IStatus[] {status}, ProvUIMessages.QueryableMetadataRepositoryManager_MultipleRepositoriesNotFound, null);
- } else {
- accumulatedNotFound.add(status);
- }
- // Always log the complete exception so the detailed stack trace is in the log.
- ProvUI.handleException(e, NLS.bind(ProvUIMessages.ProvisioningUtil_LoadRepositoryFailure, problemRepo), StatusManager.LOG);
-
- }
-
- public void reportAccumulatedStatus() {
- // If we've discovered not found repos we didn't know about, report them
- if (accumulatedNotFound != null) {
- // If there is only missing repo to report, use the specific message rather than the generic.
- if (accumulatedNotFound.getChildren().length == 1) {
- ProvUI.reportStatus(accumulatedNotFound.getChildren()[0], StatusManager.SHOW);
- } else {
- ProvUI.reportStatus(accumulatedNotFound, StatusManager.SHOW);
- }
- }
- // Reset the accumulated status so that next time we only report the newly not found repos.
- accumulatedNotFound = null;
- }
-
- /**
- * Return a boolean indicating whether all the repositories that
- * can be queried by the receiver are already loaded. If a repository
- * is not loaded because it was not found, this will not return false,
- * because this repository cannot be queried.
- *
- * @return <code>true</code> if all repositories to be queried by the
- * receiver are loaded, <code>false</code> if they
- * are not.
- */
- public boolean areRepositoriesLoaded() {
- IRepositoryManager mgr = getRepositoryManager();
- if (mgr == null)
- return false;
- URI[] repoURIs = getRepoLocations(mgr);
- for (int i = 0; i < repoURIs.length; i++) {
- IRepository repo = getRepository(mgr, repoURIs[i]);
- // A not-loaded repo doesn't count if it's considered missing (not found)
- if (repo == null && !ProvUI.hasNotFoundStatusBeenReported(repoURIs[i]))
- return false;
- }
- return true;
- }
-
- protected IRepository loadRepository(IRepositoryManager manager, URI location, IProgressMonitor monitor) throws ProvisionException {
- monitor.setTaskName(NLS.bind(ProvUIMessages.QueryableMetadataRepositoryManager_LoadRepositoryProgress, URIUtil.toUnencodedString(location)));
- IRepository repo = doLoadRepository(manager, location, monitor);
- if (repo != null)
- loaded.put(location, repo);
- return repo;
- }
-
- /**
- * Return the appropriate repository manager, or <code>null</code> if none could be found.
- * @return the repository manager
- */
- protected abstract IRepositoryManager getRepositoryManager();
-
- /**
- * Get an already-loaded repository at the specified location.
- *
- * @param manager the manager
- * @param location the repository location
- * @return the repository at that location, or <code>null</code> if no repository is
- * yet located at that location.
- */
- protected IRepository getRepository(IRepositoryManager manager, URI location) {
- // This is only used by the artifact mgr subclass.
- // MetadataRepositoryManager has a method for getting its cached repo instance
- return (IRepository) loaded.get(location);
- }
-
- /**
- * Load the repository located at the specified location.
- *
- * @param manager the manager
- * @param location the repository location
- * @param monitor the progress monitor
- * @return the repository that was loaded, or <code>null</code> if no repository could
- * be found at that location.
- */
- protected abstract IRepository doLoadRepository(IRepositoryManager manager, URI location, IProgressMonitor monitor) throws ProvisionException;
-
- protected abstract Collector query(URI[] uris, Query query, Collector collector, IProgressMonitor monitor);
-
- public void setQueryContext(IUViewQueryContext queryContext) {
- this.queryContext = queryContext;
- }
-
-}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/ResolutionResult.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/ResolutionResult.java
deleted file mode 100644
index 1e2e43da0..000000000
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/ResolutionResult.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- ******************************************************************************/
-
-package org.eclipse.equinox.internal.provisional.p2.ui;
-
-import java.util.HashMap;
-import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.p2.ui.ProvUIActivator;
-import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-
-/**
- * ResolutionResult describes problems in a provisioning plan in a structured
- * way that can be presented to a user.
- *
- * @since 3.5
- */
-public class ResolutionResult {
- private static final String NESTING_INDENT = " "; //$NON-NLS-1$
-
- private HashMap iuToStatusMap = new HashMap();
- private MultiStatus summaryStatus;
-
- public IStatus getSummaryStatus() {
- if (summaryStatus != null)
- return summaryStatus;
- return Status.OK_STATUS;
- }
-
- public void addSummaryStatus(IStatus status) {
- if (summaryStatus == null) {
- summaryStatus = new MultiStatus(ProvUIActivator.PLUGIN_ID, 0, ProvUIMessages.ResolutionReport_SummaryStatus, null);
- }
- summaryStatus.add(status);
- }
-
- public IStatus statusOf(IInstallableUnit iu) {
- return (IStatus) iuToStatusMap.get(iu);
- }
-
- public void addStatus(IInstallableUnit iu, IStatus status) {
- MultiStatus iuSummaryStatus = (MultiStatus) iuToStatusMap.get(iu);
- if (iuSummaryStatus == null) {
- iuSummaryStatus = new MultiStatus(ProvUIActivator.PLUGIN_ID, IStatusCodes.IU_REQUEST_ALTERED, new IStatus[] {status}, getIUString(iu), null);
- } else
- iuSummaryStatus.add(status);
- }
-
- private String getIUString(IInstallableUnit iu) {
- if (iu == null)
- return ProvUIMessages.PlanStatusHelper_Items;
- // Get the iu name in the default locale
- String name = IUPropertyUtils.getIUProperty(iu, IInstallableUnit.PROP_NAME);
- if (name != null)
- return name;
- return iu.getId();
- }
-
- public String getSummaryReport() {
- if (summaryStatus != null) {
- StringBuffer buffer = new StringBuffer();
- appendDetailText(summaryStatus, buffer, -1, false);
- return buffer.toString();
- }
- return ""; //$NON-NLS-1$
- }
-
- // Answers null if there is nothing to say about the ius
- public String getDetailedReport(IInstallableUnit[] ius) {
- StringBuffer buffer = new StringBuffer();
- for (int i = 0; i < ius.length; i++) {
- MultiStatus iuStatus = (MultiStatus) iuToStatusMap.get(ius[i]);
- if (iuStatus != null)
- appendDetailText(iuStatus, buffer, 0, true);
- }
- String report = buffer.toString();
- if (report.length() == 0)
- return null;
- return report;
- }
-
- void appendDetailText(IStatus status, StringBuffer buffer, int indent, boolean includeTopLevelMessage) {
- if (includeTopLevelMessage) {
- for (int i = 0; i < indent; i++)
- buffer.append(NESTING_INDENT);
- if (status.getMessage() != null)
- buffer.append(status.getMessage());
- }
- Throwable t = status.getException();
- if (t != null) {
- // A provision (or core) exception occurred. Get its status message or if none, its top level message.
- // Indent by one more level (note the <=)
- buffer.append('\n');
- for (int i = 0; i <= indent; i++)
- buffer.append(NESTING_INDENT);
- if (t instanceof CoreException) {
- IStatus exceptionStatus = ((CoreException) t).getStatus();
- if (exceptionStatus != null && exceptionStatus.getMessage() != null)
- buffer.append(exceptionStatus.getMessage());
- else {
- String details = t.getLocalizedMessage();
- if (details != null)
- buffer.append(details);
- }
- } else {
- String details = t.getLocalizedMessage();
- if (details != null)
- buffer.append(details);
- }
- }
- // Now print the children status info (if there are children)
- IStatus[] children = status.getChildren();
- for (int i = 0; i < children.length; i++) {
- if (buffer.length() > 0)
- buffer.append('\n');
- appendDetailText(children[i], buffer, indent + 1, true);
- }
- }
-}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/actions/InstallAction.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/actions/InstallAction.java
deleted file mode 100644
index df48d34b0..000000000
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/actions/InstallAction.java
+++ /dev/null
@@ -1,158 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.equinox.internal.provisional.p2.ui.actions;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.p2.ui.*;
-import org.eclipse.equinox.internal.p2.ui.model.AvailableIUElement;
-import org.eclipse.equinox.internal.p2.ui.model.IIUElement;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.director.PlannerHelper;
-import org.eclipse.equinox.internal.provisional.p2.director.ProfileChangeRequest;
-import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.Collector;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery;
-import org.eclipse.equinox.internal.provisional.p2.ui.*;
-import org.eclipse.equinox.internal.provisional.p2.ui.dialogs.PreselectedIUInstallWizard;
-import org.eclipse.equinox.internal.provisional.p2.ui.dialogs.ProvisioningWizardDialog;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.InstalledIUElement;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.PlannerResolutionOperation;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.PlatformUI;
-
-public class InstallAction extends ProfileModificationAction {
-
- public static ProfileChangeRequest computeProfileChangeRequest(IInstallableUnit[] ius, String targetProfileId, MultiStatus status, IProgressMonitor monitor) {
- ProfileChangeRequest request = ProfileChangeRequest.createByProfileId(targetProfileId);
- IProfile profile;
- // Now check each individual IU for special cases
- try {
- profile = ProvisioningUtil.getProfile(targetProfileId);
- } catch (ProvisionException e) {
- status.add(new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, e.getLocalizedMessage(), e));
- return null;
- }
- SubMonitor sub = SubMonitor.convert(monitor, ProvUIMessages.ProfileChangeRequestBuildingRequest, ius.length);
- for (int i = 0; i < ius.length; i++) {
- // If the user is installing a patch, we mark it optional. This allows
- // the patched IU to be updated later by removing the patch.
- if (Boolean.toString(true).equals(ius[i].getProperty(IInstallableUnit.PROP_TYPE_PATCH)))
- request.setInstallableUnitInclusionRules(ius[i], PlannerHelper.createOptionalInclusionRule(ius[i]));
-
- // Check to see if it is already installed. This may alter the request.
- Collector alreadyInstalled = profile.query(new InstallableUnitQuery(ius[i].getId()), new Collector(), null);
- // TODO ideally we should only do this check if the iu is a singleton, but in practice many iu's that should
- // be singletons are not, so we don't check this (yet)
- // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=230878
- if (alreadyInstalled.size() > 0) { // && installedIU.isSingleton()
- IInstallableUnit installedIU = (IInstallableUnit) alreadyInstalled.iterator().next();
- int compareTo = ius[i].getVersion().compareTo(installedIU.getVersion());
- // If the iu is a newer version of something already installed, consider this an
- // update request
- if (compareTo > 0) {
- boolean lockedForUpdate = false;
- String value = profile.getInstallableUnitProperty(installedIU, IInstallableUnit.PROP_PROFILE_LOCKED_IU);
- if (value != null)
- lockedForUpdate = (Integer.parseInt(value) & IInstallableUnit.LOCK_UPDATE) == IInstallableUnit.LOCK_UPDATE;
- if (lockedForUpdate) {
- // Add a status telling the user that this implies an update, but the
- // iu should not be updated
- status.merge(PlanAnalyzer.getStatus(IStatusCodes.ALTERED_IGNORED_IMPLIED_UPDATE, ius[i]));
- } else {
- request.addInstallableUnits(new IInstallableUnit[] {ius[i]});
- request.removeInstallableUnits(new IInstallableUnit[] {installedIU});
- // Add a status informing the user that the update has been inferred
- status.merge(PlanAnalyzer.getStatus(IStatusCodes.ALTERED_IMPLIED_UPDATE, ius[i]));
- // Mark it as a root if it hasn't been already
- if (!Boolean.toString(true).equals(profile.getInstallableUnitProperty(installedIU, IInstallableUnit.PROP_PROFILE_ROOT_IU)))
- request.setInstallableUnitProfileProperty(ius[i], IInstallableUnit.PROP_PROFILE_ROOT_IU, Boolean.toString(true));
- }
- } else if (compareTo < 0) {
- // An implied downgrade. We will not put this in the plan, add a status informing the user
- status.merge(PlanAnalyzer.getStatus(IStatusCodes.ALTERED_IGNORED_IMPLIED_DOWNGRADE, ius[i]));
- } else {
- if (Boolean.toString(true).equals(profile.getInstallableUnitProperty(installedIU, IInstallableUnit.PROP_PROFILE_ROOT_IU)))
- // It is already a root, nothing to do. We tell the user it was already installed
- status.merge(PlanAnalyzer.getStatus(IStatusCodes.ALTERED_IGNORED_ALREADY_INSTALLED, ius[i]));
- else {
- // It was already installed but not as a root. Tell the user that parts of it are already installed and mark
- // it as a root.
- status.merge(PlanAnalyzer.getStatus(IStatusCodes.ALTERED_PARTIAL_INSTALL, ius[i]));
- request.setInstallableUnitProfileProperty(ius[i], Policy.getDefault().getQueryContext().getVisibleInstalledIUProperty(), Boolean.toString(true));
- }
- }
- } else {
- // Install it and mark as a root
- request.addInstallableUnits(new IInstallableUnit[] {ius[i]});
- request.setInstallableUnitProfileProperty(ius[i], Policy.getDefault().getQueryContext().getVisibleInstalledIUProperty(), Boolean.toString(true));
- }
- sub.worked(1);
- }
- sub.done();
- return request;
- }
-
- public InstallAction(Policy policy, ISelectionProvider selectionProvider, String profileId) {
- super(policy, ProvUI.INSTALL_COMMAND_LABEL, selectionProvider, profileId);
- setToolTipText(ProvUI.INSTALL_COMMAND_TOOLTIP);
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.p2.ui.actions.ProfileModificationAction#isEnabledFor(java.lang.Object[])
- */
- protected boolean isEnabledFor(Object[] selectionArray) {
- if (selectionArray.length == 0)
- return false;
- // We allow non-IU's to be selected at this point, but there
- // must be at least one installable unit selected that is
- // selectable
- for (int i = 0; i < selectionArray.length; i++) {
- if (selectionArray[i] instanceof InstalledIUElement && isSelectable((IIUElement) selectionArray[i]))
- return true;
- IInstallableUnit iu = (IInstallableUnit) ProvUI.getAdapter(selectionArray[i], IInstallableUnit.class);
- if (iu != null && isSelectable(iu))
- return true;
- }
- return false;
- }
-
- /*
- * Overridden to reject categories and nested IU's (parent is a non-category IU)
- * (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.p2.ui.actions.ProfileModificationAction#isSelectable(org.eclipse.equinox.internal.p2.ui.model.IUElement)
- */
- protected boolean isSelectable(IIUElement element) {
- return super.isSelectable(element) && !(element.getParent(element) instanceof AvailableIUElement);
- }
-
- protected String getTaskName() {
- return ProvUIMessages.InstallIUProgress;
- }
-
- protected int performAction(IInstallableUnit[] ius, String targetProfileId, PlannerResolutionOperation resolution) {
- PreselectedIUInstallWizard wizard = new PreselectedIUInstallWizard(getPolicy(), targetProfileId, ius, resolution, new QueryableMetadataRepositoryManager(getPolicy().getQueryContext(), false));
- WizardDialog dialog = new ProvisioningWizardDialog(getShell(), wizard);
- dialog.create();
- PlatformUI.getWorkbench().getHelpSystem().setHelp(dialog.getShell(), IProvHelpContextIds.INSTALL_WIZARD);
-
- return dialog.open();
- }
-
- protected ProfileChangeRequest getProfileChangeRequest(IInstallableUnit[] ius, String targetProfileId, MultiStatus status, IProgressMonitor monitor) {
- return computeProfileChangeRequest(ius, targetProfileId, status, monitor);
- }
-}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/actions/ProfileModificationAction.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/actions/ProfileModificationAction.java
deleted file mode 100644
index 27786ec52..000000000
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/actions/ProfileModificationAction.java
+++ /dev/null
@@ -1,304 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.equinox.internal.provisional.p2.ui.actions;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.eclipse.core.runtime.*;
-import org.eclipse.core.runtime.jobs.*;
-import org.eclipse.equinox.internal.p2.ui.*;
-import org.eclipse.equinox.internal.p2.ui.model.CategoryElement;
-import org.eclipse.equinox.internal.p2.ui.model.IIUElement;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.director.ProfileChangeRequest;
-import org.eclipse.equinox.internal.provisional.p2.director.ProvisioningPlan;
-import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.ui.*;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.PlannerResolutionOperation;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.*;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.window.Window;
-import org.eclipse.osgi.util.NLS;
-import org.eclipse.swt.custom.BusyIndicator;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.statushandlers.StatusManager;
-
-public abstract class ProfileModificationAction extends ProvisioningAction {
- public static final int ACTION_NOT_RUN = -1;
- String profileId;
- String userChosenProfileId;
- Policy policy;
- int result = ACTION_NOT_RUN;
-
- protected ProfileModificationAction(Policy policy, String text, ISelectionProvider selectionProvider, String profileId) {
- super(text, selectionProvider);
- this.policy = policy;
- this.profileId = profileId;
- init();
- }
-
- public void run() {
- // Determine which IUs and which profile are involved
- IInstallableUnit[] ius = getSelectedIUs();
- String id = getProfileId(true);
- // We could not figure out a profile to operate on, so return
- if (id == null || ius.length == 0) {
- ProvUI.reportStatus(getNoProfileOrSelectionStatus(profileId, ius), StatusManager.BLOCK);
- runCanceled();
- return;
- }
- run(ius, id);
- }
-
- protected IStatus getNoProfileOrSelectionStatus(String id, IInstallableUnit[] ius) {
- return new Status(IStatus.WARNING, ProvUIActivator.PLUGIN_ID, NLS.bind(ProvUIMessages.ProfileModificationAction_InvalidSelections, id, new Integer(ius.length)));
- }
-
- protected void run(final IInstallableUnit[] ius, final String id) {
- // Get a profile change request. Supply a multi-status so that information
- // about the request can be provided along the way.
- final MultiStatus additionalStatus = getProfileChangeAlteredStatus();
- final ProfileChangeRequest[] request = new ProfileChangeRequest[1];
- // TODO even getting a profile change request can be expensive
- // when updating, because we are looking for updates. For now, most
- // clients work around this by preloading repositories in a job.
- // Consider something different here. We'll pass a fake progress monitor
- // into the profile change request method so that later we can do
- // something better here.
- BusyIndicator.showWhile(getShell().getDisplay(), new Runnable() {
- public void run() {
- request[0] = getProfileChangeRequest(ius, id, additionalStatus, new NullProgressMonitor());
- }
- });
- // If we couldn't build a request, then report an error and bail.
- // Hopefully the provider of the request gave an explanation in the status.
- if (request[0] == null) {
- IStatus failureStatus;
- if (additionalStatus.getChildren().length > 0) {
- if (additionalStatus.getChildren().length == 1)
- failureStatus = additionalStatus.getChildren()[0];
- else {
- MultiStatus nullRequestStatus = new MultiStatus(ProvUIActivator.PLUGIN_ID, IStatusCodes.UNEXPECTED_NOTHING_TO_DO, additionalStatus.getChildren(), ProvUIMessages.ProfileModificationAction_NoChangeRequestProvided, null);
- nullRequestStatus.addAll(additionalStatus);
- failureStatus = nullRequestStatus;
- }
- } else {
- // No explanation for failure was provided. It shouldn't happen, but...
- failureStatus = new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, ProvUIMessages.ProfileModificationAction_NoExplanationProvided);
- }
- ProvUI.reportStatus(failureStatus, StatusManager.SHOW | StatusManager.LOG);
- runCanceled();
- return;
- }
- // We have a profile change request, let's get a plan for it. This could take awhile.
- final PlannerResolutionOperation operation = new PlannerResolutionOperation(ProvUIMessages.ProfileModificationAction_ResolutionOperationLabel, id, request[0], null, additionalStatus, isResolveUserVisible());
- // Since we are resolving asynchronously, our job is done. Setting this allows
- // callers to decide to close the launching window.
- // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=236495
- result = Window.OK;
- Job job = ProvisioningOperationRunner.schedule(operation, StatusManager.SHOW);
- job.addJobChangeListener(new JobChangeAdapter() {
- public void done(IJobChangeEvent event) {
- // Do we have a plan??
- final ProvisioningPlan plan = operation.getProvisioningPlan();
- if (plan != null) {
- if (PlatformUI.isWorkbenchRunning()) {
- PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
- public void run() {
- if (validatePlan(plan))
- performAction(ius, getProfileId(true), operation);
- userChosenProfileId = null;
- }
- });
- }
- }
- }
- });
- }
-
- /**
- * Get the integer return code returned by any wizards launched by this
- * action. If the action has not been run, return ACTION_NOT_RUN. If the
- * action does not open a wizard, return Window.OK if the operation was performed,
- * and Window.CANCEL if it was canceled.
- *
- * @return integer return code
- */
- public int getReturnCode() {
- return result;
- }
-
- /**
- * Validate the plan and return true if the operation should
- * be performed with plan. Report any errors to the user before returning false.
- * @param plan
- * @return a boolean indicating whether the plan should be used in a
- * provisioning operation.
- */
- protected boolean validatePlan(ProvisioningPlan plan) {
- if (plan != null) {
- // Don't validate the plan if the user cancelled
- if (plan.getStatus().getSeverity() == IStatus.CANCEL)
- return false;
- if (getPlanValidator() != null)
- return getPlanValidator().continueWorkingWithPlan(plan, getShell());
- if (plan.getStatus().isOK())
- return true;
- ProvUI.reportStatus(plan.getStatus(), StatusManager.BLOCK | StatusManager.LOG);
- return false;
- }
- return false;
- }
-
- /*
- * Get a provisioning plan for this action.
- */
- protected abstract ProfileChangeRequest getProfileChangeRequest(IInstallableUnit[] ius, String targetProfileId, MultiStatus status, IProgressMonitor monitor);
-
- protected abstract int performAction(IInstallableUnit[] ius, String targetProfileId, PlannerResolutionOperation resolution);
-
- protected abstract String getTaskName();
-
- protected IInstallableUnit getIU(Object element) {
- return (IInstallableUnit) ProvUI.getAdapter(element, IInstallableUnit.class);
-
- }
-
- /**
- * Return an array of the selected and valid installable units.
- * The number of IInstallableUnits in the array may be different than
- * the actual number of selections in the action's selection provider.
- * That is, if the action is disabled due to invalid selections,
- * this method will return those selections that were valid.
- *
- * @return an array of selected IInstallableUnit that meet the
- * enablement criteria for the action.
- */
- protected IInstallableUnit[] getSelectedIUs() {
- List elements = getStructuredSelection().toList();
- List iusList = new ArrayList(elements.size());
-
- for (int i = 0; i < elements.size(); i++) {
- if (elements.get(i) instanceof IIUElement) {
- IIUElement element = (IIUElement) elements.get(i);
- if (isSelectable(element))
- iusList.add(getIU(element));
- } else {
- IInstallableUnit iu = (IInstallableUnit) ProvUI.getAdapter(elements.get(i), IInstallableUnit.class);
- if (iu != null && isSelectable(iu))
- iusList.add(iu);
- }
- }
- return (IInstallableUnit[]) iusList.toArray(new IInstallableUnit[iusList.size()]);
- }
-
- protected boolean isSelectable(IIUElement element) {
- return !(element instanceof CategoryElement);
- }
-
- protected boolean isSelectable(IInstallableUnit iu) {
- return !ProvisioningUtil.isCategory(iu);
- }
-
- protected LicenseManager getLicenseManager() {
- return policy.getLicenseManager();
- }
-
- protected QueryProvider getQueryProvider() {
- return policy.getQueryProvider();
- }
-
- protected PlanValidator getPlanValidator() {
- return policy.getPlanValidator();
- }
-
- protected IProfileChooser getProfileChooser() {
- return policy.getProfileChooser();
- }
-
- protected Policy getPolicy() {
- return policy;
- }
-
- protected final void checkEnablement(Object[] selections) {
- if (isEnabledFor(selections)) {
- String id = getProfileId(false);
- if (id == null)
- setEnabled(true);
- else
- setEnabled(!ProvisioningOperationRunner.hasScheduledOperationsFor(id));
- } else
- setEnabled(false);
- }
-
- protected abstract boolean isEnabledFor(Object[] selections);
-
- protected int getLock(IProfile profile, IInstallableUnit iu) {
- if (profile == null)
- return IInstallableUnit.LOCK_NONE;
- try {
- String value = profile.getInstallableUnitProperty(iu, IInstallableUnit.PROP_PROFILE_LOCKED_IU);
- if (value != null)
- return Integer.parseInt(value);
- } catch (NumberFormatException e) {
- // ignore and assume no lock
- }
- return IInstallableUnit.LOCK_NONE;
- }
-
- protected String getProfileProperty(IProfile profile, IInstallableUnit iu, String propertyName) {
- if (profile == null || iu == null)
- return null;
- return profile.getInstallableUnitProperty(iu, propertyName);
- }
-
- protected IProfile getProfile(boolean chooseProfile) {
- try {
- String id = getProfileId(chooseProfile);
- if (id == null)
- return null;
- return ProvisioningUtil.getProfile(id);
- } catch (ProvisionException e) {
- // ignore, we have bigger problems to report elsewhere
- }
- return null;
- }
-
- protected String getProfileId(boolean chooseProfile) {
- if (profileId != null)
- return profileId;
- if (userChosenProfileId != null)
- return userChosenProfileId;
- if (chooseProfile && getProfileChooser() != null) {
- userChosenProfileId = getProfileChooser().getProfileId(getShell());
- return userChosenProfileId;
- }
- return null;
- }
-
- private void runCanceled() {
- // The action was canceled, do any cleanup needed before
- // it is run again.
- userChosenProfileId = null;
- result = Window.CANCEL;
- }
-
- protected MultiStatus getProfileChangeAlteredStatus() {
- return PlanAnalyzer.getProfileChangeAlteredStatus();
- }
-
- protected boolean isResolveUserVisible() {
- return true;
- }
-}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/actions/UninstallAction.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/actions/UninstallAction.java
deleted file mode 100644
index b832abab8..000000000
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/actions/UninstallAction.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.equinox.internal.provisional.p2.ui.actions;
-
-import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.provisional.p2.director.ProfileChangeRequest;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.ui.IProvHelpContextIds;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUI;
-import org.eclipse.equinox.internal.provisional.p2.ui.dialogs.ProvisioningWizardDialog;
-import org.eclipse.equinox.internal.provisional.p2.ui.dialogs.UninstallWizard;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.PlannerResolutionOperation;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.PlatformUI;
-
-public class UninstallAction extends ExistingIUInProfileAction {
-
- public UninstallAction(Policy policy, ISelectionProvider selectionProvider, String profileId) {
- super(ProvUI.UNINSTALL_COMMAND_LABEL, policy, selectionProvider, profileId);
- setToolTipText(ProvUI.UNINSTALL_COMMAND_TOOLTIP);
- }
-
- protected String getTaskName() {
- return ProvUIMessages.UninstallIUProgress;
- }
-
- protected int performAction(IInstallableUnit[] ius, String targetProfileId, PlannerResolutionOperation resolution) {
- UninstallWizard wizard = new UninstallWizard(getPolicy(), targetProfileId, ius, resolution);
- WizardDialog dialog = new ProvisioningWizardDialog(getShell(), wizard);
- dialog.create();
- PlatformUI.getWorkbench().getHelpSystem().setHelp(dialog.getShell(), IProvHelpContextIds.UNINSTALL_WIZARD);
-
- return dialog.open();
- }
-
- protected ProfileChangeRequest getProfileChangeRequest(IInstallableUnit[] ius, String targetProfileId, MultiStatus status, IProgressMonitor monitor) {
- SubMonitor sub = SubMonitor.convert(monitor, ProvUIMessages.ProfileChangeRequestBuildingRequest, 1);
- ProfileChangeRequest request = null;
- try {
- request = ProfileChangeRequest.createByProfileId(targetProfileId);
- request.removeInstallableUnits(ius);
- // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=255984
- // We ask to remove the the profile root property in addition to removing the IU. In theory this
- // should be redundant, but there are cases where the planner decides not to uninstall something because
- // it is needed by others. We still want to remove the root in this case.
- String key = getPolicy().getQueryContext().getVisibleInstalledIUProperty();
- for (int i = 0; i < ius.length; i++)
- request.removeInstallableUnitProfileProperty(ius[i], key);
- } finally {
- sub.done();
- }
- return request;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.p2.ui.actions.AlterExistingProfileIUAction#getLockConstant()
- */
- protected int getLockConstant() {
- return IInstallableUnit.LOCK_UNINSTALL;
- }
-}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/actions/UpdateAction.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/actions/UpdateAction.java
deleted file mode 100644
index 8a7a6f50d..000000000
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/actions/UpdateAction.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-
-package org.eclipse.equinox.internal.provisional.p2.ui.actions;
-
-import java.util.ArrayList;
-import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.p2.ui.PlanAnalyzer;
-import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.provisional.p2.director.ProfileChangeRequest;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.ui.*;
-import org.eclipse.equinox.internal.provisional.p2.ui.dialogs.ProvisioningWizardDialog;
-import org.eclipse.equinox.internal.provisional.p2.ui.dialogs.UpdateWizard;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.IUElementListRoot;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.PlannerResolutionOperation;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
-import org.eclipse.jface.viewers.ISelectionProvider;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.PlatformUI;
-
-public class UpdateAction extends ExistingIUInProfileAction {
-
- protected IUElementListRoot root; // root that will be used to seed the wizard
- protected ArrayList initialSelections; // the elements that should be selected in the wizard
- boolean resolveIsVisible = true;
- QueryableMetadataRepositoryManager manager;
- boolean skipSelectionPage = false;
-
- public UpdateAction(Policy policy, ISelectionProvider selectionProvider, String profileId, boolean resolveIsVisible) {
- super(ProvUI.UPDATE_COMMAND_LABEL, policy, selectionProvider, profileId);
- setToolTipText(ProvUI.UPDATE_COMMAND_TOOLTIP);
- this.resolveIsVisible = resolveIsVisible;
- }
-
- public void setRepositoryManager(QueryableMetadataRepositoryManager manager) {
- this.manager = manager;
- }
-
- public void setSkipSelectionPage(boolean skipSelectionPage) {
- this.skipSelectionPage = skipSelectionPage;
- }
-
- protected int performAction(IInstallableUnit[] ius, String targetProfileId, PlannerResolutionOperation resolution) {
- // Caches should have been created while formulating the plan
- Assert.isNotNull(initialSelections);
- Assert.isNotNull(root);
- Assert.isNotNull(resolution);
-
- UpdateWizard wizard = new UpdateWizard(getPolicy(), targetProfileId, root, initialSelections.toArray(), resolution, manager);
- wizard.setSkipSelectionsPage(skipSelectionPage);
- WizardDialog dialog = new ProvisioningWizardDialog(getShell(), wizard);
- dialog.create();
- PlatformUI.getWorkbench().getHelpSystem().setHelp(dialog.getShell(), IProvHelpContextIds.UPDATE_WIZARD);
-
- return dialog.open();
- }
-
- protected ProfileChangeRequest getProfileChangeRequest(IInstallableUnit[] ius, String targetProfileId, MultiStatus status, IProgressMonitor monitor) {
- initialSelections = new ArrayList();
- root = new IUElementListRoot();
- ProfileChangeRequest request = UpdateWizard.createProfileChangeRequest(ius, targetProfileId, root, initialSelections, monitor);
- if (request == null) {
- status.add(PlanAnalyzer.getStatus(IStatusCodes.NOTHING_TO_UPDATE, null));
- return null;
- }
-
- return request;
- }
-
- protected String getTaskName() {
- return ProvUIMessages.UpdateIUProgress;
- }
-
- protected boolean isResolveUserVisible() {
- return resolveIsVisible;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.equinox.internal.provisional.p2.ui.actions.AlterExistingProfileIUAction#getLockConstant()
- */
- protected int getLockConstant() {
- return IInstallableUnit.LOCK_UPDATE;
- }
-
- protected IStatus getNoProfileOrSelectionStatus(String id, IInstallableUnit[] ius) {
- if (ius.length == 0)
- return PlanAnalyzer.getStatus(IStatusCodes.NOTHING_TO_UPDATE, null);
- return super.getNoProfileOrSelectionStatus(id, ius);
- }
-}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/InstallWizard.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/InstallWizard.java
deleted file mode 100644
index c9df0ee6f..000000000
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/InstallWizard.java
+++ /dev/null
@@ -1,137 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.dialogs;
-
-import java.util.ArrayList;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.p2.ui.dialogs.*;
-import org.eclipse.equinox.internal.p2.ui.model.AvailableIUElement;
-import org.eclipse.equinox.internal.p2.ui.model.ElementUtils;
-import org.eclipse.equinox.internal.provisional.p2.director.ProfileChangeRequest;
-import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningContext;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUIImages;
-import org.eclipse.equinox.internal.provisional.p2.ui.QueryableMetadataRepositoryManager;
-import org.eclipse.equinox.internal.provisional.p2.ui.actions.InstallAction;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.IUElementListRoot;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.PlannerResolutionOperation;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * An install wizard that allows the users to browse all of the repositories
- * and search/select for items to install.
- *
- * @since 3.4
- */
-public class InstallWizard extends WizardWithLicenses {
-
- QueryableMetadataRepositoryManager manager;
- AvailableIUsPage mainPage;
- SelectableIUsPage errorReportingPage;
-
- public InstallWizard(Policy policy, String profileId, IInstallableUnit[] initialSelections, PlannerResolutionOperation initialResolution, QueryableMetadataRepositoryManager manager) {
- super(policy, profileId, null, initialSelections, initialResolution);
- this.manager = manager;
- setWindowTitle(ProvUIMessages.InstallIUOperationLabel);
- setDefaultPageImageDescriptor(ProvUIImages.getImageDescriptor(ProvUIImages.WIZARD_BANNER_INSTALL));
- }
-
- public InstallWizard(Policy policy, String profileId) {
- this(policy, profileId, null, null, new QueryableMetadataRepositoryManager(policy.getQueryContext(), false));
- }
-
- protected ResolutionResultsWizardPage createResolutionPage() {
- return new InstallWizardPage(policy, profileId, root, resolutionOperation);
- }
-
- protected ISelectableIUsPage createMainPage(IUElementListRoot input, Object[] selections) {
- mainPage = new AvailableIUsPage(policy, profileId, manager);
- if (selections != null && selections.length > 0)
- mainPage.setCheckedElements(selections);
- return mainPage;
-
- }
-
- protected IUElementListRoot makeResolutionElementRoot(Object[] selectedElements) {
- IUElementListRoot elementRoot = new IUElementListRoot();
- ArrayList list = new ArrayList(selectedElements.length);
- for (int i = 0; i < selectedElements.length; i++) {
- IInstallableUnit iu = ElementUtils.getIU(selectedElements[i]);
- if (iu != null)
- list.add(new AvailableIUElement(elementRoot, iu, profileId, policy.getQueryContext().getShowProvisioningPlanChildren()));
- }
- elementRoot.setChildren(list.toArray());
- return elementRoot;
- }
-
- public void createPageControls(Composite pageContainer) {
- super.createPageControls(pageContainer);
- if (manager != null)
- // async exec since we are in the middle of opening
- pageContainer.getDisplay().asyncExec(new Runnable() {
- public void run() {
- manager.reportAccumulatedStatus();
- }
- });
- }
-
- protected ProvisioningContext getProvisioningContext() {
- return mainPage.getProvisioningContext();
- }
-
- protected ProfileChangeRequest computeProfileChangeRequest(Object[] selectedElements, MultiStatus additionalStatus, IProgressMonitor monitor) {
- IInstallableUnit[] selected = ElementUtils.elementsToIUs(selectedElements);
- return InstallAction.computeProfileChangeRequest(selected, profileId, additionalStatus, monitor);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.equinox.internal.p2.ui.dialogs.ProvisioningOperationWizard#getErrorReportingPage()
- */
- protected IResolutionErrorReportingPage getErrorReportingPage() {
- if (errorReportingPage == null) {
- originalRoot = root;
- errorReportingPage = new SelectableIUsPage(policy, root, root.getChildren(root), profileId);
- errorReportingPage.setTitle(ProvUIMessages.InstallWizardPage_Title);
- errorReportingPage.setDescription(ProvUIMessages.PreselectedIUInstallWizard_Description);
- errorReportingPage.updateStatus(root, resolutionOperation);
- errorReportingPage.setCheckedElements(root.getChildren(root));
- addPage(errorReportingPage);
- }
- return errorReportingPage;
- }
-
- protected void showingErrorPage() {
- // If we did a new resolution and are showing the error page,
- // update the root. We don't do this when the page is not the main
- // page, or we might be updating the root of the showing page.
- if (getContainer().getCurrentPage() == mainPage) {
- originalRoot = root;
- errorReportingPage.updateStatus(originalRoot, resolutionOperation);
- errorReportingPage.setCheckedElements(root.getChildren(root));
- }
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#getPreviousPage(org.eclipse.jface.wizard.IWizardPage)
- */
- public IWizardPage getPreviousPage(IWizardPage page) {
- if (page == errorReportingPage) {
- mainPage.setCheckedElements(errorReportingPage.getCheckedIUElements());
- return mainPage;
- }
- return super.getPreviousPage(page);
- }
-}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/PreselectedIUInstallWizard.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/PreselectedIUInstallWizard.java
deleted file mode 100644
index d9db111a1..000000000
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/PreselectedIUInstallWizard.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.dialogs;
-
-import java.util.ArrayList;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.p2.ui.dialogs.*;
-import org.eclipse.equinox.internal.p2.ui.model.AvailableIUElement;
-import org.eclipse.equinox.internal.p2.ui.model.ElementUtils;
-import org.eclipse.equinox.internal.provisional.p2.director.ProfileChangeRequest;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUIImages;
-import org.eclipse.equinox.internal.provisional.p2.ui.QueryableMetadataRepositoryManager;
-import org.eclipse.equinox.internal.provisional.p2.ui.actions.InstallAction;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.IUElementListRoot;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.PlannerResolutionOperation;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
-
-/**
- * An Install wizard that is invoked when the user has already selected which
- * IUs should be installed and does not need to browse the available software.
- *
- * @since 3.5
- */
-public class PreselectedIUInstallWizard extends WizardWithLicenses {
-
- SelectableIUsPage mainPage;
- QueryableMetadataRepositoryManager manager;
-
- static IUElementListRoot makeElementRoot(IInstallableUnit[] ius, String profileId) {
- IUElementListRoot elementRoot = new IUElementListRoot();
- Object[] elements = new Object[ius.length];
- for (int i = 0; i < ius.length; i++) {
- if (ius[i] != null)
- elements[i] = new AvailableIUElement(elementRoot, ius[i], profileId, false);
- }
- elementRoot.setChildren(elements);
- return elementRoot;
- }
-
- public PreselectedIUInstallWizard(Policy policy, String profileId, IInstallableUnit[] initialSelections, PlannerResolutionOperation initialResolution, QueryableMetadataRepositoryManager manager) {
- super(policy, profileId, makeElementRoot(initialSelections, profileId), initialSelections, initialResolution);
- this.manager = manager;
- setWindowTitle(ProvUIMessages.InstallIUOperationLabel);
- setDefaultPageImageDescriptor(ProvUIImages.getImageDescriptor(ProvUIImages.WIZARD_BANNER_INSTALL));
- }
-
- protected ISelectableIUsPage createMainPage(IUElementListRoot input, Object[] selections) {
- mainPage = new SelectableIUsPage(policy, input, selections, profileId);
- mainPage.setTitle(ProvUIMessages.PreselectedIUInstallWizard_Title);
- mainPage.setDescription(ProvUIMessages.PreselectedIUInstallWizard_Description);
- mainPage.updateStatus(input, resolutionOperation);
- return mainPage;
- }
-
- protected ResolutionResultsWizardPage createResolutionPage() {
- return new InstallWizardPage(policy, profileId, root, resolutionOperation);
- }
-
- protected IUElementListRoot makeResolutionElementRoot(Object[] selectedElements) {
- IUElementListRoot elementRoot = new IUElementListRoot();
- ArrayList list = new ArrayList(selectedElements.length);
- for (int i = 0; i < selectedElements.length; i++) {
- IInstallableUnit iu = ElementUtils.getIU(selectedElements[i]);
- if (iu != null)
- list.add(new AvailableIUElement(elementRoot, iu, profileId, policy.getQueryContext().getShowProvisioningPlanChildren()));
- }
- elementRoot.setChildren(list.toArray());
- return elementRoot;
- }
-
- protected ProfileChangeRequest computeProfileChangeRequest(Object[] selectedElements, MultiStatus additionalStatus, IProgressMonitor monitor) {
- IInstallableUnit[] selected = ElementUtils.elementsToIUs(selectedElements);
- return InstallAction.computeProfileChangeRequest(selected, profileId, additionalStatus, monitor);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.equinox.internal.p2.ui.dialogs.ProvisioningOperationWizard#getErrorReportingPage()
- */
- protected IResolutionErrorReportingPage getErrorReportingPage() {
- return mainPage;
- }
-}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/UninstallWizard.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/UninstallWizard.java
deleted file mode 100644
index 266293fc2..000000000
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/UninstallWizard.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.dialogs;
-
-import java.util.ArrayList;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.MultiStatus;
-import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.p2.ui.dialogs.*;
-import org.eclipse.equinox.internal.p2.ui.model.ElementUtils;
-import org.eclipse.equinox.internal.provisional.p2.director.ProfileChangeRequest;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.ui.ProvUIImages;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.IUElementListRoot;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.InstalledIUElement;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.PlannerResolutionOperation;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
-import org.eclipse.jface.wizard.IWizardPage;
-
-/**
- * @since 3.4
- */
-public class UninstallWizard extends ProvisioningOperationWizard {
-
- SelectableIUsPage mainPage;
-
- static IUElementListRoot makeElementRoot(Object[] selectedElements, String profileId) {
- IUElementListRoot elementRoot = new IUElementListRoot();
- ArrayList list = new ArrayList(selectedElements.length);
- for (int i = 0; i < selectedElements.length; i++) {
- IInstallableUnit iu = ElementUtils.getIU(selectedElements[i]);
- if (iu != null)
- list.add(new InstalledIUElement(elementRoot, profileId, iu));
- }
- elementRoot.setChildren(list.toArray());
- return elementRoot;
- }
-
- public UninstallWizard(Policy policy, String profileId, IInstallableUnit[] ius, PlannerResolutionOperation initialResolution) {
- super(policy, profileId, makeElementRoot(ius, profileId), ius, initialResolution);
- setWindowTitle(ProvUIMessages.UninstallIUOperationLabel);
- setDefaultPageImageDescriptor(ProvUIImages.getImageDescriptor(ProvUIImages.WIZARD_BANNER_UNINSTALL));
- }
-
- protected ISelectableIUsPage createMainPage(IUElementListRoot input, Object[] selections) {
- mainPage = new SelectableIUsPage(policy, input, selections, profileId);
- mainPage.setTitle(ProvUIMessages.UninstallIUOperationLabel);
- mainPage.setDescription(ProvUIMessages.UninstallDialog_UninstallMessage);
- mainPage.updateStatus(input, resolutionOperation);
- return mainPage;
- }
-
- protected ResolutionResultsWizardPage createResolutionPage() {
- return new UninstallWizardPage(policy, root, profileId, resolutionOperation);
- }
-
- protected IUElementListRoot makeResolutionElementRoot(Object[] selectedElements) {
- return makeElementRoot(selectedElements, profileId);
- }
-
- protected ProfileChangeRequest computeProfileChangeRequest(Object[] selectedElements, MultiStatus additionalStatus, IProgressMonitor monitor) {
- ProfileChangeRequest request = ProfileChangeRequest.createByProfileId(profileId);
- request.removeInstallableUnits(ElementUtils.elementsToIUs(selectedElements));
- return request;
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.equinox.internal.p2.ui.dialogs.ProvisioningOperationWizard#getErrorReportingPage()
- */
- protected IResolutionErrorReportingPage getErrorReportingPage() {
- return mainPage;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.jface.wizard.Wizard#getStartingPage()
- */
- public IWizardPage getStartingPage() {
- if (getCurrentStatus().isOK()) {
- if (resolutionPage == null) {
- resolutionPage = createResolutionPage();
- addPage(resolutionPage);
- }
- mainPage.setPageComplete(true);
- return resolutionPage;
- }
- return super.getStartingPage();
- }
-}
diff --git a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/UpdateWizard.java b/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/UpdateWizard.java
deleted file mode 100644
index 9b0da565d..000000000
--- a/bundles/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/provisional/p2/ui/dialogs/UpdateWizard.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- * Genuitec, LLC - added license support
- *******************************************************************************/
-package org.eclipse.equinox.internal.provisional.p2.ui.dialogs;
-
-import java.util.*;
-import org.eclipse.core.runtime.*;
-import org.eclipse.equinox.internal.p2.ui.ProvUIMessages;
-import org.eclipse.equinox.internal.p2.ui.dialogs.*;
-import org.eclipse.equinox.internal.p2.ui.model.AvailableUpdateElement;
-import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
-import org.eclipse.equinox.internal.provisional.p2.director.PlannerHelper;
-import org.eclipse.equinox.internal.provisional.p2.director.ProfileChangeRequest;
-import org.eclipse.equinox.internal.provisional.p2.engine.IProfile;
-import org.eclipse.equinox.internal.provisional.p2.metadata.IInstallableUnit;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.Collector;
-import org.eclipse.equinox.internal.provisional.p2.metadata.query.InstallableUnitQuery;
-import org.eclipse.equinox.internal.provisional.p2.ui.*;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.IUElementListRoot;
-import org.eclipse.equinox.internal.provisional.p2.ui.model.Updates;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.PlannerResolutionOperation;
-import org.eclipse.equinox.internal.provisional.p2.ui.operations.ProvisioningUtil;
-import org.eclipse.equinox.internal.provisional.p2.ui.policy.Policy;
-import org.eclipse.jface.wizard.IWizardPage;
-import org.eclipse.swt.widgets.Composite;
-
-/**
- * @since 3.4
- */
-public class UpdateWizard extends WizardWithLicenses {
- IInstallableUnit[] iusToReplace;
- QueryableMetadataRepositoryManager manager;
- SelectableIUsPage mainPage;
- boolean skipSelectionsPage = false;
-
- public static IInstallableUnit[] getIUsToReplace(Object[] replacementElements) {
- Set iusToReplace = new HashSet();
- for (int i = 0; i < replacementElements.length; i++) {
- if (replacementElements[i] instanceof AvailableUpdateElement) {
- iusToReplace.add(((AvailableUpdateElement) replacementElements[i]).getIUToBeUpdated());
- }
- }
- return (IInstallableUnit[]) iusToReplace.toArray(new IInstallableUnit[iusToReplace.size()]);
- }
-
- public static IInstallableUnit[] getReplacementIUs(Object[] replacementElements) {
- Set replacements = new HashSet();
- for (int i = 0; i < replacementElements.length; i++) {
- if (replacementElements[i] instanceof AvailableUpdateElement) {
- replacements.add(((AvailableUpdateElement) replacementElements[i]).getIU());
- }
- }
- return (IInstallableUnit[]) replacements.toArray(new IInstallableUnit[replacements.size()]);
- }
-
- /**
- * Create a profile change request that represents an update of the specified IUs to their latest versions,
- * unless otherwise specified by the initial selections. If an element root and selection container are provided,
- * update those elements so that a wizard could be opened on them to reflect the profile change request.
- *
- * @param iusToUpdate
- * @param profileId
- * @param root
- * @param initialSelections
- * @param monitor
- * @return the profile change request describing an update, or null if there is nothing to update.
- */
- public static ProfileChangeRequest createProfileChangeRequest(IInstallableUnit[] iusToUpdate, String profileId, IUElementListRoot root, Collection initialSelections, IProgressMonitor monitor) {
- // Here we create a profile change request by finding the latest version available for any replacement, unless
- // otherwise specified in the selections.
- // We have to consider the scenario where the only updates available are patches, in which case the original
- // IU should not be removed as part of the update.
- Set toBeUpdated = new HashSet();
- HashSet elementsToPlan = new HashSet();
- ArrayList allReplacements = new ArrayList();
- IProfile profile;
- try {
- profile = ProvisioningUtil.getProfile(profileId);
- if (profile == null)
- return null;
- } catch (ProvisionException e) {
- return null;
- }
- SubMonitor sub = SubMonitor.convert(monitor, ProvUIMessages.ProfileChangeRequestBuildingRequest, 100 * iusToUpdate.length);
- for (int i = 0; i < iusToUpdate.length; i++) {
- boolean selectionSpecified = false;
- ElementQueryDescriptor descriptor = Policy.getDefault().getQueryProvider().getQueryDescriptor(new Updates(profileId, new IInstallableUnit[] {iusToUpdate[i]}));
- Iterator iter = descriptor.performQuery(sub).iterator();
- ArrayList currentReplacements = new ArrayList();
- while (iter.hasNext()) {
- IInstallableUnit iu = (IInstallableUnit) ProvUI.getAdapter(iter.next(), IInstallableUnit.class);
- // If there is already a selected element representing an update for this iu, then we won't need
- // to look for the latest.
- if (iu != null) {
- // see https://bugs.eclipse.org/bugs/show_bug.cgi?id=273967
- // In the case of patches, it's possible that a patch is returned as an available update
- // even though it is already installed, because we are querying each IU for updates individually.
- // For now, we ignore any proposed update that is already installed.
- Collector alreadyInstalled = profile.query(new InstallableUnitQuery(iu), new Collector(), null);
- if (alreadyInstalled.isEmpty()) {
- toBeUpdated.add(iusToUpdate[i]);
- AvailableUpdateElement element = new AvailableUpdateElement(root, iu, iusToUpdate[i], profileId, true);
- currentReplacements.add(element);
- allReplacements.add(element);
- if (initialSelections != null && initialSelections.contains(element)) {
- elementsToPlan.add(element);
- selectionSpecified = true;
- }
- }
- }
- }
- if (!selectionSpecified) {
- // If no selection was specified, we must figure out the latest version to apply.
- // The rules are that a true update will always win over a patch, but if only
- // patches are available, they should all be selected.
- // We first gather the latest versions of everything proposed.
- // Patches are keyed by their id because they are unique and should not be compared to
- // each other. Updates are keyed by the IU they are updating so we can compare the
- // versions and select the latest one
- HashMap latestVersions = new HashMap();
- boolean foundUpdate = false;
- boolean foundPatch = false;
- for (int j = 0; j < currentReplacements.size(); j++) {
- AvailableUpdateElement replacementElement = (AvailableUpdateElement) currentReplacements.get(j);
- String key;
- if (Boolean.toString(true).equals(replacementElement.getIU().getProperty(IInstallableUnit.PROP_TYPE_PATCH))) {
- foundPatch = true;
- key = replacementElement.getIU().getId();
- } else {
- foundUpdate = true;
- key = replacementElement.getIUToBeUpdated().getId();
- }
- AvailableUpdateElement latestElement = (AvailableUpdateElement) latestVersions.get(key);
- IInstallableUnit latestIU = latestElement == null ? null : latestElement.getIU();
- if (latestIU == null || replacementElement.getIU().getVersion().compareTo(latestIU.getVersion()) > 0)
- latestVersions.put(key, replacementElement);
- }
- // If there is a true update available, ignore any patches found
- // Patches are keyed by their own id
- if (foundPatch && foundUpdate) {
- Set keys = new HashSet();
- keys.addAll(latestVersions.keySet());
- Iterator keyIter = keys.iterator();
- while (keyIter.hasNext()) {
- String id = (String) keyIter.next();
- // Get rid of things keyed by a different id. We've already made sure
- // that updates with a different id are keyed under the original id
- if (!id.equals(iusToUpdate[i].getId())) {
- latestVersions.remove(id);
- }
- }
- }
- elementsToPlan.addAll(latestVersions.values());
- }
- sub.worked(100);
- }
- if (root != null)
- root.setChildren(allReplacements.toArray());
-
- if (toBeUpdated.size() <= 0 || elementsToPlan.isEmpty()) {
- sub.done();
- return null;
- }
-
- ProfileChangeRequest request = ProfileChangeRequest.createByProfileId(profileId);
- Iterator iter = elementsToPlan.iterator();
- while (iter.hasNext()) {
- AvailableUpdateElement element = (AvailableUpdateElement) iter.next();
- IInstallableUnit theUpdate = element.getIU();
- if (initialSelections != null) {
- if (!initialSelections.contains(element))
- initialSelections.add(element);
- }
- request.addInstallableUnits(new IInstallableUnit[] {theUpdate});
- request.setInstallableUnitProfileProperty(theUpdate, IInstallableUnit.PROP_PROFILE_ROOT_IU, Boolean.toString(true));
- if (Boolean.toString(true).equals(theUpdate.getProperty(IInstallableUnit.PROP_TYPE_PATCH))) {
- request.setInstallableUnitInclusionRules(theUpdate, PlannerHelper.createOptionalInclusionRule(theUpdate));
- } else {
- request.removeInstallableUnits(new IInstallableUnit[] {element.getIUToBeUpdated()});
- }
-
- }
- sub.done();
- return request;
- }
-
- public UpdateWizard(Policy policy, String profileId, IUElementListRoot root, Object[] initialSelections, PlannerResolutionOperation initialResolution, QueryableMetadataRepositoryManager manager) {
- super(policy, profileId, root, initialSelections, initialResolution);
- setWindowTitle(ProvUIMessages.UpdateAction_UpdatesAvailableTitle);
- setDefaultPageImageDescriptor(ProvUIImages.getImageDescriptor(ProvUIImages.WIZARD_BANNER_UPDATE));
- this.manager = manager;
- }
-
- protected ISelectableIUsPage createMainPage(IUElementListRoot input, Object[] selections) {
- mainPage = new SelectableIUsPage(policy, input, selections, profileId);
- mainPage.setTitle(ProvUIMessages.UpdateAction_UpdatesAvailableTitle);
- mainPage.setDescription(ProvUIMessages.UpdateAction_UpdatesAvailableMessage);
- mainPage.updateStatus(input, resolutionOperation);
- return mainPage;
- }
-
- protected ResolutionResultsWizardPage createResolutionPage() {
- return new UpdateWizardPage(policy, root, profileId, resolutionOperation);
- }
-
- protected IUElementListRoot makeResolutionElementRoot(Object[] selectedElements) {
- IUElementListRoot elementRoot = new IUElementListRoot();
- ArrayList list = new ArrayList(selectedElements.length);
- for (int i = 0; i < selectedElements.length; i++) {
- if (selectedElements[i] instanceof AvailableUpdateElement) {
- AvailableUpdateElement element = (AvailableUpdateElement) selectedElements[i];
- AvailableUpdateElement newElement = new AvailableUpdateElement(elementRoot, element.getIU(), element.getIUToBeUpdated(), profileId, policy.getQueryContext().getShowProvisioningPlanChildren());
- list.add(newElement);
- }
- }
- elementRoot.setChildren(list.toArray());
- return elementRoot;
- }
-
- public void createPageControls(Composite pageContainer) {
- super.createPageControls(pageContainer);
- if (manager != null)
- // async exec since we are in the middle of opening
- pageContainer.getDisplay().asyncExec(new Runnable() {
- public void run() {
- manager.reportAccumulatedStatus();
- }
- });
- }
-
- protected ProfileChangeRequest computeProfileChangeRequest(Object[] selectedElements, MultiStatus additionalStatus, IProgressMonitor monitor) {
- ArrayList initialSelections = new ArrayList();
- initialSelections.addAll(Arrays.asList(selectedElements));
- return createProfileChangeRequest(getIUsToReplace(selectedElements), profileId, null, initialSelections, monitor);
- }
-
- /* (non-Javadoc)
- * @see org.eclipse.equinox.internal.p2.ui.dialogs.ProvisioningOperationWizard#getErrorReportingPage()
- */
- protected IResolutionErrorReportingPage getErrorReportingPage() {<