ResolveReferences() public method

public ResolveReferences ( ) : void
return void
コード例 #1
0
        IHighlightingStrategy LoadDefinition(Tuple <SyntaxMode, ISyntaxModeFileProvider> entry)
        {
            SyntaxMode syntaxMode = entry.Item1;
            ISyntaxModeFileProvider syntaxModeFileProvider = entry.Item2;

            DefaultHighlightingStrategy highlightingStrategy = null;

            try
            {
                var reader = syntaxModeFileProvider.GetSyntaxModeFile(syntaxMode);
                if (reader == null)
                {
                    throw new HighlightingDefinitionInvalidException("Could not get syntax mode file for " + syntaxMode.Name);
                }
                highlightingStrategy = HighlightingDefinitionParser.Parse(syntaxMode, reader);
                if (highlightingStrategy.Name != syntaxMode.Name)
                {
                    throw new HighlightingDefinitionInvalidException("The name specified in the .xshd '" + highlightingStrategy.Name + "' must be equal the syntax mode name '" + syntaxMode.Name + "'");
                }
            }
            finally
            {
                if (highlightingStrategy == null)
                {
                    highlightingStrategy = DefaultHighlighting;
                }
                HighlightingDefinitions[syntaxMode.Name] = highlightingStrategy;
                highlightingStrategy.ResolveReferences();
            }
            return(highlightingStrategy);
        }
コード例 #2
0
        private IHighlightingStrategy LoadDefinition(DictionaryEntry entry)
        {
            SyntaxMode key = (SyntaxMode)entry.Key;
            ISyntaxModeFileProvider     value = (ISyntaxModeFileProvider)entry.Value;
            DefaultHighlightingStrategy defaultHighlighting = null;

            try
            {
                XmlTextReader syntaxModeFile = value.GetSyntaxModeFile(key);
                if (syntaxModeFile == null)
                {
                    throw new HighlightingDefinitionInvalidException(string.Concat("Could not get syntax mode file for ", key.Name));
                }
                defaultHighlighting = HighlightingDefinitionParser.Parse(key, syntaxModeFile);
                if (defaultHighlighting.Name != key.Name)
                {
                    string[] name = new string[] { "The name specified in the .xshd '", defaultHighlighting.Name, "' must be equal the syntax mode name '", key.Name, "'" };
                    throw new HighlightingDefinitionInvalidException(string.Concat(name));
                }
            }
            finally
            {
                if (defaultHighlighting == null)
                {
                    defaultHighlighting = this.DefaultHighlighting;
                }
                this.highlightingDefs[key.Name] = defaultHighlighting;
                defaultHighlighting.ResolveReferences();
            }
            return(defaultHighlighting);
        }
コード例 #3
0
        IHighlightingStrategy LoadDefinition(DictionaryEntry entry)
        {
            SyntaxMode syntaxMode = (SyntaxMode)entry.Key;
            ISyntaxModeFileProvider syntaxModeFileProvider = (ISyntaxModeFileProvider)entry.Value;

            DefaultHighlightingStrategy highlightingStrategy = null;

            try {
                //johnny
                //var reader = syntaxModeFileProvider.GetSyntaxModeFile(syntaxMode);
                System.Xml.XmlTextReader reader = syntaxModeFileProvider.GetSyntaxModeFile(syntaxMode);
                if (reader == null)
                {
                    throw new HighlightingDefinitionInvalidException("Could not get syntax mode file for " + syntaxMode.Name);
                }
                highlightingStrategy = HighlightingDefinitionParser.Parse(syntaxMode, reader);
                if (highlightingStrategy.Name != syntaxMode.Name)
                {
                    throw new HighlightingDefinitionInvalidException("The name specified in the .xshd '" + highlightingStrategy.Name + "' must be equal the syntax mode name '" + syntaxMode.Name + "'");
                }
            } finally {
                if (highlightingStrategy == null)
                {
                    highlightingStrategy = DefaultHighlighting;
                }
                highlightingDefs[syntaxMode.Name] = highlightingStrategy;
                highlightingStrategy.ResolveReferences();
            }
            return(highlightingStrategy);
        }
コード例 #4
0
        IHighlightingStrategy LoadDefinition(DictionaryEntry entry)
        {
            SyntaxMode syntaxMode = (SyntaxMode)entry.Key;
            ISyntaxModeFileProvider syntaxModeFileProvider = (ISyntaxModeFileProvider)entry.Value;

            DefaultHighlightingStrategy highlightingStrategy = HighlightingDefinitionParser.Parse(syntaxMode, syntaxModeFileProvider.GetSyntaxModeFile(syntaxMode));

            highlightingDefs[syntaxMode.Name] = highlightingStrategy;
            highlightingStrategy.ResolveReferences();

            return(highlightingStrategy);
        }
コード例 #5
0
        public SyntaxMode AddHighlightingStrategy(string syntaxFile)
        {
            DefaultHighlightingStrategy highlightingStrategy = null;
            SyntaxMode syntaxMode = new SyntaxMode(syntaxFile, "", "");

            try
            {
                var reader = new XmlTextReader(File.OpenRead(syntaxFile));
                if (reader == null)
                {
                    throw new HighlightingDefinitionInvalidException("Could not get syntax mode file for " + syntaxFile);
                }

                highlightingStrategy  = HighlightingDefinitionParser.Parse(syntaxMode, reader);
                syntaxMode.Name       = highlightingStrategy.Name;
                syntaxMode.Extensions = highlightingStrategy.Extensions;

                //if (highlightingStrategy.Name != syntaxMode.Name)
                //{
                //    throw new HighlightingDefinitionInvalidException("The name specified in the .xshd '" + highlightingStrategy.Name + "' must be equal the syntax mode name '" + syntaxMode.Name + "'");
                //}

                if (highlightingStrategy == null)
                {
                    highlightingStrategy = DefaultHighlighting;
                }
                highlightingDefs[syntaxMode.Name] = highlightingStrategy;
                highlightingStrategy.ResolveReferences();
                foreach (string extension in highlightingStrategy.Extensions)
                {
                    extensionsToName[extension.ToUpperInvariant()] = highlightingStrategy.Name;
                }

                return(syntaxMode);
            }
            catch (Exception ex)
            {
                //MessageBox.Show(ex.Message + ex.StackTrace);
                return(null);
            }
        }