Esempio n. 1
0
 protected static void ResetItems(OpenResourceManager omgr, IEnumerable<RepositoryItem> rs, ServerConnectionManager connMgr)
 {
     foreach (var ri in rs)
     {
         var conn = connMgr.GetConnection(ri.ConnectionName);
         ResetItem(omgr, ri, conn);
     }
 }
Esempio n. 2
0
 public OpenResourceIdDialog(ServerConnectionManager connMgr)
     : this()
 {
     var items = new List<KeyValuePair<string, IServerConnection>>();
     foreach (var name in connMgr.GetConnectionNames())
     {
         items.Add(new KeyValuePair<string, IServerConnection>(name, connMgr.GetConnection(name)));
     }
     cmbConnection.DisplayMember = "Key"; //NOXLATE
     cmbConnection.DataSource = items;
     cmbConnection.SelectedIndex = 0;
 }
Esempio n. 3
0
 protected static void ResetClipboardedItems(ClipboardService clip, OpenResourceManager omgr, ServerConnectionManager connMgr)
 {
     //Reset state of clipboarded items
     if (clip.HasContent())
     {
         object o = clip.Get();
         var r = o as RepositoryItem;
         var rs = o as RepositoryItem[];
         if (r != null)
         {
             var conn = connMgr.GetConnection(r.ConnectionName);
             ResetItem(omgr, r, conn);
         }
         else if (rs != null)
         {
             ResetItems(omgr, rs, connMgr);
         }
     }
 }
Esempio n. 4
0
        /// <summary>
        /// Internal use only. Do not invoke directly. Use <see cref="ViewContentManager"/> for that
        /// </summary>
        public SiteExplorer()
        {
            InitializeComponent();
            Application.Idle += new EventHandler(OnIdle);
            ndResource.ToolTipProvider = new RepositoryItemToolTipProvider();
            ndResource.DrawText += new EventHandler<Aga.Controls.Tree.NodeControls.DrawEventArgs>(OnNodeDrawText);

            var ts = ToolbarService.CreateToolStripItems("/Maestro/Shell/SiteExplorer/Toolbar", this, true); //NOXLATE
            tsSiteExplorer.Items.AddRange(ts);

            _connManager = ServiceRegistry.GetService<ServerConnectionManager>();

            var omgr = ServiceRegistry.GetService<OpenResourceManager>();
            var clip = ServiceRegistry.GetService<ClipboardService>();
            _model = new RepositoryTreeModel(_connManager, trvResources, omgr, clip);
            trvResources.Model = _model;

            Workbench wb = Workbench.Instance;
            wb.ActiveDocumentChanged += OnActiveDocumentChanged;
        }
Esempio n. 5
0
 private static new void ResetClipboardedItems(ClipboardService clip, OpenResourceManager omgr, ServerConnectionManager connMgr)
 {
     //Reset state of clipboarded items
     if (clip.HasContent())
     {
         object o = clip.Get();
         var r = o as RepositoryItem;
         var rs = o as RepositoryItem[];
         if (r != null)
         {
             var conn = connMgr.GetConnection(r.ConnectionName);
             r.Reset();
             if (omgr.IsOpen(r.ResourceId, conn))
             {
                 r.IsOpen = true;
                 var ed = omgr.GetOpenEditor(r.ResourceId, conn);
                 if (ed.IsDirty)
                     r.IsDirty = true;
             }
         }
         else if (rs != null)
         {
             foreach (var ri in rs)
             {
                 var conn = connMgr.GetConnection(ri.ConnectionName);
                 ri.Reset();
                 if (omgr.IsOpen(ri.ResourceId, conn))
                 {
                     ri.IsOpen = true;
                     var ed = omgr.GetOpenEditor(ri.ResourceId, conn);
                     if (ed.IsDirty)
                         ri.IsDirty = true;
                 }
             }
         }
     }
 }
Esempio n. 6
0
        private Maestro.Editors.RepositoryHandle[] CollectDependentResources(RepositoryItem[] items, ServerConnectionManager connMgr)
        {
            var ids = new List<Maestro.Editors.RepositoryHandle>();
            foreach (var it in items)
            {
                var conn = connMgr.GetConnection(it.ConnectionName);
                if (it.IsFolder)
                {
                    ids.Add(new Editors.RepositoryHandle(new ResourceIdentifier(it.ResourceId), conn));
                    break;
                }

                try
                {
                    var references = conn.ResourceService.EnumerateResourceReferences(it.ResourceId);
                    ids.AddRange(references.ResourceId.Select(x => new Maestro.Editors.RepositoryHandle(new ResourceIdentifier(x), conn)));
                }
                catch //Back-referencing may not be supported
                {
                }
            }
            return ids.ToArray();
        }
Esempio n. 7
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
            });
        }
Esempio n. 8
0
 internal RepositoryTreeModel(ServerConnectionManager connManager, TreeViewAdv tree, OpenResourceManager openResMgr, ClipboardService clip)
 {
     _connManager = connManager;
     _tree = tree;
     _openResMgr = openResMgr;
     _clip = clip;
 }