Browse Source

Workbench.ViewContentCollection now contains all view contents, including all secondary view contents.

The new PrimaryViewContents collection only contains the views that were originally shown in a new workbench window.
This fixes the 'Save all' button being disabled when there are changes only in secondary view contents.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/branches/3.0@3546 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Christian Hornung 18 years ago
parent
commit
214dcfa309
  1. 6
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MockWorkbench.cs
  2. 9
      src/Main/Base/Project/Src/Gui/IWorkbench.cs
  3. 23
      src/Main/Base/Project/Src/Gui/Workbench/DefaultWorkbench.cs
  4. 2
      src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs
  5. 2
      src/Main/Base/Project/Src/Services/File/FileService.cs
  6. 4
      src/Main/ICSharpCode.SharpDevelop.Sda/Src/CallHelper.cs

6
src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MockWorkbench.cs

@ -47,6 +47,12 @@ namespace PythonBinding.Tests.Utils @@ -47,6 +47,12 @@ namespace PythonBinding.Tests.Utils
}
}
public ICollection<IViewContent> PrimaryViewContents {
get {
throw new NotImplementedException();
}
}
public List<PadDescriptor> PadContentCollection {
get {
throw new NotImplementedException();

9
src/Main/Base/Project/Src/Gui/IWorkbench.cs

@ -33,12 +33,19 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -33,12 +33,19 @@ namespace ICSharpCode.SharpDevelop.Gui
}
/// <summary>
/// A collection in which all opened view contents are saved.
/// A collection in which all opened view contents (including all secondary view contents) are saved.
/// </summary>
ICollection<IViewContent> ViewContentCollection {
get;
}
/// <summary>
/// A collection in which all opened primary view contents are saved.
/// </summary>
ICollection<IViewContent> PrimaryViewContents {
get;
}
/// <summary>
/// A collection in which all active workspace windows are saved.
/// </summary>

23
src/Main/Base/Project/Src/Gui/Workbench/DefaultWorkbench.cs

@ -31,7 +31,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -31,7 +31,7 @@ namespace ICSharpCode.SharpDevelop.Gui
readonly static string viewContentPath = "/SharpDevelop/Workbench/Pads";
List<PadDescriptor> padViewContentCollection = new List<PadDescriptor>();
List<IViewContent> viewContentCollection = new List<IViewContent>();
List<IViewContent> primaryViewContentCollection = new List<IViewContent>();
bool isActiveWindow; // Gets whether SharpDevelop is the active application in Windows
@ -113,17 +113,26 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -113,17 +113,26 @@ namespace ICSharpCode.SharpDevelop.Gui
public IList<IWorkbenchWindow> WorkbenchWindowCollection {
get {
return viewContentCollection.Select(vc => vc.WorkbenchWindow)
return primaryViewContentCollection.Select(vc => vc.WorkbenchWindow)
.Distinct().ToArray().AsReadOnly();
}
}
public ICollection<IViewContent> ViewContentCollection {
public ICollection<IViewContent> PrimaryViewContents {
get {
// return Linq.ToArray(Linq.Concat(Linq.Select<IWorkbenchWindow, IEnumerable<IViewContent>>(
// workbenchWindowCollection, delegate (IWorkbenchWindow w) { return w.ViewContents; }
// )));
return viewContentCollection.AsReadOnly();
return primaryViewContentCollection.AsReadOnly();
}
}
public ICollection<IViewContent> ViewContentCollection {
get {
ICollection<IViewContent> primaryContents = PrimaryViewContents;
List<IViewContent> contents = new List<IViewContent>(primaryContents);
contents.AddRange(primaryContents.SelectMany(vc => vc.SecondaryViewContents));
return contents.AsReadOnly();
}
}
@ -292,8 +301,8 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -292,8 +301,8 @@ namespace ICSharpCode.SharpDevelop.Gui
if (PropertyService.Get("SharpDevelop.LoadDocumentProperties", true) && content is IMementoCapable) {
StoreMemento(content);
}
if (viewContentCollection.Contains(content)) {
viewContentCollection.Remove(content);
if (primaryViewContentCollection.Contains(content)) {
primaryViewContentCollection.Remove(content);
}
OnViewClosed(new ViewContentEventArgs(content));
content.Dispose();
@ -316,7 +325,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -316,7 +325,7 @@ namespace ICSharpCode.SharpDevelop.Gui
public void ShowView(IViewContent content)
{
System.Diagnostics.Debug.Assert(layout != null);
viewContentCollection.Add(content);
primaryViewContentCollection.Add(content);
if (PropertyService.Get("SharpDevelop.LoadDocumentProperties", true) && content is IMementoCapable) {
try {
Properties memento = GetStoredMemento(content);

2
src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceLayout.cs

@ -180,7 +180,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -180,7 +180,7 @@ namespace ICSharpCode.SharpDevelop.Gui
}
void ShowViewContents()
{
foreach (IViewContent content in WorkbenchSingleton.Workbench.ViewContentCollection) {
foreach (IViewContent content in WorkbenchSingleton.Workbench.PrimaryViewContents) {
ShowView(content);
}
}

2
src/Main/Base/Project/Src/Services/File/FileService.cs

@ -278,7 +278,7 @@ namespace ICSharpCode.SharpDevelop @@ -278,7 +278,7 @@ namespace ICSharpCode.SharpDevelop
List<string> fileNames = new List<string>();
foreach (IViewContent content in WorkbenchSingleton.Workbench.ViewContentCollection) {
string contentName = content.PrimaryFileName;
if (contentName != null)
if (contentName != null && !fileNames.Contains(contentName))
fileNames.Add(contentName);
}
return fileNames;

4
src/Main/ICSharpCode.SharpDevelop.Sda/Src/CallHelper.cs

@ -229,8 +229,8 @@ namespace ICSharpCode.SharpDevelop.Sda @@ -229,8 +229,8 @@ namespace ICSharpCode.SharpDevelop.Sda
bool CloseWorkbenchInternal(bool force)
{
if (force) {
foreach (IViewContent vc in WorkbenchSingleton.Workbench.ViewContentCollection.ToArray()) {
vc.WorkbenchWindow.CloseWindow(true);
foreach (IWorkbenchWindow window in WorkbenchSingleton.Workbench.WorkbenchWindowCollection.ToArray()) {
window.CloseWindow(true);
}
}
WorkbenchSingleton.MainForm.Close();

Loading…
Cancel
Save