本文整理汇总了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); });
}
}
}
示例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));
}
示例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();
}
示例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);
}
示例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;
}
示例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));
}
}
示例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); });
}
}
}
示例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);
}
示例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);
}
示例10: Update
public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
{
var checkAllNotNull = context.CheckAllNotNull(DataConstants.SOLUTION);
return checkAllNotNull;
}
示例11: Update
public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
{
// Check that we have a solution
return context.CheckAllNotNull(ProjectModel.DataContext.DataConstants.SOLUTION);
}
示例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);
}
示例13: Update
public override bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
{
return context.CheckAllNotNull(IDE.DataConstants.DOCUMENT_SELECTION) &&
base.Update(context, presentation, nextUpdate);
}
示例14: Update
public bool Update(IDataContext context, ActionPresentation presentation, DelegateUpdate nextUpdate)
{
return context.CheckAllNotNull(ProjectModelConstants.SOLUTION);
}
示例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);
}