private IEditorViewContent FindEditor(ViewContentManager svc, ResourceTypeDescriptor rtd)
        {
            IEditorViewContent ed   = null;
            IEditorFactory     fact = GetRegisteredEditor(rtd);

            //No registered editor, use the xml editor fallback
            if (fact == null)
            {
                ed = svc.OpenContent <XmlEditor>(ViewRegion.Document);
            }
            else
            {
                //I LOVE ANONYMOUS DELEGATES!
                ed = svc.OpenContent(ViewRegion.Document, () => { return(fact.Create()); });
            }

            if (ed == null)
            {
                ed = svc.OpenContent <XmlEditor>(ViewRegion.Document);
            }

            return(ed);
        }
Пример #2
0
        private IEditorViewContent FindEditor(ViewContentManager svc, ResourceTypeDescriptor rtd)
        {
            IEditorViewContent ed = null;
            IEditorFactory fact = GetRegisteredEditor(rtd);

            //No registered editor, use the xml editor fallback
            if (fact == null)
            {
                ed = svc.OpenContent<XmlEditor>(ViewRegion.Document);
            }
            else
            {
                //I LOVE ANONYMOUS DELEGATES!
                ed = svc.OpenContent(ViewRegion.Document, () => { return fact.Create(); });
            }

            if (ed == null)
                ed = svc.OpenContent<XmlEditor>(ViewRegion.Document);

            return ed;
        }
Пример #3
0
        public ResourceIdNavigator(ServerConnectionManager connMgr, 
            OpenResourceManager omgr,
            ViewContentManager viewMgr,
            ISiteExplorer siteExp)
        {
            _connMgr = connMgr;
            _connMgr.ConnectionAdded += OnConnectionAdded;
            _connMgr.ConnectionRemoved += OnConnectionRemoved;

            _omgr = omgr;
            _viewMgr = viewMgr;
            _viewMgr.ViewActivated += OnViewActivated;

            _siteExp = siteExp;
            _siteExp.ItemsSelected += OnSiteExplorerItemsSelected;

            _strip = new ToolStrip();
            _strip.Layout += OnToolStripLayout;
            _strip.Stretch = true;

            _resIdLabel = new ToolStripLabel(Strings.Label_ResourceID);
            _cmbResourceId = new ToolStripComboBox();
            _cmbResourceId.AutoSize = false;
            _cmbResourceId.Width = 250;
            _cmbResourceId.TextChanged += OnResourceIdChanged;
            _cmbResourceId.KeyUp += OnResourceIdKeyUp;

            _atLabel = new ToolStripLabel("@"); //NOXLATE
            _cmbActiveConnections = new ToolStripComboBox();
            _cmbActiveConnections.AutoSize = false;
            _cmbActiveConnections.Width = 250;
            _cmbActiveConnections.ComboBox.SelectedIndexChanged += OnActiveConnectionChanged;
            _cmbActiveConnections.ComboBox.DropDownStyle = ComboBoxStyle.DropDownList;

            _btnGo = new ToolStripButton(Strings.Label_Open);
            _btnGo.Image = Properties.Resources.arrow;
            _btnGo.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText;
            _btnGo.TextImageRelation = TextImageRelation.TextBeforeImage;
            _btnGo.ToolTipText = Strings.Label_OpenResource;
            _btnGo.Click += btnGo_Click;

            _btnOpenAsXml = new ToolStripButton(Strings.Label_OpenAsXml);
            _btnOpenAsXml.Image = Properties.Resources.arrow;
            _btnOpenAsXml.DisplayStyle = ToolStripItemDisplayStyle.ImageAndText;
            _btnOpenAsXml.TextImageRelation = TextImageRelation.TextBeforeImage;
            _btnOpenAsXml.ToolTipText = Strings.Label_OpenResourceAsXml;
            _btnOpenAsXml.Click += btnOpenAsXml_Click;

            UpdateConnectionList();
            UpdateNavigationState();

            _strip.Items.AddRange(new ToolStripItem[]
            {
                _resIdLabel,
                _cmbResourceId,
                _atLabel,
                _cmbActiveConnections,
                _btnGo,
                _btnOpenAsXml
            });
        }