mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2026-09-28 17:11:11 -09:00
GP-3122 Added AutoCloseable Transaction API to DBHandle and
UndoableDomainObject. Performed renaming of some internal classes.
This commit is contained in:
@@ -28,6 +28,7 @@ import ghidra.feature.vt.api.impl.*;
|
||||
import ghidra.feature.vt.api.main.*;
|
||||
import ghidra.framework.data.DomainObjectAdapterDB;
|
||||
import ghidra.framework.model.*;
|
||||
import ghidra.framework.model.TransactionInfo.Status;
|
||||
import ghidra.framework.options.Options;
|
||||
import ghidra.framework.store.LockException;
|
||||
import ghidra.program.database.DBObjectCache;
|
||||
@@ -695,9 +696,9 @@ public class VTSessionDB extends DomainObjectAdapterDB implements VTSession, VTC
|
||||
|
||||
@Override
|
||||
public void endTransaction(int transactionID, boolean commit) {
|
||||
Transaction transaction = getCurrentTransaction();
|
||||
TransactionInfo transaction = getCurrentTransactionInfo();
|
||||
super.endTransaction(transactionID, commit);
|
||||
if (changeSetsModified && transaction.getStatus() == Transaction.COMMITTED) {
|
||||
if (changeSetsModified && transaction.getStatus() == Status.COMMITTED) {
|
||||
changeSetsModified = false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,11 @@
|
||||
*/
|
||||
package ghidra.feature.vt.api.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
import db.Transaction;
|
||||
import ghidra.feature.vt.api.main.*;
|
||||
import ghidra.framework.model.*;
|
||||
import ghidra.framework.options.Options;
|
||||
@@ -24,10 +29,6 @@ import ghidra.util.exception.AssertException;
|
||||
import ghidra.util.exception.CancelledException;
|
||||
import ghidra.util.task.TaskMonitor;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
public class EmptyVTSession implements VTSession {
|
||||
|
||||
@Override
|
||||
@@ -159,7 +160,7 @@ public class EmptyVTSession implements VTSession {
|
||||
}
|
||||
|
||||
@Override
|
||||
public Transaction getCurrentTransaction() {
|
||||
public TransactionInfo getCurrentTransactionInfo() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -178,6 +179,11 @@ public class EmptyVTSession implements VTSession {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
@Override
|
||||
public Transaction openTransaction(String description) throws IllegalStateException {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int startTransaction(String description) {
|
||||
return 0;
|
||||
|
||||
@@ -20,7 +20,7 @@ import ghidra.feature.vt.api.db.VTSessionDB;
|
||||
import ghidra.feature.vt.api.main.VTMatchTag;
|
||||
import ghidra.feature.vt.api.main.VTSession;
|
||||
import ghidra.feature.vt.gui.editors.TagEditorDialog.TagState.Action;
|
||||
import ghidra.framework.model.Transaction;
|
||||
import ghidra.framework.model.TransactionInfo;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.exception.CancelledException;
|
||||
@@ -348,7 +348,7 @@ public class TagEditorDialog extends DialogComponentProvider {
|
||||
|
||||
private boolean hasTransactionsOpen(VTSessionDB sessionDB) {
|
||||
Program program = sessionDB.getDestinationProgram();
|
||||
Transaction transaction = program.getCurrentTransaction();
|
||||
TransactionInfo transaction = program.getCurrentTransactionInfo();
|
||||
if (transaction != null) {
|
||||
Msg.showWarn(this, null, "Unable to Set Match Tag",
|
||||
"The program \"" + program.getName() + "\"already has a transaction open: " +
|
||||
@@ -356,7 +356,7 @@ public class TagEditorDialog extends DialogComponentProvider {
|
||||
return true;
|
||||
}
|
||||
|
||||
Transaction matchSetTransaction = sessionDB.getCurrentTransaction();
|
||||
TransactionInfo matchSetTransaction = sessionDB.getCurrentTransactionInfo();
|
||||
if (matchSetTransaction != null) {
|
||||
Msg.showWarn(this, null, "Unable to Set Match Tag",
|
||||
"Transaction already open for the Match Set Manager ");
|
||||
|
||||
@@ -493,7 +493,7 @@ public class VTControllerImpl
|
||||
}
|
||||
|
||||
private boolean hasTransactionsOpen(Program program, VtTask task) {
|
||||
Transaction transaction = program.getCurrentTransaction();
|
||||
TransactionInfo transaction = program.getCurrentTransactionInfo();
|
||||
if (transaction != null) {
|
||||
Msg.showWarn(this, null, "Unable to " + task.getTaskTitle(),
|
||||
"The program \"" + program.getName() + "\"already has a transaction open: " +
|
||||
@@ -501,7 +501,7 @@ public class VTControllerImpl
|
||||
return true;
|
||||
}
|
||||
|
||||
Transaction matchSetTransaction = session.getCurrentTransaction();
|
||||
TransactionInfo matchSetTransaction = session.getCurrentTransactionInfo();
|
||||
if (matchSetTransaction != null) {
|
||||
Msg.showWarn(this, null, "Unable to " + task.getTaskTitle(),
|
||||
"Transaction already open for the Match Set Manager ");
|
||||
@@ -576,7 +576,7 @@ public class VTControllerImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public void transactionStarted(DomainObjectAdapterDB domainObj, Transaction tx) {
|
||||
public void transactionStarted(DomainObjectAdapterDB domainObj, TransactionInfo tx) {
|
||||
// don't care
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ package ghidra.feature.vt.gui.task;
|
||||
|
||||
import ghidra.feature.vt.api.db.VTSessionDB;
|
||||
import ghidra.feature.vt.api.main.*;
|
||||
import ghidra.framework.model.Transaction;
|
||||
import ghidra.framework.model.TransactionInfo;
|
||||
import ghidra.program.model.listing.Program;
|
||||
import ghidra.util.Msg;
|
||||
import ghidra.util.exception.CancelledException;
|
||||
@@ -72,7 +72,7 @@ public class SetMatchTagTask extends Task {
|
||||
|
||||
private boolean hasTransactionsOpen() {
|
||||
Program program = sessionDB.getDestinationProgram();
|
||||
Transaction transaction = program.getCurrentTransaction();
|
||||
TransactionInfo transaction = program.getCurrentTransactionInfo();
|
||||
if (transaction != null) {
|
||||
Msg.showWarn(this, null, "Unable to Set Match Tag",
|
||||
"The program \"" + program.getName() + "\"already has a transaction open: " +
|
||||
@@ -80,7 +80,7 @@ public class SetMatchTagTask extends Task {
|
||||
return true;
|
||||
}
|
||||
|
||||
Transaction matchSetTransaction = sessionDB.getCurrentTransaction();
|
||||
TransactionInfo matchSetTransaction = sessionDB.getCurrentTransactionInfo();
|
||||
if (matchSetTransaction != null) {
|
||||
Msg.showWarn(this, null, "Unable to Set Match Tag",
|
||||
"Transaction already open for the Match Set Manager ");
|
||||
|
||||
Reference in New Issue
Block a user