protected DataTreeNode(Microsoft.Matrix.Core.Projects.ProjectItem item, int imageIndex, int selectedImageIndex) { this._item = item; base.Text = item.Caption; this._item.ItemNode = this; base.ImageIndex = imageIndex; base.SelectedImageIndex = selectedImageIndex; }
protected internal override DocumentType GetProjectItemDocumentTypeInternal(ProjectItem projectItem) { if (projectItem is FileProjectItem) { IDocumentTypeManager service = (IDocumentTypeManager) base.GetService(typeof(IDocumentTypeManager)); if (service != null) { string extension = Path.GetExtension(projectItem.Caption); return service.GetDocumentType(extension); } } return null; }
private ProjectTreeNode CreateProjectTreeNode(ProjectItem item, bool addDummyNode) { int iconIndex = item.IconIndex; int selectedImageIndex = iconIndex; switch (iconIndex) { case 7: { DocumentProjectItem item2 = item as DocumentProjectItem; if (item2 != null) { DocumentType documentType = item2.DocumentType; if (documentType != null) { int num3 = documentType.IconIndex; iconIndex = this._documentIconOffset + num3; selectedImageIndex = iconIndex; } } break; } case 1: selectedImageIndex = 2; break; } return new ProjectTreeNode(item, iconIndex, selectedImageIndex, addDummyNode); }
public TableTreeNode(ProjectItem item) : base(item, 7) { }
protected override string GetProjectItemPathInternal(ProjectItem projectItem) { if (projectItem is DatabaseProjectItem) { return ((DatabaseProjectItem) projectItem).Caption; } if (projectItem is TableProjectItem) { return ((TableProjectItem) projectItem).Caption; } if (projectItem is StoredProcedureProjectItem) { return ((StoredProcedureProjectItem) projectItem).Caption; } return string.Empty; }
protected override ProjectItemAttributes GetProjectItemAttributesInternal(ProjectItem projectItem) { return ProjectItemAttributes.Normal; }
public DatabaseProjectTreeNode(ProjectItem item) : base(item, 6) { base.Nodes.Add(new DummyTreeNode()); }
public bool Contains(ProjectItem item) { return (this.IndexOf(item) != -1); }
private void OnCommandCreateShortcut(ProjectItem item) { if (item is DirectoryProjectItem) { string path = item.Path; ((IProjectManager) base.GetService(typeof(IProjectManager))).CreateProject(typeof(ShortcutProjectFactory), path); } }
protected override bool UpdateProjectItemCommand(Command command, ProjectItem item) { bool flag = false; if (((command.CommandGroup == typeof(GlobalCommands)) && (command.CommandID == 720)) && (item is DirectoryProjectItem)) { command.Text = "Create Shortcut"; flag = true; } if (!flag) { flag = base.UpdateProjectItemCommand(command, item); } return flag; }
protected override DragDropEffects HandleProjectItemDragDropInternal(ProjectItem item, IDataObject dataObject) { if (dataObject.GetDataPresent(typeof(ProjectItem).Name)) { ProjectItem data = dataObject.GetData(typeof(ProjectItem).Name) as ProjectItem; if (data != null) { string destinationPath = Path.Combine(this.GetProjectItemPathInternal(item), data.Caption); if (!(data.Project is FileSystemProject)) { return this.DragDropFileByProjectItem((DocumentProjectItem) data, destinationPath); } string projectItemPathInternal = this.GetProjectItemPathInternal(data); bool copy = (Control.ModifierKeys & Keys.Control) != Keys.None; if (!copy && !Path.GetPathRoot(projectItemPathInternal).Equals(Path.GetPathRoot(destinationPath))) { copy = true; } return this.DragDropFileByLocalPath(projectItemPathInternal, destinationPath, copy); } } else if (dataObject.GetDataPresent(DataFormats.FileDrop)) { string[] strArray = (string[]) dataObject.GetData(DataFormats.FileDrop); DragDropEffects none = DragDropEffects.None; for (int i = 0; i < strArray.Length; i++) { string path = strArray[i]; if (File.Exists(path)) { string str4 = Path.Combine(this.GetProjectItemPathInternal(item), Path.GetFileName(path)); if (this.DragDropFileByLocalPath(path, str4, true) == DragDropEffects.Copy) { none = DragDropEffects.Copy; } } } return none; } return DragDropEffects.None; }
protected override bool HandleProjectItemCommand(Command command, ProjectItem item) { bool flag = false; if ((command.CommandGroup == typeof(GlobalCommands)) && (command.CommandID == 720)) { this.OnCommandCreateShortcut(item); flag = true; } if (!flag) { flag = base.HandleProjectItemCommand(command, item); } return flag; }
protected override DragDropEffects GetProjectItemDragDropEffectsInternal(ProjectItem item, IDataObject dataObject) { if (dataObject.GetDataPresent(typeof(ProjectItem).Name)) { ProjectItem data = dataObject.GetData(typeof(ProjectItem).Name) as ProjectItem; if (((data != null) && (data is DocumentProjectItem)) && (data.Project is WorkspaceProject)) { Project project = data.Project; if ((project == this) || (project is FileSystemProject)) { if ((Control.ModifierKeys & Keys.Control) != Keys.None) { return DragDropEffects.Copy; } string projectItemPathInternal = this.GetProjectItemPathInternal(item); if (Path.GetPathRoot(this.GetProjectItemPathInternal(data)).Equals(Path.GetPathRoot(projectItemPathInternal))) { return DragDropEffects.Move; } } return DragDropEffects.Copy; } } else if (dataObject.GetDataPresent(DataFormats.FileDrop)) { string[] strArray = (string[]) dataObject.GetData(DataFormats.FileDrop); for (int i = 0; i < strArray.Length; i++) { if (File.Exists(strArray[i])) { return DragDropEffects.Copy; } } } return DragDropEffects.None; }
protected internal override string GetProjectItemUrlInternal(ProjectItem projectItem) { return ("file:///" + this.GetProjectItemPathInternal(projectItem)); }
protected internal override string GetProjectItemPathInternal(ProjectItem projectItem) { if (projectItem is IMiscProjectItem) { return projectItem.Path; } return Path.Combine(projectItem.Parent.Path, projectItem.Caption); }
public StoredProcedureGroupTreeNode(ProjectItem item) : base(item, 9, 10) { base.Nodes.Add(new DummyTreeNode()); }
public ProjectItemCollection(ProjectItem owner) { this._owner = owner; }
public TableGroupTreeNode(ProjectItem item) : base(item, 9, 10) { base.Nodes.Add(new DummyTreeNode()); }
public int IndexOf(ProjectItem item) { if (this._owner._childItems != null) { return this._owner._childItems.IndexOf(item); } return -1; }
protected internal void AddChildItem(ProjectItem item) { if (item == null) { throw new ArgumentNullException(); } if (this._childItems == null) { this._childItems = new ArrayList(); } this._childItems.Add(item); item.SetParent(this); }
protected override bool DeleteProjectItemInternal(ProjectItem item) { if (item is StoredProcedureProjectItem) { StoredProcedureProjectItem item2 = (StoredProcedureProjectItem) item; try { this.Database.StoredProcedures.Delete(item2.Name); } catch (Exception exception) { ((IMxUIService) base.GetService(typeof(IMxUIService))).ReportError(exception, "Error deleting stored procedure.", false); return false; } try { IDocumentManager service = (IDocumentManager) base.GetService(typeof(IDocumentManager)); Document document = service.GetDocument((DocumentProjectItem) item); if (document != null) { service.CloseDocument(document, true); } } catch { } return true; } if (!(item is TableProjectItem)) { throw new NotSupportedException(); } TableProjectItem item3 = (TableProjectItem) item; try { this.Database.Tables.Delete(item3.Name); } catch (Exception exception2) { ((IMxUIService) base.GetService(typeof(IMxUIService))).ReportError(exception2, "Error deleting table.", false); return false; } try { IDocumentManager manager2 = (IDocumentManager) base.GetService(typeof(IDocumentManager)); Document document2 = manager2.GetDocument((DocumentProjectItem) item); if (document2 != null) { manager2.CloseDocument(document2, true); } } catch { } return true; }
protected internal void RemoveChildItem(ProjectItem item) { if (item == null) { throw new ArgumentNullException(); } int index = this.IndexOfChildItem(item); if (index == -1) { throw new ArgumentException(); } item.SetParent(null); this._childItems.RemoveAt(index); }
protected override DocumentType GetProjectItemDocumentTypeInternal(ProjectItem projectItem) { if (projectItem is TableProjectItem) { IDocumentTypeManager manager = (IDocumentTypeManager) base.GetService(typeof(IDocumentTypeManager)); if (manager == null) { return null; } return manager.GetDocumentType("@dbtable"); } if (!(projectItem is StoredProcedureProjectItem)) { return null; } IDocumentTypeManager service = (IDocumentTypeManager) base.GetService(typeof(IDocumentTypeManager)); if (service == null) { return null; } return service.GetDocumentType("@dbsproc"); }
internal void SetParent(ProjectItem parentItem) { this._parentItem = parentItem; }
protected override string GetProjectItemUrlInternal(ProjectItem projectItem) { throw new NotSupportedException(); }
protected bool ContainsChildItem(ProjectItem item) { return (this.IndexOfChildItem(item) != -1); }
private void AddNewItem(ProjectTreeNode parentNode, ProjectItem newItem) { TreeNodeCollection nodes = parentNode.Nodes; if ((nodes.Count == 1) && (nodes[0].GetType() == typeof(TreeNode))) { parentNode.Expand(); this._treeView.SelectedNode = newItem.ItemNode; } else { ProjectTreeNode node = this.CreateProjectTreeNode(newItem, newItem is FolderProjectItem); IComparer projectItemComparer = newItem.Project.ProjectItemComparer; if (projectItemComparer == null) { nodes.Add(node); } else { int index = 0; while (index < nodes.Count) { if (projectItemComparer.Compare(newItem, ((ProjectTreeNode) nodes[index]).ProjectItem) < 0) { break; } index++; } nodes.Insert(index, node); } this._treeView.SelectedNode = node; } this._treeView.SelectedNode.EnsureVisible(); }
protected int IndexOfChildItem(ProjectItem item) { if (this._childItems != null) { return this._childItems.IndexOf(item); } return -1; }
public ProjectTreeNode(Microsoft.Matrix.Core.Projects.ProjectItem item, int imageIndex, int selectedImageIndex, bool addDummyNodeIfRequired) { this._item = item; base.ImageIndex = imageIndex; base.SelectedImageIndex = selectedImageIndex; base.Text = item.Caption; if (addDummyNodeIfRequired && item.IsExpandable) { TreeNode node = new TreeNode(); base.Nodes.Add(node); } this._item.ItemNode = this; }
protected void InsertChildItem(int index, ProjectItem item) { if (item == null) { throw new ArgumentNullException(); } if (this._childItems == null) { if (index != 0) { throw new ArgumentOutOfRangeException(); } this._childItems = new ArrayList(); } this._childItems.Insert(index, item); item.SetParent(this); }