mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-05 02:39:44 +02:00
Merge branch 'GP-266-dragonmacher-function-tags-ui-lockup'
This commit is contained in:
commit
8ec3f786ff
21 changed files with 712 additions and 803 deletions
|
@ -16,6 +16,7 @@
|
|||
package ghidra.program.database.function;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Objects;
|
||||
|
||||
import db.Record;
|
||||
import ghidra.program.database.DBObjectCache;
|
||||
|
@ -47,16 +48,18 @@ public class FunctionTagDB extends DatabaseObject implements FunctionTag {
|
|||
mgr.lock.acquire();
|
||||
try {
|
||||
checkDeleted();
|
||||
|
||||
if (comment == null)
|
||||
|
||||
if (comment == null) {
|
||||
comment = "";
|
||||
|
||||
}
|
||||
|
||||
if (!comment.equals(record.getString(FunctionTagAdapter.COMMENT_COL))) {
|
||||
record.setString(FunctionTagAdapter.COMMENT_COL, comment);
|
||||
mgr.updateFunctionTag(this);
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
|
||||
}
|
||||
catch (IOException e) {
|
||||
mgr.dbError(e);
|
||||
}
|
||||
finally {
|
||||
|
@ -69,17 +72,20 @@ public class FunctionTagDB extends DatabaseObject implements FunctionTag {
|
|||
mgr.lock.acquire();
|
||||
try {
|
||||
checkDeleted();
|
||||
|
||||
if (name == null)
|
||||
|
||||
if (name == null) {
|
||||
name = "";
|
||||
|
||||
}
|
||||
|
||||
if (!name.equals(record.getString(FunctionTagAdapter.NAME_COL))) {
|
||||
record.setString(FunctionTagAdapter.NAME_COL, name);
|
||||
mgr.updateFunctionTag(this);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
}
|
||||
catch (IOException e) {
|
||||
mgr.dbError(e);
|
||||
} finally {
|
||||
}
|
||||
finally {
|
||||
mgr.lock.release();
|
||||
}
|
||||
}
|
||||
|
@ -107,7 +113,7 @@ public class FunctionTagDB extends DatabaseObject implements FunctionTag {
|
|||
mgr.lock.release();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get tag record
|
||||
* @return record
|
||||
|
@ -149,8 +155,19 @@ public class FunctionTagDB extends DatabaseObject implements FunctionTag {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return (int) key;
|
||||
public void delete() {
|
||||
mgr.lock.acquire();
|
||||
try {
|
||||
if (checkIsValid()) {
|
||||
mgr.doDeleteTag(this);
|
||||
}
|
||||
}
|
||||
catch (IOException e) {
|
||||
mgr.dbError(e);
|
||||
}
|
||||
finally {
|
||||
mgr.lock.release();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -162,37 +179,41 @@ public class FunctionTagDB extends DatabaseObject implements FunctionTag {
|
|||
return getComment().compareToIgnoreCase(otherTag.getComment());
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
final int prime = 31;
|
||||
int result = 1;
|
||||
result = prime * result + ((getComment() == null) ? 0 : getComment().hashCode());
|
||||
result = prime * result + ((getName() == null) ? 0 : getName().hashCode());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if ((obj == null) || (!(obj instanceof FunctionTag))) {
|
||||
return false;
|
||||
}
|
||||
if (obj == this) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
}
|
||||
FunctionTag tag = (FunctionTag) obj;
|
||||
if (!getName().equals(tag.getName())) {
|
||||
if (obj == null) {
|
||||
return false;
|
||||
}
|
||||
if (!getComment().equals(tag.getComment())) {
|
||||
if (!(obj instanceof FunctionTag)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
FunctionTag other = (FunctionTag) obj;
|
||||
if (!Objects.equals(getComment(), other.getComment())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!Objects.equals(getName(), other.getName())) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete() {
|
||||
mgr.lock.acquire();
|
||||
try {
|
||||
if (checkIsValid()) {
|
||||
mgr.doDeleteTag(this);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
mgr.dbError(e);
|
||||
}
|
||||
finally {
|
||||
mgr.lock.release();
|
||||
}
|
||||
public String toString() {
|
||||
return getName();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -17,48 +17,42 @@ package ghidra.program.model.listing;
|
|||
|
||||
/**
|
||||
* Represents a function tag object that can be associated with
|
||||
* functions. This maps to the
|
||||
* {@link ghidra.program.database.function.FunctionTagAdapter FunctionTagAdapter} table.
|
||||
* functions. This maps to the {@code FunctionTagAdapter} table.
|
||||
*/
|
||||
public interface FunctionTag extends Comparable<FunctionTag> {
|
||||
|
||||
/**
|
||||
* Returns the id of the item.
|
||||
*
|
||||
* @return
|
||||
* Returns the id of the item
|
||||
* @return the id of the item
|
||||
*/
|
||||
public long getId();
|
||||
|
||||
/**
|
||||
* Returns the tag name.
|
||||
*
|
||||
* @return
|
||||
* Returns the tag name
|
||||
* @return the tag name
|
||||
*/
|
||||
public String getName();
|
||||
|
||||
/**
|
||||
* Returns the tag comment.
|
||||
*
|
||||
* @return
|
||||
* Returns the tag comment
|
||||
* @return the tag comment
|
||||
*/
|
||||
public String getComment();
|
||||
|
||||
/**
|
||||
* Sets the name of the tag.
|
||||
*
|
||||
* Sets the name of the tag
|
||||
* @param name the tag name
|
||||
*/
|
||||
void setName(String name);
|
||||
public void setName(String name);
|
||||
|
||||
/**
|
||||
* Sets the comment for this tag.
|
||||
*
|
||||
* Sets the comment for this tag
|
||||
* @param comment the tag comment
|
||||
*/
|
||||
void setComment(String comment);
|
||||
public void setComment(String comment);
|
||||
|
||||
/**
|
||||
* Deletes this tag from the program.
|
||||
* Deletes this tag from the program
|
||||
*/
|
||||
void delete();
|
||||
public void delete();
|
||||
}
|
||||
|
|
|
@ -15,7 +15,6 @@
|
|||
*/
|
||||
package ghidra.program.model.listing;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue