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


C# IProgressIndicator类代码示例

本文整理汇总了C#中IProgressIndicator的典型用法代码示例。如果您正苦于以下问题:C# IProgressIndicator类的具体用法?C# IProgressIndicator怎么用?C# IProgressIndicator使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: ExecutePsiTransaction

        protected override Action<ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress)
        {
            var factory = CSharpElementFactory.GetInstance(_statement);

            var valueType = GuessValueType(_dictionary) ?? "var";

            var valueVariableName = SuggestVariableName(_statement, "value");
            var valueReference = factory.CreateReferenceExpression(valueVariableName);
            var valueDeclaration = factory.CreateStatement("$0 $1;", valueType, valueVariableName);
            var newCondition = factory.CreateExpression("$0.TryGetValue($1, out $2)", _dictionary, _key, valueReference);

            using (_statement.CreateWriteLock())
            {
                _dictionaryAccess.Where(x => x.IsValid()).ForEach(e => ModificationUtil.ReplaceChild(e, valueReference));
                ModificationUtil.ReplaceChild(_matchedElement, newCondition);
                if (_statement.Parent is IBlock)
                {
                    ModificationUtil.AddChildBefore(_statement, valueDeclaration);
                }
                else
                {
                    _statement.ReplaceBy(factory.CreateBlock("{$0$1}", valueDeclaration, _statement));
                }
            }

            return null;
        }
开发者ID:hazzik,项目名称:ReSharper.DictionaryHelper,代码行数:27,代码来源:DictionaryContainsKeyFix.cs

示例2: ExecutePsiTransaction

        /// <summary>
        /// Executes QuickFix or ContextAction. Returns post-execute method.
        /// </summary>
        /// <returns>
        /// Action to execute after document and PSI transaction finish. Use to open TextControls, navigate caret, etc.
        /// </returns>
        protected override Action<ITextControl> ExecutePsiTransaction(ISolution solution,
                                                        IProgressIndicator progress)
        {
            this.highlighting.PropertyDeclaration.AccessorDeclarations.First(o => o.Kind == AccessorKind.SETTER).SetAccessRights(AccessRights.PRIVATE);

            return null;
        }
开发者ID:Testeroids,项目名称:Testeroids.ReSharper.Plugins,代码行数:13,代码来源:MakePropertySetterPrivateQuickFix.cs

示例3: ExecutePsiTransaction

 protected override Action<ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress)
 {
     var factory = CSharpElementFactory.GetInstance(_literalExpression);
     var newExpr = factory.CreateExpressionAsIs(_replacement);
     _literalExpression.ReplaceBy(newExpr);
     return null;
 }
开发者ID:hazzik,项目名称:ReSharper.StringFormat,代码行数:7,代码来源:SpliceStringFix.cs

示例4: ExecutePsiTransaction

    protected override Action<ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress)
    {
      var block = myProvider.GetSelectedElement<IBlock>().NotNull();
      var statements = block.GetStatementsRange(myProvider.SelectedTreeRange).Statements;

      var invocation = ExtractInvocation(statements[0]).NotNull();

      for (int i = 1; i < statements.Count - 1; i++)
      {
        var nextInvocation = ExtractInvocation(statements[i]).NotNull();
        invocation = MergeInvocations(invocation, nextInvocation);
      }

      var lastDeclaredVariable = ExtractDeclaredVariableName(statements[statements.Count - 2]);
      var lastInvocationUse =
        FindLastInvocationUse(statements[statements.Count - 1], lastDeclaredVariable.Name).NotNull();
      var lastInvocation = lastInvocationUse.GetContainingNode<IInvocationExpression>().NotNull();

      MergeInvocations(invocation, lastInvocation);

      for (int i = 0; i < statements.Count - 1; i++)
      {
        block.RemoveStatement((ICSharpStatement) statements[i]);
      }

      var lastStatementCoords = DocumentHelper.GetPositionAfterStatement(statements[statements.Count - 1], myProvider.Document);

      return textControl =>
      {
        textControl.Selection.RemoveSelection(false);
        textControl.Caret.MoveTo(lastStatementCoords, CaretVisualPlacement.DontScrollIfVisible);
      };
    }
开发者ID:akarpov89,项目名称:resharper-banana-split,代码行数:33,代码来源:InlineCallsContextAction.cs

示例5: ExecutePsiTransaction

        protected sealed override Action<ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress)
        {
            Debug.Assert(attributesOwnerDeclaration != null);
            Debug.Assert(createAttributeFactory != null);

            try
            {
                using (WriteLockCookie.Create())
                {
                    var factory = CSharpElementFactory.GetInstance(provider.PsiModule);

                    var attribute = createAttributeFactory(factory);

                    Debug.Assert(attribute != null);

                    attributesOwnerDeclaration.AddAttributeAfter(attribute, attributeToRemove);
                    if (attributeToRemove != null)
                    {
                        attributesOwnerDeclaration.RemoveAttribute(attributeToRemove);
                    }

                    ContextActionUtils.FormatWithDefaultProfile(attribute);
                }

                return _ => { };
            }
            finally
            {
                attributeToRemove = null;
                createAttributeFactory = null;
                attributesOwnerDeclaration = null;
            }
        }
开发者ID:prodot,项目名称:ReCommended-Extension,代码行数:33,代码来源:AnnotateWith.cs

示例6: StringExtractor

 public StringExtractor(string text, IProgressIndicator progressIndicator)
     : base(progressIndicator)
 {
     m_Text = text;
     ProgressIndicator = progressIndicator;
     ProgressIndicator.Maximum = m_Text.Length;
 }
开发者ID:desautel,项目名称:Sdl-Community,代码行数:7,代码来源:StringExtractor.cs

示例7: Process

    public void Process(IPsiSourceFile sourceFile, IRangeMarker rangeMarker, CodeCleanupProfile profile, IProgressIndicator progressIndicator)
    {
      var file = sourceFile.GetNonInjectedPsiFile<CSharpLanguage>();
      if (file == null)
        return;

      if (!profile.GetSetting(DescriptorInstance))
        return;

      CSharpElementFactory elementFactory = CSharpElementFactory.GetInstance(sourceFile.PsiModule);
      
      file.GetPsiServices().PsiManager.DoTransaction(
        () =>
          {
            using (_shellLocks.UsingWriteLock())
              file.ProcessChildren<IExpression>(
                expression =>
                  {
                    ConstantValue value = expression.ConstantValue;
                    if (value.IsInteger() && Convert.ToInt32(value.Value) == int.MaxValue)
                      ModificationUtil.ReplaceChild(expression, elementFactory.CreateExpression("int.MaxValue"));
                  }
                );
          },
        "Code cleanup");
    }
开发者ID:Adam-Fogle,项目名称:agentralphplugin,代码行数:26,代码来源:UseIntConstantsInsteadOfLiterals.cs

示例8: ExecutePsiTransaction

        protected override Action<ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress)
        {
            if (_invocationExpression.ArgumentList.Arguments.Count == 4)
            {
                _invocationExpression.RemoveArgument(_invocationExpression.ArgumentList.Arguments[3]);
                var argument = Provider.ElementFactory.CreateArgument(ParameterKind.VALUE, Provider.ElementFactory.CreateExpression("false"));
                _invocationExpression.AddArgumentAfter(argument, _invocationExpression.ArgumentList.Arguments[2]);
            }
            else
            {
                if (_invocationExpression.ArgumentList.Arguments.Count == 1)
                {
                    var argument = Provider.ElementFactory.CreateArgument(ParameterKind.VALUE, Provider.ElementFactory.CreateExpression("default($0)", PropertyDeclaration.Type));
                    _invocationExpression.AddArgumentAfter(argument, _invocationExpression.ArgumentList.Arguments[0]);
                }

                if (_invocationExpression.ArgumentList.Arguments.Count == 2)
                {
                    var argument = Provider.ElementFactory.CreateArgument(ParameterKind.VALUE, Provider.ElementFactory.CreateExpression("null"));
                    _invocationExpression.AddArgumentAfter(argument, _invocationExpression.ArgumentList.Arguments[1]);
                }

                if (_invocationExpression.ArgumentList.Arguments.Count == 3)
                {
                    var argument = Provider.ElementFactory.CreateArgument(ParameterKind.VALUE, Provider.ElementFactory.CreateExpression("false"));
                    _invocationExpression.AddArgumentAfter(argument, _invocationExpression.ArgumentList.Arguments[2]);
                }
            }

            return null;
        }
开发者ID:Catel,项目名称:Catel.ReSharper,代码行数:31,代码来源:ExcludePropertyFromSerializationContextAction.cs

示例9: ExecutePsiTransaction

    /// <summary>
    /// Executes QuickFix or ContextAction. Returns post-execute method.
    /// </summary>
    /// <param name="solution">The solution.</param>
    /// <param name="progress">The progress.</param>
    /// <returns>Action to execute after document and PSI transaction finish. Use to open TextControls, navigate caret, etc.</returns>
    protected override Action<ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress)
    {
      var model = this.GetModel();
      if (model == null)
      {
        return null;
      }

      var function = model.Method;
      if (function != null)
      {
        function.SetAbstract(true);
        function.SetVirtual(false);
        function.SetBody(null);
      }

      var property = model.Property;
      if (property != null)
      {
        property.SetAbstract(true);
        property.SetVirtual(false);

        foreach (var accessor in property.AccessorDeclarations)
        {
          accessor.SetBody(null);
        }
      }

      model.Class.SetAbstract(true);

      return null;
    }
开发者ID:dbremner,项目名称:Resharper.UtilityPack,代码行数:38,代码来源:MakeAbstract.cs

示例10: ConvertMethods

        private bool ConvertMethods(IProgressIndicator pi)
        {
            if (base.NewMembers == null) return false;

            const int totalWorkUnits = 3;
            pi.Start(totalWorkUnits);

            var myWorkflow = Workflow as SharedToExtensionWorkflow;
            if (myWorkflow != null)
                Methods = base.NewMembers.OfType<IMethod>().ToList();

            using (var progressIndicator = pi.CreateSubProgress(1.0))
                FindUsages(progressIndicator);

            var isSharedToExtension = (this.Direction == SharedToExtensionWorkflow.WorkflowDirection.SharedToExtension);

            this.Methods.ForEachWithProgress(pi.CreateSubProgress(1.0), "",
                method => {
                    this.Constructors[method.PresentationLanguage].MakeFirstPrameterThis(method, isSharedToExtension, this.Driver);
                    method.GetPsiServices().Caches.Update();
                });

            if (isSharedToExtension)
                using (var progressIndicator = pi.CreateSubProgress(1.0))
                    MakeCallExtension(progressIndicator);
            else
                using (var progressIndicator = pi.CreateSubProgress(1.0))
                    MakeCallShared(progressIndicator);

            return true;
        }
开发者ID:ThatShawGuy,项目名称:VBSharper,代码行数:31,代码来源:SharedToExtensionRefactoring.cs

示例11: ExecutePsiTransaction

 /// <summary>
 /// Executes QuickFix or ContextAction. Returns post-execute method.
 /// </summary>
 /// <returns>
 /// Action to execute after document and PSI transaction finish. Use to open TextControls, navigate caret, etc.
 /// </returns>
 protected override Action<ITextControl> ExecutePsiTransaction(ISolution solution,
                                                 IProgressIndicator progress)
 {
     var declaration = this.highlight.GetEstablishmentMethodDeclaration();
     declaration.SetSealed(true);      
     return null;
 }
开发者ID:Testeroids,项目名称:Testeroids.ReSharper.Plugins,代码行数:13,代码来源:EnforceSealedEstablismentMethodsQuickFix.cs

示例12: ExecutePsiTransaction

        protected override Action<ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress)
        {
            var exceptionDeclaration = 
                (IClassDeclaration)_highlighting.ExceptionClass.GetDeclarations().FirstOrDefault();
            Contract.Assert(exceptionDeclaration != null);                

            using (var workflow = GeneratorWorkflowFactory.CreateWorkflowWithoutTextControl(
                GeneratorStandardKinds.Constructor,
                exceptionDeclaration,
                exceptionDeclaration))
            {
                Contract.Assert(workflow != null);

                var ctors = workflow.Context.ProvidedElements
                    .OfType<GeneratorDeclaredElement<IConstructor>>()
                    .Where(ge => _missedConstructorPredicate(ge.DeclaredElement))
                    .ToList();

                Contract.Assert(ctors.Count != 0);

                workflow.Context.InputElements.Clear();
                workflow.Context.InputElements.AddRange(ctors);
                workflow.BuildOptions();
                workflow.Generate("Generate missing constructor", NullProgressIndicator.Instance);
            }

            return null;
        }
开发者ID:breki,项目名称:ReSharperContractExtensions,代码行数:28,代码来源:RequiresExceptionValidityQuickFix.cs

示例13: ExecutePsiTransaction

        protected override Action<ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress)
        {
            if (_highlighting.ObjectCreationExpression.Initializer != null)
            {
                return textControl =>
                       JetBrains.UI.Application.ShellComponentsEx.Tooltips(Shell.Instance.Components)
                                .Show("Not supported for object initializers", l => (IPopupWindowContext)new TextControlPopupWindowContext(l, textControl, Shell.Instance.GetComponent<IShellLocks>(), Shell.Instance.GetComponent<IActionManager>()));
            }

            var psiModule = _highlighting.ObjectCreationExpression.GetPsiModule();
            var factory = CSharpElementFactory.GetInstance(psiModule);

            var activatorType = TypeFactory.CreateTypeByCLRName("System.Activator", psiModule);
            var typeType = TypeFactory.CreateTypeByCLRName("System.Type", psiModule);
            var intefaceType = TypeFactory.CreateTypeByCLRName(_highlighting.InterfaceTypeName, psiModule);

            var statement = factory.CreateExpression("($3)$0.CreateInstance($1.GetTypeFromCLSID(typeof($2).GUID))",
                                                     activatorType.GetTypeElement(),
                                                     typeType.GetTypeElement(),
                                                     _highlighting.CoClassTypeElement,
                                                     intefaceType
                );

            var containingDeclarationStatement = _highlighting.ObjectCreationExpression.GetContainingStatement() as IDeclarationStatement;
            if (containingDeclarationStatement != null && containingDeclarationStatement.Declaration.Declarators.Count == 1)
            {
                containingDeclarationStatement.Declaration.Declarators[0].SetTypeOrVar(intefaceType);
            }

            _highlighting.ObjectCreationExpression.ReplaceBy(statement);

            return null;
        }
开发者ID:petr-k,项目名称:ArcSharper,代码行数:33,代码来源:DangerousAoSingletonInstantiationQuickFix.cs

示例14: PostExecute

        public override bool PostExecute(IProgressIndicator pi)
        {
            try
            {
                if (!base.PostExecute(pi)) return false;

                RunnerFileWatcher.Path = Solution.SolutionFilePath.Directory.FullPath;

                RunnerFileWatcher.OnFileChange(f =>
                    ObjectFactory.NewRenameStep
                    (
                        f.FeatureFileFromRunner(),
                        InitialName,
                        InitialStageExecuter.NewName
                    )
                    .Execute());

            }
            catch (Exception e)
            {
                MessageBox.ShowInfo(e.ToString());
            }

            return true;
        }
开发者ID:rossbeehler,项目名称:raconteur,代码行数:25,代码来源:RenameStepWorkflow.cs

示例15: ExecutePsiTransaction

        protected override Action<ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress)
        {
            ITypeDeclaration typeDeclaration = GetTargetTypeDeclaration(_highlighting.DeclaredTypeUsage);
            if (typeDeclaration == null)
                return null;

            MemberSignature signature = CreateTransformTextSignature(typeDeclaration);
            TypeTarget target = CreateTarget(typeDeclaration);

            var context = new CreateMethodDeclarationContext {
                AccessRights = AccessRights.PUBLIC,
                ExecuteTemplateOverMemberBody = false,
                ExecuteTemplateOverName = false,
                ExecuteTemplateOverParameters = false,
                ExecuteTemplateOverReturnType = false,
                IsAbstract = true,
                IsStatic = false,
                MethodSignatures = new[] { signature },
                MethodName = T4CSharpCodeGenerator.TransformTextMethodName,
                SourceReferenceExpressionReference = null,
                Target = target,
            };

            IntentionResult intentionResult = MethodDeclarationBuilder.Create(context);
            intentionResult.ExecuteTemplate();
            return null;
        }
开发者ID:ThatShawGuy,项目名称:ForTea,代码行数:27,代码来源:CreateTransformTextMethodQuickFix.cs


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