示例#1
0
        public void UpdateSignal(Stetic.Signal oldSignal, Stetic.Signal newSignal)
        {
            if (targetObject == null)
            {
                return;
            }

            if (oldSignal.Handler == newSignal.Handler)
            {
                return;
            }

            IType cls = GetClass();

            if (cls == null)
            {
                return;
            }

            IMethod met = FindSignalHandler(cls, oldSignal);

            if (met == null)
            {
                return;
            }
            CodeRefactorer gen = GetCodeGenerator();

            gen.RenameMember(new NullProgressMonitor(), cls, met, newSignal.Handler, RefactoryScope.File);
        }
示例#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);
                }
            }
        }