6 changed files with 81 additions and 10 deletions
@ -0,0 +1,27 @@
@@ -0,0 +1,27 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.SharpDevelop; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
using ICSharpCode.SharpDevelop.Editor; |
||||
using ICSharpCode.SharpDevelop.Gui; |
||||
using ICSharpCode.SharpDevelop.Refactoring; |
||||
|
||||
namespace ICSharpCode.PackageManagement |
||||
{ |
||||
public class DocumentNamespaceCreator : IDocumentNamespaceCreator |
||||
{ |
||||
public void AddNamespace(ICompilationUnit compilationUnit, string newNamespace) |
||||
{ |
||||
if (WorkbenchSingleton.InvokeRequired) { |
||||
WorkbenchSingleton.SafeThreadCall(() => AddNamespace(compilationUnit, newNamespace)); |
||||
} else { |
||||
IViewContent view = FileService.OpenFile(compilationUnit.FileName); |
||||
var textEditor = view as ITextEditorProvider; |
||||
IDocument document = textEditor.TextEditor.Document; |
||||
NamespaceRefactoringService.AddUsingDeclaration(compilationUnit, document, newNamespace, false); |
||||
} |
||||
} |
||||
} |
||||
} |
@ -0,0 +1,13 @@
@@ -0,0 +1,13 @@
|
||||
// Copyright (c) AlphaSierraPapa for the SharpDevelop Team (for details please see \doc\copyright.txt)
|
||||
// This code is distributed under the GNU LGPL (for details please see \doc\license.txt)
|
||||
|
||||
using System; |
||||
using ICSharpCode.SharpDevelop.Dom; |
||||
|
||||
namespace ICSharpCode.PackageManagement |
||||
{ |
||||
public interface IDocumentNamespaceCreator |
||||
{ |
||||
void AddNamespace(ICompilationUnit compilationUnit, string newNamespace); |
||||
} |
||||
} |
Loading…
Reference in new issue