use of com.google.security.zynamics.binnavi.disassembly.Modules.CModuleContainer in project binnavi by google.
the class CModuleNodeTest method testChangingName.
@Test
public void testChangingName() throws CouldntSaveDataException {
final CModuleNode node = new CModuleNode(m_tree, new DefaultMutableTreeNode(), m_database, m_module, new CModuleContainer(m_database, m_module));
assertEquals("Name (55/66)", node.toString());
m_module.getConfiguration().setName("Hannes");
assertEquals("Hannes (55/66)", node.toString());
}
use of com.google.security.zynamics.binnavi.disassembly.Modules.CModuleContainer in project binnavi by google.
the class CModuleNodeTest method testLoaded.
@Test
public void testLoaded() throws CouldntLoadDataException, CouldntDeleteException, LoadCancelledException, IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException {
m_module.load();
final CModuleNode node = new CModuleNode(m_tree, new DefaultMutableTreeNode(), m_database, m_module, new CModuleContainer(m_database, m_module));
assertEquals("Name (1/0)", node.toString());
final CView view = m_module.getContent().getViewContainer().createView("Foo", "Bar");
assertEquals("Name (1/1)", node.toString());
m_module.getContent().getViewContainer().deleteView(view);
assertEquals("Name (1/0)", node.toString());
node.dispose();
assertTrue(((Collection<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_database, "listeners"), "m_listeners")) == null);
assertTrue(((Collection<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_module, "m_listeners"), "m_listeners")).isEmpty());
}
use of com.google.security.zynamics.binnavi.disassembly.Modules.CModuleContainer in project binnavi by google.
the class CModuleNodeTest method testListenersRemoved.
@Test
public void testListenersRemoved() throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException {
final CModuleContainer container = new CModuleContainer(m_database, m_module);
final CModuleNode node = new CModuleNode(m_tree, new DefaultMutableTreeNode(), m_database, m_module, container);
node.dispose();
assertTrue(((Collection<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_database, "listeners"), "m_listeners")) == null);
assertTrue(((Collection<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(m_module, "m_listeners"), "m_listeners")).isEmpty());
}
use of com.google.security.zynamics.binnavi.disassembly.Modules.CModuleContainer in project binnavi by google.
the class CModuleOverviewPanelTest method setUp.
@Before
public void setUp() throws CouldntLoadDataException, IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException, FileReadException, LoadCancelledException {
ConfigManager.instance().read();
final JTree tree = new JTree();
m_database = new MockDatabase(m_provider);
m_project = new CProject(1, "Mock Project", "Mock Project Description", new Date(), new Date(), 0, new ArrayList<DebuggerTemplate>(), m_provider);
m_project.load();
final DebuggerTemplate template = new DebuggerTemplate(1, "Mock Debugger", "localhaus", 88, m_provider);
m_module = new CModule(123, "Name", "Comment", new Date(), new Date(), "12345678123456781234567812345678", "1234567812345678123456781234567812345678", 55, 66, new CAddress(0x555), new CAddress(0x666), template, null, Integer.MAX_VALUE, false, m_provider);
m_database.getContent().getDebuggerTemplateManager().addDebugger(template);
m_viewContainer = new CModuleContainer(m_database, m_module);
m_component = new CModuleOverviewPanel(tree, m_database, null, m_module, m_viewContainer);
m_saveButton = (JButton) ReflectionHelpers.getField(m_component, "m_saveButton");
m_editPanel = (CStandardEditPanel) ReflectionHelpers.getField(m_component, "m_stdEditPanel");
m_fileBaseAddr = (JTextField) ReflectionHelpers.getField(ReflectionHelpers.getField(m_component, "m_debuggerPanel"), "m_fileBaseAddr");
m_imageBaseAddr = (JTextField) ReflectionHelpers.getField(ReflectionHelpers.getField(m_component, "m_debuggerPanel"), "m_imageBaseAddr");
m_debuggerCombo = (CDebuggerComboBox) ReflectionHelpers.getField(ReflectionHelpers.getField(m_component, "m_debuggerPanel"), "m_debuggerCombo");
}
use of com.google.security.zynamics.binnavi.disassembly.Modules.CModuleContainer in project binnavi by google.
the class PluginInterface method showInNewWindow.
/**
* Shows a view in a new window.
*
* @param view The view to show.
*
* @return The view2d object that is shown.
*/
public View2D showInNewWindow(final View view) {
Preconditions.checkNotNull(view, "Error: View argument can not be null");
final ViewContainer container = view.getContainer();
if (container instanceof Module) {
final Module module = (Module) container;
return show(null, view, new CModuleContainer(container.getDatabase().getNative(), module.getNative()));
} else {
final Project project = (Project) container;
return show(null, view, new CProjectContainer(container.getDatabase().getNative(), project.getNative()));
}
}
Aggregations