Example #1
0
        public static void NavigateToType(CSharpTypeIdentifier typeIdentifier)
        {
            bool result = false;

            try
            {
                CSharpType currentType = ResolveType(typeIdentifier);
                if (currentType == null)
                {
                    return;
                }

                var sourceLocations = currentType.SourceLocations;
                if (sourceLocations == null || sourceLocations.Count == 0)
                {
                    return;
                }

                var location = sourceLocations[0];
                if (location.FileName == null || !location.Position.IsValid)
                {
                    return;
                }

                CSRPOSDATA position = new CSRPOSDATA()
                {
                    LineIndex   = location.Position.Line,
                    ColumnIndex = location.Position.Character
                };

                ILangService languageService;
                CSharpInheritanceAnalyzer.LangService_GetInstance(out languageService);
                if (languageService == null)
                {
                    return;
                }

                IProject project = null;
                languageService.OpenSourceFile(project, location.FileName.Value, position);
            }
            catch (ApplicationException)
            {
                ////_callHierarchy.LanguageService.DisplayErrorMessage(exception.Message);
                return;
            }
            catch (InvalidOperationException)
            {
                ////this._callHierarchy.LanguageService.DisplayErrorMessage(exception2.Message);
                return;
            }

            if (!result)
            {
                ////NativeMessageId.Create(this._callHierarchy.LanguageService, jrc_StringResource_identifiers.IDS_HIDDEN_DEFINITION, new object[0]).DisplayError(this._callHierarchy.LanguageService);
            }
        }