Search in sources :

Example 86 with CouldntSaveDataException

use of com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException in project binnavi by google.

the class InsertMemberAction method actionPerformed.

@Override
public void actionPerformed(final ActionEvent e) {
    final MemberDialog dlg = MemberDialog.createBuildNewMemberDialog(owner, typeManager);
    dlg.setVisible(true);
    if (!dlg.wasCanceled()) {
        final BaseType memberType = dlg.getBaseType();
        final String memberName = dlg.getMemberName();
        try {
            typeManager.insertMemberAfter(existingMember, memberType, memberName);
        } catch (final CouldntSaveDataException exception) {
            CUtilityFunctions.logException(exception);
        }
    }
}
Also used : BaseType(com.google.security.zynamics.binnavi.disassembly.types.BaseType) CouldntSaveDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException) MemberDialog(com.google.security.zynamics.binnavi.Gui.GraphWindows.types.MemberDialog)

Example 87 with CouldntSaveDataException

use of com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException in project binnavi by google.

the class CDatabaseFunctions method addDebugger.

/**
   * Adds a new debugger to the database.
   * 
   * @param parent Parent window used for dialogs.
   * @param database The database where the debugger is added.
   * @param name The name of the new debugger.
   * @param host The host information of the new debugger.
   * @param port The port information of the new debugger.
   * @param updater Updates the project tree after the action is complete.
   */
public static void addDebugger(final JFrame parent, final IDatabase database, final String name, final String host, final int port, final INodeSelectionUpdater updater) {
    new Thread() {

        @Override
        public void run() {
            final CDefaultProgressOperation operation = new CDefaultProgressOperation("", false, true);
            try {
                operation.getProgressPanel().setMaximum(1);
                operation.getProgressPanel().setText("Creating new debugger");
                final DebuggerTemplate template = database.getContent().getDebuggerTemplateManager().createDebugger(name, host, port);
                updater.setObject(template);
                updater.update();
            } catch (final CouldntSaveDataException exception) {
                CUtilityFunctions.logException(exception);
                final String message = "E00028: " + "Debugger could not be created";
                final String description = CUtilityFunctions.createDescription(String.format("The debugger '%s' could not be created. " + "Try creating the debugger again. " + "If the problem persists, disconnect from and reconnect " + "to the database, restart BinNavi, or contact the BinNavi support.", name), new String[] { "Database connection problems." }, new String[] { "The debugger was not created." });
                NaviErrorDialog.show(parent, message, description, exception);
            } finally {
                operation.getProgressPanel().next();
                operation.stop();
            }
        }
    }.start();
}
Also used : CDefaultProgressOperation(com.google.security.zynamics.binnavi.Gui.Progress.CDefaultProgressOperation) DebuggerTemplate(com.google.security.zynamics.binnavi.debug.debugger.DebuggerTemplate) CouldntSaveDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException)

Example 88 with CouldntSaveDataException

use of com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException in project binnavi by google.

the class CFunctionHelpers method resolveFunction.

/**
   * Shows a dialog where the user can resolve a function.
   *
   * @param parent Parent window used for dialogs.
   * @param database Database the function belongs to.
   * @param function Function to be forwarded to another module.
   */
public static void resolveFunction(final Window parent, final IDatabase database, final INaviFunction function) {
    final CFunctionSelectionDialog dlg = new CFunctionSelectionDialog(parent, database);
    GuiHelper.centerChildToParent(parent, dlg, true);
    dlg.setVisible(true);
    final INaviFunction selectedFunction = dlg.getSelectedFunction();
    if (selectedFunction != null) {
        try {
            function.setForwardedFunction(selectedFunction);
        } catch (final CouldntSaveDataException e) {
            CUtilityFunctions.logException(e);
        }
    }
}
Also used : CouldntSaveDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException) CFunctionSelectionDialog(com.google.security.zynamics.binnavi.Gui.FunctionSelection.CFunctionSelectionDialog) INaviFunction(com.google.security.zynamics.binnavi.disassembly.INaviFunction)

Example 89 with CouldntSaveDataException

use of com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException in project binnavi by google.

the class CProjectFunctions method addAddressSpace.

/**
   * Adds a new address space with a default name to a given project.
   * 
   * @param parent Parent window used for dialogs.
   * @param project The project where the new address space is added.
   * @param updater Updates the project tree after the execution is complete.
   */
public static void addAddressSpace(final Window parent, final INaviProject project, final INodeSelectionUpdater updater) {
    new Thread() {

        @Override
        public void run() {
            final CDefaultProgressOperation operation = new CDefaultProgressOperation("", false, true);
            operation.getProgressPanel().setMaximum(2);
            try {
                operation.getProgressPanel().setText("Creating new address space");
                operation.getProgressPanel().next();
                final CAddressSpace addressSpace = project.getContent().createAddressSpace("New Address Space");
                operation.getProgressPanel().setText("Loading new address space");
                addressSpace.load();
                operation.getProgressPanel().next();
                operation.stop();
                updater.setObject(addressSpace);
                updater.update();
            } catch (final CouldntSaveDataException exception) {
                CUtilityFunctions.logException(exception);
                final String innerMessage = "E00136: " + "Could not add address space";
                final String innerDescription = CUtilityFunctions.createDescription(String.format("It was not possible to add a new address space to the project '%s'.", project.getConfiguration().getName()), new String[] { "There was a problem with the database connection." }, new String[] { "The address space was not created." });
                NaviErrorDialog.show(parent, innerMessage, innerDescription, exception);
            } catch (final CouldntLoadDataException exception) {
                CUtilityFunctions.logException(exception);
                final String innerMessage = "E00137: " + "Could not load the new address space";
                final String innerDescription = CUtilityFunctions.createDescription(String.format("The new address space in project '%s' was created but it could not be loaded.", project.getConfiguration().getName()), new String[] { "There was a problem with the database connection." }, new String[] { "The address space was created but not loaded." });
                NaviErrorDialog.show(parent, innerMessage, innerDescription, exception);
            } catch (final LoadCancelledException e) {
            // Do nothing
            }
        }
    }.start();
}
Also used : CDefaultProgressOperation(com.google.security.zynamics.binnavi.Gui.Progress.CDefaultProgressOperation) CouldntSaveDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException) CouldntLoadDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException) LoadCancelledException(com.google.security.zynamics.binnavi.Database.Exceptions.LoadCancelledException) CAddressSpace(com.google.security.zynamics.binnavi.disassembly.AddressSpaces.CAddressSpace)

Example 90 with CouldntSaveDataException

use of com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException in project binnavi by google.

the class CProjectFunctions method createProject.

/**
   * Creates a new project.
   * 
   * @param parent Parent window used for dialogs.
   * @param database Database where the project is created.
   * @param updater Responsible for updating the project tree after the project was created.
   */
public static void createProject(final JFrame parent, final IDatabase database, final INodeSelectionUpdater updater) {
    new Thread() {

        @Override
        public void run() {
            try {
                final CDefaultProgressOperation operation = new CDefaultProgressOperation("", false, true);
                operation.getProgressPanel().setMaximum(3);
                operation.getProgressPanel().setText("Creating new project");
                final INaviProject newProject = database.getContent().addProject("New Project");
                operation.getProgressPanel().next();
                try {
                    newProject.load();
                } catch (final LoadCancelledException e) {
                // Do nothing
                }
                operation.getProgressPanel().next();
                createDefaultAddressSpace(parent, newProject);
                updater.setObject(newProject);
                updater.update();
                operation.getProgressPanel().next();
                operation.stop();
            } catch (final CouldntSaveDataException exception) {
                CUtilityFunctions.logException(exception);
                final String innerMessage = "E00140: " + "New project could not be created";
                final String innerDescription = CUtilityFunctions.createDescription("It was not possible to create a new project in the selected database.", new String[] { "There was a problem with the database connection." }, new String[] { "No new project was created in the selected database." });
                NaviErrorDialog.show(parent, innerMessage, innerDescription, exception);
            } catch (final CouldntLoadDataException exception) {
                CUtilityFunctions.logException(exception);
                final String innerMessage = "E00141: " + "New project could not be loaded";
                final String innerDescription = CUtilityFunctions.createDescription("The new project could not be loaded.", new String[] { "There was a problem with the database connection." }, new String[] { "The new project was created but it could not be loaded." });
                NaviErrorDialog.show(parent, innerMessage, innerDescription, exception);
            }
        }
    }.start();
}
Also used : CDefaultProgressOperation(com.google.security.zynamics.binnavi.Gui.Progress.CDefaultProgressOperation) INaviProject(com.google.security.zynamics.binnavi.disassembly.INaviProject) CouldntSaveDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException) CouldntLoadDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException) LoadCancelledException(com.google.security.zynamics.binnavi.Database.Exceptions.LoadCancelledException)

Aggregations

CouldntSaveDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException)133 SQLException (java.sql.SQLException)71 PreparedStatement (java.sql.PreparedStatement)38 CConnection (com.google.security.zynamics.binnavi.Database.CConnection)35 CallableStatement (java.sql.CallableStatement)20 CouldntLoadDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntLoadDataException)17 CouldntDeleteException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntDeleteException)13 IComment (com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.Interfaces.IComment)10 CDefaultProgressOperation (com.google.security.zynamics.binnavi.Gui.Progress.CDefaultProgressOperation)10 CTag (com.google.security.zynamics.binnavi.Tagging.CTag)9 ArrayList (java.util.ArrayList)9 MaybeNullException (com.google.security.zynamics.binnavi.Exceptions.MaybeNullException)8 CComment (com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.CComment)8 INaviModule (com.google.security.zynamics.binnavi.disassembly.INaviModule)8 BigInteger (java.math.BigInteger)8 Connection (java.sql.Connection)8 ResultSet (java.sql.ResultSet)8 TraceList (com.google.security.zynamics.binnavi.debug.models.trace.TraceList)7 LoadCancelledException (com.google.security.zynamics.binnavi.Database.Exceptions.LoadCancelledException)6 INaviView (com.google.security.zynamics.binnavi.disassembly.views.INaviView)5