internal void DeleteActiveMember()
        {
            if (ActiveMemberIndex >= 0)
            {
                int newIndex;
                int fieldCount  = CompositeType.FieldCount;
                int memberCount = CompositeType.MemberCount;

                if (ActiveMemberIndex == fieldCount - 1 && fieldCount >= 2) // Last field
                {
                    newIndex = fieldCount - 2;
                }
                else if (ActiveMemberIndex == memberCount - 1) // Last member
                {
                    newIndex = ActiveMemberIndex - 1;
                }
                else
                {
                    newIndex = ActiveMemberIndex;
                }

                CompositeType.RemoveMember(ActiveMember);
                ActiveMemberIndex = newIndex;
                OnActiveMemberChanged(EventArgs.Empty);
            }
        }
Esempio n. 2
0
        private void DeleteSelectedMember()
        {
            if (lstMembers.SelectedItems.Count > 0)
            {
                ListViewItem item  = lstMembers.SelectedItems[0];
                int          index = item.Index;

                if (item.Tag is Field)
                {
                    attributeCount--;
                }
                parent.RemoveMember(item.Tag as Member);
                lstMembers.Items.Remove(item);
                OnContentsChanged(EventArgs.Empty);

                int count = lstMembers.Items.Count;
                if (count > 0)
                {
                    if (index >= count)
                    {
                        index = count - 1;
                    }
                    lstMembers.Items[index].Selected = true;
                }
                else
                {
                    DisableFields();
                }
            }
        }
Esempio n. 3
0
        private void DeleteSelectedMember()
        {
            if (lstMembers.SelectedItems.Count > 0)
            {
                ListViewItem item  = lstMembers.SelectedItems[0];
                int          index = item.Index;

                if (item.Tag is Field)
                {
                    attributeCount--;
                }
                if ((item.Tag is Method) && ((item.Tag as Method).Parent is ClassType))
                {
                    NClass.Core.ProjectCore.raptorUpdater.deleteMethod(
                        ((item.Tag as Method).Parent as ClassType).raptorTab,
                        (item.Tag as Method).raptorTab);
                }
                if ((item.Tag is Field) && ((item.Tag as Field).Parent is ClassType))
                {
                    NClass.Core.ProjectCore.raptorUpdater.resetAttributes(
                        ((item.Tag as Field).Parent as ClassType).raptorTab,
                        (item.Tag as Field).Parent.Fields);
                }
                parent.RemoveMember(item.Tag as Member);
                lstMembers.Items.Remove(item);
                OnContentsChanged(EventArgs.Empty);

                int count = lstMembers.Items.Count;
                if (count > 0)
                {
                    if (index >= count)
                    {
                        index = count - 1;
                    }
                    lstMembers.Items[index].Selected = true;
                }
                else
                {
                    DisableFields();
                }
            }
        }
Esempio n. 4
0
 public void Execute()
 {
     index = compositeType.RemoveMember(member);
 }
Esempio n. 5
0
 public void Undo()
 {
     parent.RemoveMember(newMember);
 }