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;
            }
        }
예제 #2
0
        // 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);
        }
예제 #4
0
        public override void OnNodeRemoved(object dataObject)
        {
            ValaProject project = ((ProjectPackageCollection)dataObject).Project;

            if (project == null)
            {
                return;
            }
            project.PackageAddedToProject     -= addedHandler;
            project.PackageRemovedFromProject -= removedHandler;
        }
예제 #5
0
        public override void BuildChildNodes(ITreeBuilder builder, object dataObject)
        {
            ValaProject p = dataObject as ValaProject;

            if (p == null)
            {
                return;
            }

            builder.AddChild(p.Packages);
        }
예제 #6
0
        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);
                }
            }
        }
예제 #8
0
        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);
                }
            }
        }