mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 10:19:23 +02:00
GP-5557 Composite editor transaction and update notification fixes
This commit is contained in:
parent
694b3b46ce
commit
0ef28cb54b
85 changed files with 703 additions and 633 deletions
|
@ -4,9 +4,9 @@
|
|||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
@ -212,8 +212,8 @@ public class ProjectDataTypeManager extends StandAloneDataTypeManager
|
|||
}
|
||||
|
||||
@Override
|
||||
public void endTransaction(int transactionID, boolean commit) {
|
||||
dataTypeArchive.endTransaction(transactionID, commit);
|
||||
public boolean endTransaction(int transactionID, boolean commit) {
|
||||
return dataTypeArchive.endTransaction(transactionID, commit);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
@ -296,9 +296,8 @@ public class ProgramDataTypeManager extends ProgramBasedDataTypeManagerDB implem
|
|||
}
|
||||
|
||||
@Override
|
||||
public void endTransaction(int transactionID, boolean commit) {
|
||||
program.endTransaction(transactionID, commit);
|
||||
|
||||
public boolean endTransaction(int transactionID, boolean commit) {
|
||||
return program.endTransaction(transactionID, commit);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
@ -92,11 +92,11 @@ public final class BuiltInDataTypeManager extends StandAloneDataTypeManager {
|
|||
}
|
||||
|
||||
@Override
|
||||
public synchronized void endTransaction(int transactionID, boolean commit) {
|
||||
public synchronized boolean endTransaction(int transactionID, boolean commit) {
|
||||
if (manager != null) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
super.endTransaction(transactionID, commit);
|
||||
return super.endTransaction(transactionID, commit);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
@ -18,6 +18,7 @@ package ghidra.program.model.data;
|
|||
import java.util.*;
|
||||
|
||||
import db.Transaction;
|
||||
import ghidra.framework.model.DomainObject;
|
||||
import ghidra.program.database.SpecExtension;
|
||||
import ghidra.program.database.map.AddressMap;
|
||||
import ghidra.program.model.lang.*;
|
||||
|
@ -380,11 +381,27 @@ public interface DataTypeManager {
|
|||
public int startTransaction(String description);
|
||||
|
||||
/**
|
||||
* Ends the current transaction
|
||||
* Ends the current transaction.
|
||||
* <P>
|
||||
* NOTE: If multiple transactions are outstanding the full transaction will not be ended
|
||||
* until all transactions have been ended. If any of the transactions indicate a
|
||||
* false for {@code commit} the transaction will ultimately be rolled-back when the final
|
||||
* transaction is ended.
|
||||
* <P>
|
||||
* NOTE: Use of rollback ({@code commit=false} should be avoided unless absolutely
|
||||
* neccessary since it will incur overhead to revert changes and may rollback multiple
|
||||
* concurrent transactions if they exist.
|
||||
* <P>
|
||||
* NOTE: If this manager is part of a larger {@link DomainObject} its transactions may become
|
||||
* entangled with other transactions at a higher level. In such cases, use of the
|
||||
* {@link DomainObject} transaction interface is preferred. The return value from this
|
||||
* method cannot be relied on in such cases.
|
||||
* @param transactionID id of the transaction to end
|
||||
* @param commit true if changes are committed, false if changes in transaction are revoked
|
||||
* @param commit true if changes are committed, false if changes in transaction should be
|
||||
* rolled back.
|
||||
* @return true if this invocation was the final transaction and all changes were comitted.
|
||||
*/
|
||||
public void endTransaction(int transactionID, boolean commit);
|
||||
public boolean endTransaction(int transactionID, boolean commit);
|
||||
|
||||
/**
|
||||
* Performs the given callback inside of a transaction. Use this method in place of the more
|
||||
|
|
|
@ -873,15 +873,15 @@ public class StandAloneDataTypeManager extends DataTypeManagerDB implements Clos
|
|||
}
|
||||
|
||||
/**
|
||||
* Get the number of active transactions
|
||||
* @return number of active transactions
|
||||
* Get the number of active datatype manager transactions
|
||||
* @return number of active datatype manager transactions
|
||||
*/
|
||||
protected int getTransactionCount() {
|
||||
return transactionCount;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void endTransaction(int transactionID, boolean commit) {
|
||||
public boolean endTransaction(int transactionID, boolean commit) {
|
||||
boolean restored = false;
|
||||
synchronized (this) {
|
||||
if (transaction == null) {
|
||||
|
@ -917,6 +917,7 @@ public class StandAloneDataTypeManager extends DataTypeManagerDB implements Clos
|
|||
invalidateCache();
|
||||
notifyRestored();
|
||||
}
|
||||
return transaction == null && !restored;
|
||||
}
|
||||
|
||||
public void undo() {
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
@ -60,7 +60,7 @@ public class StubProgram implements Program {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void endTransaction(int transactionID, boolean commit) {
|
||||
public boolean endTransaction(int transactionID, boolean commit) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
@ -236,7 +236,7 @@ public class TestDoubleDataTypeManager implements DataTypeManager {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void endTransaction(int transactionID, boolean commit) {
|
||||
public boolean endTransaction(int transactionID, boolean commit) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
|
@ -243,9 +243,9 @@ public class TestDummyDataTypeManager implements DataTypeManager {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void endTransaction(int transactionID, boolean commit) {
|
||||
public boolean endTransaction(int transactionID, boolean commit) {
|
||||
// stub
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue