use of com.google.security.zynamics.binnavi.disassembly.views.INaviView in project binnavi by google.
the class Project method createView.
// ! Creates a copy of a view.
/**
* Creates a new view by copying an existing view.
*
* @param view The view to copy.
* @param name The name of the new view.
* @param description The description of the new view.
*
* @return The created view.
*
* @throws CouldntSaveDataException Thrown if the view could not be created.
*/
public View createView(final View view, final String name, final String description) throws CouldntSaveDataException {
if (!isLoaded()) {
throw new IllegalStateException("Error: The project has not yet been loaded");
}
Preconditions.checkNotNull(view, "Error: View argument can't be null");
final INaviView newView = m_project.getContent().createView(view.getNative(), name, description);
return ObjectFinders.getObject(newView, m_views);
}
use of com.google.security.zynamics.binnavi.disassembly.views.INaviView in project binnavi by google.
the class CNativeCallgraphsViewsModel method setValueAt.
@Override
public void setValueAt(final Object value, final int row, final int column) {
if (column == DESCRIPTION_COLUMN) {
final INaviView view = m_module.getContent().getViewContainer().getNativeCallgraphView();
try {
view.getConfiguration().setDescription((String) value);
fireTableDataChanged();
} catch (final CouldntSaveDataException e) {
// TODO: Improve this
CUtilityFunctions.logException(e);
}
}
}
use of com.google.security.zynamics.binnavi.disassembly.views.INaviView in project binnavi by google.
the class CReilViewCreator method create.
/**
* Creates a REIL view object from a REIL graph.
*
* @param container The container in which the new REIL view is created.
* @param graph The graph that contains the REIL code to be shown in the view.
*
* @return The created REIL code view.
*/
public static INaviView create(final INaviModule container, final ReilGraph graph) {
Preconditions.checkNotNull(container, "IE01809: Container argument can not be null");
Preconditions.checkNotNull(graph, "IE01815: Graph argument can not be null");
final INaviView view = container.getContent().getViewContainer().createView("REIL View", "");
final Map<ReilBlock, CCodeNode> nodeMap = new HashMap<ReilBlock, CCodeNode>();
for (final ReilBlock block : graph) {
final List<INaviInstruction> instructions = new ArrayList<INaviInstruction>();
for (final ReilInstruction reilInstruction : block) {
final List<COperandTree> operands = new ArrayList<COperandTree>();
if (reilInstruction.getFirstOperand().getType() == OperandType.EMPTY) {
operands.add(getEmptyOperand(container));
} else {
operands.add(convert(container, reilInstruction.getFirstOperand()));
}
if (reilInstruction.getSecondOperand().getType() == OperandType.EMPTY) {
operands.add(getEmptyOperand(container));
} else {
operands.add(convert(container, reilInstruction.getSecondOperand()));
}
if (reilInstruction.getThirdOperand().getType() == OperandType.EMPTY) {
operands.add(getEmptyOperand(container));
} else {
operands.add(convert(container, reilInstruction.getThirdOperand()));
}
final INaviInstruction convertedInstruction = container.createInstruction(reilInstruction.getAddress(), reilInstruction.getMnemonic(), operands, new byte[0], "REIL");
instructions.add(convertedInstruction);
}
final CCodeNode node = view.getContent().createCodeNode(null, instructions);
node.setColor(ConfigManager.instance().getColorSettings().getBasicBlocksColor());
nodeMap.put(block, node);
}
for (final ReilEdge edge : graph.getEdges()) {
final CNaviViewEdge reilEdge = view.getContent().createEdge(nodeMap.get(edge.getSource()), nodeMap.get(edge.getTarget()), edge.getType());
EdgeInitializer.adjustColor(reilEdge);
}
return view;
}
use of com.google.security.zynamics.binnavi.disassembly.views.INaviView in project binnavi by google.
the class CFunctionViewsModel method setValueAt.
@Override
public final void setValueAt(final Object value, final int row, final int column) {
final INaviView view = getViews().get(row);
if (column == DESCRIPTION_COLUMN) {
try {
view.getConfiguration().setDescription((String) value);
} catch (final Exception e) {
CUtilityFunctions.logException(e);
final String innerMessage = "E00188: " + "View name could not be changed";
final String innerDescription = CUtilityFunctions.createDescription(String.format("The view name of view '%s' could not be changed.", view.getName()), new String[] { "There was a problem with the database connection." }, new String[] { "The view was not updated and the new view name is lost." });
NaviErrorDialog.show(null, innerMessage, innerDescription, e);
}
} else if (column == FUNCTIONNAME_COLUM) {
try {
view.getConfiguration().setName((String) value);
} catch (final Exception e) {
CUtilityFunctions.logException(e);
final String innerMessage = "E00189: " + "View description could not be changed";
final String innerDescription = CUtilityFunctions.createDescription(String.format("The view description of view '%s' could not be changed.", view.getName()), new String[] { "There was a problem with the database connection." }, new String[] { "The view was not updated and the new view description is lost." });
NaviErrorDialog.show(null, innerMessage, innerDescription, e);
}
}
}
use of com.google.security.zynamics.binnavi.disassembly.views.INaviView in project binnavi by google.
the class CViewPruner method prune.
/**
* Creates a new view from the results of an operand tracking operation.
*
* @param container Container where the new view is created.
* @param view Input view that provides the data.
* @param keptInstructions Instructions to add to the new view.
*
* @return The new view.
*/
public static INaviView prune(final IViewContainer container, final INaviView view, final List<INaviInstruction> keptInstructions) {
final INaviView prunedView = container.createView("Pruned View", "");
final Map<INaviViewNode, INaviViewNode> nodeMap = convertNodes(view, prunedView, keptInstructions);
convertEdges(view, prunedView, nodeMap);
return prunedView;
}
Aggregations