示例#1
0
 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;
 }
示例#2
0
 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;
 }
示例#3
0
 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);
 }
示例#4
0
 public TableTreeNode(ProjectItem item)
     : base(item, 7)
 {
 }
示例#5
0
 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;
 }
示例#6
0
 protected override ProjectItemAttributes GetProjectItemAttributesInternal(ProjectItem projectItem)
 {
     return ProjectItemAttributes.Normal;
 }
示例#7
0
 public DatabaseProjectTreeNode(ProjectItem item)
     : base(item, 6)
 {
     base.Nodes.Add(new DummyTreeNode());
 }
示例#8
0
 public bool Contains(ProjectItem item)
 {
     return (this.IndexOf(item) != -1);
 }
示例#9
0
 private void OnCommandCreateShortcut(ProjectItem item)
 {
     if (item is DirectoryProjectItem)
     {
         string path = item.Path;
         ((IProjectManager) base.GetService(typeof(IProjectManager))).CreateProject(typeof(ShortcutProjectFactory), path);
     }
 }
示例#10
0
 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;
 }
示例#11
0
 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;
 }
示例#12
0
 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;
 }
示例#13
0
 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;
 }
示例#14
0
 protected internal override string GetProjectItemUrlInternal(ProjectItem projectItem)
 {
     return ("file:///" + this.GetProjectItemPathInternal(projectItem));
 }
示例#15
0
 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());
 }
示例#17
0
 public ProjectItemCollection(ProjectItem owner)
 {
     this._owner = owner;
 }
示例#18
0
 public TableGroupTreeNode(ProjectItem item)
     : base(item, 9, 10)
 {
     base.Nodes.Add(new DummyTreeNode());
 }
示例#19
0
 public int IndexOf(ProjectItem item)
 {
     if (this._owner._childItems != null)
     {
         return this._owner._childItems.IndexOf(item);
     }
     return -1;
 }
示例#20
0
 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);
 }
示例#21
0
 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;
 }
示例#22
0
 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);
 }
示例#23
0
 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");
 }
示例#24
0
 internal void SetParent(ProjectItem parentItem)
 {
     this._parentItem = parentItem;
 }
示例#25
0
 protected override string GetProjectItemUrlInternal(ProjectItem projectItem)
 {
     throw new NotSupportedException();
 }
示例#26
0
 protected bool ContainsChildItem(ProjectItem item)
 {
     return (this.IndexOfChildItem(item) != -1);
 }
示例#27
0
 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();
 }
示例#28
0
 protected int IndexOfChildItem(ProjectItem item)
 {
     if (this._childItems != null)
     {
         return this._childItems.IndexOf(item);
     }
     return -1;
 }
示例#29
0
 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;
 }
示例#30
0
 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);
 }