public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
    {
      // fetch active solution from context
      ISolution solution = context.GetData(ProjectModel.DataContext.DataConstants.SOLUTION);

      // enable this action if there is an active solution, disable otherwise
      return solution != null;
    }
Пример #2
0
        public override bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
        {
            string sessionId = GetSessionId(context);
            if (sessionId == null)
                return false;

            return SessionCache.HasSerializedReport(sessionId);
        }
    public virtual bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
    {
      // Check that we have a solution
      if (!context.CheckAllNotNull(ProjectModel.DataContext.DataConstants.SOLUTION, TextControl.DataContext.DataConstants.TEXT_CONTROL))
        return false;

      return IsSupportedFile(GetProjectFile(context));
    }
    bool IActionHandler.Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
    {
      // fetch focused text editor control
      ITextControl textControl = context.GetData(TextControl.DataContext.DataConstants.TEXT_CONTROL);

      // enable this action if we are in text editor, disable otherwise
      return textControl != null;
    }
        public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
        {
            var layers = context.GetData(DataConstants.SelectedUserFriendlySettingsLayers);
            if (layers == null || layers.IsEmpty())
                return false;

            // Action is disabled if *any* layers have reset blocked
            return layers.All(CanReset) && nextUpdate();
        }
        public virtual bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
        {
            // Check that we have a solution
              if (!context.CheckAllNotNull(IDE.DataConstants.SOLUTION, IDE.DataConstants.TEXT_CONTROL))
              {
            return nextUpdate();
              }

              return IsSupportedFile(GetProjectFile(context)) || nextUpdate();
        }
        public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
        {
            // this allows double [Shift+Alt+L] to work even when there is no project file context
            // available (for example, when 'References' project node is focused in Solution Explorer)
            // and builtin 'LocateInSolutionExplorer' action is not normally available
            lastUnderlyingActionUpdate = nextUpdate();

            // and it's better to do this:
            var locateFileAction = actionManager.TryGetAction(LocateFileAction.Id) as IUpdatableAction;
            return locateFileAction == null || locateFileAction.Update(context);
        }
Пример #8
0
        /// <summary>
        /// Updates action visual presentation. If presentation.Enabled is set to false, Execute
        ///             will not be called.
        /// </summary>
        /// <param name="context">DataContext</param><param name="presentation">presentation to update</param><param name="nextUpdate">delegate to call</param>
        public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
        {
            var solution = context.GetData(DataConstants.SOLUTION);
            bool visible = solution != null;

            if (!visible)
            {
                presentation.Visible = false;
            }

            return visible;
        }
Пример #9
0
      public bool Update(IDataContext dataContext, ActionPresentation presentation, DelegateUpdate nextUpdate)
      {
        var solution = dataContext.GetData(JetBrains.ProjectModel.DataContext.DataConstants.SOLUTION);
        if (solution == null)
          return nextUpdate();

        var textControl = dataContext.GetData(JetBrains.TextControl.DataContext.DataConstants.TEXT_CONTROL);
        if (textControl == null)
          return nextUpdate();

        var doc = dataContext.GetData(JetBrains.DocumentModel.DataConstants.DOCUMENT);
        if (doc == null)
          return nextUpdate();

        return true;
      }
        public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
        {
            // action is in context menu, so it is updated only once when menu is shown
              var solution = context.GetData(DataConstants.SOLUTION);
              var elements = context.GetData(UnitTestDataConstants.UNIT_TEST_ELEMENTS);
              if (solution == null || elements == null || elements.ExplicitElements.IsEmpty())
              {
            presentation.Visible = false;
            return false;
              }

              var element = elements.ExplicitElements.First();
              var result = solution.GetComponent<IUnitTestResultManager>().GetResult(element);

              // show correct action depending on test status
              switch (result.Status)
              {
            case UnitTestStatus.Success:
            case UnitTestStatus.Ignored:
              if (element.Explicit)
              {
            presentation.Text = "Unignore test";
            presentation.Visible = true;
              }
              else
            presentation.Visible = false;
              break;
            case UnitTestStatus.Failed:
            case UnitTestStatus.Aborted:
              if (!element.Explicit)
              {
            presentation.Text = "Ignore test";
            presentation.Visible = true;
              }
              else
            presentation.Visible = false;
              break;
            default:
              presentation.Visible = false;
              return false;
              }

              return true;
        }
Пример #11
0
        public override bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
        {
            var textControl = context.GetData(TextControlDataConstants.TEXT_CONTROL);

            if (textControl == null)
            {
                return(nextUpdate());
            }

            var solution = context.GetData(ProjectModelDataConstants.SOLUTION);

            if (solution == null)
            {
                return(nextUpdate());
            }

            if (ShouldFallback(textControl, context))
            {
                return(nextUpdate());
            }

            return(true);
        }
Пример #12
0
        private void UpdateComponentPresentation(ActionComponent component, IActionContext context,
                                                 ref ActionPresentation presentation, ref string[] resTypes, ref bool tabMatched)
        {
            presentation.ResetState();

            if (!CheckResourceTypes(component, context.SelectedResources, ref resTypes))
            {
                if (resTypes != null && resTypes.Length == 0)
                {
                    // we need to get tabMatched set correctly in this case
                    UpdateComponentFilters(component, context, ref presentation, ref tabMatched);
                }
                presentation.Visible = false;
                return;
            }

            UpdateComponentFilters(component, context, ref presentation, ref tabMatched);

            if (presentation.Visible)
            {
                component.Action.Update(context, ref presentation);
            }
        }
Пример #13
0
 /**
  * returns action flags for group of favorites (IAction.Update methods)
  */
 public static void IActionUpdateWeblinks(IActionContext context, ref ActionPresentation presentation)
 {
     if (context.SelectedResources == null || context.SelectedResources.Count == 0)
     {
         presentation.Visible = false;
     }
     else
     {
         for (int i = 0; i < context.SelectedResources.Count; ++i)
         {
             IResource res = context.SelectedResources[i];
             if (res.Type != "Weblink")
             {
                 res = res.GetLinkProp("Source");
             }
             if (res == null || res.Type != "Weblink" || res.GetStringProp("URL") == null)
             {
                 presentation.Visible = false;
                 break;
             }
         }
     }
 }
    /// <summary>Updates action visual presentation. If presentation.Enabled is set to false, Execute
    /// will not be called.</summary>
    /// <param name="context">The data context</param>
    /// <param name="presentation">presentation to update</param>
    /// <param name="nextUpdate">delegate to call</param>
    /// <returns>Returns <c>true</c>, if successful, otherwise <c>false</c>.</returns>
    public bool Update(IDataContext context, ActionPresentation presentation, [CanBeNull] DelegateUpdate nextUpdate)
    {
      if (context == null)
      {
        throw new ArgumentNullException("context");
      }

      if (presentation == null)
      {
        throw new ArgumentNullException("presentation");
      }

      if (!AtLeadInWhitespace(context))
      {
        if (nextUpdate != null)
        {
          return nextUpdate();
        }

        return false;
      }

      return true;
    }
Пример #15
0
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     return true;
 }
Пример #16
0
 public bool Update(IDataContext context, ActionPresentation presentation, [CanBeNull] DelegateUpdate nextUpdate)
 {
     return(DebuggingControlIni.GetModulePathsWithDebuggingControlIni(GetSelectedModulePaths()).Any());
 }
Пример #17
0
 public void Update(IActionContext context, ref ActionPresentation presentation)
 {
     presentation.Checked = ResourceClipboardForm.IsVisible();
 }
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     // action is in context menu, so it is updated only once when menu is shown
       var elements = context.GetData(UnitTestDataConstants.UNIT_TEST_ELEMENTS);
       return elements != null && elements.ExplicitElements.Any();
 }
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     // TODO: Make sure it's only visible/available in internal mode?
     return(true);
 }
Пример #20
0
 public void Update(IActionContext context, ref ActionPresentation presentation)
 {
     presentation.Checked = Core.UIManager.RightSidebarExpanded &&
                            Core.RightSidebar.IsPaneExpanded("ToDo");
 }
Пример #21
0
 public void Update(IActionContext context, ref ActionPresentation presentation)
 {
     presentation.Enabled = WorkspaceButtonsManager.GetInstance().CanActivateNextWorkspace();
 }
        /// <summary>
        /// Updates action visual presentation. If presentation.Enabled is set to <c>false</c>, Execute
        /// will not be called.
        /// </summary>
        /// <param name="context">The data context.</param>
        /// <param name="presentation">presentation to update</param>
        /// <param name="nextUpdate">delegate to call</param>
        /// <returns><c>true</c>, if successful.</returns>
        public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
        {
            if (!AtLeadInWhitespace(context))
              {
            return nextUpdate();
              }

              return context.CheckAllNotNull(JetBrains.IDE.DataConstants.SOLUTION);
        }
Пример #23
0
 public void Update(IActionContext context, ref ActionPresentation presentation)
 {
 }
Пример #24
0
 public override void Update(IActionContext context, ref ActionPresentation presentation)
 {
     InitializeEmailService();
     base.Update(context, ref presentation);
     presentation.Enabled = (_emailService != null);
 }
 public override bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     return context.CheckAllNotNull(IDE.DataConstants.DOCUMENT_SELECTION) &&
     base.Update(context, presentation, nextUpdate);
 }
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     return context.CheckAllNotNull(ProjectModelConstants.SOLUTION);
 }
        public bool Update(IDataContext context, ActionPresentation presentation, [CanBeNull] DelegateUpdate nextUpdate)
        {
            var selectedModulePaths = GetSelectedModulePathsWithOptimizedModules();

            return(DebuggingControlIni.GetModulePathsWithoutDebuggingControlIni(selectedModulePaths).Any());
        }
 /// <summary>
 /// Updates action visual presentation. If presentation.Enabled is set to false, Execute
 /// will not be called.
 /// </summary>
 /// <param name="context">The DataContext</param>
 /// <param name="presentation">presentation to update</param>
 /// <param name="nextUpdate">delegate to call</param>
 /// <returns>The update result.</returns>
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
   var solution = context.GetData(JetBrains.ProjectModel.DataContext.DataConstants.SOLUTION);
   return solution != null;
 }
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     // return true or false to enable/disable this action
       return true;
 }
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     return context.GetData<ISolution>(JetBrains.ProjectModel.DataContext.DataConstants.SOLUTION) != null;
 }
Пример #31
0
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     return(true);
 }
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     ISolution solution;
     return TryGetExistingAssemblyFile(context, out solution) != null;
 }
Пример #33
0
        public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
        {
            var solution = context.GetData(ProjectModelDataConstants.SOLUTION);

            return(solution != null);
        }
Пример #34
0
 ///<summary>
 ///
 ///            Updates action visual presentation. If presentation.Enabled is set to false, Execute
 ///            will not be called.
 ///            
 ///</summary>
 ///
 ///<param name="context">DataContext</param>
 ///<param name="presentation">presentation to update</param>
 ///<param name="nextUpdate">delegate to call</param>
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     return (new DeleteUnusedReferencesWorkflow()).IsAvailable(context);
 }
Пример #35
0
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     return
         (context.CheckAllNotNull(ProjectModel.DataContext.DataConstants.SOLUTION, ProjectModel.DataContext.DataConstants.PROJECT_MODEL_ELEMENTS) ||
          context.CheckAllNotNull(ProjectModel.DataContext.DataConstants.SOLUTION, DataConstants.DOCUMENT_SELECTION));
 }
Пример #36
0
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     // Check that we have a solution
     return(context.CheckAllNotNull(ProjectModel.DataContext.DataConstants.SOLUTION));
 }
        public bool Update(
            IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
        {
            var solution = context.GetData(ProjectModel.DataContext.DataConstants.SOLUTION);
              var isUpdate = (solution != null);

              presentation.Visible = isUpdate;

              return isUpdate;
        }
Пример #38
0
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
   return
     context.CheckAllNotNull(ProjectModel.DataContext.DataConstants.SOLUTION, ProjectModel.DataContext.DataConstants.PROJECT_MODEL_ELEMENTS) ||
     context.CheckAllNotNull(ProjectModel.DataContext.DataConstants.SOLUTION, DataConstants.DOCUMENT_SELECTION);
 }
Пример #39
0
 public void Update(IActionContext context, ref ActionPresentation presentation)
 {
     presentation.Visible = (context.Instance is ResourceClipboardForm) &&
                            (context.SelectedResources.Count > 0);
 }
Пример #40
0
 public void Update(IActionContext context, ref ActionPresentation presentation)
 {
     presentation.Visible = context.SelectedResources.AllResourcesOfType(_resourceType);
 }
Пример #41
0
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
   // Check that we have a solution
   return context.CheckAllNotNull(ProjectModel.DataContext.DataConstants.SOLUTION);
 }
Пример #42
0
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     throw new NotImplementedException();
 }
 /// <summary>
 /// Updates action visual presentation. If presentation.Enabled is set to false, Execute
 /// will not be called.
 /// </summary>
 /// <param name="context">DataContext</param>
 /// <param name="presentation">presentation to update</param>
 /// <param name="nextUpdate">delegate to call</param>
 bool IActionHandler.Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     return Update(context);
 }
Пример #44
0
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     // return true or false to enable/disable this action
     return(true);
 }
Пример #45
0
 public abstract bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate);
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     // It's always allowed. We don't need a solution present
     return context.CheckAllNotNull(JetBrains.ProjectModel.DataContext.DataConstants.SOLUTION);
 }
Пример #47
0
 public void Update(IActionContext context, ref ActionPresentation presentation)
 {
     presentation.Checked = (Core.WorkspaceManager.ActiveWorkspace == _workspace);
 }
Пример #48
0
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     return(context.GetData <ISolution>(JetBrains.ProjectModel.DataContext.DataConstants.SOLUTION) != null);
 }
Пример #49
0
        public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
        {
            // Better to check everything now and then work with valid data.

            ITextControl textControl = context.GetData(TextControlDataConstants.TEXT_CONTROL);

            if (textControl == null)
            {
                return(false);
            }

            if (textControl.IsReadOnly)
            {
                return(false);
            }

            if (textControl.Selection.IsDisjoint())
            {
                return(false);
            }

            IEquatableList <TextControlPosRange> equatableList = textControl.Selection.Ranges.Value;

            if (equatableList.Count > 1)
            {
                return(false);
            }

            ISolution solution = context.GetData(ProjectModelDataConstants.SOLUTION);

            if (solution == null)
            {
                return(false);
            }

            IPsiSourceFile psiSourceFile = textControl.Document.GetPsiSourceFile(solution);

            if (psiSourceFile == null)
            {
                return(false);
            }

            if (!psiSourceFile.IsValid())
            {
                return(false);
            }

            TextRange textRange =
                equatableList.Count == 1 ? equatableList[0].ToDocRangeNormalized() : new TextRange(textControl.Caret.Offset());
            DocumentRange range   = new DocumentRange(textControl.Document, textRange);
            ICSharpFile   psiFile = psiSourceFile.GetPsiFile <CSharpLanguage>(range) as ICSharpFile;

            if (psiFile == null)
            {
                return(false);
            }

            if (!psiFile.IsValid())
            {
                return(false);
            }

            if (context.GetData(UIDataConstants.PopupWindowContextSource) == null)
            {
                return(false);
            }

            return(true);
        }
Пример #50
0
 /// <summary>
 /// Action UI handler for the Submit toolbar button.
 /// </summary>
 private void OnUpdateSubmitAction(IActionContext context, ref ActionPresentation presentation)
 {
     presentation.Enabled = true;
 }
Пример #51
0
        public void Update(IActionContext context, ref ActionPresentation presentation)
        {
            IResourceList selected = context.SelectedResources;

            presentation.Visible = (selected.Count == 1) && (selected[0].Type == "Task");
        }
Пример #52
0
 bool IExecutableAction.Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 => true;
Пример #53
0
 public void Update(IActionContext context, ref ActionPresentation presentation)
 {
     presentation.Enabled = Core.RightSidebar.IsPaneExpanded("ToDo");
     presentation.Checked = Core.SettingStore.ReadBool("Tasks", "ShowCompletedTasks", true);
 }
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     var checkAllNotNull = context.CheckAllNotNull(DataConstants.SOLUTION);
     return checkAllNotNull;
 }
Пример #55
0
 public override void Update(IActionContext context, ref ActionPresentation presentation)
 {
     presentation.Visible = (OutlookSession.OutlookProcessor != null);
 }
            public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
            {
                var solution = context.GetData(ProjectModel.DataContext.DataConstants.SOLUTION);
                var textControl = context.GetData(TextControl.DataContext.DataConstants.TEXT_CONTROL);
                if (textControl != null && solution != null)
                {
                  var sourceFile = textControl.Document.GetPsiSourceFile(solution);
                  if (sourceFile != null)
                  {
                var template = GetTemplateFromTextControl(textControl, solution);
                if (template != null) return true;
                  }
                }

                return nextUpdate();
            }
Пример #57
0
 ///<summary>
 ///
 ///            Updates action visual presentation. If presentation.Enabled is set to false, Execute
 ///            will not be called.
 ///            
 ///</summary>
 ///
 ///<param name="context">DataContext</param>
 ///<param name="presentation">presentation to update</param>
 ///<param name="nextUpdate">delegate to call</param>
 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     IClass @class =
         context.GetData<IDeclaredElement>(JetBrains.ReSharper.DataConstants.DECLARED_ELEMENT) as IClass;
     return @class != null && ExistsSerializableAttribute(@class);
 }
Пример #58
0
 public void Update(IActionContext context, ref ActionPresentation presentation)
 {
     // type="MAPIFolder" restriction is put into plugin.xml
     presentation.Visible = (context.SelectedResources.Count == 1);
 }
Пример #59
0
 public abstract bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate);
Пример #60
0
 public void Update(IActionContext context, ref ActionPresentation presentation)
 {
     presentation.Visible = OutlookSession.OutlookProcessor.IsStarted && !OutlookSession.OutlookProcessor.IsSyncComplete();
 }