Exemplo n.º 1
0
        public static ObjectBrowserFormProxy GetInstance()
        {
            if (_singleton == null)
            {
                _singleton = new ObjectBrowserFormProxy();
            }

            return(_singleton);
        }
Exemplo n.º 2
0
        public ObjectBrowserForm(ToolStrip toolbar)
        {
            _includeWorkspace =
                ApplicationManager.GetInstance().ClientProfile.HaveFlag(
                    ClientFlags.CodeAssistObjectBrowserIncludeWorkspace);

            InitializeComponent();

            #region Initialize UI

            _mainForm = ApplicationManager.GetInstance().MainForm;

            if (toolbar == null)
            {
                _useMainToolbar = true;
                _toolbar        = _mainForm.MainToolbar;
            }
            else
            {
                _toolbar        = toolbar;
                _useMainToolbar = false;
            }

            _hideNonPublicMembers = true;
            _hideSpecialNames     = true;
            _hideInheritedMembers = true;
            _hidePropertyGrid     = true;

            // Make the readonly items nearly black (black will be ignored!)
            propertyGrid.ViewForeColor = Color.FromArgb(0, 0, 1);

            Text = Resources.OBDocumentTitle;
            listView.Columns[0].Width = listView.Width;

            PopulateToolbar();

            /*
             * Apply theme if available.
             */

            ThemeFlags flags = ApplicationManager.GetInstance().
                               ClientProfile.ThemeFlags;

            if (flags != null)
            {
                if (flags.ViewAltBackColor != Color.Empty)
                {
                    treeView.BackColor         = flags.ViewAltBackColor;
                    listView.BackColor         = flags.ViewAltBackColor;
                    propertyGrid.ViewBackColor = flags.ViewAltBackColor;
                }

                if (flags.ViewAltForeColor != Color.Empty)
                {
                    treeView.ForeColor = flags.ViewAltForeColor;
                    listView.ForeColor = flags.ViewAltForeColor;

                    // Don't set to black (shows up as silver).
                    if (flags.ViewAltForeColor != Color.Black)
                    {
                        propertyGrid.ViewForeColor = flags.ViewAltForeColor;
                    }
                }

                if (flags.MainBackColor != Color.Empty)
                {
                    _splitter.BackColor       = flags.MainBackColor;
                    _splitContainer.BackColor = flags.MainBackColor;
                }

                if (flags.ViewShowBorder == false)
                {
                    treeView.BorderStyle = BorderStyle.None;
                    listView.BorderStyle = BorderStyle.None;
                }
            }

            #endregion

            #region ActionState Handlers

            RegisterActionStateHandler(
                Constants.UI_TOOLBAR_VIEW_MODULES, ToolbarButtonState);
            RegisterActionStateHandler(
                Constants.UI_TOOLBAR_VIEW_NAMESPACES, ToolbarButtonState);

            if (_includeWorkspace)
            {
                RegisterActionStateHandler(
                    Constants.UI_TOOLBAR_SHOW_WORKSPACE_ONLY, ToolbarButtonState);
            }

            RegisterActionStateHandler(
                Constants.UI_TOOLBAR_SHOW_NONPUBLIC, ToolbarButtonState);
            RegisterActionStateHandler(
                Constants.UI_TOOLBAR_SHOW_HIDDEN, ToolbarButtonState);
            RegisterActionStateHandler(
                Constants.UI_TOOLBAR_SHOW_INHERITED, ToolbarButtonState);
            RegisterActionStateHandler(
                Constants.UI_TOOLBAR_REFRESH_VIEW, ToolbarButtonState);
            RegisterActionStateHandler(
                Constants.UI_TOOLBAR_SHOW_PROPERTIES, ToolbarButtonState);

            _mainForm.ClientWindow.ActiveDocumentChanged +=
                new EventHandler(_mainForm_ActiveDocumentChanged);

            FormClosed +=
                new FormClosedEventHandler(ObjectBrowserForm_FormClosed);

            #endregion

            _referenceManager = ReferenceManager.GetInstance();
            _modules          = new Dictionary <string, ModuleData>();

            LoadModules();
            EnableModuleView(false);
            UpdateTreeView();

            /*
             * Allow client applications to modify the form.
             */

            ObjectBrowserFormProxy.GetInstance().
            UpdateFormControls(Controls);
        }