2284 Functioning Copy button

This commit is contained in:
William Schaefer 2017-02-21 18:01:14 -05:00
parent 12a98a795f
commit a647c0bf5c
2 changed files with 21 additions and 18 deletions

View File

@ -391,20 +391,19 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp
} }
} }
private void doCopyFileSetsDialog(FilesSet selectedSet) {
}
/** /**
* Display an interesting files set definition panel in a dialog box and * Display an interesting files set definition panel in a dialog box and
* respond to user interactions with the dialog. * respond to user interactions with the dialog.
* *
* @param selectedSet The currently selected files set, may be null to * @param selectedSet The currently selected files set, may be null to
* indicate a new interesting files set definition is to * indicate a new interesting files set definition is
* be created. * to be created.
* @param shouldCreateNew Wether this should be creating a new set or
* replacing the selectedSet. False for edit, true
* for copy or new.
*/ */
private void doFileSetsDialog(FilesSet selectedSet) { private void doFileSetsDialog(FilesSet selectedSet, boolean shouldCreateNew) {
// Create a files set defintion panle. // Create a files set defintion panle.
FilesSetPanel panel; FilesSetPanel panel;
if (selectedSet != null) { if (selectedSet != null) {
@ -425,7 +424,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp
// While adding new ruleset(selectedSet == null), if rule set with same name already exists, do not add to the filesSets hashMap. // While adding new ruleset(selectedSet == null), if rule set with same name already exists, do not add to the filesSets hashMap.
// In case of editing an existing ruleset(selectedSet != null), following check is not performed. // In case of editing an existing ruleset(selectedSet != null), following check is not performed.
if (this.filesSets.containsKey(panel.getFilesSetName()) && selectedSet == null) { if (this.filesSets.containsKey(panel.getFilesSetName()) && shouldCreateNew ) {
MessageNotifyUtil.Message.error(NbBundle.getMessage(this.getClass(), MessageNotifyUtil.Message.error(NbBundle.getMessage(this.getClass(),
"FilesSetDefsPanel.doFileSetsDialog.duplicateRuleSet.text", "FilesSetDefsPanel.doFileSetsDialog.duplicateRuleSet.text",
panel.getFilesSetName())); panel.getFilesSetName()));
@ -440,9 +439,13 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp
// Preserve the existing rules from the set being edited. // Preserve the existing rules from the set being edited.
rules.putAll(selectedSet.getRules()); rules.putAll(selectedSet.getRules());
} }
if (shouldCreateNew) {
this.replaceFilesSet(null, panel.getFilesSetName(), panel.getFilesSetDescription(), panel.getFileSetIgnoresKnownFiles(), panel.getFileSetIgnoresUnallocatedSpace(), rules);
} else {
this.replaceFilesSet(selectedSet, panel.getFilesSetName(), panel.getFilesSetDescription(), panel.getFileSetIgnoresKnownFiles(), panel.getFileSetIgnoresUnallocatedSpace(), rules); this.replaceFilesSet(selectedSet, panel.getFilesSetName(), panel.getFilesSetDescription(), panel.getFileSetIgnoresKnownFiles(), panel.getFileSetIgnoresUnallocatedSpace(), rules);
} }
} }
}
/** /**
* Display an interesting files set membership rule definition panel in a * Display an interesting files set membership rule definition panel in a
@ -1001,7 +1004,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents
private void newSetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newSetButtonActionPerformed private void newSetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newSetButtonActionPerformed
this.doFileSetsDialog(null); this.doFileSetsDialog(null, true);
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
}//GEN-LAST:event_newSetButtonActionPerformed }//GEN-LAST:event_newSetButtonActionPerformed
@ -1049,7 +1052,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp
}//GEN-LAST:event_deleteSetButtonActionPerformed }//GEN-LAST:event_deleteSetButtonActionPerformed
private void editSetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editSetButtonActionPerformed private void editSetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editSetButtonActionPerformed
this.doFileSetsDialog(this.setsList.getSelectedValue()); this.doFileSetsDialog(this.setsList.getSelectedValue(), false);
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
}//GEN-LAST:event_editSetButtonActionPerformed }//GEN-LAST:event_editSetButtonActionPerformed
@ -1064,7 +1067,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp
}//GEN-LAST:event_newRuleButtonActionPerformed }//GEN-LAST:event_newRuleButtonActionPerformed
private void copySetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_copySetButtonActionPerformed private void copySetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_copySetButtonActionPerformed
// TODO add your handling code here: this.doFileSetsDialog(this.setsList.getSelectedValue(), true);
}//GEN-LAST:event_copySetButtonActionPerformed }//GEN-LAST:event_copySetButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables