use of com.google.security.zynamics.binnavi.yfileswrap.zygraph.ZyGraph in project binnavi by google.
the class CVariableHighlighterTest method test1Simple.
@Test
public void test1Simple() throws FileReadException, CouldntLoadDataException, LoadCancelledException, CouldntSaveDataException {
final ZyGraph graph = ZyGraphFactory.generateTestGraph();
final List<INaviInstruction> mockInstructions = new ArrayList<INaviInstruction>();
final CCodeNode node = graph.getRawView().getBasicBlocks().get(0);
final NaviNode naviNode = graph.getNode(node);
mockInstructions.add(Iterables.get(node.getInstructions(), 0));
final BackEndDebuggerProvider provider = new MockDebuggerProvider();
@SuppressWarnings("unused") final CCodeNodeUpdater updater = new CCodeNodeUpdater(graph, naviNode, node, provider);
assertFalse(naviNode.getRealizer().getNodeContent().getLineContent(0).hasHighlighting(CHighlightLayers.VARIABLE_LAYER));
CVariableHighlighter.highlightInstructions(graph, mockInstructions);
assertTrue(naviNode.getRealizer().getNodeContent().getLineContent(0).hasHighlighting(CHighlightLayers.VARIABLE_LAYER));
}
use of com.google.security.zynamics.binnavi.yfileswrap.zygraph.ZyGraph in project binnavi by google.
the class CTaggedGraphNodeNodeTest method test1Simple.
@Test
public void test1Simple() throws FileReadException, CouldntLoadDataException, LoadCancelledException, CouldntSaveDataException {
final ZyGraph graph = ZyGraphFactory.generateTestGraph();
final CCodeNode node = graph.getRawView().getBasicBlocks().get(0);
final NaviNode naviNode = graph.getNode(node);
@SuppressWarnings("unused") final CTaggedGraphNodeNode taggedNode = new CTaggedGraphNodeNode(graph, naviNode);
}
use of com.google.security.zynamics.binnavi.yfileswrap.zygraph.ZyGraph in project binnavi by google.
the class CActionSave method actionPerformed.
@Override
public void actionPerformed(final ActionEvent event) {
final ZyGraph graph = m_graph.get();
final JFrame parent = m_parent.get();
if ((graph != null) && (parent != null)) {
CGraphSaver.save(parent, graph);
}
}
use of com.google.security.zynamics.binnavi.yfileswrap.zygraph.ZyGraph in project binnavi by google.
the class CViewLoader method load.
/**
* Loads a view.
*
* @throws LoadCancelledException Thrown if the user canceled the load operation.
* @throws CPartialLoadException Thrown if not all required modules are loaded.
* @throws CouldntLoadDataException Thrown if the view data could not be loaded from the database.
*/
public void load() throws CouldntLoadDataException, CPartialLoadException, LoadCancelledException {
if (!view.isLoaded()) {
view.load();
}
// Convert the data from the raw view into a graph that can be displayed.
final ZyGraph graph = container instanceof CModuleContainer ? CGraphBuilder.buildDnDGraph(view, container.getModules().get(0).getTypeManager()) : CGraphBuilder.buildGraph(view);
CRegisterHotKeys.register(graph);
if (window == null) {
// If the parent window of the graph is null, a new graph window is created.
final CGraphWindow navi = new CGraphWindow();
final CGraphModel model = new CGraphModel(navi, container.getDatabase(), container, graph);
CNodeUpdaterInitializer.addUpdaters(model);
final CGraphPanel panel = new CGraphPanel(model);
navi.addGraph(panel);
CWindowManager.instance().register(navi);
// Part of the workaround you can find in WorkaroundListener in CGraphWindow
navi.setSize(Toolkit.getDefaultToolkit().getScreenSize());
navi.setVisible(true);
GuiHelper.applyWindowFix(navi);
navi.setExtendedState(Frame.MAXIMIZED_BOTH);
workArounds(panel);
graphModel = model;
} else {
final CGraphModel model = new CGraphModel(window, container.getDatabase(), container, graph);
CNodeUpdaterInitializer.addUpdaters(model);
final CGraphPanel panel = new CGraphPanel(model);
// If a parent window is given, the graph is added to this window.
window.addGraph(panel);
workArounds(panel);
window.toFront();
graphModel = model;
}
}
use of com.google.security.zynamics.binnavi.yfileswrap.zygraph.ZyGraph in project binnavi by google.
the class CPanelCloser method saveNativeGraph.
/**
* Saves a native graph.
*
* @param parent The parent window of the panel.
* @param panel The panel to be closed.
*/
private static void saveNativeGraph(final JFrame parent, final IGraphPanel panel) {
final ZyGraph graph = panel.getModel().getGraph();
final CSaveProgress progress = CGraphSaver.saveAs(parent, graph, panel.getModel().getViewContainer());
while (!progress.isDone()) {
try {
Thread.sleep(100);
} catch (final InterruptedException e) {
// restore the interrupted status of the thread.
// http://www.ibm.com/developerworks/java/library/j-jtp05236/index.html
java.lang.Thread.currentThread().interrupt();
}
}
}
Aggregations