Пример #1
0
        public override void Apply(WorkspaceFixContext context)
        {
            var commandBinding = "{command: " + CommandName + "()}";
            var value          = new AttributeQuotedValueToken(0, "\"", commandBinding);

            Tag.AddOrUpdateAttribute(Name, value);
        }
Пример #2
0
 public override void Apply(WorkspaceFixContext context)
 {
     if (!context.Tokens.Remove(Token))
     {
         throw new InvalidOperationException("The token was already removed!");
     }
 }
        public override void Apply(WorkspaceFixContext context)
        {
            var commandBinding = "{value: " + ViewModelProperty + "}";
            var value          = new AttributeQuotedValueToken(0, "\"", commandBinding);

            Tag.AddOrUpdateAttribute(Name, value);
        }
Пример #4
0
        public override void Apply(WorkspaceFixContext context)
        {
            var firstTokenIndex = context.Tokens.IndexOf(FirstToken);

            if (firstTokenIndex < 0)
            {
                throw new InvalidOperationException("Token to move not found!");
            }

            var range = context.Tokens.GetRange(firstTokenIndex, TokenCount);

            context.Tokens.RemoveRange(firstTokenIndex, TokenCount);

            var targetIndex = context.Tokens.IndexOf(TargetPosition);

            if (targetIndex < 0)
            {
                throw new InvalidOperationException("Target token not found!");
            }

            if (Placement == Placement.After)
            {
                targetIndex++;
            }
            context.Tokens.InsertRange(targetIndex, range);
        }
Пример #5
0
 public override void Apply(WorkspaceFixContext context)
 {
     if (!Tag.Attributes.Remove(Attribute))
     {
         throw new InvalidOperationException("The attribute doesn't belong to the tag.");
     }
 }
Пример #6
0
        public override void Apply(WorkspaceFixContext context)
        {
            var file = context.GetViewModelFile();

            file.AddOrExtendItem(new CsharpItem()
            {
                ItemType = CsharpItemType.PublicProperty,
                Name     = Name,
                Type     = Type
            });
        }
        public override void Apply(WorkspaceFixContext context)
        {
            var file = context.GetViewModelFile();

            file.AddOrExtendItem(new CsharpItem()
            {
                ItemType = CsharpItemType.PublicMethod,
                Name     = EventName,
                Type     = ReturnType,
                Body     = new List <string>()
                {
                    Body
                }
            });
        }
Пример #8
0
 public override void Apply(WorkspaceFixContext context)
 {
     Attribute.ChangeName(NewName);
 }
Пример #9
0
 public abstract void Apply(WorkspaceFixContext context);
Пример #10
0
 public override void Apply(WorkspaceFixContext context)
 {
     Tag.ChangeTagName(NewName);
     EndTag?.ChangeTagName(NewName);
 }
Пример #11
0
        private void ApplyFix(FixAction fix)
        {
            var context = new WorkspaceFixContext(null, fix, workspace.Tokens, workspace.CsharpFiles);

            fix.Apply(context);
        }