Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/monodevelop.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectNodeBuilder.cs')
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectNodeBuilder.cs71
1 files changed, 38 insertions, 33 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectNodeBuilder.cs
index db967f8f2d..b598ed4865 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectNodeBuilder.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectNodeBuilder.cs
@@ -39,6 +39,7 @@ using MonoDevelop.Components.Commands;
using MonoDevelop.Ide.Gui.Components;
using MonoDevelop.Ide.Gui.Dialogs;
using System.Linq;
+using MonoDevelop.Ide.Tasks;
namespace MonoDevelop.Ide.Gui.Pads.ProjectPad
{
@@ -114,27 +115,30 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad
Project p = dataObject as Project;
string escapedProjectName = GLib.Markup.EscapeText (p.Name);
- string iconName;
-
+
if (p is DotNetProject && ((DotNetProject)p).LanguageBinding == null) {
- iconName = Gtk.Stock.DialogError;
- nodeInfo.Label = GettextCatalog.GetString ("{0} <span foreground='red' size='small'>(Unknown language '{1}')</span>", escapedProjectName, ((DotNetProject)p).LanguageName);
+ nodeInfo.Icon = Context.GetIcon (Stock.Project);
+ nodeInfo.Label = escapedProjectName;
+ nodeInfo.StatusSeverity = TaskSeverity.Error;
+ nodeInfo.StatusMessage = GettextCatalog.GetString ("Unknown language '{0}'", ((DotNetProject)p).LanguageName);
+ nodeInfo.DisabledStyle = true;
+ return;
} else if (p is UnknownProject) {
var up = (UnknownProject)p;
- nodeInfo.OverlayBottomLeft = ImageService.GetIcon (Stock.Warning).WithSize (10, 10);
- nodeInfo.Label = "<span foreground='gray'>" + escapedProjectName + " <small>(" + GLib.Markup.EscapeText (up.LoadError.TrimEnd ('.')) + ")</small></span>";
- nodeInfo.Icon = Context.GetIcon (p.StockIcon).WithAlpha (0.5);
+ nodeInfo.StatusSeverity = TaskSeverity.Warning;
+ nodeInfo.StatusMessage = up.UnsupportedProjectMessage.TrimEnd ('.');
+ nodeInfo.Label = escapedProjectName;
+ nodeInfo.DisabledStyle = true;
+ nodeInfo.Icon = Context.GetIcon (p.StockIcon);
return;
- } else {
- iconName = p.StockIcon;
- if (p.ParentSolution != null && p.ParentSolution.SingleStartup && p.ParentSolution.StartupItem == p)
- nodeInfo.Label = "<b>" + escapedProjectName + "</b>";
- else
- nodeInfo.Label = escapedProjectName;
}
-
- nodeInfo.Icon = Context.GetIcon (iconName);
-
+
+ nodeInfo.Icon = Context.GetIcon (p.StockIcon);
+ if (p.ParentSolution != null && p.ParentSolution.SingleStartup && p.ParentSolution.StartupItem == p)
+ nodeInfo.Label = "<b>" + escapedProjectName + "</b>";
+ else
+ nodeInfo.Label = escapedProjectName;
+
// Gray out the project name if it is not selected in the current build configuration
SolutionConfiguration conf = p.ParentSolution.GetConfiguration (IdeApp.Workspace.ActiveConfiguration);
@@ -142,13 +146,14 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad
bool noMapping = conf == null || (ce = conf.GetEntryForItem (p)) == null;
bool missingConfig = false;
if (p.SupportsBuild () && (noMapping || !ce.Build || (missingConfig = p.Configurations [ce.ItemConfiguration] == null))) {
- var ticon = Context.GetComposedIcon (nodeInfo.Icon, "project-no-build");
- if (ticon == null)
- ticon = Context.CacheComposedIcon (nodeInfo.Icon, "project-no-build", nodeInfo.Icon.WithAlpha (0.5));
- nodeInfo.Icon = ticon;
- nodeInfo.Label = missingConfig
- ? "<span foreground='red'>" + nodeInfo.Label + " <small>(invalid configuration mapping)</small></span>"
- : "<span foreground='gray'>" + nodeInfo.Label + " <small>(not built in active configuration)</small></span>";
+ nodeInfo.DisabledStyle = true;
+ if (missingConfig) {
+ nodeInfo.StatusSeverity = TaskSeverity.Error;
+ nodeInfo.StatusMessage = GettextCatalog.GetString ("Invalid configuration mapping");
+ } else {
+ nodeInfo.StatusSeverity = TaskSeverity.Information;
+ nodeInfo.StatusMessage = GettextCatalog.GetString ("Project not built in active configuration");
+ }
}
}
@@ -169,7 +174,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad
public override object GetParentObject (object dataObject)
{
- SolutionItem it = (SolutionItem) dataObject;
+ SolutionFolderItem it = (SolutionFolderItem) dataObject;
if (it.ParentFolder == null)
return null;
@@ -374,12 +379,12 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad
}
[CommandHandler (ProjectCommands.SetAsStartupProject)]
- public void SetAsStartupProject ()
+ public async void SetAsStartupProject ()
{
Project project = CurrentNode.DataItem as Project;
project.ParentSolution.SingleStartup = true;
project.ParentSolution.StartupItem = project;
- IdeApp.ProjectOperations.Save (project.ParentSolution);
+ await IdeApp.ProjectOperations.SaveAsync (project.ParentSolution);
}
public override void DeleteItem ()
@@ -389,11 +394,11 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad
}
[CommandHandler (ProjectCommands.AddReference)]
- public void AddReferenceToProject ()
+ public async void AddReferenceToProject ()
{
DotNetProject p = (DotNetProject) CurrentNode.DataItem;
if (IdeApp.ProjectOperations.AddReferenceToProject (p))
- IdeApp.ProjectOperations.Save (p);
+ await IdeApp.ProjectOperations.SaveAsync (p);
}
[CommandUpdateHandler (ProjectCommands.AddReference)]
@@ -406,7 +411,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad
[AllowMultiSelection]
public void OnReload ()
{
- using (IProgressMonitor m = IdeApp.Workbench.ProgressMonitors.GetProjectLoadProgressMonitor (true)) {
+ using (ProgressMonitor m = IdeApp.Workbench.ProgressMonitors.GetProjectLoadProgressMonitor (true)) {
m.BeginTask (null, CurrentNodes.Length);
foreach (ITreeNavigator nav in CurrentNodes) {
Project p = (Project) nav.DataItem;
@@ -431,21 +436,21 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad
[CommandHandler (ProjectCommands.Unload)]
[AllowMultiSelection]
- public void OnUnload ()
+ public async void OnUnload ()
{
HashSet<Solution> solutions = new HashSet<Solution> ();
- using (IProgressMonitor m = IdeApp.Workbench.ProgressMonitors.GetProjectLoadProgressMonitor (true)) {
+ using (ProgressMonitor m = IdeApp.Workbench.ProgressMonitors.GetProjectLoadProgressMonitor (true)) {
m.BeginTask (null, CurrentNodes.Length);
foreach (ITreeNavigator nav in CurrentNodes) {
Project p = (Project) nav.DataItem;
p.Enabled = false;
- p.ParentFolder.ReloadItem (m, p);
+ await p.ParentFolder.ReloadItem (m, p);
m.Step (1);
solutions.Add (p.ParentSolution);
}
m.EndTask ();
}
- IdeApp.ProjectOperations.Save (solutions);
+ await IdeApp.ProjectOperations.SaveAsync (solutions);
}
[CommandUpdateHandler (ProjectCommands.Unload)]