public static void CreatePadTree(object o) { ValaProject p = o as ValaProject; if (o == null) { return; } ProjectInformation pi = ProjectInformationManager.Instance.Get(p); try { foreach (ProjectFile f in p.Files) { if (f.BuildAction == BuildAction.Compile) { pi.AddFile(f.FilePath); } } foreach (ProjectPackage package in p.Packages) { if (!package.IsProject) { pi.AddPackage(p.Name); } } } catch (IOException) { return; } }
// Currently only accepts packages and projects that compile into a static library public override bool CanDropNode(object dataObject, DragOperation operation) { if (dataObject is ProjectPackage) { return(true); } if (dataObject is ValaProject) { ValaProject project = (ValaProject)dataObject; if (((ProjectPackageCollection)CurrentNode.DataItem).Project.Equals(project)) { return(false); } ValaProjectConfiguration config = (ValaProjectConfiguration)project.GetConfiguration(IdeApp.Workspace.ActiveConfiguration); if (config.CompileTarget != ValaBinding.CompileTarget.Bin) { return(true); } } return(false); }
public override void DeleteItem() { ProjectPackage package = CurrentNode.DataItem as ProjectPackage; ValaProject project = CurrentNode.GetParentDataItem( typeof(ValaProject), false) as ValaProject; project.Packages.Remove(package); IdeApp.ProjectOperations.Save(project); }
public override void OnNodeRemoved(object dataObject) { ValaProject project = ((ProjectPackageCollection)dataObject).Project; if (project == null) { return; } project.PackageAddedToProject -= addedHandler; project.PackageRemovedFromProject -= removedHandler; }
public override void BuildChildNodes(ITreeBuilder builder, object dataObject) { ValaProject p = dataObject as ValaProject; if (p == null) { return; } builder.AddChild(p.Packages); }
public void AddPackageToProject() { ValaProject project = (ValaProject)CurrentNode.GetParentDataItem( typeof(ValaProject), false); EditPackagesDialog dialog = new EditPackagesDialog(project); dialog.Run(); IdeApp.ProjectOperations.Save(project); CurrentNode.Expanded = true; }
public override void BuildChildNodes(ITreeBuilder builder, object dataObject) { ValaProject p = dataObject as ValaProject; if (p == null) { return; } // bool nestedNamespaces = builder.Options["NestedNamespaces"]; ProjectInformation info = ProjectInformationManager.Instance.Get(p); // Namespaces foreach (ProjectFile file in p.Files) { foreach (Symbol child in info.GetNamespacesForFile(file.FilePath.FullPath)) { builder.AddChild(child); } } }
public override void OnNodeDrop(object dataObject, DragOperation operation) { if (dataObject is ProjectPackage) { ProjectPackage package = (ProjectPackage)dataObject; ITreeNavigator nav = CurrentNode; ValaProject dest = nav.GetParentDataItem(typeof(ValaProject), true) as ValaProject; nav.MoveToObject(dataObject); ValaProject source = nav.GetParentDataItem(typeof(ValaProject), true) as ValaProject; dest.Packages.Add(package); IdeApp.ProjectOperations.Save(dest); if (operation == DragOperation.Move) { source.Packages.Remove(package); IdeApp.ProjectOperations.Save(source); } } else if (dataObject is ValaProject) { ValaProject draggedProject = (ValaProject)dataObject; ValaProject destProject = (CurrentNode.DataItem as ProjectPackageCollection).Project; draggedProject.WriteMDPkgPackage(IdeApp.Workspace.ActiveConfiguration); ProjectPackage package = new ProjectPackage(draggedProject); if (!destProject.Packages.Contains(package)) { destProject.Packages.Add(package); IdeApp.ProjectOperations.Save(destProject); } } }