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);
}
}
}
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();
}
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);
}
}
}
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();
}
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();
}
Aggregations