Browse Source

Fixed SD2-385: After project run Source/Abstract Content tabs are missing

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@358 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
7df2337803
  1. BIN
      data/resources/layouts/Debug.xml
  2. BIN
      data/resources/layouts/Default.xml
  3. BIN
      data/resources/layouts/Plain.xml
  4. 2
      src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/DesignerGenerator/CSharpDesignerGenerator.cs
  5. 2
      src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/DesignerGenerator/VBNetDesignerGenerator.cs
  6. 12
      src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/DesignerGenerator/XmlDesignerGenerator.cs
  7. 69
      src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/FormDesignerViewContent.cs
  8. 4
      src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/Services/DefaultServiceContainer.cs
  9. 12
      src/AddIns/Misc/MbUnitPad/Project/MbUnitPad.addin
  10. 5
      src/AddIns/Misc/MbUnitPad/Project/MbUnitPad.csproj
  11. 2
      src/AddIns/Misc/MbUnitPad/Project/Src/MbUnitCommands.cs
  12. 2
      src/AddIns/Misc/MbUnitPad/Project/Src/MbUnitPad.cs
  13. 2
      src/AddIns/Misc/MbUnitPad/Project/Src/TestTreeView.cs
  14. 1
      src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/ProjectBrowserVisitor/OverlayIconManager.cs
  15. 2
      src/Main/Base/Project/Src/Gui/AbstractSecondaryViewContent.cs
  16. 21
      src/Main/Base/Project/Src/Gui/AbstractViewContent.cs
  17. 7
      src/Main/Base/Project/Src/Gui/IViewContent.cs
  18. 5
      src/Main/Base/Project/Src/Gui/IWorkbenchWindow.cs
  19. 140
      src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs
  20. 14
      src/Main/Base/Project/Src/Services/DisplayBinding/DisplayBindingService.cs
  21. 73
      src/Main/Base/Project/Src/Services/File/FileService.cs
  22. 59
      src/Main/Base/Project/Src/Services/ParserService/ProjectContentRegistry.cs
  23. 3
      src/Main/Base/Project/Src/TextEditor/Gui/Dialogs/GotoDialog.cs

BIN
data/resources/layouts/Debug.xml

Binary file not shown.

BIN
data/resources/layouts/Default.xml

Binary file not shown.

BIN
data/resources/layouts/Plain.xml

Binary file not shown.

2
src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/DesignerGenerator/CSharpDesignerGenerator.cs

@ -122,7 +122,7 @@ namespace ICSharpCode.FormDesigner @@ -122,7 +122,7 @@ namespace ICSharpCode.FormDesigner
protected void Reparse(string content)
{
// get new initialize components
ParseInformation info = ParserService.ParseFile(viewContent.FileName, content, false, true);
ParseInformation info = ParserService.ParseFile(viewContent.TextEditorControl.FileName, content, false, true);
ICompilationUnit cu = (ICompilationUnit)info.BestCompilationUnit;
foreach (IClass c in cu.Classes) {
if (FormDesignerSecondaryDisplayBinding.BaseClassIsFormOrControl(c)) {

2
src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/DesignerGenerator/VBNetDesignerGenerator.cs

@ -121,7 +121,7 @@ namespace ICSharpCode.FormDesigner @@ -121,7 +121,7 @@ namespace ICSharpCode.FormDesigner
protected void Reparse(string content)
{
// get new initialize components
ParseInformation info = ParserService.ParseFile(viewContent.FileName, content, false, true);
ParseInformation info = ParserService.ParseFile(viewContent.TextEditorControl.FileName, content, false, true);
ICompilationUnit cu = (ICompilationUnit)info.BestCompilationUnit;
foreach (IClass c in cu.Classes) {
if (FormDesignerSecondaryDisplayBinding.BaseClassIsFormOrControl(c)) {

12
src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/DesignerGenerator/XmlDesignerGenerator.cs

@ -26,14 +26,8 @@ namespace ICSharpCode.FormDesigner @@ -26,14 +26,8 @@ namespace ICSharpCode.FormDesigner
public void Attach(FormDesignerViewContent viewContent)
{
this.viewContent = viewContent;
IComponentChangeService componentChangeService = (IComponentChangeService)viewContent.DesignSurface.GetService(typeof(IComponentChangeService));
componentChangeService.ComponentChanged += new ComponentChangedEventHandler(ComponentChanged);
}
void ComponentChanged(object sender, ComponentChangedEventArgs e)
{
viewContent.IsDirty = true;
}
public void MergeFormChanges()
{
StringWriter writer = new StringWriter();
@ -93,7 +87,7 @@ namespace ICSharpCode.FormDesigner @@ -93,7 +87,7 @@ namespace ICSharpCode.FormDesigner
}
// add collections as last child elements in the xml (because it is better
// to set the properties first and then add items to controls (looks nicer
// to set the properties first and then add items to controls (looks nicer
// in XML and CODE))
ArrayList childNodes = new ArrayList();
@ -107,7 +101,7 @@ namespace ICSharpCode.FormDesigner @@ -107,7 +101,7 @@ namespace ICSharpCode.FormDesigner
if (pd.Name == "Name" && nameInserted) {
continue;
}
if (pd.Name == "DataBindings" ||
if (pd.Name == "DataBindings" ||
// TabControl duplicate TabPages Workaround (TabPages got inserted twice : In Controls and in TabPages)
(o.GetType().FullName == "System.Windows.Forms.TabControl" && pd.Name == "Controls")) {
continue;

69
src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/FormDesignerViewContent.cs

@ -45,7 +45,7 @@ using Microsoft.VisualBasic; @@ -45,7 +45,7 @@ using Microsoft.VisualBasic;
namespace ICSharpCode.FormDesigner
{
public class FormDesignerViewContent : AbstractViewContent, ISecondaryViewContent, IClipboardHandler, IUndoHandler, IHasPropertyContainer
public class FormDesignerViewContent : AbstractSecondaryViewContent, IClipboardHandler, IUndoHandler, IHasPropertyContainer
{
protected bool failedDesignerInitialize;
@ -62,13 +62,6 @@ namespace ICSharpCode.FormDesigner @@ -62,13 +62,6 @@ namespace ICSharpCode.FormDesigner
DesignerLoader loader;
IDesignerGenerator generator;
public override string FileName {
get {
string fileName = textAreaControlProvider.TextEditorControl.FileName;
return fileName == null ? viewContent.UntitledName : fileName;
}
}
public override Control Control {
get {
return p;
@ -81,20 +74,6 @@ namespace ICSharpCode.FormDesigner @@ -81,20 +74,6 @@ namespace ICSharpCode.FormDesigner
}
}
public override bool IsDirty {
get {
if (viewContent == null) {
return false;
}
return viewContent.IsDirty;
}
set {
if (viewContent != null) {
viewContent.IsDirty = value;
}
}
}
public DesignSurface DesignSurface {
get {
return designSurface;
@ -168,6 +147,10 @@ namespace ICSharpCode.FormDesigner @@ -168,6 +147,10 @@ namespace ICSharpCode.FormDesigner
designSurface.Flush();
generator.Attach(this);
IComponentChangeService componentChangeService = (IComponentChangeService)designSurface.GetService(typeof(IComponentChangeService));
componentChangeService.ComponentChanged += delegate { viewContent.IsDirty = true; };
LoggingService.Info("Form Designer: END INITIALIZE");
}
@ -179,15 +162,10 @@ namespace ICSharpCode.FormDesigner @@ -179,15 +162,10 @@ namespace ICSharpCode.FormDesigner
}
}
public override void Load(string fileName)
{
}
public void Reload()
{
Initialize();
bool dirty = viewContent.IsDirty;
// TODO:
// TODO: Reload code modifications
// loader.TextContent = Document.TextContent;
try {
@ -206,22 +184,22 @@ namespace ICSharpCode.FormDesigner @@ -206,22 +184,22 @@ namespace ICSharpCode.FormDesigner
if (this.failedDesignerInitialize) {
return;
}
bool isDirty = IsDirty;
bool isDirty = viewContent.IsDirty;
generator.MergeFormChanges();
IsDirty = isDirty;
viewContent.IsDirty = isDirty;
}
public void ShowSourceCode()
public void ShowSourceCode()
{
WorkbenchWindow.SwitchView(0);
}
public void ShowSourceCode(int lineNumber)
public void ShowSourceCode(int lineNumber)
{
ShowSourceCode();
textAreaControlProvider.TextEditorControl.ActiveTextAreaControl.JumpTo(lineNumber, 255);
}
public void ShowSourceCode(IComponent component, EventDescriptor edesc, string eventMethodName)
{
int position;
@ -271,20 +249,11 @@ namespace ICSharpCode.FormDesigner @@ -271,20 +249,11 @@ namespace ICSharpCode.FormDesigner
// DeselectAllComponents();
}
public void NotifyAfterSave(bool successful)
public override void NotifyBeforeSave()
{
// //ifko: save the resources if there are any
// if (successful) {
// DesignerResourceService designerResourceService = (DesignerResourceService)designSurface.GetService(typeof(System.ComponentModel.Design.IResourceService));
// if (designerResourceService != null) {
// designerResourceService.Save();
// }
// }
}
public void NotifyBeforeSave()
{
MergeFormChanges();
base.NotifyBeforeSave();
if (IsFormDesignerVisible)
MergeFormChanges();
}
protected void UpdateSelectableObjects()
@ -319,7 +288,7 @@ namespace ICSharpCode.FormDesigner @@ -319,7 +288,7 @@ namespace ICSharpCode.FormDesigner
{
IMenuCommandService menuCommandService = (IMenuCommandService)designSurface.GetService(typeof(IMenuCommandService));
menuCommandService.GlobalInvoke(StandardCommands.Redo);
}
}
#endregion
#region IClipboardHandler implementation
@ -331,7 +300,7 @@ namespace ICSharpCode.FormDesigner @@ -331,7 +300,7 @@ namespace ICSharpCode.FormDesigner
System.ComponentModel.Design.MenuCommand menuCommand = menuCommandService.FindCommand(StandardCommands.Cut);
if (menuCommand == null) {
return false;
}
}
int status = menuCommand.OleStatus;
return menuCommand.Enabled;
}
@ -345,7 +314,7 @@ namespace ICSharpCode.FormDesigner @@ -345,7 +314,7 @@ namespace ICSharpCode.FormDesigner
System.ComponentModel.Design.MenuCommand menuCommand = menuCommandService.FindCommand(StandardCommands.Copy);
if (menuCommand == null) {
return false;
}
}
int status = menuCommand.OleStatus;
return menuCommand.Enabled;
}
@ -370,7 +339,7 @@ namespace ICSharpCode.FormDesigner @@ -370,7 +339,7 @@ namespace ICSharpCode.FormDesigner
System.ComponentModel.Design.MenuCommand menuCommand = menuCommandService.FindCommand(StandardCommands.Delete);
if (menuCommand == null) {
return false;
}
}
int status = menuCommand.OleStatus;
return menuCommand.Enabled;
}

4
src/AddIns/DisplayBindings/FormDesigner/Project/Src/FormDesigner/Services/DefaultServiceContainer.cs

@ -99,11 +99,11 @@ namespace ICSharpCode.FormDesigner.Services @@ -99,11 +99,11 @@ namespace ICSharpCode.FormDesigner.Services
#region System.IServiceProvider interface implementation
public object GetService(System.Type serviceType)
{
if (IsServiceMissing(serviceType)) {
/* if (LoggingService.IsInfoEnabled && IsServiceMissing(serviceType)) {
LoggingService.InfoFormatted("request missing service : {0} from Assembly {1} is not aviable.", serviceType, serviceType.Assembly.FullName);
} else {
LoggingService.DebugFormatted("get service : {0} from Assembly {1}.", serviceType, serviceType.Assembly.FullName);
}
} */
return serviceContainer.GetService(serviceType);
}
#endregion

12
src/AddIns/Misc/MbUnitPad/Project/MbUnitPad.addin

@ -17,7 +17,7 @@ @@ -17,7 +17,7 @@
title = "MbUnit Tests"
icon = "PadIcons.UnitTest"
shortcut = "Control|Alt|T"
class = "MbUnitPad.MbUnitPadContent"/>
class = "ICSharpCode.MbUnitPad.MbUnitPadContent"/>
</Path>
<Path name = "/MbUnitPad/Toolbar">
@ -25,25 +25,25 @@ @@ -25,25 +25,25 @@
<ToolbarItem id = "Reload"
icon = "Icons.16x16.BrowserRefresh"
tooltip = "${res:NUnitPad.NUnitPadContent.RefreshItem}"
class = "MbUnitPad.ReloadCommand"/>
class = "ICSharpCode.MbUnitPad.ReloadCommand"/>
<ToolbarItem id = "Unload"
icon = "Icons.16x16.BrowserCancel"
tooltip = "${res:NUnitPad.NUnitPadContent.CancelItem}"
class = "MbUnitPad.UnloadCommand"/>
class = "ICSharpCode.MbUnitPad.UnloadCommand"/>
<ToolbarItem id = "Separator1" type = "Separator"/>
<ToolbarItem id = "AddMbUnitReference"
icon = "Icons.16x16.Reference"
tooltip = "${res:MbUnitPad.ReferenceItem}"
class = "MbUnitPad.AddMbUnitReferenceCommand"/>
class = "ICSharpCode.MbUnitPad.AddMbUnitReferenceCommand"/>
<ToolbarItem id = "AddNUnitReference"
icon = "PadIcons.UnitTest"
tooltip = "${res:NUnitPad.NUnitPadContent.ReferenceItem}"
class = "MbUnitPad.AddNUnitReferenceCommand"/>
class = "ICSharpCode.MbUnitPad.AddNUnitReferenceCommand"/>
<ToolbarItem id = "Separator2" type = "Separator"/>
<ToolbarItem id = "Run"
icon = "Icons.16x16.RunProgramIcon"
tooltip = "${res:NUnitPad.NUnitPadContent.RunItem}"
class = "MbUnitPad.RunTestsCommand"/>
class = "ICSharpCode.MbUnitPad.RunTestsCommand"/>
</Condition>
</Path>

5
src/AddIns/Misc/MbUnitPad/Project/MbUnitPad.csproj

@ -1,13 +1,16 @@ @@ -1,13 +1,16 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<OutputType>Library</OutputType>
<RootNamespace>MbUnitPad</RootNamespace>
<RootNamespace>ICSharpCode.MbUnitPad</RootNamespace>
<AssemblyName>MbUnitPad</AssemblyName>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{B1CE28A0-04E8-490D-8256-E0C4D52C93C8}</ProjectGuid>
<ProductVersion>8.0.50215</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<StartupObject />
<ApplicationIcon />
<Win32Resource />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<OutputPath>..\..\..\..\..\AddIns\AddIns\Misc\MbUnitPad\</OutputPath>

2
src/AddIns/Misc/MbUnitPad/Project/Src/MbUnitCommands.cs

@ -11,7 +11,7 @@ using ICSharpCode.SharpDevelop; @@ -11,7 +11,7 @@ using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Project;
using MbUnit.Forms;
namespace MbUnitPad
namespace ICSharpCode.MbUnitPad
{
public class ReloadCommand : AbstractMenuCommand
{

2
src/AddIns/Misc/MbUnitPad/Project/Src/MbUnitPad.cs

@ -14,7 +14,7 @@ using ICSharpCode.SharpDevelop.Gui; @@ -14,7 +14,7 @@ using ICSharpCode.SharpDevelop.Gui;
using ICSharpCode.SharpDevelop.Project;
using MbUnit.Forms;
namespace MbUnitPad
namespace ICSharpCode.MbUnitPad
{
public class MbUnitPadContent : AbstractPadContent
{

2
src/AddIns/Misc/MbUnitPad/Project/Src/TestTreeView.cs

@ -17,7 +17,7 @@ using MbUnit.Core; @@ -17,7 +17,7 @@ using MbUnit.Core;
using MbUnit.Core.Remoting;
using MbUnit.Core.Reports.Serialization;
namespace MbUnitPad
namespace ICSharpCode.MbUnitPad
{
public class TestTreeView : ReflectorTreeView
{

1
src/AddIns/Misc/SubversionAddIn/Project/Src/Gui/ProjectBrowserVisitor/OverlayIconManager.cs

@ -127,6 +127,7 @@ namespace ICSharpCode.Svn @@ -127,6 +127,7 @@ namespace ICSharpCode.Svn
static void Run()
{
LoggingService.Debug("SVN: OverlayIconManager Thread started");
Thread.Sleep(2); // sleep 1 ms to give main thread time to add more jobs to the queue
while (true) {
AbstractProjectBrowserTreeNode node;
lock (queue) {

2
src/Main/Base/Project/Src/Gui/AbstractSecondaryViewContent.cs

@ -10,8 +10,6 @@ using System.Windows.Forms; @@ -10,8 +10,6 @@ using System.Windows.Forms;
namespace ICSharpCode.SharpDevelop.Gui
{
/// <summary>
/// </summary>
public abstract class AbstractSecondaryViewContent : AbstractBaseViewContent, ISecondaryViewContent
{
public virtual void NotifyBeforeSave()

21
src/Main/Base/Project/Src/Gui/AbstractViewContent.cs

@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
// </file>
using System;
using System.Collections.Generic;
using System.IO;
using System.Windows.Forms;
@ -49,12 +50,17 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -49,12 +50,17 @@ namespace ICSharpCode.SharpDevelop.Gui
}
}
public virtual bool CreateAsSubViewContent {
List<ISecondaryViewContent> secondaryViewContents = new List<ISecondaryViewContent>();
/// <summary>
/// Gets the list of secondary view contents attached to this view content.
/// </summary>
public List<ISecondaryViewContent> SecondaryViewContents {
get {
return false;
return secondaryViewContents;
}
}
public AbstractViewContent()
{
}
@ -90,7 +96,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -90,7 +96,7 @@ namespace ICSharpCode.SharpDevelop.Gui
get {
return false;
}
}
}
public virtual bool IsViewOnly {
get {
@ -150,9 +156,11 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -150,9 +156,11 @@ namespace ICSharpCode.SharpDevelop.Gui
}
}
protected virtual void OnSaving(EventArgs e)
{
foreach (ISecondaryViewContent svc in SecondaryViewContents) {
svc.NotifyBeforeSave();
}
if (Saving != null) {
Saving(this, e);
}
@ -160,6 +168,9 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -160,6 +168,9 @@ namespace ICSharpCode.SharpDevelop.Gui
protected virtual void OnSaved(SaveEventArgs e)
{
foreach (ISecondaryViewContent svc in SecondaryViewContents) {
svc.NotifyAfterSave(e.Successful);
}
if (Saved != null) {
Saved(this, e);
}

7
src/Main/Base/Project/Src/Gui/IViewContent.cs

@ -6,6 +6,7 @@ @@ -6,6 +6,7 @@
// </file>
using System;
using System.Collections.Generic;
using System.Windows.Forms;
namespace ICSharpCode.SharpDevelop.Gui
@ -96,12 +97,12 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -96,12 +97,12 @@ namespace ICSharpCode.SharpDevelop.Gui
}
/// <summary>
/// If this property is true, content will be created in the tab page
/// Gets the list of secondary view contents attached to this view content.
/// </summary>
bool CreateAsSubViewContent {
List<ISecondaryViewContent> SecondaryViewContents {
get;
}
/// <summary>
/// Saves this content to the last load/save location.
/// </summary>

5
src/Main/Base/Project/Src/Gui/IWorkbenchWindow.cs

@ -34,9 +34,11 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -34,9 +34,11 @@ namespace ICSharpCode.SharpDevelop.Gui
/// <summary>
/// returns null if no sub view contents are attached.
/// </summary>
/*
ArrayList SubViewContents {
get;
}
*/
IBaseViewContent ActiveViewContent {
get;
@ -59,14 +61,13 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -59,14 +61,13 @@ namespace ICSharpCode.SharpDevelop.Gui
void SwitchView(int viewNumber);
// void OnWindowSelected(EventArgs e);
/// <summary>
/// Only for internal use.
/// </summary>
void OnWindowSelected(EventArgs e);
void OnWindowDeselected(EventArgs e);
void AttachSecondaryViewContent(ISecondaryViewContent secondaryViewContent);
//void AttachSecondaryViewContent(ISecondaryViewContent secondaryViewContent);
/// <summary>
/// Is called when the window is selected.

140
src/Main/Base/Project/Src/Gui/Workbench/Layouts/SdiWorkspaceWindow.cs

@ -41,7 +41,6 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -41,7 +41,6 @@ namespace ICSharpCode.SharpDevelop.Gui
TabControl viewTabControl = null;
IViewContent content;
ArrayList subViewContents = null;
string myUntitledTitle = null;
@ -55,12 +54,6 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -55,12 +54,6 @@ namespace ICSharpCode.SharpDevelop.Gui
}
}
public ArrayList SubViewContents {
get {
return subViewContents;
}
}
public IBaseViewContent ActiveViewContent {
get {
if (viewTabControl != null) {
@ -73,8 +66,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -73,8 +66,7 @@ namespace ICSharpCode.SharpDevelop.Gui
selectedIndex = GetSelectedIndex();
}
return (IBaseViewContent)subViewContents[selectedIndex];
return GetSubViewContent(selectedIndex);
}
return content;
}
@ -98,7 +90,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -98,7 +90,7 @@ namespace ICSharpCode.SharpDevelop.Gui
}
}
public void SelectWindow()
public void SelectWindow()
{
Show();
}
@ -106,14 +98,6 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -106,14 +98,6 @@ namespace ICSharpCode.SharpDevelop.Gui
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
if (isDisposing) {
if (subViewContents != null) {
foreach (IDisposable disposeMe in subViewContents) {
disposeMe.Dispose();
}
}
}
}
public SdiWorkspaceWindow(IViewContent content)
@ -124,8 +108,6 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -124,8 +108,6 @@ namespace ICSharpCode.SharpDevelop.Gui
content.TitleNameChanged += new EventHandler(SetTitleEvent);
content.DirtyChanged += new EventHandler(SetTitleEvent);
content.Saving += new EventHandler(BeforeSave);
content.Saved += new SaveEventHandler(AfterSave);
SetTitleEvent(null, null);
@ -139,34 +121,31 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -139,34 +121,31 @@ namespace ICSharpCode.SharpDevelop.Gui
internal void InitControls()
{
if (content.CreateAsSubViewContent == true) {
InitializeSubViewContents();
if (content.SecondaryViewContents.Count > 0) {
viewTabControl = new TabControl();
viewTabControl.Alignment = TabAlignment.Bottom;
viewTabControl.Dock = DockStyle.Fill;
viewTabControl.SelectedIndexChanged += new EventHandler(viewTabControlIndexChanged);
AttachSecondaryViewContent(content);
foreach (ISecondaryViewContent subContent in content.SecondaryViewContents) {
AttachSecondaryViewContent(subContent);
}
Controls.Add(viewTabControl);
} else {
content.Control.Dock = DockStyle.Fill;
Controls.Add(content.Control);
}
}
void AfterSave(object sender, SaveEventArgs e)
private void AttachSecondaryViewContent(IBaseViewContent viewContent)
{
if (subViewContents == null || subViewContents.Count == 0) {
return;
}
for (int i = 1; i < subViewContents.Count; ++i) {
try {
((ISecondaryViewContent)subViewContents[i]).NotifyAfterSave(e.Successful);
}
catch {}
}
}
void BeforeSave(object sender, EventArgs e)
{
ISecondaryViewContent secondaryViewContent = ActiveViewContent as ISecondaryViewContent;
if (secondaryViewContent != null) {
secondaryViewContent.NotifyBeforeSave();
}
viewContent.WorkbenchWindow = this;
TabPage newPage = new TabPage(StringParser.Parse(viewContent.TabPageText));
newPage.Tag = viewContent;
viewContent.Control.Dock = DockStyle.Fill;
newPage.Controls.Add(viewContent.Control);
viewTabControl.TabPages.Add(newPage);
}
void LeaveTabPage(object sender, EventArgs e)
@ -178,9 +157,6 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -178,9 +157,6 @@ namespace ICSharpCode.SharpDevelop.Gui
get {
return content;
}
set {
content = value;
}
}
void SetToolTipText()
@ -212,7 +188,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -212,7 +188,7 @@ namespace ICSharpCode.SharpDevelop.Gui
if (content.TitleName == null) {
myUntitledTitle = Path.GetFileNameWithoutExtension(content.UntitledName);
// if (myUntitledTitle == null) {
// string baseName
// string baseName
// int number = 1;
// bool found = true;
// while (found) {
@ -253,21 +229,14 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -253,21 +229,14 @@ namespace ICSharpCode.SharpDevelop.Gui
{
content.TitleNameChanged -= new EventHandler(SetTitleEvent);
content.DirtyChanged -= new EventHandler(SetTitleEvent);
content.Saving -= new EventHandler(BeforeSave);
content.Saved -= new SaveEventHandler(AfterSave);
content = null;
if (subViewContents != null) {
subViewContents.Clear();
if (viewTabControl != null) {
foreach (TabPage page in viewTabControl.TabPages) {
page.Controls.Clear();
}
viewTabControl.Dispose();
viewTabControl = null;
if (viewTabControl != null) {
foreach (TabPage page in viewTabControl.TabPages) {
page.Controls.Clear();
}
subViewContents = null;
viewTabControl.Dispose();
viewTabControl = null;
}
Controls.Clear();
}
@ -277,9 +246,9 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -277,9 +246,9 @@ namespace ICSharpCode.SharpDevelop.Gui
if (!force && ViewContent != null && ViewContent.IsDirty) {
DialogResult dr = MessageBox.Show(
ResourceService.GetString("MainWindow.SaveChangesMessage"),
ResourceService.GetString("MainWindow.SaveChangesMessageHeader") + " " + Title + " ?",
MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
ResourceService.GetString("MainWindow.SaveChangesMessage"),
ResourceService.GetString("MainWindow.SaveChangesMessageHeader") + " " + Title + " ?",
MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
switch (dr) {
case DialogResult.Yes:
if (content.FileName == null) {
@ -312,55 +281,26 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -312,55 +281,26 @@ namespace ICSharpCode.SharpDevelop.Gui
return true;
}
private void InitializeSubViewContents()
{
subViewContents = new ArrayList();
subViewContents.Add(content);
viewTabControl = new TabControl();
viewTabControl.Alignment = TabAlignment.Bottom;
viewTabControl.Dock = DockStyle.Fill;
viewTabControl.SelectedIndexChanged += new EventHandler(viewTabControlIndexChanged);
Controls.Clear();
Controls.Add(viewTabControl);
TabPage newPage = new TabPage(StringParser.Parse(content.TabPageText));
newPage.Tag = content;
content.Control.Dock = DockStyle.Fill;
newPage.Controls.Add(content.Control);
viewTabControl.TabPages.Add(newPage);
}
public void AttachSecondaryViewContent(ISecondaryViewContent subViewContent)
IBaseViewContent GetSubViewContent(int index)
{
if (subViewContents == null) {
InitializeSubViewContents();
}
subViewContent.WorkbenchWindow = this;
subViewContents.Add(subViewContent);
TabPage newPage = new TabPage(StringParser.Parse(subViewContent.TabPageText));
newPage.Tag = subViewContent;
try {
subViewContent.Control.Dock = DockStyle.Fill;
} catch (Exception) {}
newPage.Controls.Add(subViewContent.Control);
viewTabControl.TabPages.Add(newPage);
if (index == 0)
return content;
else
return content.SecondaryViewContents[index - 1];
}
int oldIndex = 0;
void viewTabControlIndexChanged(object sender, EventArgs e)
{
if (oldIndex >= 0) {
IBaseViewContent secondaryViewContent = subViewContents[oldIndex] as IBaseViewContent;
IBaseViewContent secondaryViewContent = GetSubViewContent(oldIndex);
if (secondaryViewContent != null) {
secondaryViewContent.Deselected();
}
}
if (viewTabControl.SelectedIndex >= 0) {
IBaseViewContent secondaryViewContent = subViewContents[viewTabControl.SelectedIndex] as IBaseViewContent;
IBaseViewContent secondaryViewContent = GetSubViewContent(viewTabControl.SelectedIndex);
if (secondaryViewContent != null) {
secondaryViewContent.SwitchedTo();
secondaryViewContent.Selected();
@ -376,11 +316,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -376,11 +316,7 @@ namespace ICSharpCode.SharpDevelop.Gui
if (viewTabControl != null) {
for (int i = 0; i < viewTabControl.TabPages.Count; ++i) {
TabPage tabPage = viewTabControl.TabPages[i];
if (i == 0) {
tabPage.Text = StringParser.Parse(content.TabPageText);
} else {
tabPage.Text = StringParser.Parse(((IBaseViewContent)subViewContents[i]).TabPageText);
}
tabPage.Text = StringParser.Parse(GetSubViewContent(i).TabPageText);
}
}
}
@ -421,7 +357,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -421,7 +357,7 @@ namespace ICSharpCode.SharpDevelop.Gui
public event EventHandler WindowSelected;
public event EventHandler WindowDeselected;
public event EventHandler TitleChanged;
public event EventHandler CloseEvent;
}

14
src/Main/Base/Project/Src/Services/DisplayBinding/DisplayBindingService.cs

@ -60,17 +60,15 @@ namespace ICSharpCode.Core @@ -60,17 +60,15 @@ namespace ICSharpCode.Core
return null;
}
public static void AttachSubWindows(IWorkbenchWindow workbenchWindow)
public static void AttachSubWindows(IViewContent viewContent)
{
foreach (DisplayBindingDescriptor binding in bindings) {
if (binding.IsSecondary && binding.SecondaryBinding.CanAttachTo(workbenchWindow.ViewContent)) {
ISecondaryViewContent [] viewContents = binding.SecondaryBinding.CreateSecondaryViewContent(workbenchWindow.ViewContent);
if (viewContents != null) {
foreach (ISecondaryViewContent viewContent in viewContents) {
workbenchWindow.AttachSecondaryViewContent(viewContent);
}
if (binding.IsSecondary && binding.SecondaryBinding.CanAttachTo(viewContent)) {
ISecondaryViewContent[] subViewContents = binding.SecondaryBinding.CreateSecondaryViewContent(viewContent);
if (subViewContents != null) {
viewContent.SecondaryViewContents.AddRange(subViewContents);
} else {
MessageService.ShowError("Can't attach secondary view content. " + workbenchWindow.ViewContent + " returned null.\n(should never happen)");
MessageService.ShowError("Can't attach secondary view content. " + binding.SecondaryBinding + " returned null for " + viewContent + ".\n(should never happen)");
}
}
}

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

@ -71,8 +71,8 @@ namespace ICSharpCode.Core @@ -71,8 +71,8 @@ namespace ICSharpCode.Core
public void Invoke(string fileName)
{
IViewContent newContent = binding.CreateContentForFile(fileName);
DisplayBindingService.AttachSubWindows(newContent);
WorkbenchSingleton.Workbench.ShowView(newContent);
DisplayBindingService.AttachSubWindows(newContent.WorkbenchWindow);
}
}
@ -112,21 +112,6 @@ namespace ICSharpCode.Core @@ -112,21 +112,6 @@ namespace ICSharpCode.Core
// TODO: what kind of exception is ignored here?
}
}
if (content.WorkbenchWindow == null || content.WorkbenchWindow.SubViewContents == null)
continue;
foreach(object subViewContent in content.WorkbenchWindow.SubViewContents) {
IViewContent viewContent = subViewContent as IViewContent;
if (viewContent != null && viewContent.FileName != null) {
try {
if (isURL ? viewContent.FileName == fileName : FileUtility.IsEqualFileName(viewContent.FileName, fileName)) {
viewContent.WorkbenchWindow.SelectWindow();
return content.WorkbenchWindow;
}
} catch (Exception) {
// TODO: what kind of exception is ignored here?
}
}
}
}
IDisplayBinding binding = DisplayBindingService.GetBindingPerFileName(fileName);
@ -152,9 +137,9 @@ namespace ICSharpCode.Core @@ -152,9 +137,9 @@ namespace ICSharpCode.Core
}
newContent.UntitledName = defaultName;
newContent.IsDirty = false;
WorkbenchSingleton.Workbench.ShowView(newContent);
DisplayBindingService.AttachSubWindows(newContent);
DisplayBindingService.AttachSubWindows(newContent.WorkbenchWindow);
WorkbenchSingleton.Workbench.ShowView(newContent);
return newContent.WorkbenchWindow;
} else {
throw new ApplicationException("Can't create display binding for language " + language);
@ -164,27 +149,10 @@ namespace ICSharpCode.Core @@ -164,27 +149,10 @@ namespace ICSharpCode.Core
public static IWorkbenchWindow GetOpenFile(string fileName)
{
if (fileName != null && fileName.Length > 0) {
string normalizedFileName = (fileName.StartsWith("http://") ? fileName : Path.IsPathRooted(fileName) ? Path.GetFullPath(fileName) : fileName).ToLower();
foreach (IViewContent content in WorkbenchSingleton.Workbench.ViewContentCollection) {
string normalizedContentName = content.IsUntitled ? content.UntitledName : (content.FileName == null ? "" : (content.FileName.StartsWith("http://") ? content.FileName : Path.GetFullPath(content.FileName)));
normalizedContentName = normalizedContentName.ToLower();
if (normalizedContentName == normalizedFileName) {
string contentName = content.IsUntitled ? content.UntitledName : content.FileName;
if (FileUtility.IsEqualFileName(fileName, contentName))
return content.WorkbenchWindow;
}
if (content.WorkbenchWindow == null || content.WorkbenchWindow.SubViewContents == null)
continue;
foreach(object subViewContent in content.WorkbenchWindow.SubViewContents) {
IViewContent viewContent = subViewContent as IViewContent;
if (viewContent != null && viewContent.FileName != null) {
string normalizedViewContentName = viewContent.IsUntitled ? viewContent.UntitledName : (viewContent.FileName == null ? "" : (viewContent.FileName.StartsWith("http://") ? viewContent.FileName : Path.GetFullPath(viewContent.FileName)));
normalizedViewContentName = normalizedViewContentName.ToLower();
if (normalizedViewContentName == normalizedFileName) {
return content.WorkbenchWindow;
}
}
}
}
}
return null;
@ -262,34 +230,11 @@ namespace ICSharpCode.Core @@ -262,34 +230,11 @@ namespace ICSharpCode.Core
return null;
}
IViewContent content = window.ViewContent;
if (content.WorkbenchWindow.SubViewContents == null) {
if (content is IPositionable) {
window.SwitchView(0);
((IPositionable)content).JumpTo(Math.Max(0, line), Math.Max(0, column));
}
return content;
if (content is IPositionable) {
window.SwitchView(0);
((IPositionable)content).JumpTo(Math.Max(0, line), Math.Max(0, column));
}
else
{
int i = 0;
foreach(object subViewContent in content.WorkbenchWindow.SubViewContents) {
IViewContent viewContent = subViewContent as IViewContent;
if (viewContent != null && viewContent.FileName != null) {
try {
if (FileUtility.IsEqualFileName(viewContent.FileName, fileName)) {
if (viewContent is IPositionable) {
window.SwitchView(i);
((IPositionable)viewContent).JumpTo(Math.Max(0, line), Math.Max(0, column));
}
return viewContent;
}
} catch (Exception) {
}
}
i++;
}
}
return null;
return content;
}
static void OnFileRemoved(FileEventArgs e)

59
src/Main/Base/Project/Src/Services/ParserService/ProjectContentRegistry.cs

@ -103,52 +103,55 @@ namespace ICSharpCode.Core @@ -103,52 +103,55 @@ namespace ICSharpCode.Core
int time = Environment.TickCount;
string how = "??";
#endif
Assembly assembly = GetDefaultAssembly(shortName);
if (assembly != null) {
contents[item.Include] = new ReflectionProjectContent(assembly);
#if DEBUG
how = "typeof";
#endif
return contents[itemInclude];
}
lookupDirectory = Path.GetDirectoryName(itemFileName);
AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += AssemblyResolve;
try {
assembly = Assembly.ReflectionOnlyLoadFrom(itemFileName);
Assembly assembly = GetDefaultAssembly(shortName);
if (assembly != null) {
contents[itemFileName] = new ReflectionProjectContent(assembly);
contents[assembly.FullName] = contents[itemFileName];
contents[item.Include] = new ReflectionProjectContent(assembly);
#if DEBUG
how = "ReflectionOnly";
how = "typeof";
#endif
return contents[itemFileName];
return contents[itemInclude];
}
} catch (FileNotFoundException) {
lookupDirectory = Path.GetDirectoryName(itemFileName);
AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve += AssemblyResolve;
try {
assembly = LoadGACAssembly(itemInclude, true);
assembly = Assembly.ReflectionOnlyLoadFrom(itemFileName);
if (assembly != null) {
contents[itemInclude] = new ReflectionProjectContent(assembly);
contents[assembly.FullName] = contents[itemInclude];
contents[itemFileName] = new ReflectionProjectContent(assembly);
contents[assembly.FullName] = contents[itemFileName];
#if DEBUG
how = "PartialName";
how = "ReflectionOnly";
#endif
return contents[itemInclude];
return contents[itemFileName];
}
} catch (FileNotFoundException) {
try {
assembly = LoadGACAssembly(itemInclude, true);
if (assembly != null) {
contents[itemInclude] = new ReflectionProjectContent(assembly);
contents[assembly.FullName] = contents[itemInclude];
#if DEBUG
how = "PartialName";
#endif
return contents[itemInclude];
}
} catch (Exception e) {
LoggingService.Debug("Can't load assembly '" + itemInclude + "' : " + e.Message);
}
} catch (Exception e) {
LoggingService.Debug("Can't load assembly '" + itemInclude + "' : " + e.Message);
} catch (BadImageFormatException) {
LoggingService.Warn("BadImageFormat: " + itemInclude);
} finally {
AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve -= AssemblyResolve;
lookupDirectory = null;
}
} catch (BadImageFormatException) {
LoggingService.Warn("BadImageFormat: " + itemInclude);
} finally {
AppDomain.CurrentDomain.ReflectionOnlyAssemblyResolve -= AssemblyResolve;
lookupDirectory = null;
#if DEBUG
LoggingService.DebugFormatted("Loaded {0} with {2} in {1}ms", itemInclude, Environment.TickCount - time, how);
#endif
StatusBarService.ProgressMonitor.Done();
}
return null;
}
return null;
}
static Assembly GetDefaultAssembly(string shortName)

3
src/Main/Base/Project/Src/TextEditor/Gui/Dialogs/GotoDialog.cs

@ -209,6 +209,9 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -209,6 +209,9 @@ namespace ICSharpCode.SharpDevelop.Gui
if (lineNumber > 0) {
display += ", line " + lineNumber;
}
if (item.Project != null) {
display += " in " + item.Project.Name;
}
AddItem(display, ClassBrowserIconService.GotoArrowIndex, new FileLineReference(fileName, lineNumber), 0.5);
}
}

Loading…
Cancel
Save