Пример #1
0
        protected void AddBookmark(
            SearchBookmarkQueue sbq,
            String propertyName,
            Int32 propertyIndex,
            Int32 start,
            Int32 length)
        {
            SearchBookmark sb = new SearchBookmark();

            sb.Element      = this;
            sb.PropertyName = propertyName;
            sb.Index        = propertyIndex;
            sb.Start        = start;
            sb.Length       = length;
            sbq.Enqueue(sb);
        }
Пример #2
0
        public void TextSearch(
            SearchBookmarkQueue sbq,
            String searchedText,
            String replacedText,
            Boolean wholeWordsOnly,
            Boolean caseSensitivity,
            Boolean executeReplaceAll)
        {
            Int32  counter;
            String expr;
            Regex  regex;

            if (wholeWordsOnly)
            {
                expr = @"\b" + searchedText + @"\b";
            }
            else
            {
                expr = searchedText;
            }

            if (caseSensitivity)
            {
                regex = new Regex(expr, RegexOptions.None);
            }
            else
            {
                regex = new Regex(expr, RegexOptions.IgnoreCase);
            }

            // GOALS
            for (counter = 0; counter < this.goals.Count; counter++)
            {
                Goal goal = (Goal)this.goals[counter];

                if (!executeReplaceAll)
                {
                    foreach (Match match in regex.Matches(goal.Description))
                    {
                        if (!executeReplaceAll)
                        {
                            this.AddBookmark(sbq, "Goals", counter, match.Index, match.Length);
                        }
                    }
                }
                else
                {
                    goal.Description = regex.Replace(goal.Description, replacedText);
                }
            }

            // ATTRIBUTES -> DESCRIPTION
            if (!executeReplaceAll)
            {
                foreach (Match match in regex.Matches(this.Attributes.Description))
                {
                    if (!executeReplaceAll)
                    {
                        this.AddBookmark(sbq, "Attributes.Description", counter, match.Index, match.Length);
                    }
                }
            }
            else
            {
                this.Attributes.Description = regex.Replace(this.Attributes.Description, replacedText);
            }

            // ATTRIBUTES -> NOTES
            if (!executeReplaceAll)
            {
                foreach (Match match in regex.Matches(this.Attributes.Notes))
                {
                    if (!executeReplaceAll)
                    {
                        this.AddBookmark(sbq, "Attributes.Notes", counter, match.Index, match.Length);
                    }
                }
            }
            else
            {
                this.Attributes.Notes = regex.Replace(this.Attributes.Notes, replacedText);
            }
        }
Пример #3
0
 protected void AddBookmark(
     SearchBookmarkQueue sbq,
     String propertyName,
     Int32 propertyIndex,
     Int32 start,
     Int32 length)
 {
     SearchBookmark sb = new SearchBookmark();
     sb.Element = this;
     sb.PropertyName = propertyName;
     sb.Index = propertyIndex;
     sb.Start = start;
     sb.Length = length;
     sbq.Enqueue(sb);
 }
Пример #4
0
        public new void TextSearch(
            SearchBookmarkQueue sbq,
            String searchedText,
            String replacedText,
            Boolean wholeWordsOnly,
            Boolean caseSensitivity,
            Boolean executeReplaceAll)
        {
            Int32  counter;
            String expr;
            Regex  regex;

            if (wholeWordsOnly)
            {
                expr = @"\b" + searchedText + @"\b";
            }
            else
            {
                expr = searchedText;
            }

            if (caseSensitivity)
            {
                regex = new Regex(expr, RegexOptions.None);
            }
            else
            {
                regex = new Regex(expr, RegexOptions.IgnoreCase);
            }

            // GLOSSARY
            for (counter = 0; counter < this.glossary.Count; counter++)
            {
                GlossaryItem gi = (GlossaryItem)this.glossary[counter];

                if (!executeReplaceAll)
                {
                    foreach (Match match in regex.Matches(gi.Description))
                    {
                        if (!executeReplaceAll)
                        {
                            this.AddBookmark(sbq, "Glossary", counter, match.Index, match.Length);
                        }
                    }
                }
                else
                {
                    gi.Description = regex.Replace(gi.Description, replacedText);
                }
            }

            // STAKEHOLDERS
            for (counter = 0; counter < this.stakeholders.Count; counter++)
            {
                Stakeholder stakeholder = (Stakeholder)this.stakeholders[counter];

                if (!executeReplaceAll)
                {
                    foreach (Match match in regex.Matches(stakeholder.Description))
                    {
                        if (!executeReplaceAll)
                        {
                            this.AddBookmark(sbq, "Stakeholders", counter, match.Index, match.Length);
                        }
                    }
                }
                else
                {
                    stakeholder.Description = regex.Replace(stakeholder.Description, replacedText);
                }
            }

            base.TextSearch(sbq,
                            searchedText,
                            replacedText,
                            wholeWordsOnly,
                            caseSensitivity,
                            executeReplaceAll);
        }
Пример #5
0
        public void TextSearch(
            SearchBookmarkQueue sbq,
            String searchedText,
            String replacedText,
            Boolean wholeWordsOnly,
            Boolean caseSensitivity,
            Boolean executeReplaceAll)
        {
            Int32 counter;
            String expr;
            Regex regex;

            if(wholeWordsOnly)
            {
                expr = @"\b" + searchedText + @"\b";
            }
            else
            {
                expr = searchedText;
            }

            if(caseSensitivity)
            {
                regex = new Regex(expr, RegexOptions.None);
            }
            else
            {
                regex = new Regex(expr, RegexOptions.IgnoreCase);
            }

            // GOALS
            for(counter = 0; counter < this.goals.Count; counter++)
            {
                Goal goal = (Goal)this.goals[counter];

                if(!executeReplaceAll)
                {
                    foreach(Match match in regex.Matches(goal.Description))
                    {
                        if(!executeReplaceAll)
                        {
                            this.AddBookmark(sbq, "Goals", counter, match.Index, match.Length);
                        }
                    }
                }
                else
                {
                    goal.Description = regex.Replace(goal.Description, replacedText);
                }
            }

            // ATTRIBUTES -> DESCRIPTION
            if(!executeReplaceAll)
            {
                foreach(Match match in regex.Matches(this.Attributes.Description))
                {
                    if(!executeReplaceAll)
                    {
                        this.AddBookmark(sbq, "Attributes.Description", counter, match.Index, match.Length);
                    }
                }
            }
            else
            {
                this.Attributes.Description = regex.Replace(this.Attributes.Description, replacedText);
            }

            // ATTRIBUTES -> NOTES
            if(!executeReplaceAll)
            {
                foreach(Match match in regex.Matches(this.Attributes.Notes))
                {
                    if(!executeReplaceAll)
                    {
                        this.AddBookmark(sbq, "Attributes.Notes", counter, match.Index, match.Length);
                    }
                }
            }
            else
            {
                this.Attributes.Notes = regex.Replace(this.Attributes.Notes, replacedText);
            }
        }
Пример #6
0
        public new void TextSearch(
            SearchBookmarkQueue sbq,
            String searchedText,
            String replacedText,
            Boolean wholeWordsOnly,
            Boolean caseSensitivity,
            Boolean executeReplaceAll)
        {
            Int32 counter;
            String expr;
            Regex regex;

            if(wholeWordsOnly)
            {
                expr = @"\b" + searchedText + @"\b";
            }
            else
            {
                expr = searchedText;
            }

            if(caseSensitivity)
            {
                regex = new Regex(expr, RegexOptions.None);
            }
            else
            {
                regex = new Regex(expr, RegexOptions.IgnoreCase);
            }

            // GLOSSARY
            for(counter = 0; counter < this.glossary.Count; counter++)
            {
                GlossaryItem gi = (GlossaryItem)this.glossary[counter];

                if(!executeReplaceAll)
                {
                    foreach(Match match in regex.Matches(gi.Description))
                    {
                        if(!executeReplaceAll)
                        {
                            this.AddBookmark(sbq, "Glossary", counter, match.Index, match.Length);
                        }
                    }
                }
                else
                {
                    gi.Description = regex.Replace(gi.Description, replacedText);
                }
            }

            // STAKEHOLDERS
            for(counter = 0; counter < this.stakeholders.Count; counter++)
            {
                Stakeholder stakeholder = (Stakeholder)this.stakeholders[counter];

                if(!executeReplaceAll)
                {
                    foreach(Match match in regex.Matches(stakeholder.Description))
                    {
                        if(!executeReplaceAll)
                        {
                            this.AddBookmark(sbq, "Stakeholders", counter, match.Index, match.Length);
                        }
                    }
                }
                else
                {
                    stakeholder.Description = regex.Replace(stakeholder.Description, replacedText);
                }
            }

            base.TextSearch(sbq,
                    searchedText,
                    replacedText,
                    wholeWordsOnly,
                    caseSensitivity,
                    executeReplaceAll);
        }
Пример #7
0
        public void TextSearch(
            SearchBookmarkQueue sbq,
            String searchedText,
            String replacedText,
            Boolean wholeWordsOnly,
            Boolean caseSensitivity,
            Boolean executeReplaceAll)
        {
            Int32  counter;
            String expr;
            Regex  regex;

            if (wholeWordsOnly)
            {
                expr = @"\b" + searchedText + @"\b";
            }
            else
            {
                expr = searchedText;
            }

            if (caseSensitivity)
            {
                regex = new Regex(expr, RegexOptions.None);
            }
            else
            {
                regex = new Regex(expr, RegexOptions.IgnoreCase);
            }

            // REQUIREMENTS
            for (counter = 0; counter < this.Requirements.Count; counter++)
            {
                Requirement requirement = (Requirement)this.Requirements[counter];

                if (!executeReplaceAll)
                {
                    foreach (Match match in regex.Matches(requirement.Description))
                    {
                        if (!executeReplaceAll)
                        {
                            this.AddBookmark(sbq, "Requirements", counter, match.Index, match.Length);
                        }
                    }
                }
                else
                {
                    requirement.Description = regex.Replace(requirement.Description, replacedText);
                }
            }

            // ATTRIBUTES -> DESCRIPTION
            if (!executeReplaceAll)
            {
                foreach (Match match in regex.Matches(this.Attributes.Description))
                {
                    if (!executeReplaceAll)
                    {
                        this.AddBookmark(sbq, "Attributes.Description", counter, match.Index, match.Length);
                    }
                }
            }
            else
            {
                this.Attributes.Description = regex.Replace(this.Attributes.Description, replacedText);
            }

            // ATTRIBUTES -> NOTES
            if (!executeReplaceAll)
            {
                foreach (Match match in regex.Matches(this.Attributes.Notes))
                {
                    if (!executeReplaceAll)
                    {
                        this.AddBookmark(sbq, "Attributes.Notes", counter, match.Index, match.Length);
                    }
                }
            }
            else
            {
                this.Attributes.Notes = regex.Replace(this.Attributes.Notes, replacedText);
            }


            foreach (Actor actor in this.Actors)
            {
                actor.TextSearch(
                    sbq,
                    searchedText,
                    replacedText,
                    wholeWordsOnly,
                    caseSensitivity,
                    executeReplaceAll);
            }

            foreach (UseCase useCase in this.UseCases)
            {
                useCase.TextSearch(
                    sbq,
                    searchedText,
                    replacedText,
                    wholeWordsOnly,
                    caseSensitivity,
                    executeReplaceAll);
            }

            foreach (Package package in this.Packages)
            {
                package.TextSearch(
                    sbq,
                    searchedText,
                    replacedText,
                    wholeWordsOnly,
                    caseSensitivity,
                    executeReplaceAll);
            }
        }
Пример #8
0
        public void TextSearch(
            SearchBookmarkQueue sbq,
            String searchedText,
            String replacedText,
            Boolean wholeWordsOnly,
            Boolean caseSensitivity,
            Boolean executeReplaceAll)
        {
            Int32  counter;
            String expr;
            Regex  regex;

            if (wholeWordsOnly)
            {
                expr = @"\b" + searchedText + @"\b";
            }
            else
            {
                expr = searchedText;
            }

            if (caseSensitivity)
            {
                regex = new Regex(expr, RegexOptions.None);
            }
            else
            {
                regex = new Regex(expr, RegexOptions.IgnoreCase);
            }

            // STEPS
            for (counter = 0; counter < this.steps.Count; counter++)
            {
                Step step = (Step)this.steps[counter];

                if (!executeReplaceAll)
                {
                    foreach (Match match in regex.Matches(step.Description))
                    {
                        if (!executeReplaceAll)
                        {
                            this.AddBookmark(sbq, "Steps", counter, match.Index, match.Length);
                        }
                    }
                }
                else
                {
                    step.Description = regex.Replace(step.Description, replacedText);
                }
            }

            // OPEN ISSUES
            for (counter = 0; counter < this.openIssues.Count; counter++)
            {
                OpenIssue openIssue = (OpenIssue)this.openIssues[counter];

                if (!executeReplaceAll)
                {
                    foreach (Match match in regex.Matches(openIssue.Description))
                    {
                        if (!executeReplaceAll)
                        {
                            this.AddBookmark(sbq, "OpenIssues", counter, match.Index, match.Length);
                        }
                    }
                }
                else
                {
                    openIssue.Description = regex.Replace(openIssue.Description, replacedText);
                }
            }

            // PRECONDITIONS
            if (!executeReplaceAll)
            {
                foreach (Match match in regex.Matches(this.preconditions))
                {
                    if (!executeReplaceAll)
                    {
                        this.AddBookmark(sbq, "Preconditions", counter, match.Index, match.Length);
                    }
                }
            }
            else
            {
                this.preconditions = regex.Replace(this.preconditions, replacedText);
            }

            // POSTCONDITIONS
            if (!executeReplaceAll)
            {
                foreach (Match match in regex.Matches(this.postconditions))
                {
                    if (!executeReplaceAll)
                    {
                        this.AddBookmark(sbq, "Postconditions", counter, match.Index, match.Length);
                    }
                }
            }
            else
            {
                this.postconditions = regex.Replace(this.postconditions, replacedText);
            }

            // PROSE
            if (!executeReplaceAll)
            {
                foreach (Match match in regex.Matches(this.prose))
                {
                    if (!executeReplaceAll)
                    {
                        this.AddBookmark(sbq, "Prose", counter, match.Index, match.Length);
                    }
                }
            }
            else
            {
                this.prose = regex.Replace(this.prose, replacedText);
            }

            // ATTRIBUTES -> DESCRIPTION
            if (!executeReplaceAll)
            {
                foreach (Match match in regex.Matches(this.Attributes.Description))
                {
                    if (!executeReplaceAll)
                    {
                        this.AddBookmark(sbq, "Attributes.Description", counter, match.Index, match.Length);
                    }
                }
            }
            else
            {
                this.Attributes.Description = regex.Replace(this.Attributes.Description, replacedText);
            }

            // ATTRIBUTES -> NOTES
            if (!executeReplaceAll)
            {
                foreach (Match match in regex.Matches(this.Attributes.Notes))
                {
                    if (!executeReplaceAll)
                    {
                        this.AddBookmark(sbq, "Attributes.Notes", counter, match.Index, match.Length);
                    }
                }
            }
            else
            {
                this.Attributes.Notes = regex.Replace(this.Attributes.Notes, replacedText);
            }
        }
Пример #9
0
        public void TextSearch(
            SearchBookmarkQueue sbq,
            String searchedText,
            String replacedText,
            Boolean wholeWordsOnly,
            Boolean caseSensitivity,
            Boolean executeReplaceAll)
        {
            Int32 counter;
            String expr;
            Regex regex;

            if(wholeWordsOnly)
            {
                expr = @"\b" + searchedText + @"\b";
            }
            else
            {
                expr = searchedText;
            }

            if(caseSensitivity)
            {
                regex = new Regex(expr, RegexOptions.None);
            }
            else
            {
                regex = new Regex(expr, RegexOptions.IgnoreCase);
            }

            // STEPS
            for(counter = 0; counter < this.steps.Count; counter++)
            {
                Step step = (Step)this.steps[counter];

                if(!executeReplaceAll)
                {
                    foreach(Match match in regex.Matches(step.Description))
                    {
                        if(!executeReplaceAll)
                        {
                            this.AddBookmark(sbq, "Steps", counter, match.Index, match.Length);
                        }
                    }
                }
                else
                {
                    step.Description = regex.Replace(step.Description, replacedText);
                }
            }

            // OPEN ISSUES
            for(counter = 0; counter < this.openIssues.Count; counter++)
            {
                OpenIssue openIssue = (OpenIssue)this.openIssues[counter];

                if(!executeReplaceAll)
                {
                    foreach(Match match in regex.Matches(openIssue.Description))
                    {
                        if(!executeReplaceAll)
                        {
                            this.AddBookmark(sbq, "OpenIssues", counter, match.Index, match.Length);
                        }
                    }
                }
                else
                {
                    openIssue.Description = regex.Replace(openIssue.Description, replacedText);
                }
            }

            // PRECONDITIONS
            if(!executeReplaceAll)
            {
                foreach(Match match in regex.Matches(this.preconditions))
                {
                    if(!executeReplaceAll)
                    {
                        this.AddBookmark(sbq, "Preconditions", counter, match.Index, match.Length);
                    }
                }
            }
            else
            {
                this.preconditions = regex.Replace(this.preconditions, replacedText);
            }

            // POSTCONDITIONS
            if(!executeReplaceAll)
            {
                foreach(Match match in regex.Matches(this.postconditions))
                {
                    if(!executeReplaceAll)
                    {
                        this.AddBookmark(sbq, "Postconditions", counter, match.Index, match.Length);
                    }
                }
            }
            else
            {
                this.postconditions = regex.Replace(this.postconditions, replacedText);
            }

            // PROSE
            if(!executeReplaceAll)
            {
                foreach(Match match in regex.Matches(this.prose))
                {
                    if(!executeReplaceAll)
                    {
                        this.AddBookmark(sbq, "Prose", counter, match.Index, match.Length);
                    }
                }
            }
            else
            {
                this.prose = regex.Replace(this.prose, replacedText);
            }

            // ATTRIBUTES -> DESCRIPTION
            if(!executeReplaceAll)
            {
                foreach(Match match in regex.Matches(this.Attributes.Description))
                {
                    if(!executeReplaceAll)
                    {
                        this.AddBookmark(sbq, "Attributes.Description", counter, match.Index, match.Length);
                    }
                }
            }
            else
            {
                this.Attributes.Description = regex.Replace(this.Attributes.Description, replacedText);
            }

            // ATTRIBUTES -> NOTES
            if(!executeReplaceAll)
            {
                foreach(Match match in regex.Matches(this.Attributes.Notes))
                {
                    if(!executeReplaceAll)
                    {
                        this.AddBookmark(sbq, "Attributes.Notes", counter, match.Index, match.Length);
                    }
                }
            }
            else
            {
                this.Attributes.Notes = regex.Replace(this.Attributes.Notes, replacedText);
            }
        }