use of com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException in project binnavi by google.
the class CTagSortingHandler method drop.
@Override
public void drop(final DNDTree target, final DefaultMutableTreeNode parentNode, final DefaultMutableTreeNode draggedNode) {
final ITagManager tagManager = ((CTagTreeNode) parentNode).getTagManager();
final ITreeNode<CTag> parentNodeNode = ((CTagTreeNode) parentNode).getTag();
final ITreeNode<CTag> draggedNodeNode = ((CTagTreeNode) draggedNode).getTag();
try {
tagManager.moveTag(parentNodeNode, draggedNodeNode);
} catch (final CouldntSaveDataException e) {
// TODO: Improve this
CUtilityFunctions.logException(e);
}
}
use of com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException in project binnavi by google.
the class AppendMemberAction method actionPerformed.
@Override
public void actionPerformed(final ActionEvent e) {
final MemberDialog dlg = MemberDialog.createBuildNewMemberDialog(owner, typeManager);
GuiHelper.centerChildToParent(owner, dlg, true);
dlg.setVisible(true);
if (!dlg.wasCanceled()) {
final String name = dlg.getMemberName();
final BaseType baseType = dlg.getBaseType();
try {
final TypeMember member = typeManager.appendMember(selectedType, baseType, name);
if (member == null) {
CMessageBox.showInformation(owner, "Unable to append member since that would create a recursive type definition.");
}
} catch (final CouldntSaveDataException exception) {
CUtilityFunctions.logException(exception);
}
}
}
use of com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException in project binnavi by google.
the class EditMemberAction method actionPerformed.
@Override
public void actionPerformed(final ActionEvent e) {
final MemberDialog dialog = MemberDialog.createEditMemberDialog(owner, typeManager, selectedMember);
GuiHelper.centerChildToParent(owner, dialog, true);
dialog.setVisible(true);
if (!dialog.wasCanceled()) {
try {
switch(selectedMember.getParentType().getCategory()) {
case STRUCT:
typeManager.updateStructureMember(selectedMember, dialog.getBaseType(), dialog.getMemberName(), selectedMember.getBitOffset().get());
break;
case UNION:
typeManager.updateUnionMember(selectedMember, dialog.getBaseType(), dialog.getMemberName());
break;
case FUNCTION_PROTOTYPE:
typeManager.updateFunctionPrototypeMember(selectedMember, dialog.getBaseType(), dialog.getMemberName(), selectedMember.getArgumentIndex().get());
default:
throw new IllegalStateException("Error: can not edit a member of a non compound type.");
}
} catch (final CouldntSaveDataException exception) {
CUtilityFunctions.logException(exception);
}
}
}
use of com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException in project binnavi by google.
the class CGraphSaver method save.
/**
* Stores a graph to the database.
*
* @param parent Parent window used to display dialogs.
* @param graph Graph to be written to the database.
*
* @return Information about the save progress.
*/
public static CSaveProgress save(final Window parent, final ZyGraph graph) {
Preconditions.checkNotNull(parent, "IE01752: Parent argument can not be null");
Preconditions.checkNotNull(graph, "IE01753: Graph argument can not be null");
final CSaveProgress progress = new CSaveProgress(false);
new Thread() {
@Override
public void run() {
final CViewSaverOperation operation = new CViewSaverOperation(String.format("Saving view '%s'", graph.getRawView().getName()));
try {
if (!graph.save()) {
throw new CouldntSaveDataException("Something went wrong saving");
}
} catch (final CouldntSaveDataException e) {
CUtilityFunctions.logException(e);
final String innerMessage = "E00120: " + "Could not save graph";
final String innerDescription = CUtilityFunctions.createDescription(String.format("The function '%s' could not be saved.", graph.getRawView().getName()), new String[] { "There was a problem with the database connection." }, new String[] { "The graph remains unsaved." });
NaviErrorDialog.show(parent, innerMessage, innerDescription, e);
} finally {
operation.stop();
progress.setDone();
}
}
}.start();
return progress;
}
use of com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException in project binnavi by google.
the class CTraceCombinationFunctions method differenceTraces.
/**
* Creates a new trace that contains exactly those events that appear in the first trace but not
* in the second trace.
*
* @param parent Parent window used for dialogs.
* @param provider Creates the new trace.
* @param trace1 The first input trace.
* @param trace2 The second input trace.
*/
public static void differenceTraces(final JFrame parent, final ITraceListProvider provider, final TraceList trace1, final TraceList trace2) {
new Thread() {
@Override
public void run() {
try {
final CDefaultProgressOperation operation = new CDefaultProgressOperation("", false, true);
operation.getProgressPanel().setMaximum(3);
operation.getProgressPanel().setText(String.format("Creating trace difference between '%s' and '%s'", trace1.getName(), trace2.getName()));
final TraceList newTrace = provider.createTrace("Combined Trace", String.format("%s - %s", trace1.getName(), trace2.getName()));
operation.getProgressPanel().next();
createCombinedTrace(newTrace, Lists.newArrayList(trace1, trace2), getDifferenceAddresses(trace1, trace2));
operation.getProgressPanel().next();
newTrace.save();
operation.getProgressPanel().next();
operation.stop();
} catch (final CouldntSaveDataException e) {
CUtilityFunctions.logException(e);
final String innerMessage = "E00191: " + "Could not combine debug traces";
final String innerDescription = CUtilityFunctions.createDescription("The selected traces could not be combined into a larger trace.", new String[] { "There was a problem with the database connection." }, new String[] { "The trace list was not created. You could try to combine the lists again once the connection problem was resolved." });
NaviErrorDialog.show(parent, innerMessage, innerDescription, e);
}
}
}.start();
}
Aggregations