Beispiel #1
0
        public void OnClick(CodeInsightsHighlighting highlighting, ISolution solution)
        {
            var rules = new List <IDataRule>();

            rules.AddRule("Solution", ProjectModelDataConstants.SOLUTION, solution);

            var declaredElement = highlighting.DeclaredElement;

            rules.AddRule("DeclaredElement", PsiDataConstants.DECLARED_ELEMENTS_FROM_ALL_CONTEXTS, new[] { declaredElement });

            using (ReadLockCookie.Create())
            {
                if (!declaredElement.IsValid())
                {
                    return;
                }

                rules.AddRule("DocumentEditorContext", DocumentModelDataConstants.EDITOR_CONTEXT, new DocumentEditorContext(highlighting.Range));
                rules.AddRule("PopupWindowSourceOverride", UIDataConstants.PopupWindowContextSource,
                              new PopupWindowContextSource(lt => new RiderEditorOffsetPopupWindowContext(highlighting.Range.StartOffset.Offset)));

                rules.AddRule("DontNavigateImmediatelyToSingleUsage", NavigationSettings.DONT_NAVIGATE_IMMEDIATELY_TO_SINGLE_USAGE, new object());

                var ctx = myContexts.CreateWithDataRules(Lifetime.Eternal, rules);

                var def = myActionManager.Defs.GetActionDef <GoToUnityUsagesAction>();
                def.EvaluateAndExecute(myActionManager, ctx);
            }
        }
Beispiel #2
0
 public static IDataContext GetDataContextForSettingResultType(this SettingResetType settingResetType,
                                                               DataContexts dataContexts, Lifetime lifetime)
 {
     dataContexts.RegisterDataRule(lifetime, new DataRule <SettingResetType>(StandardDataRuleName, DataConstant, settingResetType));
     return(dataContexts.CreateWithDataRules(lifetime));
 }