本文整理汇总了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();
}
}
示例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;
}
示例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()));
}
示例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;
}
示例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;
}
示例7: SolutionPackageRepository
public SolutionPackageRepository(ISolution solution)
: this(
solution,
new SharpDevelopPackageRepositoryFactory(),
PackageManagementServices.Options)
{
}
示例8: FindMonitoredSolution
MonitoredSolution FindMonitoredSolution (ISolution solutionToMatch)
{
if (monitoredSolutions.Count == 1)
return monitoredSolutions [0];
return monitoredSolutions.FirstOrDefault (monitoredSolution => monitoredSolution.Solution.FileName == solutionToMatch.FileName);
}
示例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);
}
示例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);
}
示例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;
}
示例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;
}
}
示例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); });
}
}
}
示例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);
}