adapterType) {
+ return ProvUI.getAdapter(adaptableObject, adapterType);
+ }
+
+ @Override
+ public Class>[] getAdapterList() {
+ return CLASSES;
+ }
+
+}
diff --git a/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIImages.java b/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIImages.java
new file mode 100644
index 0000000000..a60edbaa57
--- /dev/null
+++ b/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIImages.java
@@ -0,0 +1,92 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2013 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Red Hat, Inc. - support for remediation page
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.ui;
+
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * ProvUIImages provides convenience methods for accessing shared images
+ * provided by the org.eclipse.equinox.internal.provisional.p2.ui plug-in.
+ *
+ * This class provides ImageDescriptor
s for each named image in
+ * {@link ProvUIImages}. All Image
objects created from the
+ * provided descriptors are managed the caller and must be disposed
+ * appropriately.
+ *
+ *
+ * This class is not intended to be subclassed or instantiated by clients
+ *
+ * @since 3.4
+ * @noextend This class is not intended to be subclassed by clients.
+ * @noinstantiate This class is not intended to be instantiated by clients.
+ */
+public class ProvUIImages {
+
+ // bundle-relative icon path
+ public final static String ICON_PATH = "$nl$/icons/"; //$NON-NLS-1$
+ //objects
+ public final static String IMG_ARTIFACT_REPOSITORY = "obj/artifact_repo_obj.png"; //$NON-NLS-1$
+ public final static String IMG_METADATA_REPOSITORY = "obj/metadata_repo_obj.png"; //$NON-NLS-1$
+ public final static String IMG_IU = "obj/iu_obj.png"; //$NON-NLS-1$
+ public final static String IMG_DISABLED_IU = "obj/iu_disabled_obj.png"; //$NON-NLS-1$
+ public final static String IMG_ADDED = "obj/iu_add.png"; //$NON-NLS-1$
+ public final static String IMG_REMOVED = "obj/iu_remove.png"; //$NON-NLS-1$
+ public final static String IMG_CHANGED = "obj/iu_update_obj.png"; //$NON-NLS-1$
+ public final static String IMG_NOTADDED = "obj/iu_notadd.png"; //$NON-NLS-1$
+
+ public final static String IMG_UPDATED_IU = "obj/iu_update_obj.png"; //$NON-NLS-1$
+ public final static String IMG_UPGRADED_IU = "obj/iu_upgraded.png"; //$NON-NLS-1$
+ public final static String IMG_DOWNGRADED_IU = "obj/iu_downgraded.png"; //$NON-NLS-1$
+ public final static String IMG_ADDED_OVERLAY = "ovr/added_overlay.png"; //$NON-NLS-1$
+ public final static String IMG_REMOVED_OVERLAY = "ovr/removed_overlay.png"; //$NON-NLS-1$
+ public final static String IMG_PATCH_IU = "obj/iu_patch_obj.png"; //$NON-NLS-1$
+ public final static String IMG_DISABLED_PATCH_IU = "obj/iu_disabled_patch_obj.png"; //$NON-NLS-1$
+ public final static String IMG_PROFILE = "obj/profile_obj.png"; //$NON-NLS-1$
+ public final static String IMG_CATEGORY = "obj/category_obj.png"; //$NON-NLS-1$
+ public final static String IMG_INFO = "obj/iu_info.png"; //$NON-NLS-1$
+ public final static String IMG_COPY = "obj/copy_edit.png"; //$NON-NLS-1$
+
+ // wizard graphics
+ public final static String WIZARD_BANNER_INSTALL = "wizban/install_wiz.png"; //$NON-NLS-1$
+ public final static String WIZARD_BANNER_UNINSTALL = "wizban/uninstall_wiz.png"; //$NON-NLS-1$
+ public final static String WIZARD_BANNER_UPDATE = "wizban/update_wiz.png"; //$NON-NLS-1$
+ public final static String WIZARD_BANNER_REVERT = "wizban/revert_wiz.png"; //$NON-NLS-1$
+
+ /**
+ * Returns the image descriptor for the given image ID. Returns
+ * null
if there is no such image.
+ *
+ * @param id
+ * the identifier for the image to retrieve
+ * @return the image descriptor associated with the given ID
+ */
+ public static ImageDescriptor getImageDescriptor(String id) {
+ return ProvUIActivator.getDefault().getImageRegistry().getDescriptor(id);
+ }
+
+ /**
+ * Returns the image for the given image ID. Returns null
if
+ * there is no such image.
+ *
+ * @param id
+ * the identifier for the image to retrieve
+ * @return the image associated with the given ID. This image is managed in
+ * an image registry and should not be freed by the client.
+ */
+ public static Image getImage(String id) {
+ return ProvUIActivator.getDefault().getImageRegistry().get(id);
+ }
+}
diff --git a/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIMessages.java b/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIMessages.java
new file mode 100644
index 0000000000..cc4398f4e3
--- /dev/null
+++ b/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIMessages.java
@@ -0,0 +1,370 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2018 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Red Hat, Inc - support for remediation page
+ *******************************************************************************/
+
+package org.eclipse.equinox.internal.p2.ui;
+
+import org.eclipse.osgi.util.NLS;
+
+/**
+ * Message class for provisioning UI messages.
+ *
+ * @since 3.4
+ */
+public class ProvUIMessages extends NLS {
+ private static final String BUNDLE_NAME = "org.eclipse.equinox.internal.p2.ui.messages"; //$NON-NLS-1$
+ static {
+ // load message values from bundle file
+ NLS.initializeMessages(BUNDLE_NAME, ProvUIMessages.class);
+ }
+
+ public static String AcceptLicensesWizardPage_AcceptMultiple;
+ public static String AcceptLicensesWizardPage_AcceptSingle;
+ public static String AcceptLicensesWizardPage_ItemsLabel;
+ public static String AcceptLicensesWizardPage_LicenseTextLabel;
+ public static String AcceptLicensesWizardPage_NoLicensesDescription;
+ public static String AcceptLicensesWizardPage_RejectMultiple;
+ public static String AcceptLicensesWizardPage_RejectSingle;
+ public static String AcceptLicensesWizardPage_ReviewExtraLicensesDescription;
+ public static String AcceptLicensesWizardPage_ReviewLicensesDescription;
+ public static String AcceptLicensesWizardPage_SingleLicenseTextLabel;
+ 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 ColocatedRepositoryTracker_PromptForSiteLocationEdit;
+ public static String ColocatedRepositoryTracker_SiteNotFoundTitle;
+ public static String ColocatedRepositoryTracker_SiteNotFound_EditButtonLabel;
+ public static String RevertProfilePage_ConfirmDeleteMultipleConfigs;
+ public static String RevertProfilePage_ConfirmDeleteSingleConfig;
+ public static String RevertProfilePage_Delete;
+ public static String RevertProfilePage_CancelButtonLabel;
+ public static String RevertProfilePage_DeleteMultipleConfigurationsTitle;
+ public static String RevertProfilePage_DeleteSingleConfigurationTitle;
+ public static String RevertProfilePage_DeleteTooltip;
+ public static String RevertProfilePage_NoProfile;
+ public static String RevertProfilePage_RevertLabel;
+ public static String RevertProfilePage_RevertTooltip;
+ public static String RevertProfilePage_CompareLabel;
+ public static String RevertProfilePage_CompareTooltip;
+ public static String RevertProfilePage_ProfileTagColumn;
+ public static String RevertProfilePage_ProfileTimestampColumn;
+ public static String IUCopyrightPropertyPage_NoCopyright;
+ public static String IUCopyrightPropertyPage_ViewLinkLabel;
+ public static String IUDetailsLabelProvider_KB;
+ public static String IUDetailsLabelProvider_Bytes;
+ public static String IUDetailsLabelProvider_ComputingSize;
+ public static String IUDetailsLabelProvider_Unknown;
+ public static String IUGeneralInfoPropertyPage_ContactLabel;
+ public static String IUGeneralInfoPropertyPage_CouldNotOpenBrowser;
+ public static String IUGeneralInfoPropertyPage_DescriptionLabel;
+ public static String IUGeneralInfoPropertyPage_DocumentationLink;
+ public static String IUGeneralInfoPropertyPage_IdentifierLabel;
+ public static String IUGeneralInfoPropertyPage_NameLabel;
+ public static String IUGeneralInfoPropertyPage_ProviderLabel;
+ public static String IUGeneralInfoPropertyPage_VersionLabel;
+ public static String IULicensePropertyPage_NoLicense;
+ public static String IULicensePropertyPage_ViewLicenseLabel;
+ public static String PGPPublicKeyViewDialog_Title;
+ public static String ProfileModificationAction_InvalidSelections;
+ public static String ProfileModificationWizardPage_DetailsLabel;
+ public static String ProfileSnapshots_Label;
+
+ // viewer support
+ public static String ProvDropAdapter_InvalidDropTarget;
+ public static String ProvDropAdapter_NoIUsToDrop;
+ public static String ProvDropAdapter_UnsupportedDropOperation;
+ public static String ProvElementContentProvider_FetchJobTitle;
+
+ // Provisioning operations
+ public static String ProvisioningOperationRunner_CannotApplyChanges;
+ public static String ProvisioningOperationWizard_Remediation_Operation;
+ public static String ProvisioningOperationWizard_UnexpectedFailureToResolve;
+ public static String InstalledSoftwarePage_Filter_Installed_Software;
+ public static String InstalledSoftwarePage_NoProfile;
+ public static String InstallIUOperationLabel;
+ public static String InstallIUOperationTask;
+ public static String InstallIUCommandLabel;
+ public static String InstallIUCommandTooltip;
+ public static String InstallWizardPage_NoCheckboxDescription;
+ public static String InstallWizardPage_Title;
+ public static String PreselectedIUInstallWizard_Title;
+ public static String PreselectedIUInstallWizard_Description;
+ public static String UninstallDialog_UninstallMessage;
+ public static String UninstallIUOperationLabel;
+ public static String UninstallIUOperationTask;
+ public static String UninstallIUCommandLabel;
+ public static String UninstallIUCommandTooltip;
+ public static String UninstallIUProgress;
+ public static String UninstallWizardPage_Description;
+ public static String UninstallWizardPage_Title;
+ public static String UpdateIUOperationLabel;
+ public static String UpdateIUOperationTask;
+ public static String UpdateIUCommandLabel;
+ public static String UpdateIUCommandTooltip;
+ public static String UpdateIUProgress;
+ public static String RefreshAction_Label;
+ public static String RefreshAction_Tooltip;
+ public static String RemoveColocatedRepositoryAction_Label;
+ public static String RemoveColocatedRepositoryAction_Tooltip;
+ public static String RevertIUCommandLabel;
+ public static String RevertIUCommandTooltip;
+
+ // Property pages
+ public static String IUPropertyPage_NoIUSelected;
+
+ public static String RepositoryDetailsLabelProvider_Disabled;
+ public static String RepositoryDetailsLabelProvider_Enabled;
+ // Dialog groups
+ public static String RepositoryGroup_LocalRepoBrowseButton;
+ public static String RepositoryGroup_ArchivedRepoBrowseButton;
+ public static String RepositoryGroup_RepositoryFile;
+ public static String RepositoryGroup_SelectRepositoryDirectory;
+ public static String RepositoryGroup_URLRequired;
+ public static String RepositoryManipulationPage_Add;
+ public static String RepositoryManipulationPage_ContactingSiteMessage;
+ public static String RepositoryManipulationPage_DefaultFilterString;
+ public static String RepositoryManipulationPage_Description;
+ public static String RepositoryManipulationPage_DisableButton;
+ public static String RepositoryManipulationPage_EnableButton;
+ public static String RepositoryManipulationPage_EnabledColumnTitle;
+ public static String RepositoryManipulationPage_Export;
+ public static String RepositoryManipulationPage_Import;
+ public static String RepositoryManipulationPage_LocationColumnTitle;
+ public static String RepositoryManipulationPage_NameColumnTitle;
+ public static String RepositoryManipulationPage_Edit;
+ public static String RepositoryManipulationPage_RefreshConnection;
+ public static String RepositoryManipulationPage_RefreshOperationCanceled;
+ public static String RepositoryManipulationPage_Remove;
+ public static String RepositoryManipulationPage_RemoveConfirmMessage;
+ public static String RepositoryManipulationPage_RemoveConfirmSingleMessage;
+ public static String RepositoryManipulationPage_RemoveConfirmTitle;
+ public static String RepositoryManipulationPage_TestConnectionSuccess;
+ public static String RepositoryManipulationPage_TestConnectionTitle;
+ public static String RepositoryManipulationPage_Title;
+ public static String RepositoryManipulationPage_Manage;
+ public static String RepositoryManipulatorDropTarget_DragAndDropJobLabel;
+ public static String RepositoryManipulatorDropTarget_DragSourceNotValid;
+ public static String RepositoryNameAndLocationDialog_Title;
+
+ public static String RepositorySelectionGroup_NameAndLocationSeparator;
+ public static String ResolutionWizardPage_Canceled;
+ public static String ResolutionWizardPage_ErrorStatus;
+ public static String ResolutionWizardPage_NoSelections;
+ public static String ResolutionWizardPage_WarningInfoStatus;
+ public static String ResolutionWizardPage_RelaxedConstraints;
+ public static String ResolutionWizardPage_RelaxedConstraintsTip;
+ public static String ResolutionStatusPage_ErrorIULocked;
+
+ // Dialogs
+ public static String AddRepositoryDialog_InvalidURL;
+ public static String AddRepositoryDialog_LocationLabel;
+ public static String AddRepositoryDialog_NameLabel;
+ public static String AddRepositoryDialog_Title;
+ public static String AddRepositoryDialog_addButtonLabel;
+ public static String AvailableIUGroup_LoadingRepository;
+ public static String AvailableIUGroup_NoSitesConfiguredDescription;
+ public static String AvailableIUGroup_NoSitesConfiguredExplanation;
+ public static String ColocatedRepositoryManipulator_NoContentExplanation;
+ public static String AvailableIUGroup_NoSitesExplanation;
+ public static String AvailableIUsPage_AddButton;
+ public static String AvailableIUsPage_AllSites;
+ public static String AvailableIUsPage_Description;
+ public static String AvailableIUsPage_FilterOnEnvCheckBox;
+ public static String AvailableIUsPage_GotoInstallInfo;
+ public static String AvailableIUsPage_GotoProperties;
+ public static String AvailableIUsPage_GroupByCategory;
+ public static String AvailableIUsPage_HideInstalledItems;
+ public static String AvailableIUsPage_LocalSites;
+ public static String AvailableIUsPage_MultipleSelectionCount;
+ public static String AvailableIUsPage_NameWithLocation;
+ public static String AvailableIUsPage_NoSites;
+ public static String AvailableIUsPage_RepoFilterInstructions;
+ public static String AvailableIUsPage_RepoFilterLabel;
+ public static String AvailableIUsPage_ResolveAllCheckbox;
+ public static String AvailableIUsPage_SelectASite;
+ public static String AvailableIUsPage_ShowLatestVersions;
+ public static String AvailableIUsPage_SingleSelectionCount;
+ public static String AvailableIUsPage_Title;
+ public static String AvailableIUsPage_Fetching;
+ public static String AvailableIUWrapper_AllAreInstalled;
+ public static String IUViewQueryContext_AllAreInstalledDescription;
+ 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 RepositoryElement_NotFound;
+ public static String RepositoryTracker_DuplicateLocation;
+ public static String MetadataRepositoryElement_RepositoryLoadError;
+ public static String UpdateAction_UpdatesAvailableMessage;
+ public static String UpdateAction_UpdatesAvailableTitle;
+ public static String UpdateActionRemediationJobName;
+ public static String UpdateActionRemediationJobTask;
+ 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_ProviderColumnTitle;
+ public static String ProvUI_VersionColumnTitle;
+ public static String ProvUI_WarningTitle;
+ public static String ProvUIMessages_NotAccepted_EnterFor_0;
+ public static String ProvUIMessages_SavedNotAccepted_EnterFor_0;
+ public static String OptionalPlatformRestartMessage;
+ public static String IUViewQueryContext_NoCategorizedItemsDescription;
+ public static String QueriedElementWrapper_NoCategorizedItemsExplanation;
+ public static String QueriedElementWrapper_NoItemsExplanation;
+ public static String QueriedElementWrapper_SiteNotFound;
+ public static String QueryableMetadataRepositoryManager_LoadRepositoryProgress;
+ public static String QueryableProfileRegistry_QueryProfileProgress;
+ public static String QueryableUpdates_UpdateListProgress;
+ public static String SizeComputingWizardPage_SizeJobTitle;
+ 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 RevertDialog_CancelButtonLabel;
+ public static String RollbackProfileElement_CurrentInstallation;
+ public static String SelectableIUsPage_Select_All;
+ public static String SelectableIUsPage_Deselect_All;
+ public static String InstallRemediationPage_Title;
+ public static String InstallRemediationPage_Description;
+ public static String KeySigningInfoFactory_FingerprintItem;
+ public static String KeySigningInfoFactory_KeySignersSection;
+ public static String KeySigningInfoFactory_PGPSigningType;
+ public static String KeySigningInfoFactory_UserIDItem;
+ public static String UpdateRemediationPage_Title;
+ public static String UpdateRemediationPage_Description;
+ public static String RemediationPage_SubDescription;
+ public static String RemediationPage_NoSolutionFound;
+ public static String RemediationPage_BeingInstalledSection;
+ public static String RemediationPage_InstalledSection;
+ public static String RemediationPage_BeingInstalledSection_AllowPartialInstall;
+ public static String RemediationPage_BeingInstalledSection_AllowDifferentVersion;
+ public static String RemediationPage_InstalledSection_AllowInstalledUpdate;
+ public static String RemediationPage_InstalledSection_AllowInstalledRemoval;
+ public static String RemediationPage_BestSolutionBeingInstalledRelaxed;
+ public static String RemediationPage_BestSolutionInstallationRelaxed;
+ public static String RemediationPage_BestSolutionBuilt;
+ public static String RemediationPage_SolutionDetails;
+ public static String RemedyCategoryAdded;
+ public static String RemedyCategoryRemoved;
+ public static String RemedyCategoryChanged;
+ public static String RemedyCategoryNotAdded;
+ public static String RemedyElementInstalledVersion;
+ public static String RemedyElementRequestedVersion;
+ public static String RemedyElementBeingInstalledVersion;
+ public static String RemedyElementNotHighestVersion;
+
+ public static String TrustAuthorityDialog_AcceptTrustAllAuthorities;
+ public static String TrustAuthorityDialog_AuthoritiesCollapseAllButton;
+ public static String TrustAuthorityDialog_AuthoritiesDeselectAllButton;
+ public static String TrustAuthorityDialog_AuthoritiesExpandAllButton;
+ public static String TrustAuthorityDialog_AuthoritiesSelectAllButton;
+ public static String TrustAuthorityDialog_AuthorityColumnTitle;
+ public static String TrustAuthorityDialog_AuthorityCopyLinkMenu;
+ public static String TrustAuthorityDialog_AuthorityInsecure;
+ public static String TrustAuthorityDialog_AuthoritySecure;
+ public static String TrustAuthorityDialog_CertificateDetailsButton;
+ public static String TrustAuthorityDialog_CertificateExportButton;
+ public static String TrustAuthorityDialog_ComputingAuthorityCertficate;
+ public static String TrustAuthorityDialog_ExportDialogTitle;
+ public static String TrustAuthorityDialog_IUColumnTitle;
+ public static String TrustAuthorityDialog_IUDetailDialogDescriptionMessage;
+ public static String TrustAuthorityDialog_IUDetailsButton;
+ public static String TrustAuthorityDialog_IUDetailsDialogCountMessage;
+ public static String TrustAuthorityDialog_IUDetailsDialogTitle;
+ public static String TrustAuthorityDialog_IUVersionColumnTitle;
+ public static String TrustAuthorityDialog_RejectTrustAllAuthorities;
+ public static String TrustAuthorityDialog_RememberSelectedAuthoritiesCheckbox;
+ public static String TrustAuthorityDialog_SecuredColumnTitle;
+ public static String TrustAuthorityDialog_TrustAllAuthoritiesCheckbox;
+ public static String TrustAuthorityDialog_TrustAllAuthoritiesConfirmationDescription;
+ public static String TrustAuthorityDialog_TrustAllAuthoritiesConfirmationTitle;
+ public static String TrustAuthorityDialog_TrustAuthoritiesTitle;
+ public static String TrustAuthorityDialog_TrustAuthorityDescriptionMessage;
+ public static String TrustAuthorityDialog_TrustAuthorityMainMessage;
+ public static String TrustAuthorityDialog_TrustInsecureAuthorityMessage;
+ public static String TrustAuthorityDialog_TrustSelectedCheckbox;
+ public static String TrustAuthorityDialog_UnitsColumnTitle;
+
+ public static String TrustCertificateDialog_Details;
+ public static String TrustCertificateDialog_Export;
+ public static String TrustCertificateDialog_ExportDialogTitle;
+ public static String TrustCertificateDialog_Title;
+ public static String TrustCertificateDialog_Message;
+ public static String TrustCertificateDialog_MessageUnsigned;
+ public static String TrustCertificateDialog_MessageNameWarning;
+ public static String TrustCertificateDialog_MessagePGP;
+ public static String TrustCertificateDialog_MessageRevoked;
+ public static String TrustCertificateDialog_AcceptSelectedButtonLabel;
+ public static String TrustCertificateDialog_AlwaysTrust;
+ public static String TrustCertificateDialog_AlwaysTrustConfirmationMessage;
+ public static String TrustCertificateDialog_AlwaysTrustConfirmationTitle;
+ public static String TrustCertificateDialog_AlwaysTrustNo;
+ public static String TrustCertificateDialog_AlwaysTrustYes;
+ public static String TrustCertificateDialog_ArtifactId;
+ public static String TrustCertificateDialog_SelectAll;
+ public static String TrustCertificateDialog_DeselectAll;
+ public static String TrustCertificateDialog_ObjectType;
+ public static String TrustCertificateDialog_Id;
+ public static String TrustCertificateDialog_Name;
+ public static String TrustCertificateDialog_Classifier;
+ public static String TrustCertificateDialog_CopyFingerprint;
+ public static String TrustCertificateDialog_dates;
+ public static String TrustCertificateDialog_NotApplicable;
+ public static String TrustCertificateDialog_NotYetValidStartDate;
+ public static String TrustCertificateDialog_expiredSince;
+ public static String TrustCertificateDialog_validExpires;
+ public static String TrustCertificateDialog_valid;
+ public static String TrustCertificateDialog_expired;
+ public static String TrustCertificateDialog_notYetValid;
+ public static String TrustCertificateDialog_RememberSigners;
+ public static String TrustCertificateDialog_revoked;
+ public static String TrustCertificateDialog_Unknown;
+ public static String TrustCertificateDialog_Unsigned;
+ public static String TrustCertificateDialog_Version;
+ public static String TrustCertificateDialogQuestionTrustRevokedKeyAccept;
+ public static String TrustCertificateDialogQuestionTrustRevokedKeyQuestion;
+ public static String TrustCertificateDialogQuestionTrustRevokedKeyReject;
+ public static String TrustCertificateDialogQuestionTrustRevokedKeyTitle;
+ // Operations
+ public static String UpdateManagerCompatibility_ExportSitesTitle;
+ public static String UpdateManagerCompatibility_ImportSitesTitle;
+ public static String UpdateManagerCompatibility_InvalidSiteFileMessage;
+ public static String UpdateManagerCompatibility_InvalidSitesTitle;
+ public static String UpdateManagerCompatibility_ItemRequiresUpdateManager;
+ public static String UpdateManagerCompatibility_UnableToOpenFindAndInstall;
+ public static String ServiceUI_LoginDetails;
+ public static String ServiceUI_LoginRequired;
+ public static String ServiceUI_unsigned_message;
+ public static String ServiceUI_warning_title;
+ public static String ServiceUI_InstallAnywayAction_Label;
+ public static String UpdateOrInstallWizardPage_Size;
+ public static String Updates_Label;
+ public static String UpdateSingleIUPage_SingleUpdateDescription;
+ public static String UpdateWizardPage_Description;
+ public static String UpdateWizardPage_Title;
+ public static String UserValidationDialog_PasswordLabel;
+ public static String UserValidationDialog_SavePasswordButton;
+ public static String UserValidationDialog_UsernameLabel;
+}
diff --git a/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIProvisioningListener.java b/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIProvisioningListener.java
new file mode 100644
index 0000000000..61d82adf30
--- /dev/null
+++ b/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvUIProvisioningListener.java
@@ -0,0 +1,241 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2011 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+
+package org.eclipse.equinox.internal.p2.ui;
+
+import java.util.EventObject;
+import org.eclipse.equinox.internal.p2.core.helpers.Tracing;
+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.IProfileEvent;
+import org.eclipse.equinox.p2.repository.IRepository;
+
+/**
+ * ProvisioningListener which handles event batching and other
+ * extensions to the provisioning event framework that are used by
+ * the UI.
+ *
+ * @since 3.5
+ */
+public abstract class ProvUIProvisioningListener implements SynchronousProvisioningListener {
+
+ public static final int PROV_EVENT_METADATA_REPOSITORY = 0x0001;
+ public static final int PROV_EVENT_IU = 0x0002;
+ public static final int PROV_EVENT_PROFILE = 0x0004;
+ public static final int PROV_EVENT_ARTIFACT_REPOSITORY = 0x0008;
+
+ int eventTypes = 0;
+ String name;
+ private ProvisioningOperationRunner runner;
+
+ public ProvUIProvisioningListener(String name, int eventTypes, ProvisioningOperationRunner runner) {
+ this.name = name;
+ this.eventTypes = eventTypes;
+ this.runner = runner;
+ }
+
+ @Override
+ public void notify(EventObject o) {
+ if (o instanceof RepositoryOperationBeginningEvent) {
+ if (Tracing.DEBUG_EVENTS_CLIENT)
+ Tracing.debug("Batch Eventing: Ignore Following Events. " + getReceiverString()); //$NON-NLS-1$
+ } else if (o instanceof RepositoryOperationEndingEvent) {
+ RepositoryOperationEndingEvent event = (RepositoryOperationEndingEvent) o;
+
+ if (Tracing.DEBUG_EVENTS_CLIENT)
+ Tracing.debug("Batch Eventing: Batch Ended. " + getReceiverString()); //$NON-NLS-1$
+ // A batch operation completed. Refresh.
+ if (runner.eventBatchCount <= 0) {
+ if (Tracing.DEBUG_EVENTS_CLIENT)
+ Tracing.debug("Batch Eventing Complete." + getReceiverString()); //$NON-NLS-1$
+ if (event.getEvent() == null && event.update()) {
+ if (Tracing.DEBUG_EVENTS_CLIENT) {
+ Tracing.debug("Refreshing After Batch." + getReceiverString()); //$NON-NLS-1$
+ }
+ refreshAll();
+ } else if (event.update()) {
+ if (Tracing.DEBUG_EVENTS_CLIENT)
+ Tracing.debug("Dispatching Last Event in Batch." + getReceiverString()); //$NON-NLS-1$
+ notify(event.getEvent());
+ } else if (Tracing.DEBUG_EVENTS_CLIENT) {
+ Tracing.debug("No Refresh on Batch Complete."); //$NON-NLS-1$
+ }
+ } else {
+ // We are still in the middle of a batch operation, but we've been notified
+ // about a nested batch that ended. See if it ended with a specific event.
+ // If it did, this means there was a user action involving a repository
+ // (rather than side-effect events). For example, the user might add a repo while a full
+ // background load is running. We want to honor that
+ // event. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=305478
+ RepositoryEvent innerEvent = event.getEvent();
+ if (innerEvent != null) {
+ handleRepositoryEvent(innerEvent);
+ }
+ }
+ } else if (runner.eventBatchCount > 0) {
+ // ignore raw events during a batch
+ if (Tracing.DEBUG_EVENTS_CLIENT)
+ Tracing.debug(name + " Ignoring: " + o.toString()); //$NON-NLS-1$
+ return;
+ } else if (o instanceof IProfileEvent && (((eventTypes & PROV_EVENT_IU) == PROV_EVENT_IU) || ((eventTypes & PROV_EVENT_PROFILE) == PROV_EVENT_PROFILE))) {
+ if (Tracing.DEBUG_EVENTS_CLIENT)
+ Tracing.debug(o.toString() + getReceiverString());
+ IProfileEvent event = (IProfileEvent) o;
+ if (event.getReason() == IProfileEvent.CHANGED) {
+ profileChanged(event.getProfileId());
+ } else if (event.getReason() == IProfileEvent.ADDED) {
+ profileAdded(event.getProfileId());
+ } else if (event.getReason() == IProfileEvent.REMOVED) {
+ profileRemoved(event.getProfileId());
+ }
+ } else if (o instanceof RepositoryEvent) {
+ if (Tracing.DEBUG_EVENTS_CLIENT)
+ Tracing.debug(o.toString() + getReceiverString());
+ handleRepositoryEvent((RepositoryEvent) o);
+ }
+ }
+
+ private String getReceiverString() {
+ return " -- <" + name + "> "; //$NON-NLS-1$//$NON-NLS-2$
+ }
+
+ private void handleRepositoryEvent(RepositoryEvent event) {
+ // 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 && event.isRepositoryEnabled()) {
+ repositoryAdded(event);
+ } else if (event.getKind() == RepositoryEvent.REMOVED && event.isRepositoryEnabled()) {
+ repositoryRemoved(event);
+ } else if (event.getKind() == RepositoryEvent.DISCOVERED) {
+ repositoryDiscovered(event);
+ } else if (event.getKind() == RepositoryEvent.CHANGED) {
+ repositoryChanged(event);
+ } else if (event.getKind() == RepositoryEvent.ENABLEMENT) {
+ repositoryEnablement(event);
+ }
+ }
+ }
+
+ /**
+ * A repository has been added. Subclasses may override. May be called
+ * from a non-UI thread.
+ *
+ * @param event the RepositoryEvent describing the details
+ */
+ protected void repositoryAdded(RepositoryEvent event) {
+ // Do nothing. This method is not abstract because subclasses
+ // may not be interested in repository events at all and should
+ // not have to implement it.
+ }
+
+ /**
+ * A repository has been removed. Subclasses may override. May be called
+ * from a non-UI thread.
+ *
+ * @param event the RepositoryEvent describing the details
+ */
+ protected void repositoryRemoved(RepositoryEvent event) {
+ // Do nothing. This method is not abstract because subclasses
+ // may not be interested in repository events at all and should
+ // not have to implement it.
+ }
+
+ /**
+ * A repository has been discovered. Subclasses may override. May be called
+ * from a non-UI thread.
+ *
+ * @param event the RepositoryEvent describing the details
+ */
+ protected void repositoryDiscovered(RepositoryEvent event) {
+ // Do nothing. This method is not abstract because subclasses
+ // may not be interested in repository events at all and should
+ // not have to implement it.
+ }
+
+ /**
+ * A repository has changed. Subclasses may override. May be called
+ * from a non-UI thread.
+ *
+ * @param event the RepositoryEvent describing the details
+ */
+ protected void repositoryChanged(RepositoryEvent event) {
+ // Do nothing. This method is not abstract because subclasses
+ // may not be interested in repository events at all and should
+ // not have to implement it.
+ }
+
+ /**
+ * A repository's enablement state has changed. This is treated
+ * as repository addition or removal by default. Subclasses may
+ * override. May be called from a non-UI thread.
+ * @param event
+ */
+ protected void repositoryEnablement(RepositoryEvent event) {
+ // We treat enablement of a repository as if one were added.
+ if (event.isRepositoryEnabled())
+ repositoryAdded(event);
+ else
+ repositoryRemoved(event);
+ }
+
+ /**
+ * The specified profile has changed. Subclasses may override. May be called
+ * from a non-UI thread.
+ *
+ * @param profileId the id of the profile that changed.
+ */
+ protected void profileChanged(final String profileId) {
+ // Do nothing. This method is not abstract because subclasses
+ // may not be interested in profile events at all and should
+ // not have to implement it.
+ }
+
+ /**
+ * The specified profile has been added. Subclasses may override. May be called
+ * from a non-UI thread.
+ *
+ * @param profileId the id of the profile that has been added.
+ */
+ protected void profileAdded(final String profileId) {
+ // Do nothing. This method is not abstract because subclasses
+ // may not be interested in profile events at all and should
+ // not have to implement it.
+ }
+
+ /**
+ * The specified profile has been removed. Subclasses may override. May be called
+ * from a non-UI thread.
+ *
+ * @param profileId the id of the profile that has been removed.
+ */
+ protected void profileRemoved(final String profileId) {
+ // Do nothing. This method is not abstract because subclasses
+ // may not be interested in profile events at all and should
+ // not have to implement it.
+ }
+
+ /**
+ * An event requiring a complete refresh of the listener's state has
+ * been received. This is used, for example, when a batch change has
+ * completed. Subclasses may override. May be called from a non-UI
+ * thread.
+ */
+ protected void refreshAll() {
+ // Do nothing by default.
+ }
+
+ public int getEventTypes() {
+ return eventTypes;
+ }
+}
diff --git a/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvisioningOperationRunner.java b/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvisioningOperationRunner.java
new file mode 100644
index 0000000000..eceed6bb90
--- /dev/null
+++ b/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ProvisioningOperationRunner.java
@@ -0,0 +1,148 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2018 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Red Hat Inc. - Bug 460967
+ *******************************************************************************/
+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.progress.IProgressConstants2;
+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 int eventBatchCount = 0;
+
+ 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));
+ job.setProperty(IProgressConstants2.SHOW_IN_TASKBAR_ICON_PROPERTY, Boolean.TRUE);
+ manageJob(job, job.getRestartPolicy());
+ job.schedule();
+ }
+
+ /**
+ * Request a restart of the platform according to the specified
+ * restart policy.
+ *
+ * @param restartPolicy
+ */
+ 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(() -> {
+ 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(true);
+ }
+ });
+ }
+
+ void applyProfileChanges() {
+ Configurator configurator = ServiceHelper.getService(ProvUIActivator.getContext(), Configurator.class);
+ 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() {
+ @Override
+ 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 true
to suppress all restarts and false
+ * 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/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryProvider.java b/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryProvider.java
new file mode 100644
index 0000000000..aca5c6ec0b
--- /dev/null
+++ b/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryProvider.java
@@ -0,0 +1,238 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * EclipseSource - ongoing development
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.ui;
+
+import java.util.*;
+import org.eclipse.equinox.internal.p2.metadata.InstallableUnit;
+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.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;
+
+ public QueryProvider(ProvisioningUI ui) {
+ this.ui = ui;
+ }
+
+ /*
+ * Return a map of key/value pairs which are set to the environment settings
+ * for the given profile. May return null
or an empty Map
+ * if the settings cannot be obtained.
+ */
+ private static Map getEnvFromProfile(IProfile profile) {
+ if (profile == null)
+ return null;
+ String environments = profile.getProperty(IProfile.PROP_ENVIRONMENTS);
+ if (environments == null)
+ return null;
+ Map result = new HashMap<>();
+ for (StringTokenizer tokenizer = new StringTokenizer(environments, ","); tokenizer.hasMoreElements();) { //$NON-NLS-1$
+ String entry = tokenizer.nextToken();
+ int i = entry.indexOf('=');
+ String key = entry.substring(0, i).trim();
+ String value = entry.substring(i + 1).trim();
+ result.put(key, value);
+ }
+ return result;
+ }
+
+ // If we are supposed to filter out the results based on the environment settings in
+ // the target profile then create a compound query otherwise just return the given query
+ private IQuery createEnvironmentFilterQuery(IUViewQueryContext context, IProfile profile, IQuery query) {
+ if (!context.getFilterOnEnv())
+ return query;
+ Map environment = getEnvFromProfile(profile);
+ if (environment == null)
+ return query;
+ IInstallableUnit envIU = InstallableUnit.contextIU(environment);
+ IQuery filterQuery = QueryUtil.createMatchQuery("filter == null || $0 ~= filter", envIU); //$NON-NLS-1$
+ return QueryUtil.createCompoundQuery(query, filterQuery, true);
+ }
+
+ 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);
+ context.setInstalledProfileId(ui.getProfileId());
+ }
+ switch (queryType) {
+ case ARTIFACT_REPOS :
+ queryable = new QueryableArtifactRepositoryManager(ui, false).locationsQueriable();
+ return new ElementQueryDescriptor(queryable, new RepositoryLocationQuery(), new Collector<>(), 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 = ProvUI.getProfileRegistry(ui.getSession()).getProfile(profileId);
+ }
+
+ IQuery topLevelQuery = policy.getVisibleAvailableIUQuery();
+ IQuery categoryQuery = QueryUtil.createIUCategoryQuery();
+
+ topLevelQuery = createEnvironmentFilterQuery(context, targetProfile, topLevelQuery);
+ categoryQuery = createEnvironmentFilterQuery(context, targetProfile, 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 = QueryUtil.createLatestQuery(topLevelQuery);
+ 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 drillDownTheChildren = element instanceof CategoryElement ? context.getShowAvailableChildren() : true;
+ IQuery memberOfCategoryQuery;
+ if (element instanceof CategoryElement) {
+ // We need an expression that uses the requirements of the element's requirements, which could be merged
+ // from multiple category IUs shown as one in the UI.
+ IExpression matchesRequirementsExpression = ExpressionUtil.parse("$0.exists(r | this ~= r)"); //$NON-NLS-1$
+ memberOfCategoryQuery = QueryUtil.createMatchQuery(matchesRequirementsExpression, ((CategoryElement) element).getRequirements());
+ } else {
+ memberOfCategoryQuery = QueryUtil.createIUCategoryMemberQuery(((IIUElement) element).getIU());
+ }
+ memberOfCategoryQuery = createEnvironmentFilterQuery(context, targetProfile, memberOfCategoryQuery);
+ availableIUWrapper = new AvailableIUWrapper(queryable, element, true, drillDownTheChildren);
+ if (targetProfile != null)
+ availableIUWrapper.markInstalledIUs(targetProfile, hideInstalled);
+ // if it's a category, there is a special query.
+ if (element instanceof CategoryElement) {
+ if (showLatest)
+ memberOfCategoryQuery = QueryUtil.createLatestQuery(memberOfCategoryQuery);
+ return new ElementQueryDescriptor(queryable, memberOfCategoryQuery, new Collector<>(), availableIUWrapper);
+ }
+ // It is not a category, we want to traverse the requirements that are groups.
+ IQuery query = QueryUtil.createCompoundQuery(topLevelQuery, new RequiredIUsQuery(((IIUElement) element).getIU()), true);
+ if (showLatest)
+ query = QueryUtil.createLatestQuery(query);
+ // 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 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 = ProvUI.getProfileRegistry(ui.getSession()).getProfile(((Updates) element).getProfileId());
+ toUpdate = ((Updates) element).getIUs();
+ } else {
+ profile = ProvUI.getAdapter(element, IProfile.class);
+ }
+ if (profile == null)
+ return null;
+ if (toUpdate == null) {
+ IQueryResult queryResult = profile.query(policy.getVisibleInstalledIUQuery(), null);
+ toUpdate = queryResult.toArray(IInstallableUnit.class);
+ }
+ QueryableUpdates updateQueryable = new QueryableUpdates(ui, toUpdate);
+ return new ElementQueryDescriptor(updateQueryable, context.getShowLatestVersionsOnly() ? QueryUtil.createLatestIUQuery() : QueryUtil.createIUAnyQuery(), new Collector<>());
+
+ case INSTALLED_IUS :
+ // Querying of IU's. We are drilling down into the requirements.
+ if (element instanceof IIUElement && context.getShowInstallChildren()) {
+ Collection reqs = ((IIUElement) element).getRequirements();
+ if (reqs.size() == 0)
+ return null; // no children
+ IExpression[] requirementExpressions = new IExpression[reqs.size()];
+ int i = 0;
+ for (IRequirement req : reqs) {
+ requirementExpressions[i++] = req.getMatches();
+ }
+
+ IExpressionFactory factory = ExpressionUtil.getFactory();
+ IQuery meetsAnyRequirementQuery = QueryUtil.createMatchQuery(factory.or(requirementExpressions));
+ IQuery visibleAsAvailableQuery = policy.getVisibleAvailableIUQuery();
+ IQuery createCompoundQuery = QueryUtil.createCompoundQuery(visibleAsAvailableQuery, meetsAnyRequirementQuery, true);
+ return new ElementQueryDescriptor(queryable, createCompoundQuery, new Collector<>(), new InstalledIUElementWrapper(queryable, element));
+ }
+ profile = ProvUI.getAdapter(element, IProfile.class);
+ if (profile == null)
+ return null;
+ return new ElementQueryDescriptor(profile, policy.getVisibleInstalledIUQuery(), new Collector<>(), 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<>(), new MetadataRepositoryElementWrapper(null, element));
+ }
+ return null;
+
+ case PROFILES :
+ queryable = new QueryableProfileRegistry(ui);
+ return new ElementQueryDescriptor(queryable, QueryUtil.createMatchQuery(IProfile.class, ExpressionUtil.TRUE_EXPRESSION), new Collector<>(), new ProfileElementWrapper(null, element));
+
+ case AVAILABLE_ARTIFACTS :
+ if (!(queryable instanceof IArtifactRepository))
+ return null;
+ return new ElementQueryDescriptor(queryable, ArtifactKeyQuery.ALL_KEYS, new Collector<>(), new ArtifactKeyWrapper((IArtifactRepository) queryable, element));
+
+ default :
+ return null;
+ }
+ }
+}
diff --git a/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableArtifactRepositoryManager.java b/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableArtifactRepositoryManager.java
new file mode 100644
index 0000000000..512bbb7afe
--- /dev/null
+++ b/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableArtifactRepositoryManager.java
@@ -0,0 +1,61 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * EclipseSource - ongoing development
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.ui;
+
+import java.net.URI;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.equinox.internal.p2.artifact.repository.ArtifactRepositoryManager;
+import org.eclipse.equinox.p2.core.ProvisionException;
+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 {
+
+ public QueryableArtifactRepositoryManager(ProvisioningUI ui, boolean includeDisabledRepos) {
+ super(ui, includeDisabledRepos);
+ }
+
+ @Override
+ protected IArtifactRepositoryManager getRepositoryManager() {
+ return ProvUI.getArtifactRepositoryManager(getSession());
+ }
+
+ @Override
+ protected IArtifactRepository doLoadRepository(IRepositoryManager manager, URI location,
+ IProgressMonitor monitor) throws ProvisionException {
+ return ui.loadArtifactRepository(location, false, monitor);
+ }
+
+ @Override
+ protected int getRepositoryFlags(RepositoryTracker repositoryManipulator) {
+ return repositoryManipulator.getArtifactRepositoryFlags();
+ }
+
+ @Override
+ protected IArtifactRepository getRepository(IRepositoryManager 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/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableMetadataRepositoryManager.java b/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableMetadataRepositoryManager.java
new file mode 100644
index 0000000000..c912f7c626
--- /dev/null
+++ b/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableMetadataRepositoryManager.java
@@ -0,0 +1,60 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2010 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.ui;
+
+import java.net.URI;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.equinox.internal.p2.metadata.repository.MetadataRepositoryManager;
+import org.eclipse.equinox.p2.core.ProvisionException;
+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 {
+
+ public QueryableMetadataRepositoryManager(ProvisioningUI ui, boolean includeDisabledRepos) {
+ super(ui, includeDisabledRepos);
+ }
+
+ @Override
+ protected IMetadataRepository getRepository(IRepositoryManager manager, URI location) {
+ // note the use of MetadataRepositoryManager (the concrete implementation).
+ if (manager instanceof MetadataRepositoryManager) {
+ return ((MetadataRepositoryManager) manager).getRepository(location);
+ }
+ return null;
+ }
+
+ @Override
+ protected IMetadataRepositoryManager getRepositoryManager() {
+ return ProvUI.getMetadataRepositoryManager(getSession());
+ }
+
+ @Override
+ protected IMetadataRepository doLoadRepository(IRepositoryManager manager, URI location,
+ IProgressMonitor monitor) throws ProvisionException {
+ return ui.loadMetadataRepository(location, false, monitor);
+ }
+
+ @Override
+ protected int getRepositoryFlags(RepositoryTracker repositoryManipulator) {
+ return repositoryManipulator.getMetadataRepositoryFlags();
+ }
+}
diff --git a/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableRepositoryManager.java b/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableRepositoryManager.java
new file mode 100644
index 0000000000..8b5d9e7d72
--- /dev/null
+++ b/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/QueryableRepositoryManager.java
@@ -0,0 +1,174 @@
+/*******************************************************************************
+ * Copyright (c) 2007, 2018 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * 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 implements IQueryable {
+ 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.
+ *
+ * This method is long-running; progress and cancellation are provided
+ * by the given progress monitor.
+ *
+ *
+ * @param query The query to perform..
+ * @param monitor a progress monitor, or null
if progress
+ * reporting is not desired
+ * @return The QueryResult argument
+ */
+ @Override
+ public IQueryResult query(IQuery query, IProgressMonitor monitor) {
+ IRepositoryManager manager = getRepositoryManager();
+ if (monitor == null)
+ monitor = new NullProgressMonitor();
+ return query(getRepoLocations(manager), query, monitor);
+ }
+
+ public IQueryable locationsQueriable() {
+ return (query, monitor) -> query.perform(getRepoLocations(getRepositoryManager()).iterator());
+ }
+
+ protected Collection getRepoLocations(IRepositoryManager manager) {
+ Set locations = new HashSet<>();
+ locations.addAll(Arrays.asList(manager.getKnownRepositories(repositoryFlags)));
+ if (includeDisabledRepos) {
+ locations.addAll(Arrays.asList(manager.getKnownRepositories(IRepositoryManager.REPOSITORIES_DISABLED | repositoryFlags)));
+ }
+ return locations;
+ }
+
+ /**
+ * 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 true
if all repositories to be queried by the
+ * receiver are loaded, false
if they
+ * are not.
+ */
+ public boolean areRepositoriesLoaded() {
+ IRepositoryManager mgr = getRepositoryManager();
+ if (mgr == null)
+ return false;
+ for (URI repoURI : getRepoLocations(mgr)) {
+ IRepository repo = getRepository(mgr, repoURI);
+ // A not-loaded repo doesn't count if it's considered missing (not found)
+ if (repo == null && !tracker.hasNotFoundStatusBeenReported(repoURI))
+ return false;
+ }
+ return true;
+ }
+
+ protected abstract IRepository getRepository(IRepositoryManager manager, URI location);
+
+ 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);
+ return repo;
+ }
+
+ /**
+ * Return the appropriate repository manager, or null
if none could be found.
+ * @return the repository manager
+ */
+ protected abstract IRepositoryManager 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 null
if no repository could
+ * be found at that location.
+ */
+ protected abstract IRepository doLoadRepository(IRepositoryManager manager, URI location, IProgressMonitor monitor) throws ProvisionException;
+
+ @SuppressWarnings("unchecked")
+ protected IQueryResult query(Collection uris, IQuery query, IProgressMonitor monitor) {
+ if (query instanceof RepositoryLocationQuery) {
+ return (IQueryResult) locationsQueriable().query((IQuery) query, monitor);
+ }
+ SubMonitor sub = SubMonitor.convert(monitor, (uris.size() + 1) * 100);
+ ArrayList> loadedRepos = new ArrayList<>(uris.size());
+ for (URI uri : uris) {
+ IRepository repo = null;
+ try {
+ repo = loadRepository(getRepositoryManager(), uri, sub.newChild(100));
+ } catch (ProvisionException e) {
+ tracker.reportLoadFailure(uri, e);
+ } catch (OperationCanceledException e) {
+ // user has canceled
+ repo = null;
+ }
+ if (repo != null)
+ loadedRepos.add(repo);
+ }
+ if (loadedRepos.size() > 0) {
+ return QueryUtil.compoundQueryable(loadedRepos).query(query, sub.newChild(100));
+ }
+ return Collector.emptyCollector();
+ }
+
+ public void setRespositoryFlags(int flags) {
+ this.repositoryFlags = flags;
+ }
+
+}
diff --git a/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/RepositoryLocationQuery.java b/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/RepositoryLocationQuery.java
new file mode 100644
index 0000000000..8f1ae7e94e
--- /dev/null
+++ b/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/RepositoryLocationQuery.java
@@ -0,0 +1,32 @@
+/*******************************************************************************
+ * Copyright (c) 2009, 2010 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.equinox.internal.p2.ui;
+
+import org.eclipse.equinox.p2.query.ExpressionMatchQuery;
+
+import java.net.URI;
+import org.eclipse.equinox.p2.metadata.expression.ExpressionUtil;
+
+/**
+ * RepositoryLocationQuery yields true for all URI elements.
+ *
+ * @since 3.5
+ */
+public class RepositoryLocationQuery extends ExpressionMatchQuery {
+
+ public RepositoryLocationQuery() {
+ super(URI.class, ExpressionUtil.TRUE_EXPRESSION);
+ }
+}
diff --git a/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/RepositoryOperationBeginningEvent.java b/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/RepositoryOperationBeginningEvent.java
new file mode 100644
index 0000000000..89acad61cd
--- /dev/null
+++ b/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/RepositoryOperationBeginningEvent.java
@@ -0,0 +1,38 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ ******************************************************************************/
+
+package org.eclipse.equinox.internal.p2.ui;
+
+import java.util.EventObject;
+
+/**
+ * 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 RepositoryOperationBeginningEvent extends EventObject {
+
+ private static final long serialVersionUID = -7529156836242774280L;
+
+ /**
+ * Construct a new instance of this event.
+ * @param source the source of the event
+ */
+ public RepositoryOperationBeginningEvent(Object source) {
+ super(source);
+ }
+
+}
diff --git a/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/RepositoryOperationEndingEvent.java b/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/RepositoryOperationEndingEvent.java
new file mode 100644
index 0000000000..7e953a8ef7
--- /dev/null
+++ b/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/RepositoryOperationEndingEvent.java
@@ -0,0 +1,82 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2010 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * 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 null
+ * 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 null
return value indicates that there
+ * was not a single underlying repository operation.
+ *
+ * @return the {@link RepositoryEvent} that was involved in the operation. May be
+ * null
. 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 true
if clients should update to reflect to this event, false
+ * if the client should ignore the entire operation.
+ */
+ public boolean update() {
+ return update;
+ }
+
+}
diff --git a/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/RepositoryTrackerComponent.java b/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/RepositoryTrackerComponent.java
new file mode 100644
index 0000000000..bcc152da87
--- /dev/null
+++ b/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/RepositoryTrackerComponent.java
@@ -0,0 +1,34 @@
+/*******************************************************************************
+ * Copyright (c) 2011 EclipseSource Inc. and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * EclipseSource Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.ui;
+
+import org.eclipse.equinox.p2.core.IProvisioningAgent;
+import org.eclipse.equinox.p2.core.spi.IAgentServiceFactory;
+import org.eclipse.equinox.p2.operations.RepositoryTracker;
+import org.eclipse.equinox.p2.ui.ProvisioningUI;
+
+/**
+ * Component that provides a factory that can create and initialize
+ * {@link RepositoryTracker} instances.
+ */
+public class RepositoryTrackerComponent implements IAgentServiceFactory {
+
+ @Override
+ public Object createService(IProvisioningAgent agent) {
+ ProvisioningUI ui = agent.getService(ProvisioningUI.class);
+ if (ui == null)
+ return null;
+ return new ColocatedRepositoryTracker(ui);
+ }
+}
diff --git a/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ServiceUIComponent.java b/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ServiceUIComponent.java
new file mode 100644
index 0000000000..cad8f35b98
--- /dev/null
+++ b/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ServiceUIComponent.java
@@ -0,0 +1,31 @@
+/*******************************************************************************
+ * Copyright (c) 2010 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.ui;
+
+import org.eclipse.equinox.p2.core.IProvisioningAgent;
+import org.eclipse.equinox.p2.core.UIServices;
+import org.eclipse.equinox.p2.core.spi.IAgentServiceFactory;
+
+/**
+ * Component that provides a factory that can create and initialize
+ * {@link UIServices} instances.
+ */
+public class ServiceUIComponent implements IAgentServiceFactory {
+
+ @Override
+ public Object createService(IProvisioningAgent agent) {
+ return new ValidationDialogServiceUI(agent);
+ }
+
+}
diff --git a/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/UpdateManagerCompatibility.java b/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/UpdateManagerCompatibility.java
new file mode 100644
index 0000000000..b1adf7354b
--- /dev/null
+++ b/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/UpdateManagerCompatibility.java
@@ -0,0 +1,284 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.ui;
+
+import java.io.*;
+import java.net.URI;
+import java.net.URISyntaxException;
+import java.util.Vector;
+import javax.xml.parsers.*;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.p2.core.helpers.SecureXMLUtil;
+import org.eclipse.equinox.internal.p2.ui.model.MetadataRepositoryElement;
+import org.eclipse.equinox.p2.engine.IProvisioningPlan;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.query.IQueryResult;
+import org.eclipse.equinox.p2.query.QueryUtil;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.FileDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.ui.statushandlers.StatusManager;
+import org.w3c.dom.*;
+import org.xml.sax.SAXException;
+
+/**
+ * Utility methods involving compatibility with the Eclipse Update Manager.
+ *
+ * @since 3.4
+ *
+ */
+public class UpdateManagerCompatibility {
+
+ // This value was copied from MetadataGeneratorHelper. Must be the same.
+ private static final String ECLIPSE_INSTALL_HANDLER_PROP = "org.eclipse.update.installHandler"; //$NON-NLS-1$
+
+ private static void parse(String fileName, Vector bookmarks) {
+ File file = new File(fileName);
+ if (!file.exists())
+ return;
+
+ try {
+ DocumentBuilderFactory documentBuilderFactory = SecureXMLUtil.newSecureDocumentBuilderFactory();
+ documentBuilderFactory.setNamespaceAware(true);
+ DocumentBuilder parser = documentBuilderFactory.newDocumentBuilder();
+ Document doc = parser.parse(file);
+ Node root = doc.getDocumentElement();
+ processRoot(root, bookmarks);
+ } catch (ParserConfigurationException e) {
+ logFail(e);
+ } catch (SAXException e) {
+ logFail(e);
+ } catch (IOException e) {
+ logFail(e);
+ }
+ }
+
+ private static MetadataRepositoryElement[] getSites(Vector bookmarks) {
+ return bookmarks.toArray(new MetadataRepositoryElement[bookmarks.size()]);
+ }
+
+ private static void processRoot(Node root, Vector bookmarks) {
+ if (root.getNodeName().equals("bookmarks")) { //$NON-NLS-1$
+ NodeList children = root.getChildNodes();
+ processChildren(children, bookmarks);
+ }
+ }
+
+ private static void processChildren(NodeList children, Vector bookmarks) {
+ for (int i = 0; i < children.getLength(); i++) {
+ Node child = children.item(i);
+ if (child.getNodeType() == Node.ELEMENT_NODE) {
+ if (child.getNodeName().equals("site")) { //$NON-NLS-1$
+ createSite(child, bookmarks);
+ } else if (child.getNodeName().equals("folder")) { //$NON-NLS-1$
+ createFolder(child, bookmarks);
+ }
+ }
+ }
+ }
+
+ private static void createSite(Node child, Vector bookmarks) {
+ URI uri = null;
+ try {
+ uri = URIUtil.fromString((getAttribute(child, "url"))); //$NON-NLS-1$
+ } catch (URISyntaxException e) {
+ logFail(e);
+ return;
+ }
+
+ String sel = getAttribute(child, "selected"); //$NON-NLS-1$
+ boolean selected = (sel != null && sel.equals("true")); //$NON-NLS-1$
+
+ MetadataRepositoryElement element = new MetadataRepositoryElement(null, uri, selected);
+ String nickname = getAttribute(child, "name"); //$NON-NLS-1$
+ if (nickname != null && nickname.length() > 0)
+ element.setNickname(nickname);
+ bookmarks.add(element);
+ }
+
+ private static void createFolder(Node child, Vector bookmarks) {
+ if (child.hasChildNodes())
+ processChildren(child.getChildNodes(), bookmarks);
+ }
+
+ private static String getAttribute(Node node, String name) {
+ NamedNodeMap atts = node.getAttributes();
+ Node att = atts.getNamedItem(name);
+ if (att != null) {
+ return att.getNodeValue();
+ }
+ return ""; //$NON-NLS-1$
+ }
+
+ private static void store(String fileName, Vector bookmarks) {
+ FileOutputStream fos = null;
+ OutputStreamWriter osw = null;
+ PrintWriter writer = null;
+ try {
+ fos = new FileOutputStream(fileName);
+ osw = new OutputStreamWriter(fos, "UTF8"); //$NON-NLS-1$
+ writer = new PrintWriter(osw);
+ writer.println(""); //$NON-NLS-1$
+ writer.println(""); //$NON-NLS-1$
+ for (MetadataRepositoryElement obj : bookmarks) {
+ writeObject(" ", obj, writer); //$NON-NLS-1$
+ }
+ } catch (IOException e) {
+ logFail(e);
+ } finally {
+ if (writer != null) {
+ writer.println(""); //$NON-NLS-1$
+ writer.flush();
+ writer.close();
+ }
+ try {
+ if (osw != null)
+ osw.close();
+ } catch (IOException e1) {
+ logFail(e1);
+ }
+ try {
+ if (fos != null)
+ fos.close();
+ } catch (IOException e2) {
+ logFail(e2);
+ }
+ }
+ }
+
+ private static void writeObject(String indent, Object obj, PrintWriter writer) {
+ if (obj instanceof MetadataRepositoryElement) {
+ MetadataRepositoryElement element = (MetadataRepositoryElement) obj;
+ String sel = element.isEnabled() ? "true" : "false"; //$NON-NLS-1$ //$NON-NLS-2$
+ String name = element.getName();
+ writer.print(indent + ""); //$NON-NLS-1$
+ }
+ }
+
+ public static IStatus getInstallHandlerStatus(IProvisioningPlan plan) {
+ IQueryResult result = plan.getAdditions().query(QueryUtil.createIUAnyQuery(), null);
+ for (IInstallableUnit iu : result) {
+ if (iu != null && iu.getProperty(ECLIPSE_INSTALL_HANDLER_PROP) != null)
+ return new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, NLS.bind(ProvUIMessages.UpdateManagerCompatibility_ItemRequiresUpdateManager, iu.getId()));
+ }
+ return Status.OK_STATUS;
+ }
+
+ /**
+ * Prompt the user for a file and import the sites specified in that
+ * file. Return the collection of repo elements in the import.
+ * @param shell the shell used to parent any dialogs used.
+ */
+ public static MetadataRepositoryElement[] importSites(Shell shell) {
+ FileDialog dialog = new FileDialog(shell);
+ dialog.setText(ProvUIMessages.UpdateManagerCompatibility_ImportSitesTitle);
+ dialog.setFilterExtensions(new String[] {"*.xml", "*"}); //$NON-NLS-1$ //$NON-NLS-2$
+
+ MetadataRepositoryElement[] sites = null;
+
+ String bookmarksFile = dialog.open();
+ while (bookmarksFile != null && sites == null) {
+ File file = new File(bookmarksFile);
+ sites = readBookmarkFile(file);
+ if (sites == null || sites.length == 0) {
+ MessageDialog.openInformation(shell, ProvUIMessages.UpdateManagerCompatibility_InvalidSitesTitle, ProvUIMessages.UpdateManagerCompatibility_InvalidSiteFileMessage);
+ bookmarksFile = dialog.open();
+ }
+ }
+ return sites == null ? new MetadataRepositoryElement[0] : sites;
+ }
+
+ public static MetadataRepositoryElement[] readBookmarkFile(File file) {
+ Vector bookmarks = new Vector<>();
+ parse(file.getAbsolutePath(), bookmarks);
+ return getSites(bookmarks);
+ }
+
+ public static void writeBookmarkFile(String filename, MetadataRepositoryElement[] sites) {
+ Vector bookmarks = new Vector<>(sites.length);
+ for (MetadataRepositoryElement site : sites)
+ bookmarks.add(site);
+ store(filename, bookmarks);
+
+ }
+
+ /**
+ * Export the specified list of sites to a bookmarks file that
+ * can be read later.
+ *
+ * @param shell the shell used to parent the export dialog
+ * @param sites the sites to export
+ */
+
+ public static void exportSites(Shell shell, MetadataRepositoryElement[] sites) {
+ FileDialog dialog = new FileDialog(shell, SWT.SAVE);
+ dialog.setText(ProvUIMessages.UpdateManagerCompatibility_ExportSitesTitle);
+ dialog.setFileName("bookmarks.xml"); //$NON-NLS-1$
+ dialog.setFilterExtensions(new String[] {"*.xml", "*"}); //$NON-NLS-1$ //$NON-NLS-2$
+ dialog.setOverwrite(true);
+
+ String bookmarksFile = dialog.open();
+ if (bookmarksFile == null)
+ return;
+
+ writeBookmarkFile(bookmarksFile, sites);
+ }
+
+ /**
+ * Open the old UpdateManager installer UI using the specified shell.
+ * We do not call the UpdateManagerUI class directly because we want to be able to be configured
+ * without requiring those plug-ins. Instead, we invoke a known command.
+ */
+ public static void openInstaller() {
+ ProvUI.openUpdateManagerInstaller(null);
+ }
+
+ private static void logFail(Throwable t) {
+ Status failStatus = new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, t.getLocalizedMessage(), t);
+ ProvUI.reportStatus(failStatus, StatusManager.LOG);
+ }
+
+ private static String getWritableXMLString(String value) {
+ StringBuilder buf = new StringBuilder();
+ if (value == null)
+ return buf.toString();
+ for (int i = 0; i < value.length(); i++) {
+ char c = value.charAt(i);
+ switch (c) {
+ case '&' :
+ buf.append("&"); //$NON-NLS-1$
+ break;
+ case '<' :
+ buf.append("<"); //$NON-NLS-1$
+ break;
+ case '>' :
+ buf.append(">"); //$NON-NLS-1$
+ break;
+ case '\'' :
+ buf.append("'"); //$NON-NLS-1$
+ break;
+ case '\"' :
+ buf.append("""); //$NON-NLS-1$
+ break;
+ default :
+ buf.append(c);
+ break;
+ }
+ }
+ return buf.toString();
+ }
+}
\ No newline at end of file
diff --git a/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ValidationDialogServiceUI.java b/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ValidationDialogServiceUI.java
new file mode 100644
index 0000000000..7dd479470f
--- /dev/null
+++ b/tycho-its/projects/api-tools/missing-bin/org.eclipse.equinox.p2.ui/src/org/eclipse/equinox/internal/p2/ui/ValidationDialogServiceUI.java
@@ -0,0 +1,611 @@
+/*******************************************************************************
+ * Copyright (c) 2008, 2018 IBM Corporation and others.
+ *
+ * This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License 2.0
+ * which accompanies this distribution, and is available at
+ * https://www.eclipse.org/legal/epl-2.0/
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * IBM Corporation - initial API and implementation
+ * Rapicorp, Inc. - add support for information dialog
+ *******************************************************************************/
+package org.eclipse.equinox.internal.p2.ui;
+
+import java.io.File;
+import java.net.URI;
+import java.net.URL;
+import java.security.cert.Certificate;
+import java.security.cert.X509Certificate;
+import java.util.*;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
+import java.util.function.Consumer;
+import java.util.function.Function;
+import java.util.stream.Collectors;
+import org.bouncycastle.openpgp.PGPPublicKey;
+import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.equinox.internal.p2.engine.phases.AuthorityChecker;
+import org.eclipse.equinox.internal.p2.ui.dialogs.*;
+import org.eclipse.equinox.p2.core.IProvisioningAgent;
+import org.eclipse.equinox.p2.core.UIServices;
+import org.eclipse.equinox.p2.metadata.IArtifactKey;
+import org.eclipse.equinox.p2.metadata.IInstallableUnit;
+import org.eclipse.equinox.p2.repository.artifact.spi.IArtifactUIServices;
+import org.eclipse.equinox.p2.repository.metadata.spi.IInstallableUnitUIServices;
+import org.eclipse.equinox.p2.repository.spi.PGPPublicKeyService;
+import org.eclipse.equinox.p2.ui.LoadMetadataRepositoryJob;
+import org.eclipse.jface.dialogs.*;
+import org.eclipse.jface.viewers.TreeNode;
+import org.eclipse.jface.window.IShellProvider;
+import org.eclipse.jface.window.Window;
+import org.eclipse.osgi.util.NLS;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.SelectionListener;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.widgets.*;
+import org.eclipse.ui.PlatformUI;
+
+/**
+ * The default GUI-based implementation of {@link UIServices}. The service
+ * declaration is made in the serviceui_component.xml file.
+ *
+ */
+public class ValidationDialogServiceUI extends UIServices implements IArtifactUIServices, IInstallableUnitUIServices {
+
+ private final IProvisioningAgent agent;
+
+ private Display display;
+
+ private Consumer linkHandler = link -> {
+ if (PlatformUI.isWorkbenchRunning()) {
+ try {
+ URL url = new URL(link);
+ PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser().openURL(url);
+ } catch (Exception x) {
+ ProvUIActivator.getDefault().getLog()
+ .log(new Status(IStatus.ERROR, ProvUIActivator.PLUGIN_ID, x.getMessage(), x));
+ }
+ }
+ };
+
+ private IShellProvider shellProvider = () -> ProvUI.getDefaultParentShell();
+
+ public ValidationDialogServiceUI() {
+ this(null);
+ }
+
+ public ValidationDialogServiceUI(IProvisioningAgent agent) {
+ this.agent = agent;
+ }
+
+ static final class MessageDialogWithLink extends MessageDialog {
+ private final String linkText;
+ private final Consumer linkOpener;
+
+ MessageDialogWithLink(Shell parentShell, String dialogTitle, Image dialogTitleImage, String dialogMessage,
+ int dialogImageType, String[] dialogButtonLabels, int defaultIndex, String linkText,
+ Consumer linkOpener) {
+ super(parentShell, dialogTitle, dialogTitleImage, dialogMessage, dialogImageType, dialogButtonLabels,
+ defaultIndex);
+ this.linkText = linkText;
+ this.linkOpener = linkOpener;
+ }
+
+ @Override
+ protected Control createCustomArea(Composite parent) {
+ if (linkText == null)
+ return super.createCustomArea(parent);
+
+ Link link = new Link(parent, SWT.NONE);
+ link.setText(linkText);
+ link.addSelectionListener(SelectionListener.widgetSelectedAdapter(e -> {
+ linkOpener.accept(e.text);
+ }));
+ return link;
+ }
+ }
+
+ /**
+ * Subclassed to add a cancel button to the error dialog.
+ */
+ static class OkCancelErrorDialog extends ErrorDialog {
+
+ public OkCancelErrorDialog(Shell parentShell, String dialogTitle, String message, IStatus status,
+ int displayMask) {
+ super(parentShell, dialogTitle, message, status, displayMask);
+ }
+
+ @Override
+ protected void createButtonsForButtonBar(Composite parent) {
+ // create OK and Details buttons
+ createButton(parent, IDialogConstants.OK_ID, ProvUIMessages.ServiceUI_InstallAnywayAction_Label, true);
+ createButton(parent, IDialogConstants.CANCEL_ID, IDialogConstants.CANCEL_LABEL, true);
+ createDetailsButton(parent);
+ }
+ }
+
+ @Override
+ public AuthenticationInfo getUsernamePassword(final String location) {
+
+ final AuthenticationInfo[] result = new AuthenticationInfo[1];
+ if (!suppressAuthentication() && !isHeadless()) {
+ getDisplay().syncExec(() -> {
+ Shell shell = shellProvider.getShell();
+ String message = NLS.bind(ProvUIMessages.ServiceUI_LoginDetails, location);
+ UserValidationDialog dialog = new UserValidationDialog(shell, ProvUIMessages.ServiceUI_LoginRequired,
+ null, message);
+ int dialogCode = dialog.open();
+ if (dialogCode == Window.OK) {
+ result[0] = dialog.getResult();
+ } else if (dialogCode == Window.CANCEL) {
+ result[0] = AUTHENTICATION_PROMPT_CANCELED;
+ }
+ });
+ }
+ return result[0];
+ }
+
+ private boolean suppressAuthentication() {
+ Job job = Job.getJobManager().currentJob();
+ if (job != null) {
+ return job.getProperty(LoadMetadataRepositoryJob.SUPPRESS_AUTHENTICATION_JOB_MARKER) != null;
+ }
+ return false;
+ }
+
+ @Override
+ public TrustInfo getTrustInfo(Certificate[][] untrustedChains, final String[] unsignedDetail) {
+ return getTrustInfo(untrustedChains, Collections.emptyList(), unsignedDetail);
+ }
+
+ @Override
+ public TrustInfo getTrustInfo(Certificate[][] untrustedChains, Collection untrustedPublicKeys,
+ final String[] unsignedDetail) {
+ if (untrustedChains == null) {
+ untrustedChains = new Certificate[][] {};
+ }
+ boolean trustUnsigned = true;
+ boolean persistTrust = false;
+ List trustedCertificates = new ArrayList<>();
+ List trustedKeys = new ArrayList<>();
+ // Some day we may summarize all of this in one UI, or perhaps we'll have a
+ // preference to honor regarding
+ // unsigned content. For now we prompt separately first as to whether unsigned
+ // detail should be trusted
+ if (!isHeadless() && unsignedDetail != null && unsignedDetail.length > 0) {
+ final boolean[] result = new boolean[] { false };
+ getDisplay().syncExec(new Runnable() {
+ @Override
+ public void run() {
+ Shell shell = shellProvider.getShell();
+ OkCancelErrorDialog dialog = new OkCancelErrorDialog(shell, ProvUIMessages.ServiceUI_warning_title,
+ null, createStatus(), IStatus.WARNING);
+ result[0] = dialog.open() == IDialogConstants.OK_ID;
+ }
+
+ private IStatus createStatus() {
+ MultiStatus parent = new MultiStatus(ProvUIActivator.PLUGIN_ID, 0,
+ ProvUIMessages.ServiceUI_unsigned_message, null);
+ for (String element : unsignedDetail) {
+ parent.add(new Status(IStatus.WARNING, ProvUIActivator.PLUGIN_ID, element));
+ }
+ return parent;
+ }
+ });
+ trustUnsigned = result[0];
+ }
+ // For now, there is no need to show certificates if there was unsigned content
+ // and we don't trust it.
+ if (!trustUnsigned)
+ return new TrustInfo(trustedCertificates, trustedKeys, persistTrust, trustUnsigned);
+
+ // We've established trust for unsigned content, now examine the untrusted
+ // chains
+ if (!isHeadless() && (untrustedChains.length > 0 || !untrustedPublicKeys.isEmpty())) {
+ return getTrustInfo(
+ Arrays.stream(untrustedChains).collect(
+ Collectors.toMap(Arrays::asList, it -> Set.of(), (e1, e2) -> e1, LinkedHashMap::new)),
+ untrustedPublicKeys.stream().collect(
+ Collectors.toMap(Function.identity(), it -> Set.of(), (e1, e2) -> e1, LinkedHashMap::new)),
+ null, null);
+
+ }
+
+ return new TrustInfo(trustedCertificates, trustedKeys, persistTrust, trustUnsigned);
+ }
+
+ @Override
+ public TrustInfo getTrustInfo(Map, Set> untrustedCertificates,
+ Map> untrustedPGPKeys, //
+ Set unsignedArtifacts, //
+ Map artifacts) {
+ boolean trustUnsigned = true;
+ AtomicBoolean persistTrust = new AtomicBoolean();
+ AtomicBoolean trustAlways = new AtomicBoolean();
+ List trustedCertificates = new ArrayList<>();
+ List trustedKeys = new ArrayList<>();
+ if (!isHeadless()) {
+ TreeNode[] input = createTreeNodes(untrustedCertificates, untrustedPGPKeys, unsignedArtifacts, artifacts);
+ if (input.length != 0) {
+ trustUnsigned = unsignedArtifacts == null || unsignedArtifacts.isEmpty();
+ List