public HResult CreateCommandBarWindow(Guid id, out INiWindowPane commandBar) { commandBar = null; try { commandBar = new CommandBarWindow(id); commandBar.SetSite(this); return(HResult.OK); } catch (Exception ex) { return(ErrorUtil.GetHResult(ex)); } }
public override HResult CreateEditor(string document, out string editorCaption, out INiWindowPane editor) { editor = null; editorCaption = null; try { editor = new DiffViewerWindow(); editor.SetSite(this); return HResult.OK; } catch (Exception ex) { return ErrorUtil.GetHResult(ex); } }
public override HResult CreateEditor(string document, out string editorCaption, out INiWindowPane editor) { editor = null; editorCaption = null; try { INiTextLines textLines = null; // If we were opened from a real document or hier, set a text buffer. // NiOpenDocumentManager will initialize this. if (document != null) { var registry = (INiLocalRegistry)GetService(typeof(INiLocalRegistry)); object instance; var hr = registry.CreateInstance(new Guid(NiConstants.TextLines), this, out instance); if (ErrorUtil.Failure(hr)) return hr; textLines = (INiTextLines)instance; Guid languageServiceId; hr = ((INiLanguageServiceRegistry)GetService(typeof(INiLanguageServiceRegistry))).FindForFileName( document, out languageServiceId ); if (ErrorUtil.Failure(hr)) return hr; hr = textLines.SetLanguageServiceID(languageServiceId); if (ErrorUtil.Failure(hr)) return hr; } editor = new TextEditorWindow(textLines); editor.SetSite(this); return HResult.OK; } catch (Exception ex) { return ErrorUtil.GetHResult(ex); } }
public DockContent(INiWindowPane windowPane, NiDockStyle dockStyle, NiToolWindowOrientation orientation) { if (windowPane == null) { throw new ArgumentNullException("windowPane"); } WindowPane = windowPane; DockStyle = dockStyle; Orientation = orientation; ShowIcon = false; switch (dockStyle) { case NiDockStyle.Document: DockAreas = WeifenLuo.WinFormsUI.Docking.DockAreas.Document; break; case NiDockStyle.Float: DockAreas = WeifenLuo.WinFormsUI.Docking.DockAreas.Document | WeifenLuo.WinFormsUI.Docking.DockAreas.Float; break; case NiDockStyle.AlwaysFloat: DockAreas = WeifenLuo.WinFormsUI.Docking.DockAreas.Float; break; default: DockAreas = WeifenLuo.WinFormsUI.Docking.DockAreas.DockBottom | WeifenLuo.WinFormsUI.Docking.DockAreas.DockLeft | WeifenLuo.WinFormsUI.Docking.DockAreas.DockRight | WeifenLuo.WinFormsUI.Docking.DockAreas.DockTop; break; } _host = new WindowHost(this) { Dock = System.Windows.Forms.DockStyle.Fill }; Controls.Add(_host); }
public DockContent(INiWindowPane windowPane, NiDockStyle dockStyle, NiToolWindowOrientation orientation) { if (windowPane == null) throw new ArgumentNullException("windowPane"); WindowPane = windowPane; DockStyle = dockStyle; Orientation = orientation; ShowIcon = false; switch (dockStyle) { case NiDockStyle.Document: DockAreas = WeifenLuo.WinFormsUI.Docking.DockAreas.Document; break; case NiDockStyle.Float: DockAreas = WeifenLuo.WinFormsUI.Docking.DockAreas.Document | WeifenLuo.WinFormsUI.Docking.DockAreas.Float; break; case NiDockStyle.AlwaysFloat: DockAreas = WeifenLuo.WinFormsUI.Docking.DockAreas.Float; break; default: DockAreas = WeifenLuo.WinFormsUI.Docking.DockAreas.DockBottom | WeifenLuo.WinFormsUI.Docking.DockAreas.DockLeft | WeifenLuo.WinFormsUI.Docking.DockAreas.DockRight | WeifenLuo.WinFormsUI.Docking.DockAreas.DockTop; break; } _host = new WindowHost(this) { Dock = System.Windows.Forms.DockStyle.Fill }; Controls.Add(_host); }
public HResult CreateToolWindow(Guid guid, out INiWindowPane toolWindow) { toolWindow = null; try { var registration = GetType() .GetCustomAttributes(typeof(ProvideToolWindowAttribute), true) .Cast <ProvideToolWindowAttribute>() .SingleOrDefault(p => p.ToolType.GUID == guid); if (registration != null) { toolWindow = CreateToolWindow(registration.ToolType); return(HResult.OK); } return(HResult.False); } catch (Exception ex) { return(ErrorUtil.GetHResult(ex)); } }
public HResult CreateToolWindow(Guid guid, out INiWindowPane toolWindow) { toolWindow = null; try { var registration = GetType() .GetCustomAttributes(typeof(ProvideToolWindowAttribute), true) .Cast<ProvideToolWindowAttribute>() .SingleOrDefault(p => p.ToolType.GUID == guid); if (registration != null) { toolWindow = CreateToolWindow(registration.ToolType); return HResult.OK; } return HResult.False; } catch (Exception ex) { return ErrorUtil.GetHResult(ex); } }
public override HResult CreateEditor(string document, out string editorCaption, out INiWindowPane editor) { editor = null; editorCaption = null; try { INiTextLines textLines = null; // If we were opened from a real document or hier, set a text buffer. // NiOpenDocumentManager will initialize this. if (document != null) { var registry = (INiLocalRegistry)GetService(typeof(INiLocalRegistry)); object instance; var hr = registry.CreateInstance(new Guid(NiConstants.TextLines), this, out instance); if (ErrorUtil.Failure(hr)) { return(hr); } textLines = (INiTextLines)instance; Guid languageServiceId; hr = ((INiLanguageServiceRegistry)GetService(typeof(INiLanguageServiceRegistry))).FindForFileName( document, out languageServiceId ); if (ErrorUtil.Failure(hr)) { return(hr); } hr = textLines.SetLanguageServiceID(languageServiceId); if (ErrorUtil.Failure(hr)) { return(hr); } } editor = new TextEditorWindow(textLines); editor.SetSite(this); return(HResult.OK); } catch (Exception ex) { return(ErrorUtil.GetHResult(ex)); } }
public abstract HResult CreateEditor(string document, out string editorCaption, out INiWindowPane editor);
public override HResult CreateEditor(string document, out string editorCaption, out INiWindowPane editor) { editor = null; editorCaption = null; try { editor = new DiffViewerWindow(); editor.SetSite(this); return(HResult.OK); } catch (Exception ex) { return(ErrorUtil.GetHResult(ex)); } }
public HResult GetWindowFrameForWindowPane(INiWindowPane windowPane, out INiWindowFrame windowFrame) { windowFrame = null; try { DockContent dockContent; if (_dockContents.TryGetValue(windowPane, out dockContent)) windowFrame = dockContent.GetProxy(); return HResult.OK; } catch (Exception ex) { return ErrorUtil.GetHResult(ex); } }
public HResult CreateToolWindow(INiWindowPane windowPane, NiDockStyle dockStyle, NiToolWindowOrientation toolWindowOrientation, out INiWindowFrame toolWindow) { toolWindow = null; try { if (windowPane == null) throw new ArgumentNullException("windowPane"); var dockContent = new DockContent(windowPane, dockStyle, toolWindowOrientation) { Site = new SiteProxy(this) }; dockContent.Disposed += dockContent_Disposed; _dockContents.Add(windowPane, dockContent); toolWindow = dockContent.GetProxy(); return HResult.OK; } catch (Exception ex) { return ErrorUtil.GetHResult(ex); } }
public HResult CreateCommandBarWindow(Guid id, out INiWindowPane commandBar) { commandBar = null; try { commandBar = new CommandBarWindow(id); commandBar.SetSite(this); return HResult.OK; } catch (Exception ex) { return ErrorUtil.GetHResult(ex); } }