bool ValidateName()
        {
            string         fileName      = properties.DeclaringMember.DeclaringType.CompilationUnit.FileName;
            INameValidator nameValidator = MonoDevelop.Projects.LanguageBindingService.GetRefactorerForFile(fileName ?? "default.cs");

            if (nameValidator == null)
            {
                return(true);
            }
            ValidationResult result = nameValidator.ValidateName(new DomMethod(), entry.Text);

            if (!result.IsValid)
            {
                imageWarning.IconName = Gtk.Stock.DialogError;
            }
            else if (result.HasWarning)
            {
                imageWarning.IconName = Gtk.Stock.DialogWarning;
            }
            else
            {
                imageWarning.IconName = Gtk.Stock.Apply;
            }
            labelWarning.Text = result.Message;
            return(result.IsValid);
        }
        bool ValidateName()
        {
            INameValidator nameValidator = MonoDevelop.Projects.LanguageBindingService.GetRefactorerForFile(fileName ?? "default.cs");

            if (nameValidator == null)
            {
                return(true);
            }
            ValidationResult result = nameValidator.ValidateName(this.options.SelectedItem, entry.Text);

            if (!result.IsValid)
            {
                imageWarning.IconName = Gtk.Stock.DialogError;
            }
            else if (result.HasWarning)
            {
                imageWarning.IconName = Gtk.Stock.DialogWarning;
            }
            else
            {
                imageWarning.IconName = Gtk.Stock.Apply;
            }
            labelWarning.Text = result.Message;
            return(result.IsValid);
        }
示例#3
0
        bool ValidateName()
        {
            string fileName   = properties.DeclaringMember.DeclaringType.CompilationUnit.FileName;
            string methodName = entry.Text;

            if (HasMember(methodName))
            {
                labelWarning.Text     = GettextCatalog.GetString("A member with the name '{0}' already exists.", methodName);
                imageWarning.IconName = Gtk.Stock.DialogError;
                return(false);
            }

            INameValidator nameValidator = MonoDevelop.Projects.LanguageBindingService.GetRefactorerForFile(fileName ?? "default.cs");

            if (nameValidator == null)
            {
                return(true);
            }
            ValidationResult result = nameValidator.ValidateName(new DomMethod(), entry.Text);

            if (!result.IsValid)
            {
                imageWarning.IconName = Gtk.Stock.DialogError;
            }
            else if (result.HasWarning)
            {
                imageWarning.IconName = Gtk.Stock.DialogWarning;
            }
            else
            {
                imageWarning.IconName = Gtk.Stock.Apply;
            }
            labelWarning.Text = result.Message;
            return(result.IsValid);
        }