From eef9ee0ba061ad39e0781120c5f9686043bc8807 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christoph=20L=C3=A4ubrich?= Date: Wed, 13 Nov 2024 13:16:07 +0100 Subject: [PATCH] Fix editing of Implicit Plugin-Dpendencies Currently editing the Implicit Plugin-Dpendencies only seem to work randomly (e.g. if one change some other property along with the change). This now do not refresh the full target (what seem to reset the underlying model and remove the dirty flag before changes are applied) but only updates the UI so finally these thing appear in the target file. Fixes https://github.com/eclipse-pde/eclipse.pde/issues/451 --- .../internal/core/target/TargetDefinition.java | 1 + .../ImplicitDependenciesSection.java | 18 +++++++++++------- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/target/TargetDefinition.java b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/target/TargetDefinition.java index 81fd1120b1..26e6fa3ccf 100644 --- a/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/target/TargetDefinition.java +++ b/ui/org.eclipse.pde.core/src/org/eclipse/pde/internal/core/target/TargetDefinition.java @@ -819,6 +819,7 @@ public NameVersionDescriptor[] getImplicitDependencies() { @Override public void setImplicitDependencies(NameVersionDescriptor[] bundles) { + incrementSequenceNumber(); if (bundles != null && bundles.length == 0) { bundles = null; } diff --git a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/targetdefinition/ImplicitDependenciesSection.java b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/targetdefinition/ImplicitDependenciesSection.java index 40f1aed30a..11fabdbc34 100644 --- a/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/targetdefinition/ImplicitDependenciesSection.java +++ b/ui/org.eclipse.pde.ui/src/org/eclipse/pde/internal/ui/editor/targetdefinition/ImplicitDependenciesSection.java @@ -217,9 +217,9 @@ protected void handleAdd() { if (currentBundles != null) { allDependencies.addAll(Arrays.asList(currentBundles)); } - getTarget().setImplicitDependencies(allDependencies.toArray(new NameVersionDescriptor[allDependencies.size()])); markDirty(); - refresh(); + getTarget().setImplicitDependencies(allDependencies.toArray(new NameVersionDescriptor[allDependencies.size()])); + updateUI(); } } @@ -260,26 +260,30 @@ private void handleRemove() { bundles.remove(removeBundle); } } - getTarget().setImplicitDependencies(bundles.toArray((new NameVersionDescriptor[bundles.size()]))); markDirty(); - refresh(); + getTarget().setImplicitDependencies(bundles.toArray((new NameVersionDescriptor[bundles.size()]))); + updateUI(); } } private void handleRemoveAll() { - getTarget().setImplicitDependencies(null); markDirty(); - refresh(); + getTarget().setImplicitDependencies(null); + updateUI(); } @Override public void refresh() { // TODO Try to retain selection during refresh, add and remove operations + updateUI(); + super.refresh(); + } + + protected void updateUI() { fViewer.setInput(getTarget()); fViewer.refresh(); updateButtons(); updateCount(); - super.refresh(); } }