public void Resolve(IDataContext context, Action<IQuickDocPresenter, PsiLanguageType> resolved)
        {
            var elements = context.GetData(PsiDataConstants.DECLARED_ELEMENTS);
            Assertion.AssertNotNull(elements, "elements != null");

            var document = context.GetData(DocumentModelDataConstants.DOCUMENT);
            IProjectFile projectFile = null;
            if (document != null)
                projectFile = myDocumentManager.TryGetProjectFile(document);

            var defaultLanguage = PresentationUtil.GetPresentationLanguageByContainer(projectFile, mySolution);

            foreach (var element in elements.OfType<IClrDeclaredElement>())
            {
                var eventFunction = GetEventFunction(element);
                if (eventFunction != null)
                {
                    var presenter = new UnityEventFunctionQuickDocPresenter(eventFunction, element, myQuickDocTypeMemberProvider,
                        myTheming, myHelpSystem);
                    resolved(presenter, defaultLanguage);
                    return;
                }

                var eventFunctionForParameter = GetEventFunctionFromParameter(element as IParameter);
                if (eventFunctionForParameter != null)
                {
                    var presenter = new UnityEventFunctionQuickDocPresenter(eventFunctionForParameter, element.ShortName, element,
                        myQuickDocTypeMemberProvider, myTheming, myHelpSystem);
                    resolved(presenter, defaultLanguage);
                    return;
                }
            }
        }
예제 #2
0
        public void Resolve(IDataContext context, Action <IQuickDocPresenter, PsiLanguageType> resolved)
        {
            var elements = context.GetData(PsiDataConstants.DECLARED_ELEMENTS);

            Assertion.AssertNotNull(elements, "elements != null");

            var          document    = context.GetData(DocumentModelDataConstants.DOCUMENT);
            IProjectFile projectFile = null;

            if (document != null)
            {
                projectFile = myDocumentManager.TryGetProjectFile(document);
            }

            var defaultLanguage = PresentationUtil.GetPresentationLanguageByContainer(projectFile, mySolution);

            foreach (var element in elements.OfType <IClrDeclaredElement>())
            {
                var eventFunction = GetEventFunction(element);
                if (eventFunction != null)
                {
                    var presenter = new UnityEventFunctionQuickDocPresenter(eventFunction, element, myQuickDocTypeMemberProvider,
                                                                            myTheming, myHelpSystem);
                    resolved(presenter, defaultLanguage);
                    return;
                }

                var eventFunctionForParameter = GetEventFunctionFromParameter(element as IParameter);
                if (eventFunctionForParameter != null)
                {
                    var presenter = new UnityEventFunctionQuickDocPresenter(eventFunctionForParameter, element.ShortName, element,
                                                                            myQuickDocTypeMemberProvider, myTheming, myHelpSystem);
                    resolved(presenter, defaultLanguage);
                    return;
                }
            }
        }