예제 #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);
        }