mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-12 16:06:15 +00:00
6454 Added confirmation before deleting persona
This commit is contained in:
parent
b6f33e72f8
commit
dd36f60f31
@ -21,17 +21,15 @@ CTL_PersonaDetailsTopComponent=Persona Details
|
||||
OpenPersonasAction.displayName=Persona Manager
|
||||
PersonaDetailsDialogCreateTitle=Create Persona
|
||||
PersonaDetailsDialogEditTitle=Edit Persona
|
||||
PersonaDetailsDialogViewTitle=View Persona
|
||||
PersonaDetailsPanel_CentralRepoErr_msg=Failure to write to Central Repository
|
||||
PersonaDetailsPanel_CentralRepoErr_Title=Central Repository failure
|
||||
PersonaDetailsPanel_EmptyName_msg=Persona name cannot be empty
|
||||
PersonaDetailsPanel_EmptyName_Title=Empty persona name
|
||||
PersonaDetailsPanel_load_exception_msg=Failed to load persona
|
||||
PersonaDetailsPanel_load_exception_Title=Initialization failure
|
||||
PersonaDetailsPanel_NameCreate=Create Persona
|
||||
PersonaDetailsPanel_NameEdit=Edit Persona
|
||||
PersonaDetailsPanel_NameView=View Persona
|
||||
PersonaDetailsPanel_NotEnoughAccounts_msg=Two or more accounts are necessary to create a persona
|
||||
PersonaDetailsPanel_NotEnoughAccounts_Title=Not enough accounts
|
||||
PersonaDetailsPanel_NotEnoughAccounts_msg=A persona needs at least one account
|
||||
PersonaDetailsPanel_NotEnoughAccounts_Title=Missing account
|
||||
PersonaManagerTopComponent.createBtn.text=New Persona
|
||||
PersonaManagerTopComponent.searchBtn.text=Search
|
||||
PersonaManagerTopComponent.resultsTable.columnModel.title1=Name
|
||||
@ -84,6 +82,11 @@ AddAccountDialog.confidenceLbl.text=Confidence:
|
||||
AddAccountDialog.typeLbl.text=Type:
|
||||
AddAccountDialog.identiferLbl.text=Identifier:
|
||||
AddAccountDialog.identifierTextField.text=
|
||||
PersonaManagerTopComponent.deleteBtn.text=Delete Persona
|
||||
PMTopComponent_delete_confirmation_msg=Are you sure you want to delete a persona?
|
||||
PMTopComponent_delete_confirmation_Title=Are you sure?
|
||||
PMTopComponent_delete_exception_msg=Failed to delete persona.
|
||||
PMTopComponent_delete_exception_Title=Delete failure
|
||||
PMTopComponent_Name=Persona Manager
|
||||
PMTopComponent_search_exception_msg=Failed to search personas
|
||||
PMTopComponent_search_exception_Title=Search failure
|
||||
|
@ -30,6 +30,8 @@ import javax.swing.ListSelectionModel;
|
||||
import javax.swing.event.ListSelectionEvent;
|
||||
import javax.swing.event.ListSelectionListener;
|
||||
import javax.swing.table.DefaultTableModel;
|
||||
import org.openide.DialogDisplayer;
|
||||
import org.openide.NotifyDescriptor;
|
||||
import org.openide.util.NbBundle.Messages;
|
||||
import org.openide.windows.RetainLocation;
|
||||
import org.openide.windows.TopComponent;
|
||||
@ -56,7 +58,9 @@ public final class PersonaManagerTopComponent extends TopComponent {
|
||||
@Messages({
|
||||
"PMTopComponent_Name=Persona Manager",
|
||||
"PMTopComponent_delete_exception_Title=Delete failure",
|
||||
"PMTopComponent_delete_exception_msg=Failed to delete persona",
|
||||
"PMTopComponent_delete_exception_msg=Failed to delete persona.",
|
||||
"PMTopComponent_delete_confirmation_Title=Are you sure?",
|
||||
"PMTopComponent_delete_confirmation_msg=Are you sure you want to delete this persona?",
|
||||
})
|
||||
public PersonaManagerTopComponent() {
|
||||
initComponents();
|
||||
@ -89,19 +93,26 @@ public final class PersonaManagerTopComponent extends TopComponent {
|
||||
deleteBtn.addActionListener(new ActionListener() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
try {
|
||||
if (selectedPersona != null) {
|
||||
selectedPersona.delete();
|
||||
NotifyDescriptor confirm = new NotifyDescriptor.Confirmation(
|
||||
Bundle.PMTopComponent_delete_confirmation_msg(),
|
||||
Bundle.PMTopComponent_delete_confirmation_Title(),
|
||||
NotifyDescriptor.YES_NO_OPTION);
|
||||
DialogDisplayer.getDefault().notify(confirm);
|
||||
if (confirm.getValue().equals(NotifyDescriptor.YES_OPTION)) {
|
||||
try {
|
||||
if (selectedPersona != null) {
|
||||
selectedPersona.delete();
|
||||
}
|
||||
} catch (CentralRepoException ex) {
|
||||
logger.log(Level.SEVERE, "Failed to delete persona: " + selectedPersona.getName(), ex);
|
||||
JOptionPane.showMessageDialog(PersonaManagerTopComponent.this,
|
||||
Bundle.PMTopComponent_delete_exception_msg(),
|
||||
Bundle.PMTopComponent_delete_exception_Title(),
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
}
|
||||
} catch (CentralRepoException ex) {
|
||||
logger.log(Level.SEVERE, "Failed to delete persona: " + selectedPersona.getName(), ex);
|
||||
JOptionPane.showMessageDialog(PersonaManagerTopComponent.this,
|
||||
Bundle.PMTopComponent_delete_exception_msg(),
|
||||
Bundle.PMTopComponent_delete_exception_Title(),
|
||||
JOptionPane.ERROR_MESSAGE);
|
||||
return;
|
||||
executeSearch();
|
||||
}
|
||||
executeSearch();
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user