use of com.google.security.zynamics.binnavi.yfileswrap.zygraph.ZyGraph in project binnavi by google.
the class CPanelCloser method closeModifiedGraph.
/**
* Closes a modified graph.
*
* @param parent The parent window of the panel.
* @param panel The panel to be closed.
*
* @return True, if the panel can be closed. False, if the user vetoed the operation.
*/
private static boolean closeModifiedGraph(final JFrame parent, final IGraphPanel panel) {
final ZyGraph graph = panel.getModel().getGraph();
final int result = CMessageBox.showYesNoCancelQuestion(parent, String.format("Do you want to save the view '%s' before closing?", CNameShortener.shorten(graph.getRawView())));
if (result == JOptionPane.YES_OPTION) {
if (graph.getRawView().getType() == ViewType.Native) {
saveNativeGraph(parent, panel);
} else {
saveNonNativeGraph(parent, graph);
}
}
return (result == JOptionPane.YES_OPTION) || (result == JOptionPane.NO_OPTION);
}
use of com.google.security.zynamics.binnavi.yfileswrap.zygraph.ZyGraph in project binnavi by google.
the class CTaggedGraphNodeNodeTest method test2getGraphNode.
@Test
public void test2getGraphNode() throws FileReadException, CouldntLoadDataException, LoadCancelledException, CouldntSaveDataException {
final ZyGraph graph = ZyGraphFactory.generateTestGraph();
final CCodeNode node = graph.getRawView().getBasicBlocks().get(0);
final NaviNode naviNode = graph.getNode(node);
final CTaggedGraphNodeNode taggedNode = new CTaggedGraphNodeNode(graph, naviNode);
assertEquals(naviNode, taggedNode.getGraphNode());
}
use of com.google.security.zynamics.binnavi.yfileswrap.zygraph.ZyGraph in project binnavi by google.
the class CTaggedGraphNodesContainerNodeTest method test1Simple.
@Test
public void test1Simple() throws FileReadException, CouldntLoadDataException, LoadCancelledException, CouldntSaveDataException {
final ZyGraph graph = ZyGraphFactory.generateTestGraph();
final CTagsTreeModel model = new CTagsTreeModel(null);
final CTag tag = new CTag(0, "tag", "description", TagType.NODE_TAG, new MockSqlProvider());
final TreeNode<CTag> treeNode = new TreeNode<CTag>(tag);
final CTaggedGraphNodesContainerNode containerNode = new CTaggedGraphNodesContainerNode(graph, model, treeNode);
assertEquals("Tagged Nodes (0/0/1/1)", containerNode.toString());
assertEquals(null, containerNode.getIconName());
containerNode.getIcon();
}
use of com.google.security.zynamics.binnavi.yfileswrap.zygraph.ZyGraph in project binnavi by google.
the class CBreakpointTableTest method testAddedDebugger.
/**
* This test is making sure that listeners are correctly attached to new debuggers.
*
* @throws CouldntSaveDataException
* @throws FileReadException
*/
@Test
public void testAddedDebugger() throws CouldntSaveDataException, FileReadException {
ConfigManager.instance().read();
final INaviModule mockModule = new MockModule();
final DebugTargetSettings target = new ModuleTargetSettings(mockModule);
final DebuggerProvider debuggerProvider = new DebuggerProvider(target);
final ZyGraphViewSettings settings = new ZyGraphViewSettings(new FlowGraphSettingsConfigItem());
settings.getLayoutSettings().setDefaultGraphLayout(LayoutStyle.CIRCULAR);
final ZyGraph graph = new ZyGraph(new MockView(), new LinkedHashMap<Node, NaviNode>(), new LinkedHashMap<Edge, NaviEdge>(), settings, new ZyGraph2DView());
final IViewContainer viewContainer = new MockViewContainer();
final CBreakpointTable table = new CBreakpointTable(debuggerProvider, graph, viewContainer);
final MockDebugger debugger = new MockDebugger(new ModuleTargetSettings(mockModule));
final MockModule module = new MockModule();
debugger.getBreakpointManager().addBreakpoints(BreakpointType.REGULAR, Sets.newHashSet(new BreakpointAddress(module, new UnrelocatedAddress(new CAddress(0)))));
debuggerProvider.addDebugger(debugger);
table.dispose();
}
use of com.google.security.zynamics.binnavi.yfileswrap.zygraph.ZyGraph in project binnavi by google.
the class SetupCriteriaGraphTest method setUp.
public void setUp() throws CouldntLoadDataException, LoadCancelledException, FileReadException, CouldntSaveDataException {
final ZyGraph graph = ZyGraphFactory.generateTestGraph();
final CCriteriaFactory criteriaFactory = new CCriteriaFactory(graph, null, null);
final List<ICriteriumCreator> criteria = criteriaFactory.getConditions();
final CCriteriumTree m_ctree = new CCriteriumTree();
final JCriteriumTree jtree = new JCriteriumTree(m_ctree, criteria);
jtree.getModel().setRoot(new JCriteriumTreeNode(m_ctree, m_ctree.getRoot().getCriterium(), criteria));
final CCriteriumTreeNode parent = new CCriteriumTreeNode(null);
final CCriteriumTreeNode child = new CCriteriumTreeNode(null);
m_ctree.appendNode(parent, child);
}
Aggregations