Search in sources :

Example 21 with CDefaultProgressOperation

use of com.google.security.zynamics.binnavi.Gui.Progress.CDefaultProgressOperation in project binnavi by google.

the class CTagFunctions method deleteTagSubtree.

/**
   * Deletes a tag and all of its child tags from the database.
   * 
   * @param parent Parent window used for dialogs.
   * @param tagManager The tag manager that manages the tag.
   * @param tag The tag to be deleted.
   */
public static void deleteTagSubtree(final JFrame parent, final ITagManager tagManager, final TreeNode<CTag> tag) {
    if (CMessageBox.showYesNoQuestion(parent, String.format("Do you really want to delete the tag '%s' and all of its children from the database?", tag.getObject().getName())) == JOptionPane.YES_OPTION) {
        new Thread() {

            @Override
            public void run() {
                try {
                    final CDefaultProgressOperation operation = new CDefaultProgressOperation("", false, false);
                    operation.getProgressPanel().setMaximum(1);
                    operation.getProgressPanel().setText("Deleting tag tree" + ": " + tag.getObject().getName());
                    tagManager.deleteTagSubTree(tag);
                    operation.getProgressPanel().next();
                    operation.stop();
                } catch (final CouldntDeleteException e) {
                    CUtilityFunctions.logException(e);
                    final String innerMessage = "E00146: " + "Could not delete tag tree";
                    final String innerDescription = CUtilityFunctions.createDescription(String.format("The tag '%s' and its children could not be deleted.", tag.getObject().getName()), new String[] { "There was a problem with the database connection." }, new String[] { "The tag and its children were not deleted and can still be used." });
                    NaviErrorDialog.show(parent, innerMessage, innerDescription, e);
                }
            }
        }.start();
    }
}
Also used : CouldntDeleteException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntDeleteException) CDefaultProgressOperation(com.google.security.zynamics.binnavi.Gui.Progress.CDefaultProgressOperation)

Aggregations

CDefaultProgressOperation (com.google.security.zynamics.binnavi.Gui.Progress.CDefaultProgressOperation)21 CouldntSaveDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException)10 CouldntDeleteException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntDeleteException)8 CouldntLoadDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException)5 LoadCancelledException (com.google.security.zynamics.binnavi.Database.Exceptions.LoadCancelledException)4 TraceList (com.google.security.zynamics.binnavi.debug.models.trace.TraceList)4 DebuggerTemplate (com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate)2 INaviAddressSpace (com.google.security.zynamics.binnavi.disassembly.INaviAddressSpace)2 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)2 INaviProject (com.google.security.zynamics.binnavi.disassembly.INaviProject)2 CouldntConnectException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntConnectException)1 CouldntInitializeDatabaseException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntInitializeDatabaseException)1 CouldntLoadDriverException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDriverException)1 CouldntUpdateDatabaseException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntUpdateDatabaseException)1 InvalidDatabaseException (com.google.security.zynamics.binnavi.Database.Exceptions.InvalidDatabaseException)1 InvalidDatabaseVersionException (com.google.security.zynamics.binnavi.Database.Exceptions.InvalidDatabaseVersionException)1 InvalidExporterDatabaseFormatException (com.google.security.zynamics.binnavi.Database.Exceptions.InvalidExporterDatabaseFormatException)1 CAddressSpace (com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace)1 SwingInvoker (com.google.security.zynamics.zylib.gui.SwingInvoker)1 ArrayList (java.util.ArrayList)1