示例#1
0
        private void SaveState()
        {
            var fragment = GeProfile.Fragment;

            GeProfile.Fragment = GeProfile.Profile;
            GeProfile.GetNodeProfileText();
            NodeFragmentPosition = GeProfile.ProfileTextPostionList.GetFragmentPosition(fragment);
        }
示例#2
0
 public void CutSelection(FragmentSelection fragments)
 {
     Contract.Requires(GeProfile.IsSelectable(fragments.Start, fragments.End, false));
     Contract.Ensures(GeProfile.IsInputable(fragments.Start));
     SaveState();
     NewProfile = GeProfile.ProfileText.Substring(0, fragments.Start) + GeProfile.ProfileText.Substring(fragments.End);
     ChangeProfile();
     RestoreState();
 }
示例#3
0
 public void InsertSelection(int position, FragmentSelection fragments)
 {
     Contract.Requires(GeProfile.IsInputable(position));
     Contract.Ensures(GeProfile.IsSelectable(position, position + fragments.ProfileText.Length, false));
     SaveState();
     NewProfile = GeProfile.ProfileText.Insert(NodeFragmentPosition.Position.Offset + position,
                                               fragments.ProfileText);
     ChangeProfile();
     RestoreState();
 }
示例#4
0
        private void RestoreState()
        {
            GeProfile.Fragment = GeProfile.Profile;
            GeProfile.GetNodeProfileText();
            Fragment after;
            Fragment before;

            GeProfile.GetFragmentsAt(out before, out after, NodeFragmentPosition.Position.Offset);
            GeProfile.Fragment = after;
            GeProfile.GetNodeProfileText();
        }
示例#5
0
 public ModifyProfile(GeProfile geProfile)
 {
     GeProfile = geProfile;
 }
示例#6
0
 public ReplaceSelectionWithPlaceholderCommand(Text text, int selectionStart, int selectionEnd, GenDataId id, GeProfile geProfile) : base(geProfile)
 {
     Text           = text;
     SelectionStart = selectionStart;
     SelectionEnd   = selectionEnd;
     Id             = id;
     Body           = (FragmentBody)Text.Parent;
     FragmentIndex  = Body.FragmentList.IndexOf(Text) + 1;
     Prefix         = Text.TextValue.Substring(0, SelectionStart);
     Suffix         = Text.TextValue.Substring(SelectionEnd);
 }
示例#7
0
 public InsertSelectionCommand(GeProfile geProfile, int position, FragmentSelection fragments)
     : base(geProfile)
 {
     Position  = position;
     Fragments = fragments;
 }
示例#8
0
 public CutSelectionCommand(GeProfile geProfile, FragmentSelection fragments)
     : base(geProfile)
 {
     Fragments = fragments;
 }
示例#9
0
 protected ProfileCommandBase(GeProfile geProfile)
 {
     GeProfile = geProfile;
 }
示例#10
0
 public ReplacePlaceholderWithTextCommand(Placeholder placeholder, string substitutedText, GeProfile geProfile) : base(geProfile)
 {
     Placeholder     = placeholder;
     SubstitutedText = substitutedText;
     SelectionStart  = 0;
     SelectionEnd    = SubstitutedText.Length;
     Id = new GenDataId {
         ClassName = Placeholder.Class, PropertyName = Placeholder.Property
     };
 }