Search in sources :

Example 1 with MemberDialog

use of com.google.security.zynamics.binnavi.Gui.GraphWindows.types.MemberDialog in project binnavi by google.

the class AppendMemberAction method actionPerformed.

@Override
public void actionPerformed(final ActionEvent e) {
    final MemberDialog dlg = MemberDialog.createBuildNewMemberDialog(owner, typeManager);
    GuiHelper.centerChildToParent(owner, dlg, true);
    dlg.setVisible(true);
    if (!dlg.wasCanceled()) {
        final String name = dlg.getMemberName();
        final BaseType baseType = dlg.getBaseType();
        try {
            final TypeMember member = typeManager.appendMember(selectedType, baseType, name);
            if (member == null) {
                CMessageBox.showInformation(owner, "Unable to append member since that would create a recursive type definition.");
            }
        } catch (final CouldntSaveDataException exception) {
            CUtilityFunctions.logException(exception);
        }
    }
}
Also used : BaseType(com.google.security.zynamics.binnavi.disassembly.types.BaseType) TypeMember(com.google.security.zynamics.binnavi.disassembly.types.TypeMember) CouldntSaveDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException) MemberDialog(com.google.security.zynamics.binnavi.Gui.GraphWindows.types.MemberDialog)

Example 2 with MemberDialog

use of com.google.security.zynamics.binnavi.Gui.GraphWindows.types.MemberDialog in project binnavi by google.

the class EditMemberAction method actionPerformed.

@Override
public void actionPerformed(final ActionEvent e) {
    final MemberDialog dialog = MemberDialog.createEditMemberDialog(owner, typeManager, selectedMember);
    GuiHelper.centerChildToParent(owner, dialog, true);
    dialog.setVisible(true);
    if (!dialog.wasCanceled()) {
        try {
            switch(selectedMember.getParentType().getCategory()) {
                case STRUCT:
                    typeManager.updateStructureMember(selectedMember, dialog.getBaseType(), dialog.getMemberName(), selectedMember.getBitOffset().get());
                    break;
                case UNION:
                    typeManager.updateUnionMember(selectedMember, dialog.getBaseType(), dialog.getMemberName());
                    break;
                case FUNCTION_PROTOTYPE:
                    typeManager.updateFunctionPrototypeMember(selectedMember, dialog.getBaseType(), dialog.getMemberName(), selectedMember.getArgumentIndex().get());
                default:
                    throw new IllegalStateException("Error: can not edit a member of a non compound type.");
            }
        } catch (final CouldntSaveDataException exception) {
            CUtilityFunctions.logException(exception);
        }
    }
}
Also used : CouldntSaveDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException) MemberDialog(com.google.security.zynamics.binnavi.Gui.GraphWindows.types.MemberDialog)

Example 3 with MemberDialog

use of com.google.security.zynamics.binnavi.Gui.GraphWindows.types.MemberDialog in project binnavi by google.

the class InsertMemberAction method actionPerformed.

@Override
public void actionPerformed(final ActionEvent e) {
    final MemberDialog dlg = MemberDialog.createBuildNewMemberDialog(owner, typeManager);
    dlg.setVisible(true);
    if (!dlg.wasCanceled()) {
        final BaseType memberType = dlg.getBaseType();
        final String memberName = dlg.getMemberName();
        try {
            typeManager.insertMemberAfter(existingMember, memberType, memberName);
        } catch (final CouldntSaveDataException exception) {
            CUtilityFunctions.logException(exception);
        }
    }
}
Also used : BaseType(com.google.security.zynamics.binnavi.disassembly.types.BaseType) CouldntSaveDataException(com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException) MemberDialog(com.google.security.zynamics.binnavi.Gui.GraphWindows.types.MemberDialog)

Aggregations

CouldntSaveDataException (com.google.security.zynamics.binnavi.Database.Exceptions.CouldntSaveDataException)3 MemberDialog (com.google.security.zynamics.binnavi.Gui.GraphWindows.types.MemberDialog)3 BaseType (com.google.security.zynamics.binnavi.disassembly.types.BaseType)2 TypeMember (com.google.security.zynamics.binnavi.disassembly.types.TypeMember)1