示例#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);
            }
        }
示例#2
0
 public void OnExtraActionClick(CodeInsightsHighlighting highlighting, string actionId)
 {
     if (actionId.Equals(StartUnityActionId))
     {
         myHost.PerformModelAction(model => model.StartUnity.Fire(RdVoid.Instance));
     }
 }
 public void OnExtraActionClick(CodeInsightsHighlighting highlighting, string actionId, ISolution solution)
 {
     if (actionId.Equals(StartUnityActionId))
     {
         myHost.PerformModelAction(model => model.StartUnity());
     }
 }
 public void OnExtraActionClick(CodeInsightsHighlighting highlighting, string actionId, ISolution solution)
 {
     if (actionId.Equals(StartUnityActionId))
     {
         myFrontendBackendHost.Do(model => model.StartUnity());
     }
 }
示例#5
0
 public void OnClick(CodeInsightsHighlighting highlighting, ISolution solution)
 {
     ShowIndicators = !ShowIndicators;
     using (WriteLockCookie.Create())
     {
         var sourceFile = highlighting.Range.Document.GetPsiSourceFile(solution);
         _services.MarkAsDirty(sourceFile.ToProjectFile());
     }
 }
        public virtual void OnClick(CodeInsightsHighlighting highlighting, ISolution solution)
        {
            var windowContextSource = new PopupWindowContextSource(lt => new RiderEditorOffsetPopupWindowContext(highlighting.Range.StartOffset.Offset));

            if (highlighting is UnityCodeInsightsHighlighting unityCodeInsightsHighlighting)
            {
                if (unityCodeInsightsHighlighting.MenuItems.Count > 0)
                {
                    myBulbMenu.ShowBulbMenu(unityCodeInsightsHighlighting.MenuItems, windowContextSource);
                }
            }
        }
        public void OnClick(CodeInsightsHighlighting highlighting, ISolution solution)
        {
            var windowContextSource = new PopupWindowContextSource(
                lt => new HostTextControlPopupWindowContext(lt,
                                                            highlighting.DeclaredElement.GetSolution().GetComponent <TextControlManager>().LastFocusedTextControl
                                                            .Value).MarkAsOriginatedFromDataContext());

            if (highlighting is UnityCodeInsightsHighlighting unityCodeInsightsHighlighting)
            {
                if (unityCodeInsightsHighlighting.MenuItems.Count > 0)
                {
                    myBulbMenu.ShowBulbMenu(unityCodeInsightsHighlighting.MenuItems, windowContextSource);
                }
            }
        }
示例#8
0
 public void OnExtraActionClick(CodeInsightsHighlighting highlighting, string actionId, ISolution solution)
 {
 }
 public void OnClick(CodeInsightsHighlighting highlighting, ISolution solution)
 {
 }
示例#10
0
        public override void OnClick(CodeInsightsHighlighting highlighting, ISolution solution)
        {
            if (highlighting is UnityInspectorCodeInsightsHighlighting unityInspectorCodeInsightsHighlighting)
            {
                Shell.Instance.GetComponent <JetPopupMenus>().Show(solution.GetLifetime(),
                                                                   JetPopupMenu.ShowWhen.NoItemsBannerIfNoItems, (lifetime, menu) =>
                {
                    var presentationType = unityInspectorCodeInsightsHighlighting.UnityPresentationType;
                    var initValue        = unityInspectorCodeInsightsHighlighting.ConstantValue;
                    var declaredElement  = (highlighting.DeclaredElement as IClrDeclaredElement).NotNull("declaredElement != null");

                    if (!declaredElement.IsValid())
                    {
                        return;
                    }

                    var result = GetAssetGuidAndPropertyName(solution, declaredElement);
                    if (!result.HasValue)
                    {
                        return;
                    }


                    var valuesCache = solution.GetComponent <UnitySceneDataLocalCache>();
                    var values      = valuesCache.GetPropertyValues(result.Value.guid, result.Value.propertyName);

                    menu.Caption.Value = WindowlessControlAutomation.Create("Inspector values");
                    menu.KeyboardAcceleration.Value = KeyboardAccelerationFlags.QuickSearch;

                    var valuesToShow = values.Where(t => !IsSameWithInitializer(t.Value, presentationType, initValue)).Take(POP_UP_MAX_COUNT);
                    foreach (var valueWithLocation in valuesToShow)
                    {
                        var value = valueWithLocation.Value;
                        if (ShouldShowUnknownPresentation(presentationType))
                        {
                            menu.ItemKeys.Add(valueWithLocation);
                        }
                        else
                        {
                            menu.ItemKeys.Add(valueWithLocation);
                        }
                    }

                    menu.DescribeItem.Advise(lifetime, e =>
                    {
                        var value = (e.Key as MonoBehaviourPropertyValueWithLocation).NotNull("value != null");

                        string shortPresentation;
                        if (ShouldShowUnknownPresentation(presentationType))
                        {
                            shortPresentation = "...";
                        }
                        else
                        {
                            if (!declaredElement.IsValid())
                            {
                                return;
                            }

                            using (CompilationContextCookie.GetExplicitUniversalContextIfNotSet())
                            {
                                var type          = declaredElement.Type();
                                shortPresentation = GetPresentation(value, presentationType, type, solution,
                                                                    declaredElement.Module, true);
                            }
                        }

                        e.Descriptor.Text = shortPresentation;
                        OccurrencePresentationUtil.AppendRelatedFile(e.Descriptor, value.File.DisplayName.Replace("\\", "/"));

                        e.Descriptor.Icon  = UnityFileTypeThemedIcons.FileUnity.Id;
                        e.Descriptor.Style = MenuItemStyle.Enabled;
                    });

                    menu.ItemClicked.Advise(lifetime, key =>
                    {
                        if (!myConnectionTracker.IsConnectionEstablished())
                        {
                            ShowNotification();
                            return;
                        }

                        var value = (key as MonoBehaviourPropertyValueWithLocation).NotNull("value != null");

                        UnityEditorFindUsageResultCreator.CreateRequestAndShow(myUnityHost, solution.SolutionDirectory, myUnitySceneDataLocalCache,
                                                                               value.Value.MonoBehaviour, value.File);
                    });
                });
            }
        }
示例#11
0
 public void OnClick(CodeInsightsHighlighting highlighting)
 {
 }