44using System ;
55using System . IO ;
66using ICSharpCode . Core ;
7+ using ICSharpCode . SharpDevelop ;
78using ICSharpCode . SharpDevelop . Editor ;
8- using ICSharpCode . SharpDevelop . Gui ;
99using Microsoft . Win32 ;
1010
1111namespace EmbeddedImageAddIn
@@ -17,22 +17,22 @@ public class InsertImageCommand : AbstractMenuCommand
1717 {
1818 public override void Run ( )
1919 {
20- if ( WorkbenchSingleton . Workbench . ActiveViewContent == null )
20+ if ( SD . Workbench . ActiveViewContent == null )
2121 return ;
22- ITextEditorProvider provider = WorkbenchSingleton . Workbench . ActiveViewContent . GetService ( typeof ( ITextEditorProvider ) ) as ITextEditorProvider ;
23- if ( provider == null )
22+ ITextEditor editor = SD . Workbench . ActiveViewContent . GetService ( typeof ( ITextEditor ) ) as ITextEditor ;
23+ if ( editor == null )
2424 return ;
2525 OpenFileDialog dlg = new OpenFileDialog ( ) ;
2626 dlg . Filter = "Image files|*.png;*.jpg;*.gif;*.bmp;*.jpeg|All files|*.*" ;
2727 dlg . CheckFileExists = true ;
2828 dlg . DereferenceLinks = true ;
29- string baseDirectory = Path . GetDirectoryName ( provider . TextEditor . FileName ) ;
29+ string baseDirectory = Path . GetDirectoryName ( editor . FileName ) ;
3030 dlg . InitialDirectory = baseDirectory ;
3131 if ( dlg . ShowDialog ( ) == true ) {
3232 string relativePath = FileUtility . GetRelativePath ( baseDirectory , dlg . FileName ) ;
3333 if ( ! Path . IsPathRooted ( relativePath ) )
3434 relativePath = relativePath . Replace ( '\\ ' , '/' ) ;
35- provider . TextEditor . Document . Insert ( provider . TextEditor . Caret . Offset , "<<IMAGE:" + relativePath + ">>" ) ;
35+ editor . Document . Insert ( editor . Caret . Offset , "<<IMAGE:" + relativePath + ">>" ) ;
3636 }
3737 }
3838 }
0 commit comments