mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 16:06:15 +00:00
Merge pull request #3930 from wschaeferB/4003-PreserveExistingTagComment
4003 preserve existing comment when replacing tag
This commit is contained in:
commit
1ca199dbbc
@ -64,14 +64,14 @@ public final class ReplaceBlackboardArtifactTagAction extends ReplaceTagAction<B
|
|||||||
*
|
*
|
||||||
* @param oldArtifactTag tag to be replaced
|
* @param oldArtifactTag tag to be replaced
|
||||||
* @param newTagName name of the tag to replace with
|
* @param newTagName name of the tag to replace with
|
||||||
* @param comment the comment for the tag use an empty string for no comment
|
* @param newComment the newComment for the tag use an empty string for no newComment
|
||||||
*/
|
*/
|
||||||
@NbBundle.Messages({
|
@NbBundle.Messages({
|
||||||
"# {0} - old tag name",
|
"# {0} - old tag name",
|
||||||
"# {1} - artifactID",
|
"# {1} - artifactID",
|
||||||
"ReplaceBlackboardArtifactTagAction.replaceTag.alert=Unable to replace tag {0} for artifact {1}."})
|
"ReplaceBlackboardArtifactTagAction.replaceTag.alert=Unable to replace tag {0} for artifact {1}."})
|
||||||
@Override
|
@Override
|
||||||
protected void replaceTag( BlackboardArtifactTag oldArtifactTag, TagName newTagName, String comment) {
|
protected void replaceTag( BlackboardArtifactTag oldArtifactTag, TagName newTagName, String newComment) {
|
||||||
new SwingWorker<Void, Void>() {
|
new SwingWorker<Void, Void>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -91,7 +91,7 @@ public final class ReplaceBlackboardArtifactTagAction extends ReplaceTagAction<B
|
|||||||
logger.log(Level.INFO, "Replacing tag {0} with tag {1} for artifact {2}", new Object[]{oldArtifactTag.getName().getDisplayName(), newTagName.getDisplayName(), oldArtifactTag.getContent().getName()}); //NON-NLS
|
logger.log(Level.INFO, "Replacing tag {0} with tag {1} for artifact {2}", new Object[]{oldArtifactTag.getName().getDisplayName(), newTagName.getDisplayName(), oldArtifactTag.getContent().getName()}); //NON-NLS
|
||||||
|
|
||||||
tagsManager.deleteBlackboardArtifactTag(oldArtifactTag);
|
tagsManager.deleteBlackboardArtifactTag(oldArtifactTag);
|
||||||
tagsManager.addBlackboardArtifactTag(oldArtifactTag.getArtifact(), newTagName, comment);
|
tagsManager.addBlackboardArtifactTag(oldArtifactTag.getArtifact(), newTagName, newComment);
|
||||||
|
|
||||||
} catch (TskCoreException tskCoreException) {
|
} catch (TskCoreException tskCoreException) {
|
||||||
logger.log(Level.SEVERE, "Error replacing artifact tag", tskCoreException); //NON-NLS
|
logger.log(Level.SEVERE, "Error replacing artifact tag", tskCoreException); //NON-NLS
|
||||||
|
@ -64,7 +64,7 @@ public final class ReplaceContentTagAction extends ReplaceTagAction<ContentTag>
|
|||||||
"# {1} - content obj id",
|
"# {1} - content obj id",
|
||||||
"ReplaceContentTagAction.replaceTag.alert=Unable to replace tag {0} for {1}."})
|
"ReplaceContentTagAction.replaceTag.alert=Unable to replace tag {0} for {1}."})
|
||||||
@Override
|
@Override
|
||||||
protected void replaceTag(ContentTag oldTag, TagName newTagName, String comment) {
|
protected void replaceTag(ContentTag oldTag, TagName newTagName, String newComment) {
|
||||||
new SwingWorker<Void, Void>() {
|
new SwingWorker<Void, Void>() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -84,7 +84,7 @@ public final class ReplaceContentTagAction extends ReplaceTagAction<ContentTag>
|
|||||||
logger.log(Level.INFO, "Replacing tag {0} with tag {1} for artifact {2}", new Object[]{oldTag.getName().getDisplayName(), newTagName.getDisplayName(), oldTag.getContent().getName()}); //NON-NLS
|
logger.log(Level.INFO, "Replacing tag {0} with tag {1} for artifact {2}", new Object[]{oldTag.getName().getDisplayName(), newTagName.getDisplayName(), oldTag.getContent().getName()}); //NON-NLS
|
||||||
|
|
||||||
tagsManager.deleteContentTag(oldTag);
|
tagsManager.deleteContentTag(oldTag);
|
||||||
tagsManager.addContentTag(oldTag.getContent(), newTagName, comment);
|
tagsManager.addContentTag(oldTag.getContent(), newTagName, newComment);
|
||||||
|
|
||||||
} catch (TskCoreException tskCoreException) {
|
} catch (TskCoreException tskCoreException) {
|
||||||
logger.log(Level.SEVERE, "Error replacing artifact tag", tskCoreException); //NON-NLS
|
logger.log(Level.SEVERE, "Error replacing artifact tag", tskCoreException); //NON-NLS
|
||||||
|
@ -141,7 +141,7 @@ abstract class ReplaceTagAction<T extends Tag> extends AbstractAction implements
|
|||||||
// Add action to replace the tag
|
// Add action to replace the tag
|
||||||
tagNameItem.addActionListener((ActionEvent event) -> {
|
tagNameItem.addActionListener((ActionEvent event) -> {
|
||||||
selectedTags.forEach((oldtag) -> {
|
selectedTags.forEach((oldtag) -> {
|
||||||
replaceTag(oldtag, entry.getValue(), "");
|
replaceTag(oldtag, entry.getValue(), oldtag.getComment());
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -178,7 +178,7 @@ abstract class ReplaceTagAction<T extends Tag> extends AbstractAction implements
|
|||||||
TagName newTagName = GetTagNameDialog.doDialog();
|
TagName newTagName = GetTagNameDialog.doDialog();
|
||||||
if (null != newTagName) {
|
if (null != newTagName) {
|
||||||
selectedTags.forEach((oldtag) -> {
|
selectedTags.forEach((oldtag) -> {
|
||||||
replaceTag(oldtag, newTagName, "");
|
replaceTag(oldtag, newTagName, oldtag.getComment());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user