-
Notifications
You must be signed in to change notification settings - Fork 0
Add Source Lookups preference page with ordering and external source locator for issue #2073 #66
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 7 commits
994ac5d
0bf3e23
5055277
10a7caf
4f6aefc
e33920f
c659695
3070dd8
b8b9b54
14ae9ee
cbb9af3
9f3b5fc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| # Improve UI screenshot generation for PR documentation | ||
|
|
||
| ## Problem | ||
|
|
||
| The current approach to generating screenshots for UI components using Python/PIL produces white/blank images that don't accurately represent the Eclipse UI. | ||
|
|
||
| ## Proposed Solutions | ||
|
|
||
| ### 1. SWT Snippet Approach | ||
| Create small SWT snippets that can render the UI components. However, this requires complex setup for many components that depend on Eclipse platform infrastructure. | ||
|
|
||
| ### 2. MCP Server with Eclipse Install (Recommended) | ||
| Create a Model Context Protocol (MCP) server that includes a full Eclipse installation. This would allow: | ||
| - Programmatic access to Eclipse UI components | ||
| - Automated screenshot capture of actual rendered UI | ||
| - Better representation of Eclipse styling and themes | ||
| - Reusable infrastructure for future UI documentation | ||
|
|
||
| ## Context | ||
|
|
||
| This issue was identified while implementing the Source Lookups preference page (see related PR for #2073). The generated screenshot using Python/PIL doesn't accurately show how the preference page would look in a real Eclipse environment. | ||
|
|
||
| ## Benefits of MCP Server Approach | ||
|
|
||
| - **Accuracy**: Screenshots show actual Eclipse UI rendering with proper fonts, colors, and styling | ||
| - **Reusability**: Can be used for all future UI-related PRs and documentation | ||
| - **Automation**: Can be integrated into CI/CD pipeline for automatic screenshot generation | ||
| - **Quality**: Better documentation quality improves contributor and user experience | ||
|
|
||
| ## Implementation Ideas | ||
|
|
||
| 1. Create a headless Eclipse installation in a container | ||
| 2. Build an MCP server that can: | ||
| - Launch Eclipse workbench programmatically | ||
| - Navigate to specific UI components (dialogs, preference pages, views, etc.) | ||
| - Capture screenshots using SWT/platform APIs | ||
| - Return screenshots as base64 or file paths | ||
| 3. Integrate with Copilot workflow for automatic screenshot generation | ||
|
|
||
| ## Labels | ||
|
|
||
| - `enhancement` | ||
| - `documentation` | ||
| - `tooling` | ||
|
|
||
| ## Related | ||
|
|
||
| - Source Lookups preference page PR | ||
| - Issue #2073 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,177 @@ | ||
| /******************************************************************************* | ||
| * Copyright (c) 2025 Christoph Läubrich 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: | ||
| * Christoph Läubrich - initial API and implementation | ||
| *******************************************************************************/ | ||
| package org.eclipse.pde.internal.core; | ||
|
|
||
| import java.util.Arrays; | ||
| import java.util.List; | ||
|
|
||
| import org.eclipse.core.runtime.IPath; | ||
| import org.eclipse.jface.preference.IPreferenceStore; | ||
| import org.eclipse.pde.core.IPluginSourcePathLocator; | ||
| import org.eclipse.pde.core.plugin.IPluginBase; | ||
| import org.eclipse.pde.internal.ui.IPreferenceConstants; | ||
| import org.eclipse.pde.internal.ui.PDEPlugin; | ||
|
|
||
| /** | ||
| * A plugin source path locator that queries external repositories and the | ||
| * Eclipse index for source bundles based on the configured preferences. | ||
| * <p> | ||
| * This locator checks the Source Lookups preference page settings and performs | ||
| * lookups according to the configured order. | ||
| * </p> | ||
| * | ||
| * @since 3.17 | ||
| */ | ||
| public class ExternalPluginSourcePathLocator implements IPluginSourcePathLocator { | ||
|
|
||
| // Source lookup strategy identifiers | ||
| private static final String STRATEGY_REPOSITORIES = "REPOSITORIES"; //$NON-NLS-1$ | ||
| private static final String STRATEGY_TARGETS = "TARGETS"; //$NON-NLS-1$ | ||
| private static final String STRATEGY_INDEX = "INDEX"; //$NON-NLS-1$ | ||
| private static final String STRATEGY_SITES = "SITES"; //$NON-NLS-1$ | ||
|
|
||
| @Override | ||
| public IPath locateSource(IPluginBase plugin) { | ||
| IPreferenceStore store = PDEPlugin.getDefault().getPreferenceStore(); | ||
|
|
||
| // Check if source lookup is enabled | ||
| if (!store.getBoolean(IPreferenceConstants.SOURCE_LOOKUP_ENABLED)) { | ||
| return null; | ||
| } | ||
|
|
||
| // Get the lookup order | ||
| List<String> lookupOrder = getLookupOrder(store); | ||
|
|
||
| // Execute lookups in the configured order | ||
| for (String strategy : lookupOrder) { | ||
| IPath result = null; | ||
| switch (strategy) { | ||
| case STRATEGY_REPOSITORIES: | ||
| result = searchInRepositories(plugin, getConfiguredRepositories(store)); | ||
| break; | ||
| case STRATEGY_TARGETS: | ||
| result = searchInTargets(plugin, getSelectedTargets(store)); | ||
| break; | ||
| case STRATEGY_INDEX: | ||
| result = queryEclipseIndex(plugin); | ||
| break; | ||
| case STRATEGY_SITES: | ||
| result = queryAvailableSoftwareSites(plugin); | ||
| break; | ||
| default: | ||
| // Unknown strategy, skip | ||
| break; | ||
| } | ||
|
|
||
| if (result != null) { | ||
| return result; | ||
| } | ||
| } | ||
|
|
||
| return null; | ||
| } | ||
|
|
||
| /** | ||
| * Gets the configured lookup order from preferences. | ||
| * | ||
| * @param store the preference store | ||
| * @return the list of strategy identifiers in order | ||
| */ | ||
| private List<String> getLookupOrder(IPreferenceStore store) { | ||
| String order = store.getString(IPreferenceConstants.SOURCE_LOOKUP_ORDER); | ||
| if (order == null || order.trim().isEmpty()) { | ||
| // Use default order | ||
| return Arrays.asList(STRATEGY_REPOSITORIES, STRATEGY_TARGETS, STRATEGY_INDEX, STRATEGY_SITES); | ||
| } | ||
| return Arrays.asList(order.split(",")); //$NON-NLS-1$ | ||
| } | ||
|
|
||
| /** | ||
| * Searches for the source bundle in the configured repositories. | ||
| * | ||
| * @param plugin the plugin to locate sources for | ||
| * @param repositories the list of repository URLs | ||
| * @return the path to the source bundle or null if not found | ||
| */ | ||
| private IPath searchInRepositories(IPluginBase plugin, List<String> repositories) { | ||
| // TODO: Implement searching in configured repositories | ||
| // This will be implemented in a future step | ||
| return null; | ||
| } | ||
|
|
||
| /** | ||
| * Searches for the source bundle in the specified target platforms. | ||
| * | ||
| * @param plugin the plugin to locate sources for | ||
| * @param selectedTargets the list of selected target platform names | ||
| * @return the path to the source bundle or null if not found | ||
| */ | ||
| private IPath searchInTargets(IPluginBase plugin, List<String> selectedTargets) { | ||
| // TODO: Implement searching in selected target platforms | ||
| // This will be implemented in a future step | ||
| return null; | ||
| } | ||
|
laeubi marked this conversation as resolved.
|
||
|
|
||
| /** | ||
| * Queries the Eclipse index for the source bundle. | ||
| * | ||
| * @param plugin the plugin to locate sources for | ||
| * @return the path to the source bundle or null if not found | ||
| */ | ||
| private IPath queryEclipseIndex(IPluginBase plugin) { | ||
| // TODO: Implement querying the Eclipse index | ||
| // This will be implemented in a future step | ||
| return null; | ||
| } | ||
|
laeubi marked this conversation as resolved.
|
||
|
|
||
| /** | ||
| * Queries available software sites for the source bundle. | ||
| * | ||
| * @param plugin the plugin to locate sources for | ||
| * @return the path to the source bundle or null if not found | ||
| */ | ||
| private IPath queryAvailableSoftwareSites(IPluginBase plugin) { | ||
| // TODO: Implement querying available software sites | ||
| // This will be implemented in a future step | ||
| return null; | ||
| } | ||
|
Comment on lines
+378
to
+417
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @copilot This sis the last one to implement and we need to get all Known repositories from the P2 Manager then loop through them and look for the source bundle
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Implemented in commit 9f3b5fc. Implementation:
This completes all 4 source lookup strategies. The method searches all P2 repositories registered in Eclipse (update sites, installed software sites, etc.), providing the broadest search scope. |
||
|
|
||
| /** | ||
| * Gets the list of selected target platform names from preferences. | ||
| * | ||
| * @param store the preference store | ||
| * @return the list of selected target names | ||
| */ | ||
| private List<String> getSelectedTargets(IPreferenceStore store) { | ||
| String selectedTargets = store.getString(IPreferenceConstants.SOURCE_LOOKUP_SELECTED_TARGETS); | ||
| if (selectedTargets == null || selectedTargets.trim().isEmpty()) { | ||
| return List.of(); | ||
| } | ||
| return Arrays.asList(selectedTargets.split(",")); //$NON-NLS-1$ | ||
| } | ||
|
|
||
| /** | ||
| * Gets the list of configured repository URLs from preferences. | ||
| * | ||
| * @param store the preference store | ||
| * @return the list of repository URLs | ||
| */ | ||
| private List<String> getConfiguredRepositories(IPreferenceStore store) { | ||
| String repositories = store.getString(IPreferenceConstants.SOURCE_LOOKUP_REPOSITORIES); | ||
| if (repositories == null || repositories.trim().isEmpty()) { | ||
| return List.of(); | ||
| } | ||
| return Arrays.asList(repositories.split(",")); //$NON-NLS-1$ | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.