Beispiel #1
0
        public async Task UpdateField(Stetic.Component obj, string oldName)
        {
            if (targetObject == null)
            {
                return;
            }

            if (obj == targetObject)
            {
                return;                 // The root widget name can only be changed internally.
            }
            var cls = GetClass(false);

            string newName = GetObjectName(obj);

            if (newName.Length == 0)
            {
                return;
            }

            if (cls != null)
            {
                var f = ClassUtils.FindWidgetField(cls, oldName);
                if (f != null)
                {
                    await MonoDevelop.Refactoring.Rename.RenameRefactoring.Rename(f, newName);
                }
            }
        }
Beispiel #2
0
        public void UpdateField(Stetic.Component obj, string oldName)
        {
            if (targetObject == null)
            {
                return;
            }

            CodeRefactorer cr = GetCodeGenerator();

            IType cls;

            if (obj == targetObject)
            {
                return;                 // The root widget name can only be changed internally.
            }
            else
            {
                cls = GetClass(false);
            }

            string newName = GetObjectName(obj);

            if (newName.Length == 0)
            {
                return;
            }

            if (cls != null)
            {
                IField f = ClassUtils.FindWidgetField(cls, oldName);
                if (f != null)
                {
                    cr.RenameMember(new NullProgressMonitor(), cls, f, newName, RefactoryScope.File);
                }
            }
        }