GP-2025 - Function Window - fixed duplicate functions appearing when

editing external functions
This commit is contained in:
dragonmacher 2022-05-12 18:08:52 -04:00
parent 2436cba12a
commit 76b5ec7787
2 changed files with 26 additions and 9 deletions

View File

@ -62,4 +62,9 @@ public class FunctionRowObject implements Comparable<FunctionRowObject> {
public int compareTo(FunctionRowObject o) {
return ((Long) function.getID()).compareTo(o.function.getID());
}
@Override
public String toString() {
return "[id=" + function.getID() + ", name=" + function.getSignature() + "]";
}
}

View File

@ -62,18 +62,20 @@ public class FunctionTableModel extends AddressBasedTableModel<FunctionRowObject
// Function tag column is not something widely used, so make hidden by default
descriptor.addHiddenColumn(
DiscoverableTableUtils.adaptColumForModel(this, new FunctionTagTableColumn()));
descriptor.addHiddenColumn(
DiscoverableTableUtils.adaptColumForModel(this, new IsFunctionInlineTableColumn()));
descriptor.addHiddenColumn(
DiscoverableTableUtils.adaptColumForModel(this, new IsFunctionNonReturningTableColumn()));
DiscoverableTableUtils.adaptColumForModel(this,
new IsFunctionNonReturningTableColumn()));
descriptor.addHiddenColumn(
DiscoverableTableUtils.adaptColumForModel(this, new IsFunctionVarargsTableColumn()));
descriptor.addHiddenColumn(
DiscoverableTableUtils.adaptColumForModel(this, new IsFunctionCustomStorageTableColumn()));
DiscoverableTableUtils.adaptColumForModel(this,
new IsFunctionCustomStorageTableColumn()));
return descriptor;
}
@ -149,15 +151,25 @@ public class FunctionTableModel extends AddressBasedTableModel<FunctionRowObject
}
void functionAdded(Function f) {
addObject(new FunctionRowObject(f));
if (supportsFunction(f)) {
addObject(new FunctionRowObject(f));
}
}
void functionRemoved(Function f) {
removeObject(new FunctionRowObject(f));
if (supportsFunction(f)) {
removeObject(new FunctionRowObject(f));
}
}
void update(Function f) {
updateObject(new FunctionRowObject(f));
if (supportsFunction(f)) {
updateObject(new FunctionRowObject(f));
}
}
private boolean supportsFunction(Function f) {
return !f.isExternal(); // this model does not show external functions
}
@Override