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


C# ISolution类代码示例

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


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

示例1: Execute

        public void Execute(ISolution solution, ITextControl textControl)
        {
            // TODO extract add attribute to another class
            // method name  IDeclaredParameter AddDeclaredParameter()

            if (missedParameterError.Descriptor.IsAttribute)
            {
                IDocument document = textControl.Document;
                using (ModificationCookie cookie = document.EnsureWritable())
                {
                    int navigationOffset = -1;

                    try
                    {
                        CommandProcessor.Instance.BeginCommand("TextControl:AddAttribute");
                        string toInsert = " " + this.missedParameterError.Descriptor.Name + "=\"\"";
                        document.InsertText(this.headerNameRange.TextRange.EndOffset, toInsert);
                        navigationOffset = (this.headerNameRange.TextRange.EndOffset + toInsert.Length) - 1;
                    }
                    finally
                    {
                        CommandProcessor.Instance.EndCommand();
                    }
                    if (navigationOffset != -1)
                    {
                        textControl.CaretModel.MoveTo(navigationOffset, TextControlScrollType.MAKE_VISIBLE);
                        // todo run Completion Action
                    }
                }
            }
            else
            {
                Assert.Fail();
            }
        }
开发者ID:willrawls,项目名称:arp,代码行数:35,代码来源:CreateMissedParameterFix.cs

示例2: WindowsFileImporter

 /// <summary>
 /// Creates a new instance of the <see cref="WindowsFileImporter"/> class.
 /// </summary>
 public WindowsFileImporter(ISolution solution, IUriReferenceService uriService, IProductElement currentElement, string targetPath)
 {
     this.solution = solution;
     this.uriService = uriService;
     this.currentElement = currentElement;
     this.targetPath = targetPath;
 }
开发者ID:NuPattern,项目名称:NuPattern,代码行数:10,代码来源:WindowsFileImporter.cs

示例3: ExecuteTransactionInner

        /// <summary>
        /// The execute transaction inner.
        /// </summary>
        /// <param name="solution">
        /// The solution.
        /// </param>
        /// <param name="textControl">
        /// The text control.
        /// </param>
        public override void ExecuteTransactionInner(ISolution solution, ITextControl textControl)
        {
            ITreeNode element = Utils.GetElementAtCaret(solution, textControl);
            IBlock containingBlock = element.GetContainingNode<IBlock>(true);

            if (containingBlock != null)
            {
                //// CSharpFormatterHelper.FormatterInstance.Format(containingBlock);
                ICSharpCodeFormatter codeFormatter = (ICSharpCodeFormatter)CSharpLanguage.Instance.LanguageService().CodeFormatter;
                codeFormatter.Format(containingBlock);

                new LayoutRules().CurlyBracketsForMultiLineStatementsMustNotShareLine(containingBlock);
            }
            else
            {
                IFieldDeclaration fieldDeclarationNode = element.GetContainingNode<IFieldDeclaration>(true);
                if (fieldDeclarationNode != null)
                {
                    //// CSharpFormatterHelper.FormatterInstance.Format(fieldDeclarationNode);
                    ICSharpCodeFormatter codeFormatter = (ICSharpCodeFormatter)CSharpLanguage.Instance.LanguageService().CodeFormatter;
                    codeFormatter.Format(fieldDeclarationNode);

                    new LayoutRules().CurlyBracketsForMultiLineStatementsMustNotShareLine(fieldDeclarationNode);
                }
            }
        }
开发者ID:transformersprimeabcxyz,项目名称:_TO-FIRST-stylecop,代码行数:35,代码来源:SA1500CurlyBracketsForMultiLineStatementsMustNotShareLineBulbItem.cs

示例4: Initialize

            public void Initialize()
            {
                this.solutionEvents = new SolutionEvents(VsIdeTestHostContext.ServiceProvider);

                this.solution = VsIdeTestHostContext.ServiceProvider.GetService<ISolution>();
                this.solution.CreateInstance(Path.GetTempPath(), Path.GetFileName(Path.GetRandomFileName()));
            }
开发者ID:NuPattern,项目名称:NuPattern,代码行数:7,代码来源:SolutionEventsSpec.cs

示例5: Generate

		public override async Task<IProject> Generate(ISolution solution, string name)
		{
			var shell = IoC.Get<IShell>();
			var project = await base.Generate(solution, name);

			project.ToolChain = shell.ToolChains.FirstOrDefault(tc => tc is LocalGCCToolchain);

            project.ToolChain.ProvisionSettings(project);

			project.Debugger = shell.Debuggers.FirstOrDefault(db => db is LocalDebugAdaptor);

			var code = new StringBuilder();

			code.AppendLine("#include <stdio.h>");
			code.AppendLine();
			code.AppendLine("int main (void)");
			code.AppendLine("{");
			code.AppendLine("    printf(\"Hello World\");");
			code.AppendLine("    return 0;");
			code.AppendLine("}");
			code.AppendLine();

			await SourceFile.Create(project, "main.cpp", code.ToString());

			project.Save();

			return project;
		}
开发者ID:VitalElement,项目名称:AvalonStudio,代码行数:28,代码来源:ConsoleAppProjectTemplate.cs

示例6: 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

示例7: SolutionPackageRepository

		public SolutionPackageRepository(ISolution solution)
			: this(
				solution,
				new SharpDevelopPackageRepositoryFactory(),
				PackageManagementServices.Options)
		{
		}
开发者ID:AdamLStevenson,项目名称:SharpDevelop,代码行数:7,代码来源:SolutionPackageRepository.cs

示例8: FindMonitoredSolution

		MonitoredSolution FindMonitoredSolution (ISolution solutionToMatch)
		{
			if (monitoredSolutions.Count == 1)
				return monitoredSolutions [0];

			return monitoredSolutions.FirstOrDefault (monitoredSolution => monitoredSolution.Solution.FileName == solutionToMatch.FileName);
		}
开发者ID:lkalif,项目名称:monodevelop,代码行数:7,代码来源:ProjectTargetFrameworkMonitor.cs

示例9: ExecuteTransactionInner

        /// <summary>
        /// The execute transaction inner.
        /// </summary>
        /// <param name="solution">
        /// The solution.
        /// </param>
        /// <param name="textControl">
        /// The text control.
        /// </param>
        public override void ExecuteTransactionInner(ISolution solution, ITextControl textControl)
        {
            ICSharpFile file = Utils.GetCSharpFile(solution, textControl);

            IRangeMarker marker = this.DocumentRange.CreateRangeMarker();
            file.ArrangeThisQualifier(marker);
        }
开发者ID:transformersprimeabcxyz,项目名称:_TO-FIRST-stylecop,代码行数:16,代码来源:PrefixLocalCallsWithThis.cs

示例10: ReadFromXml

    public static IUnitTestElement ReadFromXml(XmlElement parent, IUnitTestElement parentElement, MSpecUnitTestProvider provider, ISolution solution
#if RESHARPER_61
      , IUnitTestElementManager manager, PsiModuleManager psiModuleManager, CacheManager cacheManager
#endif
      )
    {
      var projectId = parent.GetAttribute("projectId");
      var project = ProjectUtil.FindProjectElementByPersistentID(solution, projectId) as IProject;
      if (project == null)
      {
        return null;
      }

      var behavior = parentElement as BehaviorElement;
      if (behavior == null)
      {
        return null;
      }

      var typeName = parent.GetAttribute("typeName");
      var methodName = parent.GetAttribute("methodName");
      var isIgnored = bool.Parse(parent.GetAttribute("isIgnored"));

      return BehaviorSpecificationFactory.GetOrCreateBehaviorSpecification(provider,
#if RESHARPER_61
        manager, psiModuleManager, cacheManager,
#endif
        project, behavior, ProjectModelElementEnvoy.Create(project), typeName, methodName, isIgnored);
    }
开发者ID:rho24,项目名称:machine.specifications,代码行数:29,代码来源:BehaviorSpecificationElement.cs

示例11: 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 code = model.Method.GetText();
      if (string.IsNullOrEmpty(code))
      {
        return null;
      }

      var typeMember = this.provider.ElementFactory.CreateTypeMemberDeclaration(code);

      var classDeclaration = model.ContainingType as IClassLikeDeclaration;
      if (classDeclaration == null)
      {
        return null;
      }

      var memberDeclaration = typeMember as IClassMemberDeclaration;
      Debug.Assert(memberDeclaration != null, "memberDeclaration != null");

      var result = classDeclaration.AddClassMemberDeclarationBefore(memberDeclaration, model.Method);

      FormattingUtils.Format(result);

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

示例12: LoadChanges

        /// <summary>
        /// Loads the specified solution.
        /// </summary>
        /// <param name="solution">
        /// The solution.
        /// </param>
        public void LoadChanges(ISolution solution)
        {
            this.solution = solution;

              var locations = RecentFilesManager.GetInstance(solution).EditLocations;

              var count = 0;
              foreach (var locationInfo in locations)
              {
            var projectFile = locationInfo.ProjectFile;
            var project = projectFile.GetProject();

            var solutionName = project.GetSolution().Name;
            var fileName = projectFile.Location.ConvertToRelativePath(project.Location).FullPath;

            int line;
            int position;
            int selectionStart;
            int selectionLength;

            if (EditorManager.GetInstance(solution).IsOpenedInTextControl(projectFile))
            {
              var textControl = EditorManager.GetInstance(solution).TryGetTextControl(projectFile);
              if (textControl == null)
              {
            return;
              }

              var documentText = textControl.Document.GetText();

              ReadText(new StringReader(documentText), locationInfo.CaretOffset, out line, out position, out selectionStart, out selectionLength);
            }
            else
            {
              ReadFile(projectFile, locationInfo.CaretOffset, out line, out position, out selectionStart, out selectionLength);
            }

            var labelText = "<" + solutionName + ">\\" + fileName + " (Ln " + line + ", Col " + position + ")";

            var l = new Selection
            {
              Text = labelText,
              SelectionStart = selectionStart,
              SelectionLength = selectionLength,
            };

            this.Listbox.Items.Add(l);

            count++;
            if (count >= 25)
            {
              break;
            }
              }

              if (this.Listbox.Items.Count > 0)
              {
            this.Listbox.SelectedIndex = 0;
              }
        }
开发者ID:xerxesb,项目名称:agentjohnsonplugin,代码行数:66,代码来源:RecentChanges.cs

示例13: 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

示例14: ExecutePsiTransaction

 protected override Action<ITextControl> ExecutePsiTransaction(ISolution solution, IProgressIndicator progress)
 {
     var methodDeclaration = _highlighting.MethodDeclaration;
     methodDeclaration.SetExtern(true);
     methodDeclaration.SetStatic(true);
     return null;
 }
开发者ID:vcsjones,项目名称:ResharperInteropHelpers,代码行数:7,代码来源:ImportedMethodIsNotExternOrStaticQuickFix.cs

示例15: SolutionPackageRepositoryPath

		public SolutionPackageRepositoryPath (
			ISolution solution,
			PackageManagementOptions options)
		{
			this.solution = solution;
			PackageRepositoryPath = GetSolutionPackageRepositoryPath (options);
		}
开发者ID:brantwedel,项目名称:monodevelop,代码行数:7,代码来源:SolutionPackageRepositoryPath.cs


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