diff --git a/Core/src/org/sleuthkit/autopsy/logicalimager/configuration/Bundle.properties b/Core/src/org/sleuthkit/autopsy/logicalimager/configuration/Bundle.properties index ab58cbe823..d77b84daef 100644 --- a/Core/src/org/sleuthkit/autopsy/logicalimager/configuration/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/logicalimager/configuration/Bundle.properties @@ -96,16 +96,10 @@ EditFullPathsRulePanel.fullPathsLabel.text=Full paths: EditFullPathsRulePanel.fullPathsLabel.toolTipText= EditNonFullPathsRulePanel.ruleNameTextField.text= EditNonFullPathsRulePanel.ruleNameLabel.text=Name: -EditNonFullPathsRulePanel.descriptionLabel.text=Description: EditNonFullPathsRulePanel.descriptionTextField.text= EditNonFullPathsRulePanel.shouldSaveCheckBox.text=Extract file if it matches a condition EditNonFullPathsRulePanel.daysIncludedLabel.text=day(s) -EditNonFullPathsRulePanel.modifiedDateLabel.text=Modified Within: -EditNonFullPathsRulePanel.fileSizeLabel.text=File size (bytes): -EditNonFullPathsRulePanel.folderNamesLabel.text=Folder names: -EditNonFullPathsRulePanel.filenamesLabel.text=File names: EditNonFullPathsRulePanel.extensionsTextField.text= -EditNonFullPathsRulePanel.extensionsLabel.text=Extensions: EditNonFullPathsRulePanel.shouldAlertCheckBox.actionCommand= EditNonFullPathsRulePanel.shouldAlertCheckBox.text=Alert in imager console if a condition matches ConfigVisualPanel1.browseButton.text=Browse @@ -113,8 +107,6 @@ ConfigVisualPanel2.fullPathsTable.columnModel.title0= ConfigVisualPanel2.folderNamesTable.columnModel.title0= ConfigVisualPanel2.shouldSaveCheckBox.toolTipText= NewRuleSetPanel.chooseLabel.text=Choose the type of rule -EditNonFullPathsRulePanel.minSizeLabel.text=Minimum: -EditNonFullPathsRulePanel.maxSizeLabel.text=Maximum: EditNonFullPathsRulePanel.minSizeTextField.text= EditNonFullPathsRulePanel.maxSizeTextField.text= ConfigVisualPanel2.maxSizeTextField.text= @@ -123,8 +115,11 @@ ConfigVisualPanel2.minSizeTextField.text= ConfigVisualPanel2.minSizeLabel.text=Minimum: EditNonFullPathsRulePanel.minDaysTextField.text=jFormattedTextField1 ConfigVisualPanel1.browseButton.toolTipText= -EditNonFullPathsRulePanel.extensionsRadioButton.text= -EditNonFullPathsRulePanel.filenamesRadioButton.text= -EditNonFullPathsRulePanel.extensionsRadioButton.toolTipText=Extensions and File names are mutually exclusive -EditNonFullPathsRulePanel.filenamesRadioButton.toolTipText=Extensions and File names are mutually exclusive EditNonFullPathsRulePanel.userFolderNote.text=Starting a folder name with the token [USER_FOLDER] will allow matches of all user folders in the file system. +EditNonFullPathsRulePanel.minSizeCheckBox.text=Minimum size: +EditNonFullPathsRulePanel.maxSizeCheckBox.text=Maximum size: +EditNonFullPathsRulePanel.modifiedWithinCheckbox.text=Modified within: +EditNonFullPathsRulePanel.folderNamesCheckbox.text=Folder names: +EditNonFullPathsRulePanel.fileNamesCheckbox.text=File names: +EditNonFullPathsRulePanel.extensionsCheckbox.text=Extensions: +EditNonFullPathsRulePanel.descriptionCheckbox.text=Description: diff --git a/Core/src/org/sleuthkit/autopsy/logicalimager/configuration/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/logicalimager/configuration/Bundle.properties-MERGED index da34711a47..748f8589e4 100644 --- a/Core/src/org/sleuthkit/autopsy/logicalimager/configuration/Bundle.properties-MERGED +++ b/Core/src/org/sleuthkit/autopsy/logicalimager/configuration/Bundle.properties-MERGED @@ -139,16 +139,10 @@ EditFullPathsRulePanel.fullPathsLabel.text=Full paths: EditFullPathsRulePanel.fullPathsLabel.toolTipText= EditNonFullPathsRulePanel.ruleNameTextField.text= EditNonFullPathsRulePanel.ruleNameLabel.text=Name: -EditNonFullPathsRulePanel.descriptionLabel.text=Description: EditNonFullPathsRulePanel.descriptionTextField.text= EditNonFullPathsRulePanel.shouldSaveCheckBox.text=Extract file if it matches a condition EditNonFullPathsRulePanel.daysIncludedLabel.text=day(s) -EditNonFullPathsRulePanel.modifiedDateLabel.text=Modified Within: -EditNonFullPathsRulePanel.fileSizeLabel.text=File size (bytes): -EditNonFullPathsRulePanel.folderNamesLabel.text=Folder names: -EditNonFullPathsRulePanel.filenamesLabel.text=File names: EditNonFullPathsRulePanel.extensionsTextField.text= -EditNonFullPathsRulePanel.extensionsLabel.text=Extensions: EditNonFullPathsRulePanel.shouldAlertCheckBox.actionCommand= EditNonFullPathsRulePanel.shouldAlertCheckBox.text=Alert in imager console if a condition matches ConfigVisualPanel1.browseButton.text=Browse @@ -165,8 +159,6 @@ LogicalImagerConfigDeserializer.unsupportedKeyException=Unsupported key: {0} NewRuleSetPanel.attributeRule.description=Search for files based on one or more attributes or metadata fields. NewRuleSetPanel.attributeRule.name=Attribute NewRuleSetPanel.chooseLabel.text=Choose the type of rule -EditNonFullPathsRulePanel.minSizeLabel.text=Minimum: -EditNonFullPathsRulePanel.maxSizeLabel.text=Maximum: EditNonFullPathsRulePanel.minSizeTextField.text= EditNonFullPathsRulePanel.maxSizeTextField.text= ConfigVisualPanel2.maxSizeTextField.text= @@ -175,10 +167,13 @@ ConfigVisualPanel2.minSizeTextField.text= ConfigVisualPanel2.minSizeLabel.text=Minimum: EditNonFullPathsRulePanel.minDaysTextField.text=jFormattedTextField1 ConfigVisualPanel1.browseButton.toolTipText= -EditNonFullPathsRulePanel.extensionsRadioButton.text= -EditNonFullPathsRulePanel.filenamesRadioButton.text= -EditNonFullPathsRulePanel.extensionsRadioButton.toolTipText=Extensions and File names are mutually exclusive -EditNonFullPathsRulePanel.filenamesRadioButton.toolTipText=Extensions and File names are mutually exclusive EditNonFullPathsRulePanel.userFolderNote.text=Starting a folder name with the token [USER_FOLDER] will allow matches of all user folders in the file system. +EditNonFullPathsRulePanel.minSizeCheckBox.text=Minimum size: +EditNonFullPathsRulePanel.maxSizeCheckBox.text=Maximum size: +EditNonFullPathsRulePanel.modifiedWithinCheckbox.text=Modified within: +EditNonFullPathsRulePanel.folderNamesCheckbox.text=Folder names: +EditNonFullPathsRulePanel.fileNamesCheckbox.text=File names: +EditNonFullPathsRulePanel.extensionsCheckbox.text=Extensions: +EditNonFullPathsRulePanel.descriptionCheckbox.text=Description: NewRuleSetPanel.fullPathRule.description=Search for files based on full exact match path. NewRuleSetPanel.fullPathRule.name=Full Path diff --git a/Core/src/org/sleuthkit/autopsy/logicalimager/configuration/EditNonFullPathsRulePanel.form b/Core/src/org/sleuthkit/autopsy/logicalimager/configuration/EditNonFullPathsRulePanel.form index 74c32592ff..799c443965 100644 --- a/Core/src/org/sleuthkit/autopsy/logicalimager/configuration/EditNonFullPathsRulePanel.form +++ b/Core/src/org/sleuthkit/autopsy/logicalimager/configuration/EditNonFullPathsRulePanel.form @@ -1,10 +1,6 @@
- - - - @@ -20,64 +16,65 @@ - - + + - - - - - - + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + - - + + + + - + - - - - - - - - - - - - - + + + + + + + + + + - - - - - + - @@ -90,65 +87,59 @@ - - - + + + - - - - + + + - + - - - - - + + - - + + + + + - - - - - - - + + + + - + + + + + + - - + + - + - - - - - - - @@ -174,39 +165,12 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - + @@ -214,13 +178,7 @@ - - - - - - - + @@ -238,20 +196,19 @@ + + + + + + - - - - - - - @@ -260,13 +217,7 @@ - - - - - - - + @@ -277,48 +228,17 @@ + - + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -329,5 +249,75 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/logicalimager/configuration/EditNonFullPathsRulePanel.java b/Core/src/org/sleuthkit/autopsy/logicalimager/configuration/EditNonFullPathsRulePanel.java index c566e94778..1099bc7594 100644 --- a/Core/src/org/sleuthkit/autopsy/logicalimager/configuration/EditNonFullPathsRulePanel.java +++ b/Core/src/org/sleuthkit/autopsy/logicalimager/configuration/EditNonFullPathsRulePanel.java @@ -1,7 +1,7 @@ /* - * Autopsy Forensic Browser + * Autopsy * - * Copyright 2011-2019 Basis Technology Corp. + * Copyright 2019 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -43,11 +43,13 @@ import org.openide.util.NbBundle; @SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives final class EditNonFullPathsRulePanel extends javax.swing.JPanel { + private static final long serialVersionUID = 1L; + private static final Color DISABLED_COLOR = new Color(240,240,240); private JButton okButton; private JButton cancelButton; private final javax.swing.JTextArea filenamesTextArea; private final javax.swing.JTextArea folderNamesTextArea; - + /** * Creates new form EditRulePanel */ @@ -65,45 +67,46 @@ final class EditNonFullPathsRulePanel extends javax.swing.JPanel { this.setButtons(okButton, cancelButton); setExtensions(rule.getExtensions()); - + filenamesTextArea = new JTextArea(); initTextArea(filenamesScrollPane, filenamesTextArea); setTextArea(filenamesTextArea, rule.getFilenames()); - if (rule.getExtensions() == null) { - extensionsRadioButton.setSelected(false); - filenamesRadioButton.setSelected(true); - } else { - extensionsRadioButton.setSelected(true); - filenamesRadioButton.setSelected(false); + if (rule.getExtensions() != null) { + extensionsCheckbox.setSelected(true); + } else if (rule.getFilenames() != null && !rule.getFilenames().isEmpty()) { + fileNamesCheckbox.setSelected(true); } - + updateExclusiveConditions(); folderNamesTextArea = new JTextArea(); initTextArea(folderNamesScrollPane, folderNamesTextArea); setTextArea(folderNamesTextArea, rule.getPaths()); - + setMinDays(rule.getMinDays()); - + minSizeTextField.setText(rule.getMinFileSize() == null ? "" : rule.getMinFileSize().toString()); maxSizeTextField.setText(rule.getMaxFileSize() == null ? "" : rule.getMaxFileSize().toString()); ruleNameTextField.requestFocus(); - + EditRulePanel.setTextFieldPrompts(extensionsTextField, Bundle.EditNonFullPathsRulePanel_example() + "gif,jpg,png"); // NON-NLS - EditRulePanel.setTextFieldPrompts(filenamesTextArea, "" - + Bundle.EditNonFullPathsRulePanel_example() + EditRulePanel.setTextFieldPrompts(filenamesTextArea, "" + + Bundle.EditNonFullPathsRulePanel_example() + "
filename.txt
readme.txt"); // NON-NLS - EditRulePanel.setTextFieldPrompts(folderNamesTextArea, "" - + Bundle.EditNonFullPathsRulePanel_example() + EditRulePanel.setTextFieldPrompts(folderNamesTextArea, "" + + Bundle.EditNonFullPathsRulePanel_example() + "
[USER_FOLDER]/My Documents/Downloads" + "
/Program Files/Common Files"); // NON-NLS validate(); repaint(); } - + private void initTextArea(JScrollPane pane, JTextArea textArea) { textArea.setColumns(20); - textArea.setRows(5); + textArea.setRows(4); pane.setViewportView(textArea); + textArea.setEnabled(false); + textArea.setEditable(false); + textArea.setBackground(DISABLED_COLOR); textArea.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { @@ -115,20 +118,18 @@ final class EditNonFullPathsRulePanel extends javax.swing.JPanel { } e.consume(); } - } + } }); } - + private void setMinDays(Integer minDays) { - minDaysTextField.setText(minDays == null ? "" : minDays.toString()); + modifiedWithTextField.setText(minDays == null ? "" : minDays.toString()); } private void setTextArea(JTextArea textArea, List set) { String text = ""; if (set != null) { - for (String s : set) { - text += s + System.getProperty("line.separator"); // NON-NLS - } + text = set.stream().map((s) -> s + System.getProperty("line.separator")).reduce(text, String::concat); // NON-NLS } textArea.setText(text); } @@ -138,13 +139,14 @@ final class EditNonFullPathsRulePanel extends javax.swing.JPanel { String content = ""; if (extensions != null) { boolean first = true; - for (String ext : extensions) { + for (String ext : extensions) { content += (first ? "" : ",") + ext; first = false; } } extensionsTextField.setText(content); } + /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always @@ -154,32 +156,26 @@ final class EditNonFullPathsRulePanel extends javax.swing.JPanel { // //GEN-BEGIN:initComponents private void initComponents() { - buttonGroup = new javax.swing.ButtonGroup(); - modifiedDateLabel = new javax.swing.JLabel(); daysIncludedLabel = new javax.swing.JLabel(); shouldSaveCheckBox = new javax.swing.JCheckBox(); shouldAlertCheckBox = new javax.swing.JCheckBox(); - extensionsLabel = new javax.swing.JLabel(); extensionsTextField = new javax.swing.JTextField(); - filenamesLabel = new javax.swing.JLabel(); - folderNamesLabel = new javax.swing.JLabel(); - fileSizeLabel = new javax.swing.JLabel(); descriptionTextField = new javax.swing.JTextField(); - descriptionLabel = new javax.swing.JLabel(); ruleNameLabel = new javax.swing.JLabel(); ruleNameTextField = new javax.swing.JTextField(); filenamesScrollPane = new javax.swing.JScrollPane(); folderNamesScrollPane = new javax.swing.JScrollPane(); - minSizeLabel = new javax.swing.JLabel(); minSizeTextField = new javax.swing.JFormattedTextField(); - maxSizeLabel = new javax.swing.JLabel(); maxSizeTextField = new javax.swing.JFormattedTextField(); - minDaysTextField = new javax.swing.JFormattedTextField(); - extensionsRadioButton = new javax.swing.JRadioButton(); - filenamesRadioButton = new javax.swing.JRadioButton(); + modifiedWithTextField = new javax.swing.JFormattedTextField(); userFolderNote = new javax.swing.JLabel(); - - org.openide.awt.Mnemonics.setLocalizedText(modifiedDateLabel, org.openide.util.NbBundle.getMessage(EditNonFullPathsRulePanel.class, "EditNonFullPathsRulePanel.modifiedDateLabel.text")); // NOI18N + minSizeCheckBox = new javax.swing.JCheckBox(); + maxSizeCheckBox = new javax.swing.JCheckBox(); + modifiedWithinCheckbox = new javax.swing.JCheckBox(); + folderNamesCheckbox = new javax.swing.JCheckBox(); + fileNamesCheckbox = new javax.swing.JCheckBox(); + extensionsCheckbox = new javax.swing.JCheckBox(); + descriptionCheckbox = new javax.swing.JCheckBox(); org.openide.awt.Mnemonics.setLocalizedText(daysIncludedLabel, org.openide.util.NbBundle.getMessage(EditNonFullPathsRulePanel.class, "EditNonFullPathsRulePanel.daysIncludedLabel.text")); // NOI18N @@ -189,108 +185,131 @@ final class EditNonFullPathsRulePanel extends javax.swing.JPanel { org.openide.awt.Mnemonics.setLocalizedText(shouldAlertCheckBox, org.openide.util.NbBundle.getMessage(EditNonFullPathsRulePanel.class, "EditNonFullPathsRulePanel.shouldAlertCheckBox.text")); // NOI18N shouldAlertCheckBox.setActionCommand(org.openide.util.NbBundle.getMessage(EditNonFullPathsRulePanel.class, "EditNonFullPathsRulePanel.shouldAlertCheckBox.actionCommand")); // NOI18N - org.openide.awt.Mnemonics.setLocalizedText(extensionsLabel, org.openide.util.NbBundle.getMessage(EditNonFullPathsRulePanel.class, "EditNonFullPathsRulePanel.extensionsLabel.text")); // NOI18N - extensionsTextField.setText(org.openide.util.NbBundle.getMessage(EditNonFullPathsRulePanel.class, "EditNonFullPathsRulePanel.extensionsTextField.text")); // NOI18N - - org.openide.awt.Mnemonics.setLocalizedText(filenamesLabel, org.openide.util.NbBundle.getMessage(EditNonFullPathsRulePanel.class, "EditNonFullPathsRulePanel.filenamesLabel.text")); // NOI18N - - org.openide.awt.Mnemonics.setLocalizedText(folderNamesLabel, org.openide.util.NbBundle.getMessage(EditNonFullPathsRulePanel.class, "EditNonFullPathsRulePanel.folderNamesLabel.text")); // NOI18N - - org.openide.awt.Mnemonics.setLocalizedText(fileSizeLabel, org.openide.util.NbBundle.getMessage(EditNonFullPathsRulePanel.class, "EditNonFullPathsRulePanel.fileSizeLabel.text")); // NOI18N + extensionsTextField.setEnabled(false); descriptionTextField.setText(org.openide.util.NbBundle.getMessage(EditNonFullPathsRulePanel.class, "EditNonFullPathsRulePanel.descriptionTextField.text")); // NOI18N - - org.openide.awt.Mnemonics.setLocalizedText(descriptionLabel, org.openide.util.NbBundle.getMessage(EditNonFullPathsRulePanel.class, "EditNonFullPathsRulePanel.descriptionLabel.text")); // NOI18N + descriptionTextField.setEnabled(false); org.openide.awt.Mnemonics.setLocalizedText(ruleNameLabel, org.openide.util.NbBundle.getMessage(EditNonFullPathsRulePanel.class, "EditNonFullPathsRulePanel.ruleNameLabel.text")); // NOI18N ruleNameTextField.setText(org.openide.util.NbBundle.getMessage(EditNonFullPathsRulePanel.class, "EditNonFullPathsRulePanel.ruleNameTextField.text")); // NOI18N - org.openide.awt.Mnemonics.setLocalizedText(minSizeLabel, org.openide.util.NbBundle.getMessage(EditNonFullPathsRulePanel.class, "EditNonFullPathsRulePanel.minSizeLabel.text")); // NOI18N + filenamesScrollPane.setEnabled(false); + + folderNamesScrollPane.setEnabled(false); minSizeTextField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#,###; ")))); minSizeTextField.setText(org.openide.util.NbBundle.getMessage(EditNonFullPathsRulePanel.class, "EditNonFullPathsRulePanel.minSizeTextField.text")); // NOI18N - - org.openide.awt.Mnemonics.setLocalizedText(maxSizeLabel, org.openide.util.NbBundle.getMessage(EditNonFullPathsRulePanel.class, "EditNonFullPathsRulePanel.maxSizeLabel.text")); // NOI18N + minSizeTextField.setEnabled(false); maxSizeTextField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("#,###; ")))); maxSizeTextField.setText(org.openide.util.NbBundle.getMessage(EditNonFullPathsRulePanel.class, "EditNonFullPathsRulePanel.maxSizeTextField.text")); // NOI18N + maxSizeTextField.setEnabled(false); - minDaysTextField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("####; ")))); - - buttonGroup.add(extensionsRadioButton); - extensionsRadioButton.setSelected(true); - org.openide.awt.Mnemonics.setLocalizedText(extensionsRadioButton, org.openide.util.NbBundle.getMessage(EditNonFullPathsRulePanel.class, "EditNonFullPathsRulePanel.extensionsRadioButton.text")); // NOI18N - extensionsRadioButton.setToolTipText(org.openide.util.NbBundle.getMessage(EditNonFullPathsRulePanel.class, "EditNonFullPathsRulePanel.extensionsRadioButton.toolTipText")); // NOI18N - extensionsRadioButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - extensionsRadioButtonActionPerformed(evt); - } - }); - - buttonGroup.add(filenamesRadioButton); - org.openide.awt.Mnemonics.setLocalizedText(filenamesRadioButton, org.openide.util.NbBundle.getMessage(EditNonFullPathsRulePanel.class, "EditNonFullPathsRulePanel.filenamesRadioButton.text")); // NOI18N - filenamesRadioButton.setToolTipText(org.openide.util.NbBundle.getMessage(EditNonFullPathsRulePanel.class, "EditNonFullPathsRulePanel.filenamesRadioButton.toolTipText")); // NOI18N - filenamesRadioButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - filenamesRadioButtonActionPerformed(evt); - } - }); + modifiedWithTextField.setFormatterFactory(new javax.swing.text.DefaultFormatterFactory(new javax.swing.text.NumberFormatter(new java.text.DecimalFormat("####; ")))); + modifiedWithTextField.setEnabled(false); userFolderNote.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/info-icon-16.png"))); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(userFolderNote, org.openide.util.NbBundle.getMessage(EditNonFullPathsRulePanel.class, "EditNonFullPathsRulePanel.userFolderNote.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(minSizeCheckBox, org.openide.util.NbBundle.getMessage(EditNonFullPathsRulePanel.class, "EditNonFullPathsRulePanel.minSizeCheckBox.text")); // NOI18N + minSizeCheckBox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + minSizeCheckBoxActionPerformed(evt); + } + }); + + org.openide.awt.Mnemonics.setLocalizedText(maxSizeCheckBox, org.openide.util.NbBundle.getMessage(EditNonFullPathsRulePanel.class, "EditNonFullPathsRulePanel.maxSizeCheckBox.text")); // NOI18N + maxSizeCheckBox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + maxSizeCheckBoxActionPerformed(evt); + } + }); + + org.openide.awt.Mnemonics.setLocalizedText(modifiedWithinCheckbox, org.openide.util.NbBundle.getMessage(EditNonFullPathsRulePanel.class, "EditNonFullPathsRulePanel.modifiedWithinCheckbox.text")); // NOI18N + modifiedWithinCheckbox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + modifiedWithinCheckboxActionPerformed(evt); + } + }); + + org.openide.awt.Mnemonics.setLocalizedText(folderNamesCheckbox, org.openide.util.NbBundle.getMessage(EditNonFullPathsRulePanel.class, "EditNonFullPathsRulePanel.folderNamesCheckbox.text")); // NOI18N + folderNamesCheckbox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + folderNamesCheckboxActionPerformed(evt); + } + }); + + org.openide.awt.Mnemonics.setLocalizedText(fileNamesCheckbox, org.openide.util.NbBundle.getMessage(EditNonFullPathsRulePanel.class, "EditNonFullPathsRulePanel.fileNamesCheckbox.text")); // NOI18N + fileNamesCheckbox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + fileNamesCheckboxActionPerformed(evt); + } + }); + + org.openide.awt.Mnemonics.setLocalizedText(extensionsCheckbox, org.openide.util.NbBundle.getMessage(EditNonFullPathsRulePanel.class, "EditNonFullPathsRulePanel.extensionsCheckbox.text")); // NOI18N + extensionsCheckbox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + extensionsCheckboxActionPerformed(evt); + } + }); + + org.openide.awt.Mnemonics.setLocalizedText(descriptionCheckbox, org.openide.util.NbBundle.getMessage(EditNonFullPathsRulePanel.class, "EditNonFullPathsRulePanel.descriptionCheckbox.text")); // NOI18N + descriptionCheckbox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + descriptionCheckboxActionPerformed(evt); + } + }); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(extensionsRadioButton) - .addComponent(filenamesRadioButton)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGap(27, 27, 27) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(shouldAlertCheckBox) .addGroup(layout.createSequentialGroup() - .addGap(81, 81, 81) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addComponent(minDaysTextField) - .addComponent(minSizeLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addComponent(folderNamesCheckbox, javax.swing.GroupLayout.DEFAULT_SIZE, 101, Short.MAX_VALUE) + .addComponent(extensionsCheckbox, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(descriptionCheckbox, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(ruleNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(minSizeCheckBox, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(maxSizeCheckBox, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 101, Short.MAX_VALUE))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(ruleNameTextField, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(descriptionTextField, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(extensionsTextField, javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(folderNamesScrollPane) + .addComponent(filenamesScrollPane, javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() - .addComponent(minSizeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(18, 18, 18) - .addComponent(maxSizeLabel) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(maxSizeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addComponent(daysIncludedLabel))) - .addComponent(shouldSaveCheckBox)) - .addGap(0, 0, Short.MAX_VALUE)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(minSizeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(maxSizeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(userFolderNote)) + .addGap(0, 0, Short.MAX_VALUE)))) + .addGroup(layout.createSequentialGroup() + .addComponent(fileNamesCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 101, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE))) + .addContainerGap()) .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(ruleNameLabel) - .addComponent(descriptionLabel) - .addComponent(extensionsLabel) - .addComponent(filenamesLabel) - .addComponent(folderNamesLabel) - .addComponent(fileSizeLabel) - .addComponent(modifiedDateLabel)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() - .addComponent(userFolderNote) - .addGap(0, 0, Short.MAX_VALUE)) - .addComponent(folderNamesScrollPane, javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(filenamesScrollPane, javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(extensionsTextField, javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(descriptionTextField, javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(ruleNameTextField, javax.swing.GroupLayout.Alignment.TRAILING)))) - .addContainerGap()) + .addComponent(modifiedWithinCheckbox) + .addGap(10, 10, 10) + .addComponent(modifiedWithTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 63, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(daysIncludedLabel)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(shouldAlertCheckBox) + .addComponent(shouldSaveCheckBox))) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -300,82 +319,118 @@ final class EditNonFullPathsRulePanel extends javax.swing.JPanel { .addComponent(ruleNameLabel) .addComponent(ruleNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) - .addComponent(descriptionLabel) - .addComponent(descriptionTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(descriptionTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(descriptionCheckbox)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(extensionsTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(extensionsLabel) - .addComponent(extensionsRadioButton)) + .addComponent(extensionsCheckbox)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(filenamesScrollPane) .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) - .addComponent(filenamesLabel) - .addComponent(filenamesRadioButton)) - .addGap(0, 53, Short.MAX_VALUE))) + .addComponent(fileNamesCheckbox) + .addGap(0, 0, Short.MAX_VALUE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(folderNamesLabel) - .addComponent(folderNamesScrollPane)) + .addComponent(folderNamesScrollPane) + .addGroup(layout.createSequentialGroup() + .addComponent(folderNamesCheckbox) + .addGap(0, 0, Short.MAX_VALUE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(userFolderNote) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 8, Short.MAX_VALUE) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) - .addComponent(fileSizeLabel) - .addComponent(minSizeLabel) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(minSizeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(maxSizeLabel) - .addComponent(maxSizeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGap(6, 6, 6) + .addComponent(minSizeCheckBox)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(maxSizeTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(maxSizeCheckBox)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER) - .addComponent(modifiedDateLabel) .addComponent(daysIncludedLabel) - .addComponent(minDaysTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(modifiedWithTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(modifiedWithinCheckbox)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(shouldSaveCheckBox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(shouldAlertCheckBox) - .addContainerGap()) + .addGap(11, 11, 11)) ); }// //GEN-END:initComponents - private void extensionsRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_extensionsRadioButtonActionPerformed - filenamesTextArea.setEnabled(false); - filenamesTextArea.setForeground(Color.LIGHT_GRAY); - extensionsTextField.setEnabled(true); - extensionsTextField.setForeground(Color.BLACK); - }//GEN-LAST:event_extensionsRadioButtonActionPerformed + private void extensionsCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_extensionsCheckboxActionPerformed + if (fileNamesCheckbox.isSelected() && extensionsCheckbox.isSelected()) { + fileNamesCheckbox.setSelected(false); + } + updateExclusiveConditions(); + }//GEN-LAST:event_extensionsCheckboxActionPerformed - private void filenamesRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_filenamesRadioButtonActionPerformed - filenamesTextArea.setEnabled(true); - filenamesTextArea.setForeground(Color.BLACK); - extensionsTextField.setEnabled(false); - extensionsTextField.setForeground(Color.LIGHT_GRAY); - }//GEN-LAST:event_filenamesRadioButtonActionPerformed + private void fileNamesCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileNamesCheckboxActionPerformed + if (fileNamesCheckbox.isSelected() && extensionsCheckbox.isSelected()) { + extensionsCheckbox.setSelected(false); + } + updateExclusiveConditions(); + }//GEN-LAST:event_fileNamesCheckboxActionPerformed + + private void descriptionCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_descriptionCheckboxActionPerformed + descriptionTextField.setEnabled(descriptionCheckbox.isSelected()); + }//GEN-LAST:event_descriptionCheckboxActionPerformed + + private void folderNamesCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_folderNamesCheckboxActionPerformed + folderNamesScrollPane.setEnabled(folderNamesCheckbox.isSelected()); + folderNamesTextArea.setEditable(folderNamesCheckbox.isSelected()); + folderNamesTextArea.setEnabled(folderNamesCheckbox.isSelected()); + updateTextAreaBackgroundColor(folderNamesTextArea); + + }//GEN-LAST:event_folderNamesCheckboxActionPerformed + + private void minSizeCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_minSizeCheckBoxActionPerformed + minSizeTextField.setEnabled(minSizeCheckBox.isSelected()); + }//GEN-LAST:event_minSizeCheckBoxActionPerformed + + private void maxSizeCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_maxSizeCheckBoxActionPerformed + maxSizeTextField.setEnabled(maxSizeCheckBox.isSelected()); + }//GEN-LAST:event_maxSizeCheckBoxActionPerformed + + private void modifiedWithinCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_modifiedWithinCheckboxActionPerformed + modifiedWithTextField.setEnabled(modifiedWithinCheckbox.isSelected()); + }//GEN-LAST:event_modifiedWithinCheckboxActionPerformed + + private static void updateTextAreaBackgroundColor(JTextArea textArea){ + if (textArea.isEnabled()){ + textArea.setBackground(Color.WHITE); + } else { + textArea.setBackground(DISABLED_COLOR); + } + } + + private void updateExclusiveConditions() { + extensionsTextField.setEnabled(extensionsCheckbox.isSelected()); + filenamesScrollPane.setEnabled(fileNamesCheckbox.isSelected()); + filenamesTextArea.setEditable(fileNamesCheckbox.isSelected()); + filenamesTextArea.setEnabled(fileNamesCheckbox.isSelected()); + updateTextAreaBackgroundColor(filenamesTextArea); + } // Variables declaration - do not modify//GEN-BEGIN:variables - private javax.swing.ButtonGroup buttonGroup; private javax.swing.JLabel daysIncludedLabel; - private javax.swing.JLabel descriptionLabel; + private javax.swing.JCheckBox descriptionCheckbox; private javax.swing.JTextField descriptionTextField; - private javax.swing.JLabel extensionsLabel; - private javax.swing.JRadioButton extensionsRadioButton; + private javax.swing.JCheckBox extensionsCheckbox; private javax.swing.JTextField extensionsTextField; - private javax.swing.JLabel fileSizeLabel; - private javax.swing.JLabel filenamesLabel; - private javax.swing.JRadioButton filenamesRadioButton; + private javax.swing.JCheckBox fileNamesCheckbox; private javax.swing.JScrollPane filenamesScrollPane; - private javax.swing.JLabel folderNamesLabel; + private javax.swing.JCheckBox folderNamesCheckbox; private javax.swing.JScrollPane folderNamesScrollPane; - private javax.swing.JLabel maxSizeLabel; + private javax.swing.JCheckBox maxSizeCheckBox; private javax.swing.JFormattedTextField maxSizeTextField; - private javax.swing.JFormattedTextField minDaysTextField; - private javax.swing.JLabel minSizeLabel; + private javax.swing.JCheckBox minSizeCheckBox; private javax.swing.JFormattedTextField minSizeTextField; - private javax.swing.JLabel modifiedDateLabel; + private javax.swing.JFormattedTextField modifiedWithTextField; + private javax.swing.JCheckBox modifiedWithinCheckbox; private javax.swing.JLabel ruleNameLabel; private javax.swing.JTextField ruleNameTextField; private javax.swing.JCheckBox shouldAlertCheckBox; @@ -451,32 +506,31 @@ final class EditNonFullPathsRulePanel extends javax.swing.JPanel { "# {1} - minFileSize", "EditNonFullPathsRulePanel.maxFileSizeSmallerThanMinException=Maximum file size: {0} must be bigger than minimum file size: {1}", "EditNonFullPathsRulePanel.fileNames=File names", - "EditNonFullPathsRulePanel.folderNames=Folder names", - }) + "EditNonFullPathsRulePanel.folderNames=Folder names",}) ImmutablePair toRule() throws IOException { String ruleName = EditRulePanel.validRuleName(ruleNameTextField.getText()); List extensions = validateExtensions(extensionsTextField); List filenames = EditRulePanel.validateTextList(filenamesTextArea, Bundle.EditNonFullPathsRulePanel_fileNames()); List folderNames = EditRulePanel.validateTextList(folderNamesTextArea, Bundle.EditNonFullPathsRulePanel_folderNames()); - + LogicalImagerRule.Builder builder = new LogicalImagerRule.Builder(); builder.getName(ruleName) .getDescription(descriptionTextField.getText()) .getShouldAlert(shouldAlertCheckBox.isSelected()) .getShouldSave(shouldSaveCheckBox.isSelected()) .getPaths(folderNames); - - if (extensionsRadioButton.isSelected()) { + + if (extensionsCheckbox.isSelected()) { builder.getExtensions(extensions); - } else { + } else if (fileNamesCheckbox.isSelected()) { builder.getFilenames(filenames); } - + int minDays; - if (!isBlank(minDaysTextField.getText())) { + if (!isBlank(modifiedWithTextField.getText())) { try { - minDaysTextField.commitEdit(); - minDays = ((Number)minDaysTextField.getValue()).intValue(); + modifiedWithTextField.commitEdit(); + minDays = ((Number) modifiedWithTextField.getValue()).intValue(); if (minDays < 0) { throw new IOException(Bundle.EditNonFullPathsRulePanel_modifiedDaysNotPositiveException()); } @@ -485,12 +539,12 @@ final class EditNonFullPathsRulePanel extends javax.swing.JPanel { throw new IOException(Bundle.EditNonFullPathsRulePanel_modifiedDaysMustBeNumberException(ex.getMessage()), ex); } } - + int minFileSize = 0; if (!isBlank(minSizeTextField.getText())) { try { minSizeTextField.commitEdit(); - minFileSize = ((Number)minSizeTextField.getValue()).intValue(); + minFileSize = ((Number) minSizeTextField.getValue()).intValue(); if (minFileSize < 0) { throw new IOException(Bundle.EditNonFullPathsRulePanel_minFileSizeNotPositiveException()); } @@ -498,12 +552,12 @@ final class EditNonFullPathsRulePanel extends javax.swing.JPanel { throw new IOException(Bundle.EditNonFullPathsRulePanel_minFileSizeMustBeNumberException(ex.getMessage()), ex); } } - + int maxFileSize = 0; if (!isBlank(maxSizeTextField.getText())) { try { maxSizeTextField.commitEdit(); - maxFileSize = ((Number)maxSizeTextField.getValue()).intValue(); + maxFileSize = ((Number) maxSizeTextField.getValue()).intValue(); if (maxFileSize < 0) { throw new IOException(Bundle.EditNonFullPathsRulePanel_maxFileSizeNotPositiveException()); } @@ -511,7 +565,7 @@ final class EditNonFullPathsRulePanel extends javax.swing.JPanel { throw new IOException(Bundle.EditNonFullPathsRulePanel_maxFileSizeMustBeNumberException(ex.getMessage()), ex); } } - + if (maxFileSize != 0 && (maxFileSize < minFileSize)) { throw new IOException(Bundle.EditNonFullPathsRulePanel_maxFileSizeSmallerThanMinException(maxFileSize, minFileSize)); } @@ -521,25 +575,24 @@ final class EditNonFullPathsRulePanel extends javax.swing.JPanel { if (maxFileSize != 0) { builder.getMaxFileSize(maxFileSize); } - + LogicalImagerRule rule = builder.build(); return new ImmutablePair<>(ruleName, rule); } @NbBundle.Messages({ - "EditNonFullPathsRulePanel.emptyExtensionException=Extensions cannot have an empty entry", - }) + "EditNonFullPathsRulePanel.emptyExtensionException=Extensions cannot have an empty entry",}) private List validateExtensions(JTextField textField) throws IOException { if (isBlank(textField.getText())) { return null; } List extensions = new ArrayList<>(); for (String extension : textField.getText().split(",")) { - extension = strip(extension); + String strippedExtension = strip(extension); if (extension.isEmpty()) { throw new IOException(Bundle.EditNonFullPathsRulePanel_emptyExtensionException()); } - extensions.add(extension); + extensions.add(strippedExtension); } if (extensions.isEmpty()) { return null;