From 9448ff0ec336b98d367e2cf95c6d9b0efed96d53 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 29 Oct 2025 07:41:44 +0000 Subject: [PATCH 1/3] Initial plan From 94a94b041617746f19efbda9537e8a31bf1ef8b0 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 29 Oct 2025 07:50:50 +0000 Subject: [PATCH 2/3] Add Install Sources menu item and handler - Created InstallSourcesHandler to toggle org.eclipse.update.install.sources property - Added command, handler, and menu contribution to plugin.xml - Added UI messages for Install Sources feature - Menu item positioned after Install New Software in Help menu Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com> --- .../plugin.properties | 2 + .../org.eclipse.equinox.p2.ui.sdk/plugin.xml | 18 +++ .../p2/ui/sdk/InstallSourcesHandler.java | 151 ++++++++++++++++++ .../internal/p2/ui/sdk/ProvSDKMessages.java | 7 + .../internal/p2/ui/sdk/messages.properties | 7 + 5 files changed, 185 insertions(+) create mode 100644 bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/InstallSourcesHandler.java diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/plugin.properties b/bundles/org.eclipse.equinox.p2.ui.sdk/plugin.properties index 372fe98ce9..b7224084f5 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk/plugin.properties +++ b/bundles/org.eclipse.equinox.p2.ui.sdk/plugin.properties @@ -20,6 +20,8 @@ Update.command=Check for Updates Update.command.mnemonic=U Install.command=Install New Software... Install.command.mnemonic=S +InstallSources.command=Install Sources +InstallSources.command.mnemonic=o InstallationDetails.command=Installation Details InstallationDetails.command.mnemonic=I TempInstallView.command=Installation Information diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/plugin.xml b/bundles/org.eclipse.equinox.p2.ui.sdk/plugin.xml index 802b742a12..e05fa133e3 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk/plugin.xml +++ b/bundles/org.eclipse.equinox.p2.ui.sdk/plugin.xml @@ -54,6 +54,10 @@ name="%Install.command" id="org.eclipse.equinox.p2.ui.sdk.install"> + + + + @@ -93,6 +101,16 @@ + + + + + { + MessageDialog.openInformation(PlatformUI.getWorkbench().getModalDialogShellProvider().getShell(), + ProvSDKMessages.InstallSourcesHandler_EnabledTitle, + ProvSDKMessages.InstallSourcesHandler_EnabledMessage); + // Trigger an update operation to fetch sources + triggerUpdateForSources(provUI); + }); + } else { + PlatformUI.getWorkbench().getDisplay().asyncExec(() -> { + MessageDialog.openInformation(PlatformUI.getWorkbench().getModalDialogShellProvider().getShell(), + ProvSDKMessages.InstallSourcesHandler_DisabledTitle, + ProvSDKMessages.InstallSourcesHandler_DisabledMessage); + }); + } + } + return result; + } else { + return plan.getStatus(); + } + } finally { + sub.done(); + } + } + }; + + job.setUser(true); + job.schedule(); + + return null; + } + + /** + * Triggers an update operation to fetch missing source bundles + */ + private void triggerUpdateForSources(ProvisioningUI provUI) { + UpdateOperation op = provUI.getUpdateOperation(null, null); + + Job updateJob = new Job(ProvSDKMessages.InstallSourcesHandler_UpdateJobName) { + @Override + protected IStatus run(IProgressMonitor monitor) { + IStatus result = op.resolveModal(monitor); + if (result.isOK() && op.hasResolved()) { + // Schedule the provisioning job + ProvisioningJob provJob = op.getProvisioningJob(monitor); + if (provJob != null) { + provJob.schedule(); + } + } + return Status.OK_STATUS; + } + }; + updateJob.setUser(true); + updateJob.schedule(); + } + + protected ProvisioningUI getProvisioningUI() { + return ProvisioningUI.getDefaultUI(); + } +} diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/ProvSDKMessages.java b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/ProvSDKMessages.java index c42a8638a8..95ecf67dd5 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/ProvSDKMessages.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/ProvSDKMessages.java @@ -100,5 +100,12 @@ public class ProvSDKMessages extends NLS { public static String TrustPreferencePage_TrustAllYes; public static String TrustPreferencePage_TypeColumn; public static String TrustPreferencePage_ValidityColumn; + public static String InstallSourcesHandler_DisabledMessage; + public static String InstallSourcesHandler_DisabledTitle; + public static String InstallSourcesHandler_EnabledMessage; + public static String InstallSourcesHandler_EnabledTitle; + public static String InstallSourcesHandler_JobName; + public static String InstallSourcesHandler_ProgressTaskName; + public static String InstallSourcesHandler_UpdateJobName; } diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/messages.properties b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/messages.properties index c2a3a84eff..75a3297f34 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/messages.properties +++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/messages.properties @@ -85,3 +85,10 @@ TrustPreferencePage_TrustAllNo=No, Prompt Me Instead TrustPreferencePage_TrustAllYes=Yes, I Accept the Risk TrustPreferencePage_TypeColumn=Type TrustPreferencePage_ValidityColumn=Validity Dates +InstallSourcesHandler_DisabledMessage=Source bundle installation has been disabled. Source bundles will not be automatically installed. +InstallSourcesHandler_DisabledTitle=Install Sources Disabled +InstallSourcesHandler_EnabledMessage=Source bundle installation has been enabled. An update will be performed to fetch missing source bundles. +InstallSourcesHandler_EnabledTitle=Install Sources Enabled +InstallSourcesHandler_JobName=Toggling source bundle installation +InstallSourcesHandler_ProgressTaskName=Updating source installation preference... +InstallSourcesHandler_UpdateJobName=Fetching source bundles... From dd655dfdcab18532c1ac7dec5b2d5f7d28e8497d Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 29 Oct 2025 07:52:24 +0000 Subject: [PATCH 3/3] Clean up imports in InstallSourcesHandler Co-authored-by: laeubi <1331477+laeubi@users.noreply.github.com> --- .../equinox/internal/p2/ui/sdk/InstallSourcesHandler.java | 1 - 1 file changed, 1 deletion(-) diff --git a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/InstallSourcesHandler.java b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/InstallSourcesHandler.java index 7f626958f6..9b9509b2fd 100644 --- a/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/InstallSourcesHandler.java +++ b/bundles/org.eclipse.equinox.p2.ui.sdk/src/org/eclipse/equinox/internal/p2/ui/sdk/InstallSourcesHandler.java @@ -20,7 +20,6 @@ import org.eclipse.equinox.internal.p2.director.ProfileChangeRequest; import org.eclipse.equinox.p2.core.IProvisioningAgent; import org.eclipse.equinox.p2.engine.*; -import org.eclipse.equinox.p2.metadata.IInstallableUnit; import org.eclipse.equinox.p2.operations.*; import org.eclipse.equinox.p2.ui.ProvisioningUI; import org.eclipse.jface.dialogs.MessageDialog;