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')
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/CommandSearchCategory.cs14
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/FileSearchCategory.cs14
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/MainToolbarController.cs10
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/RoslynSearchCategory.cs19
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchInSolutionSearchCategory.cs13
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.BuildOutputView/BuildOutputViewContent.cs6
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/PadCodon.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Desktop/PlatformService.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/AutoSave.cs8
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs4
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/VersionInformationTabPage.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFileNodeBuilder.cs11
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs23
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/UnknownEntryNodeBuilder.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Shell/DefaultWorkbench.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Wizard/WizardDialogController.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs6
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/GtkNewProjectDialogBackend.cs21
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewProjectController.cs34
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/PropertyDescriptionTemplate.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs7
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/DesktopService.cs5
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ImageService.cs11
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs2
-rw-r--r--main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs2
26 files changed, 111 insertions, 115 deletions
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/CommandSearchCategory.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/CommandSearchCategory.cs
index 4f6e636415..eacb97fb2d 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/CommandSearchCategory.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/CommandSearchCategory.cs
@@ -64,18 +64,8 @@ namespace MonoDevelop.Components.MainToolbar
sortOrder = CommandCategoryOrder;
}
- readonly string[] validTags = { "cmd", "command", "c" };
-
- public override string [] Tags {
- get {
- return validTags;
- }
- }
-
- public override bool IsValidTag (string tag)
- {
- return validTags.Any (t => t == tag);
- }
+ public override string [] Tags { get; } = { "cmd", "command", "c" };
+ public override bool IsValidTag (string tag) => Array.IndexOf (Tags, tag) >= 0;
public override Task GetResults (ISearchResultCallback searchResultCallback, SearchPopupSearchPattern pattern, CancellationToken token)
{
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/FileSearchCategory.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/FileSearchCategory.cs
index 76e923f2ac..9c8875a4d6 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/FileSearchCategory.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/FileSearchCategory.cs
@@ -86,18 +86,8 @@ namespace MonoDevelop.Components.MainToolbar
return list;
}
- string [] validTags = new [] { "file", "f" };
-
- public override string [] Tags {
- get {
- return validTags;
- }
- }
-
- public override bool IsValidTag (string tag)
- {
- return validTags.Any (t => t == tag);
- }
+ public override string [] Tags { get; } = { "file", "f" };
+ public override bool IsValidTag (string tag) => Array.IndexOf (Tags, tag) >= 0;
static List<Tuple<string, string, ProjectFile>> allFilesCache;
static SemaphoreSlim allFilesLock = new SemaphoreSlim (1, 1);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/MainToolbarController.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/MainToolbarController.cs
index c73b1972b1..959db38cb8 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/MainToolbarController.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/MainToolbarController.cs
@@ -575,6 +575,7 @@ namespace MonoDevelop.Components.MainToolbar
currentSolution.StartupConfigurationChanged -= HandleStartupItemChanged;
currentSolution.Saved -= HandleSolutionSaved;
currentSolution.EntrySaved -= HandleSolutionEntrySaved;
+ currentSolution.SolutionItemAdded -= HandleSolutionItemAdded;
}
currentSolution = e.Solution;
@@ -583,6 +584,7 @@ namespace MonoDevelop.Components.MainToolbar
currentSolution.StartupConfigurationChanged += HandleStartupItemChanged;
currentSolution.Saved += HandleSolutionSaved;
currentSolution.EntrySaved += HandleSolutionEntrySaved;
+ currentSolution.SolutionItemAdded += HandleSolutionItemAdded;
}
TrackStartupProject ();
@@ -625,6 +627,14 @@ namespace MonoDevelop.Components.MainToolbar
HandleSolutionSaved (sender, e);
}
+ void HandleSolutionItemAdded (object sender, SolutionItemChangeEventArgs e)
+ {
+ // When a solution item is added due to a reload we need to ensure the configurationMergers dictionary is
+ // using the new project and not the old disposed project.
+ if (e.Reloading)
+ UpdateCombos ();
+ }
+
void HandleStartupItemChanged (object sender, EventArgs e)
{
TrackStartupProject ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/RoslynSearchCategory.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/RoslynSearchCategory.cs
index 4bbded7af5..c34ef49227 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/RoslynSearchCategory.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/RoslynSearchCategory.cs
@@ -56,23 +56,14 @@ namespace MonoDevelop.Components.MainToolbar
sortOrder = FirstCategoryOrder;
}
- static readonly string [] tags = new [] {
+ public override string [] Tags { get; } = new [] {
// Types
"type", "t", "class", "struct", "interface", "enum", "delegate",
// Members
"member", "m", "method", "property", "field", "event"
- };
-
- public override string [] Tags {
- get {
- return tags;
- }
- }
-
- public override bool IsValidTag (string tag)
- {
- return tags.Contains (tag);
- }
+ };
+
+ public override bool IsValidTag (string tag) => Array.IndexOf (Tags, tag) >= 0;
static readonly IImmutableSet<string> typeKinds = ImmutableHashSet.Create (
NavigateToItemKind.Class,
@@ -154,7 +145,7 @@ namespace MonoDevelop.Components.MainToolbar
if (string.IsNullOrEmpty (searchPattern.Pattern))
return Task.CompletedTask;
- if (searchPattern.Tag != null && !tags.Contains (searchPattern.Tag) || searchPattern.HasLineNumber)
+ if (searchPattern.Tag != null && Array.IndexOf (Tags, searchPattern.Tag) < 0 || searchPattern.HasLineNumber)
return Task.CompletedTask;
return Task.Run (async delegate {
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchInSolutionSearchCategory.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchInSolutionSearchCategory.cs
index d3d6474915..ec317bad20 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchInSolutionSearchCategory.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Components.MainToolbar/SearchInSolutionSearchCategory.cs
@@ -59,18 +59,9 @@ namespace MonoDevelop.Components.MainToolbar
// return (ISearchDataSource)new SearchInSolutionDataSource (searchPattern);
// });
//}
- static readonly string[] tags = { "search" };
+ public override string [] Tags { get; } = { "search" };
- public override string[] Tags {
- get {
- return tags;
- }
- }
-
- public override bool IsValidTag (string tag)
- {
- return tag == "search";
- }
+ public override bool IsValidTag (string tag) => tag == "search";
class SearchInSolutionSearchResult : SearchResult
{
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.BuildOutputView/BuildOutputViewContent.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.BuildOutputView/BuildOutputViewContent.cs
index ff00434baf..b773ca4a4e 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.BuildOutputView/BuildOutputViewContent.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.BuildOutputView/BuildOutputViewContent.cs
@@ -60,7 +60,7 @@ namespace MonoDevelop.Ide.BuildOutputView
{
this.buildOutput = buildOutput;
DocumentTitle = $"{GettextCatalog.GetString ("Build Output")} {DateTime.Now.ToString ("h:mm tt yyyy-MM-dd")}.binlog";
- Counters.OpenedFromIDE++;
+ Counters.OpenedFromIDE.Inc (1);
}
protected override async Task OnInitialize (ModelDescriptor modelDescriptor, Properties status)
@@ -70,7 +70,7 @@ namespace MonoDevelop.Ide.BuildOutputView
if (modelDescriptor is FileDescriptor file) {
FilePath = file.FilePath;
loadedFromFile = true;
- Counters.OpenedFromFile++;
+ Counters.OpenedFromFile.Inc (1);
}
}
@@ -206,7 +206,7 @@ namespace MonoDevelop.Ide.BuildOutputView
[CommandHandler (FileCommands.Save)]
protected override Task OnSave ()
{
- Counters.SavedToFile++;
+ Counters.SavedToFile.Inc (1);
return control.SaveAs ();
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/PadCodon.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/PadCodon.cs
index 27a2ee4598..77a8ba0e26 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/PadCodon.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Codons/PadCodon.cs
@@ -135,7 +135,7 @@ namespace MonoDevelop.Ide.Codons
protected virtual PadContent CreatePad ()
{
- Counters.PadsLoaded++;
+ Counters.PadsLoaded.Inc (1);
return (PadContent) Addin.CreateInstance (ClassName, true);
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Desktop/PlatformService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Desktop/PlatformService.cs
index 2ecb25f055..47c7c983c9 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Desktop/PlatformService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Desktop/PlatformService.cs
@@ -513,6 +513,8 @@ namespace MonoDevelop.Ide.Desktop
public static bool AccessibilityKeyboardFocusInUse { get; protected set; }
+ internal virtual void MakeAccessibilityAnnouncement (string text) { }
+
internal virtual string GetNativeRuntimeDescription ()
{
return null;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/AutoSave.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/AutoSave.cs
index 5d5adc3915..ad93550190 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/AutoSave.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/AutoSave.cs
@@ -111,7 +111,7 @@ namespace MonoDevelop.Ide.Editor
if (File.Exists (autosaveFileName))
File.Delete (autosaveFileName);
content.WriteTextTo (autosaveFileName);
- Counters.AutoSavedFiles++;
+ Counters.AutoSavedFiles.Inc (1);
} catch (Exception e) {
LoggingService.LogError ("Error in auto save while creating: " + fileName +". Disableing auto save.", e);
DisableAutoSave ();
@@ -158,20 +158,20 @@ namespace MonoDevelop.Ide.Editor
}
}
}
- static Task finishedTask = Task.FromResult (true);
+
internal static Task InformAutoSaveThread (ITextSource content, string fileName, bool isDirty)
{
if (content == null)
throw new ArgumentNullException (nameof (content));
if (!autoSaveEnabled || string.IsNullOrEmpty (fileName))
- return finishedTask;
+ return Task.CompletedTask;
if (isDirty) {
return Task.Run (() => {
CreateAutoSave (fileName, content);
});
} else {
RemoveAutoSaveFile (fileName);
- return finishedTask;
+ return Task.CompletedTask;
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs
index cc9805e70f..53745babf6 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Editor/DefaultSourceEditorOptions.cs
@@ -333,7 +333,7 @@ namespace MonoDevelop.Ide.Editor
private Task UpdateContextOptions (object sender, CodingConventionsChangedEventArgs arg)
{
if (context == null)
- return Task.FromResult (false);
+ return Task.CompletedTask;
bool followCodingConventions = IdeApp.Preferences.Editor.FollowCodingConventions;
@@ -368,7 +368,7 @@ namespace MonoDevelop.Ide.Editor
}
}
this.FireChange ();
- return Task.FromResult (true);
+ return Task.CompletedTask;
}
#region new options
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/VersionInformationTabPage.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/VersionInformationTabPage.cs
index 13b54f8d59..d766d37830 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/VersionInformationTabPage.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Dialogs/VersionInformationTabPage.cs
@@ -105,7 +105,7 @@ namespace MonoDevelop.Ide.Gui.Dialogs
contentBox.BorderWidth = 4;
contentBox.PackStart (buf, false, false, 0);
- var asmButton = new Gtk.Button ("Show loaded assemblies");
+ var asmButton = new Gtk.Button (GettextCatalog.GetString ("Show loaded assemblies"));
asmButton.Clicked += (sender, e) => {
asmButton.Hide ();
contentBox.PackStart (CreateAssembliesTable (), false, false, 0);
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFileNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFileNodeBuilder.cs
index d7cb48b503..4fe44f4e70 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFileNodeBuilder.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFileNodeBuilder.cs
@@ -366,19 +366,22 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad
folderFile.Subtype = Subtype.Directory;
project.Files.Add (folderFile);
}
-
var children = FileNestingService.GetDependentOrNestedTree (file);
if (children != null) {
foreach (var child in children.ToArray ()) {
- project.Files.Remove (child);
- if(delete)
+ // Delete file before removing them from the project to avoid Remove items being added
+ // if the project is currently being saved in memory or to disk.
+ if (delete)
FileService.DeleteFile (child.Name);
+ project.Files.Remove (child);
}
}
- project.Files.Remove (file);
+ // Delete file before removing them from the project to avoid Remove items being added
+ // if the project is currently being saved in memory or to disk.
if (delete && !file.IsLink)
FileService.DeleteFile (file.Name);
+ project.Files.Remove (file);
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs
index 5070f796f1..f0404a5e03 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/ProjectFolderNodeBuilder.cs
@@ -230,19 +230,20 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad
break;
projects.Add (project);
-
- //remove the files and link files in the directory
- foreach (var f in files)
- project.Files.Remove (f);
-
- // also remove the folder's own ProjectFile, if it exists
- // FIXME: it probably was already in the files list
- if (folderPf != null)
- project.Files.Remove (folderPf);
}
-
+ // Delete folder before removing it and its files from the project to avoid Remove items being
+ // added to the project if the project is currently being saved in memory or to disk.
DeleteFolder (folder);
-
+
+ //remove the files and link files in the directory
+ foreach (var f in files)
+ project.Files.Remove (f);
+
+ // also remove the folder's own ProjectFile, if it exists
+ // FIXME: it probably was already in the files list
+ if (folderPf != null)
+ project.Files.Remove (folderPf);
+
if (isProjectFolder && folder.Path.ParentDirectory != project.BaseDirectory) {
// If it's the last item in the parent folder, make sure we keep a reference to the parent
// folder, so it is not deleted from the tree.
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/UnknownEntryNodeBuilder.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/UnknownEntryNodeBuilder.cs
index cc9212fe44..6ada8f0715 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/UnknownEntryNodeBuilder.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads.ProjectPad/UnknownEntryNodeBuilder.cs
@@ -97,7 +97,7 @@ namespace MonoDevelop.Ide.Gui.Pads.ProjectPad
public async void OnReload ()
{
var solutions = new HashSet<Solution> ();
- Task task = Task.FromResult (0);
+ Task task = Task.CompletedTask;
using (ProgressMonitor m = IdeApp.Workbench.ProgressMonitors.GetProjectLoadProgressMonitor (true)) {
m.BeginTask (null, CurrentNodes.Length);
foreach (ITreeNavigator node in CurrentNodes) {
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs
index c826300f8a..aac3a29b8f 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Pads/ErrorListPad.cs
@@ -1041,7 +1041,7 @@ namespace MonoDevelop.Ide.Gui.Pads
SetInitialOutputViewSize (control.Allocation.Width);
if (visible) {
- Counters.BuildLogShown++;
+ Counters.BuildLogShown.Inc (1);
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Shell/DefaultWorkbench.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Shell/DefaultWorkbench.cs
index 4dad8a2ecb..253d1f5483 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Shell/DefaultWorkbench.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Shell/DefaultWorkbench.cs
@@ -470,7 +470,7 @@ namespace MonoDevelop.Ide.Gui
PadWindow win = (PadWindow) GetPadWindow (codon);
if (win != null) {
win.NotifyDestroyed ();
- Counters.PadsLoaded--;
+ Counters.PadsLoaded.Dec (1);
padCodons.Remove (win);
}
if (item != null) {
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Wizard/WizardDialogController.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Wizard/WizardDialogController.cs
index 94ee7d76f6..b99021a5cc 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Wizard/WizardDialogController.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui.Wizard/WizardDialogController.cs
@@ -141,7 +141,7 @@ namespace MonoDevelop.Ide.Gui.Wizard
protected virtual Task OnCompleted (CancellationToken token)
{
- return Task.FromResult (true);
+ return Task.CompletedTask;
}
protected virtual void OnPropertyChanged (string propertyName)
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs
index 72fc681f2f..90185898da 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Gui/Document.cs
@@ -236,7 +236,7 @@ namespace MonoDevelop.Ide.Gui
internal Document (DocumentManager documentManager, IShell shell, DocumentController controller, DocumentControllerDescription controllerDescription, IWorkbenchWindow window)
{
- Counters.OpenDocuments++;
+ Counters.OpenDocuments.Inc (1);
this.shell = shell;
this.documentManager = documentManager;
@@ -377,7 +377,7 @@ namespace MonoDevelop.Ide.Gui
public ITextBuffer TextBuffer => GetContent<ITextBuffer> ();
- Task currentOperationTask = Task.FromResult (true);
+ Task currentOperationTask = Task.CompletedTask;
Task RunAsyncOperation (Func<Task> action)
{
@@ -578,7 +578,7 @@ namespace MonoDevelop.Ide.Gui
shell.CloseView (window, true);
- Counters.OpenDocuments--;
+ Counters.OpenDocuments.Dec (1);
Dispose ();
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/GtkNewProjectDialogBackend.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/GtkNewProjectDialogBackend.cs
index 33c9d388a1..b4fa2f72b7 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/GtkNewProjectDialogBackend.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/GtkNewProjectDialogBackend.cs
@@ -78,23 +78,7 @@ namespace MonoDevelop.Ide.Projects
actionHandler.PerformShowMenu += PerformShowMenu;
}
- void ProjectCreationFailed (object obj, EventArgs args) => ShowProjectCreationAccessibityNotification (true);
- void ProjectCreated(object obj, EventArgs args) => ShowProjectCreationAccessibityNotification (false);
async void NextButtonClicked (object sender, EventArgs e) => await MoveToNextPage ();
-
- void ShowProjectCreationAccessibityNotification (bool hasError)
- {
- var projectTemplate = controller.SelectedTemplate;
-
- string messageText;
-
- if (hasError)
- messageText = GettextCatalog.GetString ("{0} failed to create", projectTemplate.Name);
- else
- messageText = GettextCatalog.GetString ("{0} successfully created", projectTemplate.Name);
-
- this.Accessible.MakeAccessibilityAnnouncement (messageText);
- }
public void ShowDialog ()
{
@@ -114,8 +98,6 @@ namespace MonoDevelop.Ide.Projects
public void RegisterController (INewProjectDialogController controller)
{
this.controller = controller;
- controller.ProjectCreationFailed += ProjectCreationFailed;
- controller.ProjectCreated += ProjectCreated;
languageCellRenderer.SelectedLanguage = controller.SelectedLanguage;
topBannerLabel.Text = controller.BannerText;
LoadTemplates ();
@@ -299,9 +281,6 @@ namespace MonoDevelop.Ide.Projects
if (!controller.IsLastPage)
projectConfigurationWidget.Destroy ();
- controller.ProjectCreationFailed -= ProjectCreationFailed;
- controller.ProjectCreated -= ProjectCreated;
-
base.OnDestroyed ();
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewProjectController.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewProjectController.cs
index 455929c782..41705740a0 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewProjectController.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Projects/NewProjectController.cs
@@ -613,6 +613,8 @@ namespace MonoDevelop.Ide.Projects
public async Task Create ()
{
+ Runtime.AssertMainThread ();
+ OnProjectCreating ();
projectCreated = new TaskCompletionSource<bool> ();
if (wizardProvider.HasWizard)
@@ -620,7 +622,7 @@ namespace MonoDevelop.Ide.Projects
if (!await CreateProject ()) {
projectCreated.SetResult (false);
- ProjectCreationFailed?.Invoke (this, EventArgs.Empty);
+ OnProjectCreationFailed ();
return;
}
@@ -714,13 +716,41 @@ namespace MonoDevelop.Ide.Projects
UpdateDefaultSettings ();
projectCreated.SetResult (true);
- await Runtime.RunInMainThread (() => ProjectCreated?.Invoke (this, EventArgs.Empty));
+ OnProjectCreated ();
} catch (Exception ex) {
projectCreated.SetException (ex);
throw;
}
}
+ void OnProjectCreating ()
+ {
+ if (IdeServices.DesktopService.AccessibilityInUse) {
+ var announcement = GettextCatalog.GetString ("Creating project {0}", SelectedTemplate.Name);
+ IdeServices.DesktopService.MakeAccessibilityAnnouncement (announcement);
+ }
+ }
+
+ void OnProjectCreationFailed ()
+ {
+ ProjectCreationFailed?.Invoke (this, EventArgs.Empty);
+
+ if (IdeServices.DesktopService.AccessibilityInUse) {
+ var announcement = GettextCatalog.GetString ("{0} failed to create", SelectedTemplate.Name);
+ IdeServices.DesktopService.MakeAccessibilityAnnouncement (announcement);
+ }
+ }
+
+ void OnProjectCreated ()
+ {
+ ProjectCreated?.Invoke (this, EventArgs.Empty);
+
+ if (IdeServices.DesktopService.AccessibilityInUse) {
+ var announcement = GettextCatalog.GetString ("{0} successfully created", SelectedTemplate.Name);
+ IdeServices.DesktopService.MakeAccessibilityAnnouncement (announcement);
+ }
+ }
+
public Task<bool> ProjectCreation => projectCreated?.Task;
TaskCompletionSource<bool> projectCreated;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/PropertyDescriptionTemplate.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/PropertyDescriptionTemplate.cs
index 7b223911fe..0294419425 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/PropertyDescriptionTemplate.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.Templates/PropertyDescriptionTemplate.cs
@@ -75,7 +75,7 @@ namespace MonoDevelop.Ide.Templates
var fileName = StringParserService.Parse (name, model);
project.ProjectProperties.SetValue (typeAtt.Value, string.IsNullOrEmpty (fileName) ? propertyInnerText : string.Concat (fileName, extension));
- return Task.FromResult(true);
+ return Task.FromResult (true);
}
}
}
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs
index bdd4b2039c..0032dd5951 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide.TypeSystem/MonoDevelopWorkspace.cs
@@ -336,7 +336,10 @@ namespace MonoDevelop.Ide.TypeSystem
protected override void ClearProjectData (ProjectId projectId)
{
var actualProject = ProjectMap.RemoveProject (projectId);
- UnloadMonoProject (actualProject);
+ // Do not unload the project if there are still project ids mappings defined for this project.
+ // This prevents the Project.Modified event being unsubscribed for the wrong project on project reload.
+ if (actualProject != null && ProjectMap.GetIds (actualProject) == null)
+ UnloadMonoProject (actualProject);
dynamicFileManager?.UnloadProject (projectId);
base.ClearProjectData (projectId);
@@ -994,7 +997,7 @@ namespace MonoDevelop.Ide.TypeSystem
/// Used by tests to validate that project has been saved.
/// </summary>
/// <value>The task that can be awaited to validate saving has finished.</value>
- internal Task ProjectSaveTask { get; private set; } = Task.FromResult<object> (null);
+ internal Task ProjectSaveTask { get; private set; } = Task.CompletedTask;
internal override bool TryApplyChanges (Solution newSolution, IProgressTracker progressTracker)
{
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/DesktopService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/DesktopService.cs
index 37c4cd60c9..a44b14be25 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/DesktopService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/DesktopService.cs
@@ -447,6 +447,11 @@ namespace MonoDevelop.Ide
PlatformService.RestartIde (reopenWorkspace);
}
+ public void MakeAccessibilityAnnouncement(string text)
+ {
+ PlatformService.MakeAccessibilityAnnouncement (text);
+ }
+
public bool AccessibilityInUse {
get {
return PlatformService.AccessibilityInUse;
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ImageService.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ImageService.cs
index b1dc79a125..cd1b75f497 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ImageService.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ImageService.cs
@@ -913,7 +913,7 @@ namespace MonoDevelop.Ide
class CustomImageLoader : Xwt.Drawing.IImageLoader
{
RuntimeAddin addin;
- Dictionary<System.Reflection.Assembly, string []> resources = new Dictionary<System.Reflection.Assembly, string[]> ();
+ static Dictionary<System.Reflection.Assembly, List<string>> resources = new Dictionary<System.Reflection.Assembly, List<string>> ();
public CustomImageLoader (RuntimeAddin addin)
{
@@ -924,11 +924,12 @@ namespace MonoDevelop.Ide
{
var r = addin.GetResourceInfo (fileName);
- string [] resourceList;
- if (!resources.TryGetValue (r.ReferencedAssembly, out resourceList))
- resourceList = resources [r.ReferencedAssembly] = r.ReferencedAssembly.GetManifestResourceNames ();
+ if (!resources.TryGetValue (r.ReferencedAssembly, out var resourceList)) {
+ resourceList = resources [r.ReferencedAssembly] = r.ReferencedAssembly.GetManifestResourceNames ().ToList ();
+ resourceList.Sort (); // sort resources by name
+ }
- return resourceList;
+ return resourceList.Where (r => r.StartsWith (baseName) && r.EndsWith (ext));
}
public Stream LoadImage (string fileName)
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs
index d324842b72..190e9db83b 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/ProjectOperations.cs
@@ -529,7 +529,7 @@ namespace MonoDevelop.Ide
return SaveAsync ((IWorkspaceFileObject)item);
if (item.ParentObject != null)
return SaveAsync (item.ParentObject);
- return Task.FromResult (0);
+ return Task.CompletedTask;
}
async Task SaveAsync (IWorkspaceFileObject item)
diff --git a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs
index c3303b93ab..0b95aad703 100644
--- a/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs
+++ b/main/src/core/MonoDevelop.Ide/MonoDevelop.Ide/RootWorkspace.cs
@@ -429,7 +429,7 @@ namespace MonoDevelop.Ide
Task IBuildTarget.PrepareExecution (ProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration)
{
- return Task.FromResult (0);
+ return Task.CompletedTask;
}
public Task Execute (ProgressMonitor monitor, ExecutionContext context, ConfigurationSelector configuration)