コード例 #1
0
ファイル: NiCommandManager.cs プロジェクト: vector-man/netide
        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));
            }
        }
コード例 #2
0
ファイル: DiffViewerFactory.cs プロジェクト: netide/netide
        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);
            }
        }
コード例 #3
0
ファイル: TextEditorFactory.cs プロジェクト: netide/netide
        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);
            }
        }
コード例 #4
0
ファイル: DockContent.cs プロジェクト: vector-man/netide
        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);
        }
コード例 #5
0
ファイル: DockContent.cs プロジェクト: netide/netide
        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);
        }
コード例 #6
0
        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));
            }
        }
コード例 #7
0
ファイル: NiPackage.cs プロジェクト: netide/netide
        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);
            }
        }
コード例 #8
0
        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));
            }
        }
コード例 #9
0
 public abstract HResult CreateEditor(string document, out string editorCaption, out INiWindowPane editor);
コード例 #10
0
        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));
            }
        }
コード例 #11
0
ファイル: NiShell.cs プロジェクト: netide/netide
        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);
            }
        }
コード例 #12
0
ファイル: NiShell.cs プロジェクト: netide/netide
        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);
            }
        }
コード例 #13
0
ファイル: NiEditorFactory.cs プロジェクト: netide/netide
 public abstract HResult CreateEditor(string document, out string editorCaption, out INiWindowPane editor);
コード例 #14
0
ファイル: NiCommandManager.cs プロジェクト: netide/netide
        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);
            }
        }