use of com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmark in project binnavi by google.
the class CCodeBookmarkTableModelTest method test5getValueAtFail.
@Test
public void test5getValueAtFail() {
final CCodeBookmarkManager bookmarkManager = new CCodeBookmarkManager();
final CCodeBookmarkTableModel tableModel = new CCodeBookmarkTableModel(bookmarkManager);
final CCodeBookmark bookmark = new CCodeBookmark(new MockModule(), new MockAddress(), "burzel");
bookmarkManager.addBookmark(bookmark);
try {
tableModel.getValueAt(0, 4);
fail();
} catch (final IllegalArgumentException e) {
}
}
use of com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmark in project binnavi by google.
the class CCodeBookmarkTableModelTest method test2setValueAtWorking.
@Test
public void test2setValueAtWorking() {
final CCodeBookmarkManager bookmarkManager = new CCodeBookmarkManager();
final CCodeBookmarkTableModel tableModel = new CCodeBookmarkTableModel(bookmarkManager);
final CCodeBookmark bookmark = new CCodeBookmark(new MockModule(), new MockAddress(), "burzel");
bookmarkManager.addBookmark(bookmark);
assertEquals("burzel", tableModel.getValueAt(0, 2));
tableModel.setValueAt("working", 0, 2);
assertEquals(1, tableModel.getRowCount());
assertEquals("working", tableModel.getValueAt(0, 2));
}
use of com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmark in project binnavi by google.
the class CCodeBookmarkTableModelTest method test8checkEditable.
@Test
public void test8checkEditable() {
final CCodeBookmarkManager bookmarkManager = new CCodeBookmarkManager();
final CCodeBookmarkTableModel tableModel = new CCodeBookmarkTableModel(bookmarkManager);
final CCodeBookmark bookmark = new CCodeBookmark(new MockModule(), new MockAddress(), "burzel");
bookmarkManager.addBookmark(bookmark);
assertFalse(tableModel.isCellEditable(0, 0));
assertFalse(tableModel.isCellEditable(0, 1));
assertTrue(tableModel.isCellEditable(0, 2));
}
use of com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmark in project binnavi by google.
the class CCodeBookmarkTableModelTest method test9checkRemoveListeners.
@Test
public void test9checkRemoveListeners() throws IllegalArgumentException, SecurityException, IllegalAccessException, NoSuchFieldException {
final CCodeBookmarkManager bookmarkManager = new CCodeBookmarkManager();
final CCodeBookmarkTableModel tableModel = new CCodeBookmarkTableModel(bookmarkManager);
final LinkedHashSet<?> m_daListeners = (LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(bookmarkManager, "m_listeners"), "m_listeners");
assertEquals(1, m_daListeners.size());
final CCodeBookmark bookmark = new CCodeBookmark(new MockModule(), new MockAddress(), "burzel");
bookmarkManager.addBookmark(bookmark);
final LinkedHashSet<?> m_bmListeners = (LinkedHashSet<?>) ReflectionHelpers.getField(ReflectionHelpers.getField(bookmark, "m_listeners"), "m_listeners");
assertEquals(1, m_bmListeners.size());
tableModel.dispose();
assertTrue(m_daListeners.isEmpty());
assertTrue(m_bmListeners.isEmpty());
}
use of com.google.security.zynamics.binnavi.models.Bookmarks.code.CCodeBookmark in project binnavi by google.
the class CBookmarkFunctions method deleteBookmarks.
/**
* Deletes a list of bookmarks.
*
* @param manager Code bookmark manager from which the bookmarks are deleted.
* @param rows Indices of the table rows of the bookmarks to delete.
*/
public static void deleteBookmarks(final CCodeBookmarkManager manager, final int[] rows) {
Preconditions.checkNotNull(manager, "IE01262: Manager argument can not be null");
Preconditions.checkNotNull(rows, "IE01263: Rows argument can not be null");
final List<CCodeBookmark> bookmarks = new ArrayList<CCodeBookmark>();
for (final int row : rows) {
bookmarks.add(manager.get(row));
}
for (final CCodeBookmark bookmark : bookmarks) {
manager.removeBookmark(bookmark);
}
}
Aggregations