3201 disable tag deletion and editing during ingest

This commit is contained in:
William Schaefer 2017-11-08 09:58:03 -05:00
parent 93a72e6a36
commit d49b1667af
4 changed files with 112 additions and 28 deletions

View File

@ -1,7 +1,7 @@
OptionsCategory_Name_TagNamesOptions=Tags
OptionsCategory_TagNames=TagNames
Blackboard.unableToIndexArtifact.error.msg=Unable to index blackboard artifact {0}
NewTagNameDialog.title.text=New Tag Name
NewTagNameDialog.title.text=New Tag
NewTagNameDialog.JOptionPane.tagNameIllegalCharacters.message=Tag name may not contain any of the following symbols\: \\ \: * ? " < > | , ;
NewTagNameDialog.JOptionPane.tagNameIllegalCharacters.title=Invalid character in tag name
NewTagNameDialog.JOptionPane.tagNameEmpty.message=The tag name cannot be empty
@ -14,9 +14,10 @@ TagNameDialog.descriptionLabel.text=Description:
TagNameDialog.okButton.text=OK
TagNameDialog.cancelButton.text=Cancel
TagNameDialog.tagNameTextField.text=
TagNameDialog.newTagNameLabel.text=New Tag Name:
TagNameDialog.newTagNameLabel.text=Name:
TagNameDialog.notableCheckbox.text=Tag indicates item is notable.
TagOptionsPanel.isNotableLabel.text=Tag indicates item is notable:
TagOptionsPanel.notableYesOrNoLabel.text=
TagOptionsPanel.descriptionLabel.text=Tag Description:
TagOptionsPanel.jTextArea1.text=Autopsy keeps a list of the tag names you have created in the past. Add more or delete them here.
TagOptionsPanel.jTextArea1.text=Create and manage tags, which can be applied to files and results in the case. Notable tags will cause items tagged with them to be flagged as notable when using a central repository.
TagOptionsPanel.ingestRunningWarningLabel.text=Cannot make changes to existing tags when ingest is running!

View File

@ -1,2 +1,3 @@
TagsManager.predefTagNames.bookmark.text=\u30d6\u30c3\u30af\u30de\u30fc\u30af
Blackboard.unableToIndexArtifact.error.msg=blackboard\u30a2\u30fc\u30c6\u30a3\u30d5\u30a1\u30af\u30c8{0}\u3092\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002
Blackboard.unableToIndexArtifact.error.msg=blackboard\u30a2\u30fc\u30c6\u30a3\u30d5\u30a1\u30af\u30c8{0}\u3092\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002
TagOptionsPanel.ingestRunningWarningLabel.text=\u30a4\u30f3\u30b8\u30a7\u30b9\u30c8\u3092\u5b9f\u884c\u4e2d\u306b\u30d5\u30a1\u30a4\u30eb\u30bf\u30a4\u30d7\u5b9a\u7fa9\u3092\u5909\u66f4\u3067\u304d\u307e\u305b\u3093\uff01

View File

@ -203,6 +203,9 @@
</Component>
<Component class="javax.swing.JButton" name="editTagNameButton">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/sleuthkit/autopsy/images/edit-tag.png"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/services/Bundle.properties" key="TagOptionsPanel.editTagNameButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
@ -260,18 +263,24 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="descriptionScrollPane" pref="361" max="32767" attributes="0"/>
<Component id="descriptionLabel" min="-2" pref="92" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="isNotableLabel" min="-2" pref="150" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="notableYesOrNoLabel" min="-2" pref="25" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="descriptionLabel" min="-2" pref="92" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="isNotableLabel" min="-2" pref="150" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="notableYesOrNoLabel" min="-2" pref="25" max="-2" attributes="0"/>
</Group>
<Component id="ingestRunningWarningLabel" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -287,7 +296,9 @@
<Component id="isNotableLabel" alignment="3" min="-2" pref="22" max="-2" attributes="0"/>
<Component id="notableYesOrNoLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace pref="351" max="32767" attributes="0"/>
<EmptySpace pref="304" max="32767" attributes="0"/>
<Component id="ingestRunningWarningLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="31" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -339,6 +350,21 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="ingestRunningWarningLabel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font bold="false" component="ingestRunningWarningLabel" property="font" relativeSize="false" size="11"/>
</FontInfo>
</Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/sleuthkit/autopsy/modules/filetypeid/warning16.png"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/services/Bundle.properties" key="TagOptionsPanel.ingestRunningWarningLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>

View File

@ -18,6 +18,9 @@
*/
package org.sleuthkit.autopsy.casemodule.services;
import java.awt.EventQueue;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.util.Set;
import java.util.TreeSet;
import javax.swing.DefaultListModel;
@ -26,6 +29,7 @@ import javax.swing.event.ListSelectionEvent;
import org.netbeans.spi.options.OptionsPanelController;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.corecomponents.OptionsPanel;
import org.sleuthkit.autopsy.ingest.IngestManager;
import org.sleuthkit.datamodel.TagName;
/**
@ -38,6 +42,7 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
private static final TagName.HTML_COLOR DEFAULT_COLOR = TagName.HTML_COLOR.NONE;
private final DefaultListModel<TagNameDefinition> tagTypesListModel;
private Set<TagNameDefinition> tagTypes;
private IngestJobEventPropertyChangeListener ingestJobEventsListener;
/**
* Creates new form TagsManagerOptionsPanel
@ -54,6 +59,18 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
tagNamesList.addListSelectionListener((ListSelectionEvent event) -> {
updatePanel();
});
addIngestJobEventsListener();
}
/**
* Add a property change listener that listens to ingest job events to
* disable the buttons on the panel if ingest is running. This is done to
* prevent changes to user-defined types while the type definitions are in
* use.
*/
private void addIngestJobEventsListener() {
ingestJobEventsListener = new IngestJobEventPropertyChangeListener();
IngestManager.getInstance().addIngestJobEventListener(ingestJobEventsListener);
}
/**
@ -83,6 +100,7 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
descriptionTextArea = new javax.swing.JTextArea();
isNotableLabel = new javax.swing.JLabel();
notableYesOrNoLabel = new javax.swing.JLabel();
ingestRunningWarningLabel = new javax.swing.JLabel();
jPanel1.setPreferredSize(new java.awt.Dimension(750, 490));
@ -119,6 +137,7 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
}
});
editTagNameButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/edit-tag.png"))); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(editTagNameButton, org.openide.util.NbBundle.getMessage(TagOptionsPanel.class, "TagOptionsPanel.editTagNameButton.text")); // NOI18N
editTagNameButton.setMaximumSize(new java.awt.Dimension(111, 25));
editTagNameButton.setMinimumSize(new java.awt.Dimension(111, 25));
@ -202,6 +221,10 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
org.openide.awt.Mnemonics.setLocalizedText(notableYesOrNoLabel, org.openide.util.NbBundle.getMessage(TagOptionsPanel.class, "TagOptionsPanel.notableYesOrNoLabel.text")); // NOI18N
ingestRunningWarningLabel.setFont(ingestRunningWarningLabel.getFont().deriveFont(ingestRunningWarningLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
ingestRunningWarningLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/modules/filetypeid/warning16.png"))); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(ingestRunningWarningLabel, org.openide.util.NbBundle.getMessage(TagOptionsPanel.class, "TagOptionsPanel.ingestRunningWarningLabel.text")); // NOI18N
javax.swing.GroupLayout tagTypesAdditionalPanelLayout = new javax.swing.GroupLayout(tagTypesAdditionalPanel);
tagTypesAdditionalPanel.setLayout(tagTypesAdditionalPanelLayout);
tagTypesAdditionalPanelLayout.setHorizontalGroup(
@ -210,11 +233,15 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
.addContainerGap()
.addGroup(tagTypesAdditionalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(descriptionScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 361, Short.MAX_VALUE)
.addComponent(descriptionLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(tagTypesAdditionalPanelLayout.createSequentialGroup()
.addComponent(isNotableLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(notableYesOrNoLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(tagTypesAdditionalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(descriptionLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(tagTypesAdditionalPanelLayout.createSequentialGroup()
.addComponent(isNotableLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(notableYesOrNoLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(ingestRunningWarningLabel))
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
tagTypesAdditionalPanelLayout.setVerticalGroup(
@ -228,7 +255,9 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
.addGroup(tagTypesAdditionalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(isNotableLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(notableYesOrNoLabel))
.addContainerGap(351, Short.MAX_VALUE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 304, Short.MAX_VALUE)
.addComponent(ingestRunningWarningLabel)
.addGap(31, 31, 31))
);
jSplitPane1.setRightComponent(tagTypesAdditionalPanel);
@ -323,6 +352,7 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
private javax.swing.JScrollPane descriptionScrollPane;
private javax.swing.JTextArea descriptionTextArea;
private javax.swing.JButton editTagNameButton;
private javax.swing.JLabel ingestRunningWarningLabel;
private javax.swing.JLabel isNotableLabel;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
@ -371,28 +401,54 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
* component.
*/
private void updatePanel() {
boolean ingestIsRunning = IngestManager.getInstance().isIngestRunning();
/*
* Only enable the delete button when there is a tag type selected in
* the tag types JList.
*/
ingestRunningWarningLabel.setVisible(ingestIsRunning);
boolean isSelected = tagNamesList.getSelectedIndex() != -1;
editTagNameButton.setEnabled(isSelected);
boolean enableDelete = isSelected && !TagNameDefinition.STANDARD_TAG_DISPLAY_NAMES.contains(tagNamesList.getSelectedValue().getDisplayName());
boolean enableEdit = !ingestIsRunning && isSelected;
editTagNameButton.setEnabled(enableEdit);
boolean enableDelete = enableEdit && !TagNameDefinition.STANDARD_TAG_DISPLAY_NAMES.contains(tagNamesList.getSelectedValue().getDisplayName());
deleteTagNameButton.setEnabled(enableDelete);
if (isSelected){
if (isSelected) {
descriptionTextArea.setText(tagNamesList.getSelectedValue().getDescription());
if (tagNamesList.getSelectedValue().isNotable()){
if (tagNamesList.getSelectedValue().isNotable()) {
notableYesOrNoLabel.setText("Yes");
} else {
notableYesOrNoLabel.setText("No");
}
else {
notableYesOrNoLabel.setText("No");
}
}
else {
} else {
descriptionTextArea.setText("");
notableYesOrNoLabel.setText("");
}
}
/**
* @inheritDoc
*/
@Override
@SuppressWarnings("FinalizeDeclaration")
protected void finalize() throws Throwable {
IngestManager.getInstance().removeIngestJobEventListener(ingestJobEventsListener);
super.finalize();
}
/**
* A property change listener that listens to ingest job events.
*/
private class IngestJobEventPropertyChangeListener implements PropertyChangeListener {
@Override
public void propertyChange(PropertyChangeEvent evt) {
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
updatePanel();
}
});
}
}
}