Browse Source

fix samples/PInvokeAddIn

pull/297/head
Siegfried Pammer 12 years ago
parent
commit
8e16f5313a
  1. 3
      samples/PInvokeAddIn/Project/Src/InsertPInvokeSignaturesCommand.cs
  2. 14
      samples/PInvokeAddIn/Project/Src/InsertPInvokeSignaturesForm.cs

3
samples/PInvokeAddIn/Project/Src/InsertPInvokeSignaturesCommand.cs

@ -3,6 +3,7 @@ @@ -3,6 +3,7 @@
using System;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
namespace ICSharpCode.PInvokeAddIn
@ -20,7 +21,7 @@ namespace ICSharpCode.PInvokeAddIn @@ -20,7 +21,7 @@ namespace ICSharpCode.PInvokeAddIn
{
// Show PInvoke dialog.
using(InsertPInvokeSignaturesForm form = new InsertPInvokeSignaturesForm()) {
form.ShowDialog(WorkbenchSingleton.MainWin32Window);
form.ShowDialog(SD.WinForms.MainWin32Window);
}
}
}

14
samples/PInvokeAddIn/Project/Src/InsertPInvokeSignaturesForm.cs

@ -8,6 +8,7 @@ using System.Text; @@ -8,6 +8,7 @@ using System.Text;
using System.Windows.Forms;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.PInvokeAddIn.WebServices;
using ICSharpCode.SharpDevelop.Editor;
using ICSharpCode.SharpDevelop.Gui;
@ -140,7 +141,7 @@ namespace ICSharpCode.PInvokeAddIn @@ -140,7 +141,7 @@ namespace ICSharpCode.PInvokeAddIn
string signature = GetSelectedPInvokeSignature(language);
if (signature.Length > 0) {
ITextEditor textEditor = GetTextEditor();
ITextEditor textEditor = SD.GetActiveViewContentService<ITextEditor>();
if (textEditor != null) {
generator.Generate(textEditor, signature);
}
@ -242,7 +243,7 @@ namespace ICSharpCode.PInvokeAddIn @@ -242,7 +243,7 @@ namespace ICSharpCode.PInvokeAddIn
string GetSourceFileLanguage()
{
ITextEditor textEditor = GetTextEditor();
ITextEditor textEditor = SD.GetActiveViewContentService<ITextEditor>();
if (textEditor != null) {
string fileExtension = Path.GetExtension(textEditor.FileName);
if (fileExtension.Equals(".vb", StringComparison.OrdinalIgnoreCase)) {
@ -280,14 +281,5 @@ namespace ICSharpCode.PInvokeAddIn @@ -280,14 +281,5 @@ namespace ICSharpCode.PInvokeAddIn
}
}
}
static ITextEditor GetTextEditor()
{
ITextEditorProvider provider = WorkbenchSingleton.Workbench.ActiveViewContent as ITextEditorProvider;
if (provider != null)
return provider.TextEditor;
else
return null;
}
}
}

Loading…
Cancel
Save