Search in sources :

Example 26 with ZyLineContent

use of com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLineContent in project binnavi by google.

the class GraphSearcherTest method testAfterLast.

@Test
public void testAfterLast() {
    final ZyNodeRealizer<NaviNode> r = new ZyNormalNodeRealizer<NaviNode>(m_content);
    final NaviNode m_node1 = new NaviNode(m_ynode, r, m_codeNode1);
    final GraphSearcher searcher = new GraphSearcher();
    searcher.search(Lists.newArrayList(m_node1), new ArrayList<NaviEdge>(), "");
    assertNull(searcher.getCursor().current());
    m_content.addLineContent(new ZyLineContent("Hello my Test", null));
    searcher.search(Lists.newArrayList(m_node1), new ArrayList<NaviEdge>(), "my");
    assertFalse(searcher.getCursor().isAfterLast());
    searcher.getCursor().next();
    assertTrue(searcher.getCursor().isAfterLast());
    searcher.getCursor().next();
    assertTrue(searcher.getCursor().isAfterLast());
}
Also used : ZyNormalNodeRealizer(com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.realizers.ZyNormalNodeRealizer) NaviNode(com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode) GraphSearcher(com.google.security.zynamics.binnavi.yfileswrap.Gui.GraphWindows.Searchers.Text.Model.GraphSearcher) ZyLineContent(com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLineContent) NaviEdge(com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviEdge) Test(org.junit.Test)

Example 27 with ZyLineContent

use of com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLineContent in project binnavi by google.

the class CPasteKeyBehavior method initUndoHistory.

@Override
protected void initUndoHistory() {
    final int x = getCaretEndPosX();
    final int y = getCaretMouseReleasedY();
    final ZyLineContent lineContent = getLineContent(y);
    IZyEditableObject lineFragmentObject = lineContent.getLineFragmentObjectAt(x);
    boolean isNewBehindLineComment = false;
    String text = "";
    m_isAboveComment = isAboveLineComment(y);
    m_isLabelComment = isLabelComment(y);
    if ((x == lineContent.getText().length()) && !isComment(x, y)) {
        m_isBehindComment = true;
        isNewBehindLineComment = true;
        lineFragmentObject = lineContent.getLineObject();
    } else {
        m_isBehindComment = isBehindLineComment(x, y);
    }
    m_editableObject = lineFragmentObject;
    if (lineFragmentObject != null) {
        if (!isNewBehindLineComment) {
            text = lineContent.getText().substring(lineFragmentObject.getStart(), lineFragmentObject.getEnd());
            if (isComment(x, y)) {
                text = getMultiLineComment(y);
            }
        }
        udpateUndolist(getLabelContent(), lineContent.getLineObject().getPersistentModel(), lineFragmentObject, text, m_isAboveComment, m_isBehindComment, m_isLabelComment, getCaretStartPosX(), getCaretMousePressedX(), getCaretMousePressedY(), getCaretEndPosX(), getCaretMouseReleasedX(), getCaretMouseReleasedY());
    }
}
Also used : IZyEditableObject(com.google.security.zynamics.zylib.gui.zygraph.realizers.IZyEditableObject) ZyLineContent(com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLineContent) Point(java.awt.Point)

Example 28 with ZyLineContent

use of com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLineContent in project binnavi by google.

the class CPasteKeyBehavior method updateUndoHistory.

@Override
protected void updateUndoHistory() {
    if (m_editableObject != null) {
        final int x = getCaretEndPosX();
        final int y = getCaretMouseReleasedY();
        final ZyLineContent lineContent = getLineContent(y);
        final IZyEditableObject lineFragmentObject = lineContent.getLineFragmentObjectAt(x);
        if (lineFragmentObject != null) {
            String text = lineContent.getText().substring(lineFragmentObject.getStart(), lineFragmentObject.getEnd());
            if (isComment(x, y)) {
                text = getMultiLineComment(y);
            }
            udpateUndolist(getLabelContent(), lineContent.getLineObject().getPersistentModel(), lineFragmentObject, text, m_isAboveComment, m_isBehindComment, m_isLabelComment, getCaretStartPosX(), getCaretMousePressedX(), getCaretMousePressedY(), getCaretEndPosX(), getCaretMouseReleasedX(), getCaretMouseReleasedY());
        }
    }
}
Also used : IZyEditableObject(com.google.security.zynamics.zylib.gui.zygraph.realizers.IZyEditableObject) ZyLineContent(com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLineContent) Point(java.awt.Point)

Example 29 with ZyLineContent

use of com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLineContent in project binnavi by google.

the class CReturnKeyBehavior method updateCaret.

@Override
protected void updateCaret() {
    if ((m_caretY > -1) && isComment(getCaretEndPosX(), m_caretY)) {
        final ZyLineContent nextLineContent = getLineContent(m_caretY);
        final IZyEditableObject lineObject = nextLineContent.getLineFragmentObjectList().get(0);
        int x = 0;
        if (lineObject != null) {
            x = lineObject.getEnd();
        }
        setCaret(x, x, m_caretY, x, x, m_caretY);
    }
}
Also used : IZyEditableObject(com.google.security.zynamics.zylib.gui.zygraph.realizers.IZyEditableObject) ZyLineContent(com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLineContent)

Example 30 with ZyLineContent

use of com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLineContent in project binnavi by google.

the class CCutKeyBehavior method initUndoHistory.

@Override
protected void initUndoHistory() {
    final int x = getCaretEndPosX();
    final int y = getCaretMouseReleasedY();
    final ZyLineContent lineContent = getLineContent(y);
    final IZyEditableObject lineFragmentObject = lineContent.getLineFragmentObjectAt(x);
    m_editableObject = lineContent.getLineObject();
    if (lineFragmentObject != null) {
        String text = lineContent.getText().substring(lineFragmentObject.getStart(), lineFragmentObject.getEnd());
        m_isAboveComment = isAboveLineComment(y);
        m_isBehindComment = isBehindLineComment(x, y);
        m_isLabelComment = isLabelComment(y);
        if (isComment(x, y)) {
            text = getMultiLineComment(y);
        }
        udpateUndolist(getLabelContent(), lineContent.getLineObject().getPersistentModel(), m_editableObject, text, isAboveLineComment(y), isBehindLineComment(x, y), isLabelComment(y), getCaretStartPosX(), getCaretMousePressedX(), getCaretMousePressedY(), getCaretEndPosX(), getCaretMouseReleasedX(), getCaretMouseReleasedY());
    }
}
Also used : IZyEditableObject(com.google.security.zynamics.zylib.gui.zygraph.realizers.IZyEditableObject) ZyLineContent(com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLineContent)

Aggregations

ZyLineContent (com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLineContent)56 IZyEditableObject (com.google.security.zynamics.zylib.gui.zygraph.realizers.IZyEditableObject)24 Point (java.awt.Point)15 GraphSearcher (com.google.security.zynamics.binnavi.yfileswrap.Gui.GraphWindows.Searchers.Text.Model.GraphSearcher)8 NaviEdge (com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviEdge)8 NaviNode (com.google.security.zynamics.binnavi.yfileswrap.zygraph.NaviNode)8 ZyNormalNodeRealizer (com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.realizers.ZyNormalNodeRealizer)8 Test (org.junit.Test)8 ZyLabelContent (com.google.security.zynamics.zylib.gui.zygraph.realizers.ZyLabelContent)5 CStyleRunData (com.google.security.zynamics.zylib.gui.zygraph.realizers.CStyleRunData)3 IZyNodeRealizer (com.google.security.zynamics.zylib.yfileswrap.gui.zygraph.realizers.IZyNodeRealizer)3 INaviFunction (com.google.security.zynamics.binnavi.disassembly.INaviFunction)2 UnrelocatedAddress (com.google.security.zynamics.binnavi.disassembly.UnrelocatedAddress)2 ArrayList (java.util.ArrayList)2 MockSqlProvider (com.google.security.zynamics.binnavi.Database.MockClasses.MockSqlProvider)1 MaybeNullException (com.google.security.zynamics.binnavi.Exceptions.MaybeNullException)1 IComment (com.google.security.zynamics.binnavi.Gui.GraphWindows.CommentDialogs.Interfaces.IComment)1 CTag (com.google.security.zynamics.binnavi.Tagging.CTag)1 DefaultAddressConverter (com.google.security.zynamics.binnavi.debug.debugger.DefaultAddressConverter)1 IDebugger (com.google.security.zynamics.binnavi.debug.debugger.interfaces.IDebugger)1