Refresh dependency error decorations on target platform changes - #2412
Open
vogella wants to merge 1 commit into
Open
Refresh dependency error decorations on target platform changes#2412vogella wants to merge 1 commit into
vogella wants to merge 1 commit into
Conversation
The error decorations on the Dependencies tab of the manifest editor are computed on the fly from isResolved(), so they only stay correct if the result is recomputed and if the sections learn that the world changed. Two things prevented that. PluginReference memoized the plug-in it looked up and never invalidated it, so a required bundle that disappeared from the target kept reporting itself as resolved and no error decoration ever appeared. Only an explicitly assigned plug-in is cached now; the id is looked up on every call, which is a hash lookup on the model entry table. RequiresSection listened to plug-in model deltas only, and ImportPackageSection listened to nothing beyond its own bundle model. A target reload fires neither, so both kept painting the previous resolution result until the editor was reopened. Both now also listen to IStateDeltaListener.stateChanged, which is what a reload does fire, and ImportPackageSection gained the plug-in model listener it was missing for ordinary workspace changes.
vogella
force-pushed
the
dependencies-tab-stale-decorations
branch
from
August 10, 2026 05:58
d9a9553 to
9b4df21
Compare
vogella
marked this pull request as ready for review
August 10, 2026 07:52
There was a problem hiding this comment.
Pull request overview
This PR improves PDE manifest editor dependency error decorations so they stay accurate when the target platform is reloaded or workspace plug-in models change, by ensuring dependency resolution is recomputed and the UI refreshes on relevant model/state notifications.
Changes:
- Stop
PluginReferencefrom memoizing looked-up plug-ins soisResolved()reflects current target contents. - Make both dependency sections react to target reloads by listening to
IStateDeltaListener.stateChanged(and add the missing plug-in model listener toImportPackageSection). - Add
StaleDependencyResolutionTestto cover recomputation and the notification contract, and register it in the core test suite.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/RequiresSection.java | Adds state-delta listening to refresh dependency decorations when the target state changes. |
| ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/ImportPackageSection.java | Adds plug-in model + state-delta listeners and refresh logic to keep imported-package decorations in sync. |
| ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/core/tests/internal/StaleDependencyResolutionTest.java | New regression test covering stale resolution and target reload notifications. |
| ui/org.eclipse.pde.ui.tests/src/org/eclipse/pde/core/tests/internal/AllPDECoreTests.java | Registers the new regression test in the PDE core test suite. |
| ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/plugin/PluginReference.java | Changes plug-in lookup to be non-caching so resolution status tracks target changes. |
Suppressed comments (1)
ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/plugin/RequiresSection.java:699
modelsChanged/stateChangedcallbacks can be invoked off the UI thread (they are fired directly byPluginModelManager).refreshImports()currently calls SWT widget APIs (getControl(),isDisposed(),getDisplay()) on the calling thread, which can throwSWTException: Invalid thread accessduring target reloads or workspace model updates. Schedule the UI work viaDisplay.getDefault().asyncExec(...)and only touch the viewer/control inside the runnable.
private void refreshImports() {
fImports = null;
final Control control = fImportViewer.getControl();
if (!control.isDisposed()) {
control.getDisplay().asyncExec(() -> {
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+307
to
+316
| private void refreshPackages() { | ||
| Control control = fPackageViewer.getControl(); | ||
| if (!control.isDisposed()) { | ||
| control.getDisplay().asyncExec(() -> { | ||
| if (!control.isDisposed()) { | ||
| fPackageViewer.refresh(); | ||
| } | ||
| }); | ||
| } | ||
| } |
Comment on lines
+44
to
+48
| // Only an explicitly assigned plug-in is cached. Looking the id up on | ||
| // every call keeps isResolved() in sync with the current target | ||
| // platform, which the error decorations in the editor rely on. | ||
| if (fPlugin != null || fId == null) { | ||
| return fPlugin; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The error decorations on the Dependencies tab of the manifest editor are computed on the fly from
isResolved(), so they are only correct if the result is recomputed and if the sections learn that the target platform changed. Neither held:PluginReferencememoized the plug-in it looked up and never invalidated it, so a required bundle that vanished from the target kept reporting itself as resolved and no error marker ever appeared. On top of that a target reload fires noPluginModelDelta, which is the only notificationRequiresSectionlistened to, andImportPackageSectionlistened to nothing beyond its own bundle model.The reference now looks the id up on every call (a hash lookup on the model entry table, cheaper than the exported-package scan the imported-package labels already do), and both sections additionally listen to
IStateDeltaListener.stateChanged, which is what a reload does fire.ImportPackageSectionalso gained the plug-in model listener it was missing for ordinary workspace changes, so both halves of the tab now stay in sync instead of disagreeing. The practical effect is that fixing a missing dependency and reloading the target clears the marker, rather than requiring the editor to be closed and reopened.StaleDependencyResolutionTestcovers the recomputation and pins down the notification contract the sections depend on.