mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-14 17:06:16 +00:00
2483 add new line before pasting into keywords list jTextArea
This commit is contained in:
parent
1a5f6182d9
commit
5d4681335e
@ -134,6 +134,9 @@
|
|||||||
<Events>
|
<Events>
|
||||||
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="keywordTextAreaMouseClicked"/>
|
<EventHandler event="mouseClicked" listener="java.awt.event.MouseListener" parameters="java.awt.event.MouseEvent" handler="keywordTextAreaMouseClicked"/>
|
||||||
</Events>
|
</Events>
|
||||||
|
<AuxValues>
|
||||||
|
<AuxValue name="JavaCodeGenerator_CreateCodeCustom" type="java.lang.String" value="new JTextArea() {
 //Override the paste action for this jtext area to always insert a new line before the pasted text
 @Override
 public void paste() {
 keywordTextArea.setText(keywordTextArea.getText() + "\n");
 super.paste();
 }
}"/>
|
||||||
|
</AuxValues>
|
||||||
</Component>
|
</Component>
|
||||||
</SubComponents>
|
</SubComponents>
|
||||||
</Container>
|
</Container>
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* Autopsy Forensic Browser
|
* Autopsy Forensic Browser
|
||||||
*
|
*
|
||||||
* Copyright 2011-2016 Basis Technology Corp.
|
* Copyright 2011-2017 Basis Technology Corp.
|
||||||
* Contact: carrier <at> sleuthkit <dot> org
|
* Contact: carrier <at> sleuthkit <dot> org
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
@ -28,6 +28,7 @@ import java.util.Arrays;
|
|||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
import javax.swing.JMenuItem;
|
import javax.swing.JMenuItem;
|
||||||
import javax.swing.JPopupMenu;
|
import javax.swing.JPopupMenu;
|
||||||
|
import javax.swing.JTextArea;
|
||||||
import javax.swing.SwingUtilities;
|
import javax.swing.SwingUtilities;
|
||||||
import javax.swing.event.DocumentEvent;
|
import javax.swing.event.DocumentEvent;
|
||||||
import javax.swing.event.DocumentListener;
|
import javax.swing.event.DocumentListener;
|
||||||
@ -42,8 +43,9 @@ class AddKeywordsDialog extends javax.swing.JDialog {
|
|||||||
List<String> newKeywords = new ArrayList<>();
|
List<String> newKeywords = new ArrayList<>();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates new form AddKeywordsDialog.
|
* Creates new form AddKeywordsDialog. Note that this does not display the
|
||||||
* Note that this does not display the dialog - call display() after creation.
|
* dialog - call display() after creation.
|
||||||
|
*
|
||||||
* @param initialKeywords Keywords to populate the list with
|
* @param initialKeywords Keywords to populate the list with
|
||||||
* @param type Starting keyword type
|
* @param type Starting keyword type
|
||||||
*/
|
*/
|
||||||
@ -52,7 +54,6 @@ class AddKeywordsDialog extends javax.swing.JDialog {
|
|||||||
NbBundle.getMessage(AddKeywordsDialog.class, "AddKeywordsDialog.addKeywordsTitle.text"),
|
NbBundle.getMessage(AddKeywordsDialog.class, "AddKeywordsDialog.addKeywordsTitle.text"),
|
||||||
true);
|
true);
|
||||||
initComponents();
|
initComponents();
|
||||||
|
|
||||||
// Set the add button to only be active when there is text in the text area
|
// Set the add button to only be active when there is text in the text area
|
||||||
addButton.setEnabled(false);
|
addButton.setEnabled(false);
|
||||||
keywordTextArea.getDocument().addDocumentListener(new DocumentListener() {
|
keywordTextArea.getDocument().addDocumentListener(new DocumentListener() {
|
||||||
@ -60,14 +61,17 @@ class AddKeywordsDialog extends javax.swing.JDialog {
|
|||||||
public void changedUpdate(DocumentEvent e) {
|
public void changedUpdate(DocumentEvent e) {
|
||||||
fire();
|
fire();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeUpdate(DocumentEvent e) {
|
public void removeUpdate(DocumentEvent e) {
|
||||||
fire();
|
fire();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void insertUpdate(DocumentEvent e) {
|
public void insertUpdate(DocumentEvent e) {
|
||||||
fire();
|
fire();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void fire() {
|
private void fire() {
|
||||||
enableButtons();
|
enableButtons();
|
||||||
}
|
}
|
||||||
@ -85,30 +89,29 @@ class AddKeywordsDialog extends javax.swing.JDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the initial contents of the text box.
|
* Set the initial contents of the text box. Intended to be used to
|
||||||
* Intended to be used to redisplay any keywords that contained errors
|
* redisplay any keywords that contained errors
|
||||||
|
*
|
||||||
* @param initialKeywords
|
* @param initialKeywords
|
||||||
*/
|
*/
|
||||||
void setInitialKeywordList(String initialKeywords, boolean isLiteral, boolean isWholeWord) {
|
void setInitialKeywordList(String initialKeywords, boolean isLiteral, boolean isWholeWord) {
|
||||||
keywordTextArea.setText(initialKeywords);
|
keywordTextArea.setText(initialKeywords);
|
||||||
if (!isLiteral) {
|
if (!isLiteral) {
|
||||||
regexRadioButton.setSelected(true);
|
regexRadioButton.setSelected(true);
|
||||||
}
|
} else if (isWholeWord) {
|
||||||
else if (isWholeWord){
|
|
||||||
exactRadioButton.setSelected(true);
|
exactRadioButton.setSelected(true);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
substringRadioButton.setSelected(true);
|
substringRadioButton.setSelected(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void enableButtons() {
|
private void enableButtons() {
|
||||||
addButton.setEnabled(!keywordTextArea.getText().isEmpty());
|
addButton.setEnabled(!keywordTextArea.getText().isEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the list of keywords from the text area
|
* Get the list of keywords from the text area
|
||||||
|
*
|
||||||
* @return list of keywords
|
* @return list of keywords
|
||||||
*/
|
*/
|
||||||
List<String> getKeywords() {
|
List<String> getKeywords() {
|
||||||
@ -117,6 +120,7 @@ class AddKeywordsDialog extends javax.swing.JDialog {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get whether the regex option is selected
|
* Get whether the regex option is selected
|
||||||
|
*
|
||||||
* @return true if the regex radio button is selected
|
* @return true if the regex radio button is selected
|
||||||
*/
|
*/
|
||||||
boolean isKeywordRegex() {
|
boolean isKeywordRegex() {
|
||||||
@ -125,6 +129,7 @@ class AddKeywordsDialog extends javax.swing.JDialog {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get whether the exact match option is selected
|
* Get whether the exact match option is selected
|
||||||
|
*
|
||||||
* @return true if the exact match radio button is selected
|
* @return true if the exact match radio button is selected
|
||||||
*/
|
*/
|
||||||
boolean isKeywordExact() {
|
boolean isKeywordExact() {
|
||||||
@ -145,7 +150,14 @@ class AddKeywordsDialog extends javax.swing.JDialog {
|
|||||||
substringRadioButton = new javax.swing.JRadioButton();
|
substringRadioButton = new javax.swing.JRadioButton();
|
||||||
regexRadioButton = new javax.swing.JRadioButton();
|
regexRadioButton = new javax.swing.JRadioButton();
|
||||||
jScrollPane1 = new javax.swing.JScrollPane();
|
jScrollPane1 = new javax.swing.JScrollPane();
|
||||||
keywordTextArea = new javax.swing.JTextArea();
|
keywordTextArea = new JTextArea() {
|
||||||
|
//Override the paste action for this jtext area to always insert a new line before the pasted text
|
||||||
|
@Override
|
||||||
|
public void paste() {
|
||||||
|
keywordTextArea.setText(keywordTextArea.getText() + "\n");
|
||||||
|
super.paste();
|
||||||
|
}
|
||||||
|
};
|
||||||
enterKeywordsLabel = new javax.swing.JLabel();
|
enterKeywordsLabel = new javax.swing.JLabel();
|
||||||
keywordTypeLabel = new javax.swing.JLabel();
|
keywordTypeLabel = new javax.swing.JLabel();
|
||||||
addButton = new javax.swing.JButton();
|
addButton = new javax.swing.JButton();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user