Skip to content

Commit

Permalink
Fix editing of Implicit Plugin-Dpendencies
Browse files Browse the repository at this point in the history
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 eclipse-pde#451
  • Loading branch information
laeubi committed Dec 4, 2024
1 parent bb04e28 commit b8ce236
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -819,6 +819,7 @@ public NameVersionDescriptor[] getImplicitDependencies() {

@Override
public void setImplicitDependencies(NameVersionDescriptor[] bundles) {
incrementSequenceNumber();
if (bundles != null && bundles.length == 0) {
bundles = null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}

Expand Down Expand Up @@ -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();
}

}

0 comments on commit b8ce236

Please sign in to comment.