GP-3992 fixed various issues/bugs related to the new askValues() script method

This commit is contained in:
ghidragon 2023-11-06 15:40:38 -05:00
parent 134806cbe4
commit 9cd2666799
22 changed files with 556 additions and 383 deletions

View file

@ -313,11 +313,6 @@ public class DomainFileProxy implements DomainFile {
return true;
}
public boolean isUsedExclusivelyBy(Object consumer) {
DomainObjectAdapter dobj = getDomainObject();
return dobj != null ? dobj.isUsedExclusivelyBy(consumer) : false;
}
@Override
public ArrayList<?> getConsumers() {
DomainObjectAdapter dobj = getDomainObject();

View file

@ -333,19 +333,12 @@ public abstract class DomainObjectAdapter implements DomainObject {
@Override
public boolean addConsumer(Object consumer) {
if (consumer == null) {
throw new IllegalArgumentException("Consumer must not be null");
}
Objects.requireNonNull(consumer);
synchronized (consumers) {
if (isClosed()) {
return false;
}
if (consumers.contains(consumer)) {
throw new IllegalArgumentException("Attempted to acquire the " +
"domain object more than once by the same consumer: " + consumer);
}
consumers.add(consumer);
}
@ -359,18 +352,7 @@ public abstract class DomainObjectAdapter implements DomainObject {
}
/**
* Returns true if the this file is used only by the given consumer
* @param consumer the consumer
* @return true if the this file is used only by the given consumer
*/
boolean isUsedExclusivelyBy(Object consumer) {
synchronized (consumers) {
return (consumers.size() == 1) && (consumers.contains(consumer));
}
}
/**
* Returns true if the given tool is using this object.
* Returns true if the given consumer is using this object.
*/
@Override
public boolean isUsedBy(Object consumer) {

View file

@ -31,7 +31,7 @@ public class AppInfo {
tool = t;
}
static void setActiveProject(Project p) {
public static void setActiveProject(Project p) {
activeProject = p;
}

View file

@ -17,7 +17,8 @@ package ghidra.framework.model;
import java.io.File;
import java.io.IOException;
import java.util.*;
import java.util.List;
import java.util.Map;
import ghidra.framework.options.Options;
import ghidra.util.ReadOnlyException;
@ -216,7 +217,7 @@ public interface DomainObject {
* Returns the list of consumers on this domainObject
* @return the list of consumers.
*/
public ArrayList<Object> getConsumerList();
public List<Object> getConsumerList();
/**
* Returns true if the given consumer is using (has open) this domain object.