public bool Undo()
            {
                _con.View.BeginTreeUpdate();

                foreach(string f in _folder)
                    _con.View.AddTreeFolder(f);

                foreach (var obj in _state)
                {
                    var item = new ContentItem()
                        {
                            Observer = _con,
                            Exists = File.Exists(System.IO.Path.GetDirectoryName(_con._project.OriginalPath) + Path.DirectorySeparatorChar + obj.SourceFile)
                        };
                    obj.Apply(item);
                    item.ResolveTypes();

                    _con._project.ContentItems.Add(item);
                    _con.View.AddTreeItem(item);
                }

                _con.View.EndTreeUpdate();
                _con.ProjectDirty = true;

                return true;
            }
            public void Undo()
            {
                _con._view.BeginTreeUpdate();

                foreach (var obj in _state)
                {
                    var item = new ContentItem()
                        {
                            Controller = _con,
                        };
                    obj.Apply(item);
                    item.ResolveTypes();

                    _con._project.ContentItems.Add(item);
                    _con._view.AddTreeItem(item);                        
                }

                _con._view.EndTreeUpdate();
                _con.ProjectDiry = true;
            }
Ejemplo n.º 3
0
 public void RemoveTreeItem (ContentItem contentItem)
 {
     projectview1.RemoveItem (projectview1.GetBaseIter (), contentItem.OriginalPath);
 }
        public void OnItemModified(ContentItem contentItem)
        {
            Debug.Assert(ProjectOpen, "OnItemModified called with no project open?");
            ProjectDiry = true;
            _view.UpdateProperties(contentItem);

            _view.BeginTreeUpdate();
            _view.UpdateTreeItem(contentItem);
            _view.EndTreeUpdate();
        }
            private void MoveFile(ContentItem item, string newpath)
            {
                _con._project.ContentItems.Remove(item);
                _con.View.RemoveTreeItem(item);

                item.OriginalPath = newpath;
                item.ResolveTypes();

                _con._project.ContentItems.Add(item);
                _con.View.AddTreeItem(item);
            }
Ejemplo n.º 6
0
        public void RemoveTreeItem(ContentItem item)
        {
            Debug.Assert(_treeUpdating, "Must call BeginTreeUpdate() first!");

            var node = _treeView.AllNodes().Find(f => f.Tag == item);
            if (node == null)
                return;

            node.Remove();

            var obj = _propertyGrid.SelectedObject as ContentItem;
            if (obj != null && obj.OriginalPath == item.OriginalPath)
                _propertyGrid.SelectedObject = null;
        }
Ejemplo n.º 7
0
        public void RemoveTreeItem(ContentItem item)
        {
            Debug.Assert(_treeUpdating, "Must call BeginTreeUpdate() first!");

            var node = _treeView.AllNodes().Find(f => f.Tag == item);
            if (node == null)
                return;

            var parent = node.Parent;
            node.Remove();

            {
                var obj = _propertyGrid.SelectedObject as ContentItem;
                if (obj != null && obj.OriginalPath == item.OriginalPath)
                    _propertyGrid.SelectedObject = null;
            }

            // Clean up the parent nodes without children
            // and be sure not to delete the root node.
            while (parent != null && parent.Parent != null && parent.Nodes.Count == 0)
            {
                var parentParent = parent.Parent;

                parent.Remove();

                {
                    var obj = _propertyGrid.SelectedObject as ContentItem;
                    if (obj != null && obj.OriginalPath == item.OriginalPath)
                        _propertyGrid.SelectedObject = null;
                }

                parent = parentParent;
            }            
        }