blob: 175c6b5905a0df5307b665dbed35466fed7eedfa (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
|
using System.IO;
using MonoDevelop.Projects;
using MonoDevelop.Components.Commands;
using MonoDevelop.Deployment.Gui;
using MonoDevelop.Ide;
namespace MonoDevelop.Deployment
{
public enum Commands
{
CreatePackage,
Install,
AddPackage
}
internal class CreatePackageHandler: CommandHandler
{
protected override void Run ()
{
SolutionFolderItem entry = IdeApp.ProjectOperations.CurrentSelectedSolutionItem;
DeployDialog dlg = new DeployDialog (entry, false);
try {
if (MessageService.RunCustomDialog (dlg) == (int) Gtk.ResponseType.Ok) {
if (dlg.SaveToProject) {
Package p = new Package ();
p.Name = dlg.NewPackageName;
p.PackageBuilder = dlg.PackageBuilder;
if (dlg.CreateNewProject) {
PackagingProject project = new PackagingProject ();
project.Name = dlg.NewProjectName;
project.FileName = Path.Combine (dlg.NewProjectSolution.BaseDirectory, project.Name + ".mdse");
project.Packages.Add (p);
dlg.NewProjectSolution.Items.Add (project);
IdeApp.ProjectOperations.SaveAsync (dlg.NewProjectSolution.ParentSolution);
}
else {
dlg.ExistingPackagingProject.Packages.Add (p);
IdeApp.ProjectOperations.SaveAsync (dlg.ExistingPackagingProject);
}
}
Package pkg = new Package (dlg.PackageBuilder);
DeployOperations.BuildPackage (pkg);
}
} finally {
dlg.Destroy ();
dlg.Dispose ();
}
}
protected override void Update (CommandInfo info)
{
info.Enabled = IdeApp.ProjectOperations.CurrentSelectedSolutionItem != null;
}
}
internal class AddPackageHandler: CommandHandler
{
protected override void Run ()
{
PackagingProject project = IdeApp.ProjectOperations.CurrentSelectedSolutionItem as PackagingProject;
DeployDialog dlg = new DeployDialog (project.ParentFolder, true);
try {
if (MessageService.RunCustomDialog (dlg) == (int) Gtk.ResponseType.Ok) {
project.AddPackage (dlg.NewPackageName, dlg.PackageBuilder);
IdeApp.ProjectOperations.SaveAsync (project);
}
} finally {
dlg.Destroy ();
dlg.Dispose ();
}
}
protected override void Update (CommandInfo info)
{
info.Enabled = IdeApp.ProjectOperations.CurrentSelectedSolutionItem is PackagingProject;
}
}
internal class InstallHandler: CommandHandler
{
protected override void Run ()
{
SolutionFolderItem entry = IdeApp.ProjectOperations.CurrentSelectedSolutionItem;
DeployOperations.Install (entry, IdeApp.Workspace.ActiveConfiguration);
}
protected override void Update (CommandInfo info)
{
info.Enabled = IdeApp.ProjectOperations.CurrentSelectedSolutionItem != null;
}
}
}
|