当前位置: 首页>>代码示例>>C#>>正文


C# IDataContext.CheckAllNotNull方法代码示例

本文整理汇总了C#中IDataContext.CheckAllNotNull方法的典型用法代码示例。如果您正苦于以下问题:C# IDataContext.CheckAllNotNull方法的具体用法?C# IDataContext.CheckAllNotNull怎么用?C# IDataContext.CheckAllNotNull使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IDataContext的用法示例。


在下文中一共展示了IDataContext.CheckAllNotNull方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Execute

        /// <summary>
        /// Executes action. Called after Update, that set <c>ActionPresentation.Enabled</c> to true.
        /// </summary>
        /// <param name="solution">The solution.</param>
        /// <param name="context">The context.</param>
        protected override void Execute(ISolution solution, IDataContext context)
        {
            if (!context.CheckAllNotNull(DataConstants.SOLUTION)) {
                return;
            }

            ITextControl textControl = context.GetData(DataConstants.TEXT_CONTROL);
            if (textControl == null) {
                return;
            }

            IElement element = GetElementAtCaret(context);
            if (element == null) {
                return;
            }

            var enumDeclaration = element.ToTreeNode().Parent as IEnumDeclaration;
            if (enumDeclaration == null) {
                return;
            }

            using (ModificationCookie cookie = textControl.Document.EnsureWritable()) {
                if (cookie.EnsureWritableResult != EnsureWritableResult.SUCCESS) {
                    return;
                }

                using (CommandCookie.Create("Context Action Sort Enum By Name")) {
                    PsiManager.GetInstance(solution).DoTransaction(delegate { Execute(solution, enumDeclaration); });
                }
            }
        }
开发者ID:tcabanski,项目名称:SouthSideDevToys,代码行数:36,代码来源:SortEnumByNameActionHandler.cs

示例2: Update

    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));
    }
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:8,代码来源:ZenCodingActionBase.cs

示例3: Update

        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();
        }
开发者ID:derigel23,项目名称:resharper-zencoding,代码行数:10,代码来源:ZenCodingActionBase.cs

示例4: Update

        /// <summary>
        /// Updates the specified context.
        /// </summary>
        /// <param name="context">
        /// The context.
        /// </param>
        /// <returns>
        /// The update.
        /// </returns>
        protected override bool Update(IDataContext context)
        {
            if (!context.CheckAllNotNull(DataConstants.SOLUTION))
              {
            return false;
              }

              var element = GetElementAtCaret(context);
              if (element == null)
              {
            return false;
              }

              return IntroduceStringConstantRefactoring.IsAvailable(element);
        }
开发者ID:xerxesb,项目名称:agentjohnsonplugin,代码行数:24,代码来源:IntroduceStringConstantActionHandler.cs

示例5: Update

        /// <summary>
        /// Updates the specified context.
        /// </summary>
        /// <param name="context">The context.</param>
        /// <returns><c>true</c>, if updateable.</returns>
        protected override bool Update(IDataContext context)
        {
            if (!context.CheckAllNotNull(DataConstants.SOLUTION)) {
                return false;
            }

            IElement element = GetElementAtCaret(context);
            if (element == null) {
                return false;
            }

            var enumDeclaration = element.ToTreeNode().Parent as IEnumDeclaration;
            if (enumDeclaration == null) {
                return false;
            }

            return true;
        }
开发者ID:tcabanski,项目名称:SouthSideDevToys,代码行数:23,代码来源:SortEnumByNameActionHandler.cs

示例6: Execute

        /// <summary>
        /// Executes action. Called after Update, that set <c>ActionPresentation.Enabled</c> to <c>true</c>.
        /// </summary>
        /// <param name="solution">
        /// The solution.
        /// </param>
        /// <param name="context">
        /// The context.
        /// </param>
        protected override void Execute(ISolution solution, IDataContext context)
        {
            if (!context.CheckAllNotNull(DataConstants.SOLUTION))
              {
            return;
              }

              var element = GetElementAtCaret(context);
              if (element == null)
              {
            return;
              }

              Shell.Instance.Locks.AssertReadAccessAllowed();

              var textControl = context.GetData(DataConstants.TEXT_CONTROL);
              if (textControl == null)
              {
            return;
              }

              var selection = global::JetBrains.Util.TextRange.InvalidRange;

              using (var cookie = textControl.Document.EnsureWritable())
              {
            if (cookie.EnsureWritableResult != global::JetBrains.Util.EnsureWritableResult.SUCCESS)
            {
              return;
            }

            using (CommandCookie.Create("Context Action Duplicate Method"))
            {
              PsiManager.GetInstance(solution).DoTransaction(delegate { selection = Execute(element); });
            }
              }

              if (selection != global::JetBrains.Util.TextRange.InvalidRange)
              {
            textControl.Selection.SetRange(TextControlPosRange.FromDocRange(textControl, selection.StartOffset, selection.EndOffset));
              }
        }
开发者ID:xerxesb,项目名称:agentjohnsonplugin,代码行数:50,代码来源:DuplicateMethod.cs

示例7: Execute

        /// <summary>
        /// Executes action. Called after Update, that set <c>ActionPresentation</c>.Enabled to true.
        /// </summary>
        /// <param name="solution">
        /// The solution.
        /// </param>
        /// <param name="context">
        /// The context.
        /// </param>
        protected override void Execute(ISolution solution, IDataContext context)
        {
            if (!context.CheckAllNotNull(DataConstants.SOLUTION))
              {
            return;
              }

              var textControl = context.GetData(DataConstants.TEXT_CONTROL);
              if (textControl == null)
              {
            return;
              }

              var element = GetElementAtCaret(context);
              if (element == null)
              {
            return;
              }

              var classDeclaration = element.ToTreeNode().Parent as IClassDeclaration;
              if (classDeclaration == null)
              {
            return;
              }

              using (var cookie = textControl.Document.EnsureWritable())
              {
            if (cookie.EnsureWritableResult != global::JetBrains.Util.EnsureWritableResult.SUCCESS)
            {
              return;
            }

            using (CommandCookie.Create("Context Action Implement Proxy Class"))
            {
              PsiManager.GetInstance(solution).DoTransaction(delegate { Execute(classDeclaration); });
            }
              }
        }
开发者ID:xerxesb,项目名称:agentjohnsonplugin,代码行数:47,代码来源:ImplementProxyClassActionHandler.cs

示例8: Update

        /// <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);
        }
开发者ID:xerxesb,项目名称:agentjohnsonplugin,代码行数:17,代码来源:SmartGenerateContextAction.cs

示例9: Update

 /// <summary>
 /// Updates the specified context.
 /// </summary>
 /// <param name="context">The context.</param>
 /// <returns></returns>
 protected virtual bool Update(IDataContext context)
 {
     return context.CheckAllNotNull(DataConstants.SOLUTION);
 }
开发者ID:tcabanski,项目名称:SouthSideDevToys,代码行数:9,代码来源:ActionHandlerBase.cs

示例10: Update

 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     var checkAllNotNull = context.CheckAllNotNull(DataConstants.SOLUTION);
     return checkAllNotNull;
 }
开发者ID:citizenmatt,项目名称:ReSharper.FindUsagesOfSymbol,代码行数:5,代码来源:FindUsagesOfSymbolAction.cs

示例11: Update

 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
   // Check that we have a solution
   return context.CheckAllNotNull(ProjectModel.DataContext.DataConstants.SOLUTION);
 }
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:5,代码来源:FindTextAction.cs

示例12: Update

 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);
 }
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:6,代码来源:GistAction.cs

示例13: Update

 public override bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     return context.CheckAllNotNull(IDE.DataConstants.DOCUMENT_SELECTION) &&
     base.Update(context, presentation, nextUpdate);
 }
开发者ID:derigel23,项目名称:resharper-zencoding,代码行数:5,代码来源:ZenCodingWrapAction.cs

示例14: Update

 public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
 {
     return context.CheckAllNotNull(ProjectModelConstants.SOLUTION);
 }
开发者ID:hmemcpy,项目名称:ReSharper.LocateFileInSolutionExplorer,代码行数:4,代码来源:LocateFileAction.cs

示例15: Update

 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);
 }
开发者ID:e-llumin,项目名称:YouTrackForReSharper,代码行数:5,代码来源:YouTrackSearchAction.cs


注:本文中的IDataContext.CheckAllNotNull方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。