Search in sources :

Example 1 with TypeMember

use of com.google.security.zynamics.binnavi.disassembly.types.TypeMember in project binnavi by google.

the class ArrayTypePanel method populateControls.

private void populateControls() {
    if (existingType == null) {
        return;
    }
    final TypeMember arrayMember = existingType.iterator().next();
    numberElements.setValue(arrayMember.getNumberOfElements().get());
    baseTypes.getModel().selectByBaseType(arrayMember.getBaseType());
    updatePreview();
}
Also used : TypeMember(com.google.security.zynamics.binnavi.disassembly.types.TypeMember)

Example 2 with TypeMember

use of com.google.security.zynamics.binnavi.disassembly.types.TypeMember in project binnavi by google.

the class BaseTypeTransferHandler method createOrUpdateTypeSubstitution.

/**
 * Locate operand tree node and use type manager to assign type substitution.
 */
private boolean createOrUpdateTypeSubstitution(final DragAndDropSupportWrapper wrapper) throws UnsupportedFlavorException, IOException, CouldntSaveDataException {
    final INaviOperandTreeNode node = wrapper.determineDropNode();
    if (!isLegalDropNode(node)) {
        return false;
    }
    final BaseType baseType = wrapper.getDroppedBaseType();
    if (node.getTypeSubstitution() != null) {
        typeManager.updateTypeSubstitution(node, node.getTypeSubstitution(), baseType, new ArrayList<TypeMember>(), 0);
    } else {
        // When creating a substitution via drag and drop, the offset is always zero to have a
        // better workflow for the user (otherwise we would need an additional dialog each time).
        typeManager.createTypeSubstitution(node, baseType, node.getOperandPosition(), 0, /* offset */
        node.getInstructionAddress());
    }
    return true;
}
Also used : INaviOperandTreeNode(com.google.security.zynamics.binnavi.disassembly.INaviOperandTreeNode) BaseType(com.google.security.zynamics.binnavi.disassembly.types.BaseType) TypeMember(com.google.security.zynamics.binnavi.disassembly.types.TypeMember)

Example 3 with TypeMember

use of com.google.security.zynamics.binnavi.disassembly.types.TypeMember in project binnavi by google.

the class ComplexTypePanel method populateControls.

private void populateControls() {
    if (existingType == null) {
        return;
    }
    name.setText(existingType.getName());
    final MemberTableModel model = members.getModel();
    for (final TypeMember member : existingType) {
        model.addRow(new MemberTableRowData(member));
    }
}
Also used : TypeMember(com.google.security.zynamics.binnavi.disassembly.types.TypeMember)

Example 4 with TypeMember

use of com.google.security.zynamics.binnavi.disassembly.types.TypeMember in project binnavi by google.

the class TypeSubstitutionDialog method createOrUpdateSubstitution.

private void createOrUpdateSubstitution(final TypeSelectionPath path) throws CouldntSaveDataException {
    final int offset = path.determineTotalMemberOffset();
    final BaseType baseType = path.getRootType();
    final int position = selectedNode.getOperandPosition();
    final IAddress address = selectedNode.getInstructionAddress();
    final TypeSubstitution substitution = selectedNode.getTypeSubstitution();
    final List<TypeMember> memberPath = path.getMembers();
    if (substitution == null) {
        typeManager.createTypeSubstitution(selectedNode, baseType, memberPath, position, offset, address);
    } else {
        typeManager.updateTypeSubstitution(selectedNode, substitution, baseType, path.getMembers(), offset);
    }
}
Also used : TypeSubstitution(com.google.security.zynamics.binnavi.disassembly.types.TypeSubstitution) BaseType(com.google.security.zynamics.binnavi.disassembly.types.BaseType) TypeMember(com.google.security.zynamics.binnavi.disassembly.types.TypeMember) IAddress(com.google.security.zynamics.zylib.disassembly.IAddress)

Example 5 with TypeMember

use of com.google.security.zynamics.binnavi.disassembly.types.TypeMember in project binnavi by google.

the class TypeEditorPanel method getSelectedMembers.

@Override
public ImmutableList<TypeMember> getSelectedMembers() {
    final Builder<TypeMember> builder = ImmutableList.<TypeMember>builder();
    final TreePath[] paths = typesTree.getSelectionPaths();
    if (paths != null) {
        for (final TreePath path : typesTree.getSelectionPaths()) {
            final Object node = path.getLastPathComponent();
            if (node instanceof TypeMemberTreeNode) {
                builder.add(((TypeMemberTreeNode) node).getTypeMember());
            }
        }
    }
    return builder.build();
}
Also used : TreePath(javax.swing.tree.TreePath) TypeMember(com.google.security.zynamics.binnavi.disassembly.types.TypeMember)

Aggregations

TypeMember (com.google.security.zynamics.binnavi.disassembly.types.TypeMember)14 BaseType (com.google.security.zynamics.binnavi.disassembly.types.BaseType)6 TypeSubstitution (com.google.security.zynamics.binnavi.disassembly.types.TypeSubstitution)2 DefaultMutableTreeNode (javax.swing.tree.DefaultMutableTreeNode)2 TreePath (javax.swing.tree.TreePath)2 CouldntSaveDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException)1 MemberDialog (com.google.security.zynamics.binnavi.Gui.GraphWindows.types.MemberDialog)1 TypeMemberTreeNode (com.google.security.zynamics.binnavi.Gui.GraphWindows.types.TypeMemberTreeNode)1 AppendMemberAction (com.google.security.zynamics.binnavi.Gui.GraphWindows.types.actions.AppendMemberAction)1 EditMemberAction (com.google.security.zynamics.binnavi.Gui.GraphWindows.types.actions.EditMemberAction)1 EditTypeAction (com.google.security.zynamics.binnavi.Gui.GraphWindows.types.actions.EditTypeAction)1 InsertMemberAction (com.google.security.zynamics.binnavi.Gui.GraphWindows.types.actions.InsertMemberAction)1 INaviOperandTreeNode (com.google.security.zynamics.binnavi.disassembly.INaviOperandTreeNode)1 WalkResult (com.google.security.zynamics.binnavi.disassembly.types.BaseTypeHelpers.WalkResult)1 IAddress (com.google.security.zynamics.zylib.disassembly.IAddress)1 AbstractAction (javax.swing.AbstractAction)1 JPopupMenu (javax.swing.JPopupMenu)1 BadLocationException (javax.swing.text.BadLocationException)1 Style (javax.swing.text.Style)1 Test (org.junit.Test)1