reference = context
+ .getServiceReference(IProvisioningAgentProvider.class);
+ if (reference != null) {
+ IProvisioningAgentProvider agentProvider = context.getService(reference);
+ if (agentProvider != null) {
+ try {
+ return agentProvider.createAgent(P2TargetUtils.AGENT_LOCATION);
+ } catch (Exception e) {
+ PDELaunchingPlugin.log(e);
+ } finally {
+ context.ungetService(reference);
+ }
+ }
+ }
+ return null;
+ }
+
+ /**
+ * Retrieves the local file for an artifact from the repository.
+ */
+ private File getArtifactFile(IArtifactRepositoryManager manager, IArtifactKey key, URI repoUri) {
+ try {
+ IArtifactRepository artifactRepo = manager.loadRepository(repoUri, null);
+ if (artifactRepo instanceof IFileArtifactRepository fileRepo) {
+ File location = fileRepo.getArtifactFile(key);
+ if (location != null && location.exists()) {
+ return location;
+ }
+ }
+ } catch (Exception e) {
+ // Ignore and return null
+ }
+ return null;
+ }
+}
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java
index 575ac6fd8fa..98b8010e493 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/PDEUIMessages.java
@@ -2713,6 +2713,8 @@ public class PDEUIMessages extends NLS {
public static String LaunchingPreferencePage_description;
+ public static String LaunchingPreferencePage_searchRepositoriesForSource;
+
public static String RemoveLazyLoadingDirectiveResolution_remove;
public static String RemoveAutomaticModuleResolution_remove;
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties
index 8b45f594b30..e5ebc465eea 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/pderesources.properties
@@ -2194,6 +2194,7 @@ LauncherSection_launcherName=Launcher Name:
LauncherSection_dialogTitle=Image Selection
LauncherSection_dialogMessage=Select an image:
LaunchingPreferencePage_description=Settings for Plug-in launches
+LaunchingPreferencePage_searchRepositoriesForSource=Search in repositories for source bundles (may be slower)
RemoveLazyLoadingDirectiveResolution_remove=Remove lazy activation header
RemoveAutomaticModuleResolution_remove=Remove automatic module name header
ProductDefinitonWizardPage_applicationDefinition=
diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/preferences/LaunchingPreferencePage.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/preferences/LaunchingPreferencePage.java
index 6da6486e1cc..49a416cc40f 100644
--- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/preferences/LaunchingPreferencePage.java
+++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/preferences/LaunchingPreferencePage.java
@@ -148,6 +148,8 @@ protected boolean isFile() {
private Button fAddSwtNonDisposalReporting;
+ private Button fSearchRepositoriesForSource;
+
private Text fRuntimeWorkspaceLocation;
private Button fRuntimeWorkspaceLocationRadio;
private Button fRuntimeWorkspacesContainerRadio;
@@ -188,6 +190,11 @@ protected Control createContents(Composite parent) {
fAddSwtNonDisposalReporting
.setSelection(launchingStore.getBoolean(ILaunchingPreferenceConstants.ADD_SWT_NON_DISPOSAL_REPORTING));
+ fSearchRepositoriesForSource = new Button(optionComp, SWT.CHECK);
+ fSearchRepositoriesForSource.setText(PDEUIMessages.LaunchingPreferencePage_searchRepositoriesForSource);
+ fSearchRepositoriesForSource
+ .setSelection(launchingStore.getBoolean(ILaunchingPreferenceConstants.PROP_SEARCH_REPOSITORIES_FOR_SOURCE));
+
new DefaultRuntimeWorkspaceBlock().createControl(composite);
fRuntimeWorkspaceLocation
.setText(launchingStore.getString(ILaunchingPreferenceConstants.PROP_RUNTIME_WORKSPACE_LOCATION));
@@ -250,6 +257,8 @@ public boolean performOk() {
fJunitAutoValidate.getSelection());
launchingStore.setValueOrRemove(ILaunchingPreferenceConstants.ADD_SWT_NON_DISPOSAL_REPORTING,
fAddSwtNonDisposalReporting.getSelection());
+ launchingStore.setValueOrRemove(ILaunchingPreferenceConstants.PROP_SEARCH_REPOSITORIES_FOR_SOURCE,
+ fSearchRepositoriesForSource.getSelection());
try {
launchingStore.flush();
} catch (BackingStoreException e) {
@@ -287,6 +296,8 @@ protected void performDefaults() {
launchingStore.getDefaultBoolean(ILaunchingPreferenceConstants.PROP_JUNIT_ADD_NEW_WORKSPACE_PLUGINS));
fJunitAutoValidate.setSelection(
launchingStore.getDefaultBoolean(ILaunchingPreferenceConstants.PROP_JUNIT_VALIDATE_LAUNCH));
+ fSearchRepositoriesForSource.setSelection(
+ launchingStore.getDefaultBoolean(ILaunchingPreferenceConstants.PROP_SEARCH_REPOSITORIES_FOR_SOURCE));
}
@Override