Browse Source

Don't reuse IAmbience instances (they are not thread-safe).

Make NewFileDialog + SelectReferenceDialog resizable.
ClassBrowser: fixed bug that could cause classes not to be removed from the class browser when the file containing the class definition was removed from the project.
ClassBrowser: fixed bug with generic and non-generic classes that have the same name.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@2933 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 18 years ago
parent
commit
ebe69d2387
  1. 2
      src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/BooAmbience.cs
  2. 8
      src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/BooProject.cs
  3. 2
      src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/Designer/BooDesignerGenerator.cs
  4. 8
      src/AddIns/BackendBindings/CSharpBinding/Project/Src/Project/CSharpProject.cs
  5. 11
      src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MockProject.cs
  6. 8
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/Project/VBNetProject.cs
  7. 7
      src/AddIns/BackendBindings/VBNetBinding/Project/Src/VBNetCompletionBinding.cs
  8. 1
      src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj
  9. 87
      src/Main/Base/Project/Resources/NewFileDialog.xfrm
  10. 97
      src/Main/Base/Project/Resources/NewFileWithNameDialog.xfrm
  11. 1
      src/Main/Base/Project/Src/Gui/Dialogs/NewProjectDialog.Designer.cs
  12. 241
      src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/SelectReferenceDialog.cs
  13. 11
      src/Main/Base/Project/Src/Gui/Pads/ClassBrowser/ClassBrowser.cs
  14. 2
      src/Main/Base/Project/Src/Gui/Pads/ClassBrowser/Nodes/ClassNode.cs
  15. 27
      src/Main/Base/Project/Src/Gui/Pads/ClassBrowser/Nodes/ProjectNode.cs
  16. 10
      src/Main/Base/Project/Src/Project/AbstractProject.cs
  17. 5
      src/Main/Base/Project/Src/Project/IProject.cs
  18. 97
      src/Main/Base/Project/Src/Services/AmbienceService/AmbienceReflectionDecorator.cs
  19. 15
      src/Main/Base/Project/Src/Services/AmbienceService/AmbienceService.cs
  20. 20
      src/Main/Base/Project/Src/Services/ParserService/ParseInformationEventHandler.cs
  21. 14
      src/Main/Base/Project/Src/Services/ParserService/ParserService.cs
  22. 2
      src/Main/Base/Test/GenericResolverTests.cs
  23. 7
      src/Main/Base/Test/Utils/MockProject.cs
  24. 13
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Ambience.cs
  25. 20
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/CSharp/CSharpAmbience.cs
  26. 14
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/LanguageProperties.cs
  27. 20
      src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/VBNet/VBNetAmbience.cs

2
src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/BooAmbience.cs

@ -19,8 +19,6 @@ namespace Grunwald.BooBinding @@ -19,8 +19,6 @@ namespace Grunwald.BooBinding
static Dictionary<string, string> reverseTypeConversionTable = new Dictionary<string, string>();
static Dictionary<string, string> typeConversionTable = new Dictionary<string, string>();
public readonly static BooAmbience Instance = new BooAmbience();
/// <summary>
/// Gets a dictionary with boo's short names as keys and
/// the fully qualified type names as values.

8
src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/BooProject.cs

@ -102,11 +102,9 @@ namespace Grunwald.BooBinding @@ -102,11 +102,9 @@ namespace Grunwald.BooBinding
return pc;
}
[Browsable(false)]
public override IAmbience Ambience {
get {
return BooAmbience.Instance;
}
public override IAmbience GetAmbience()
{
return new BooAmbience();
}
[Browsable(false)]

2
src/AddIns/BackendBindings/Boo/BooBinding/Project/Src/Designer/BooDesignerGenerator.cs

@ -146,7 +146,7 @@ namespace Grunwald.BooBinding.Designer @@ -146,7 +146,7 @@ namespace Grunwald.BooBinding.Designer
param += " as ";
string typeStr = pInfo.ParameterType.ToString();
typeStr = BooAmbience.Instance.GetIntrinsicTypeName(typeStr);
typeStr = new BooAmbience().GetIntrinsicTypeName(typeStr);
param += typeStr;
if (i + 1 < mInfo.GetParameters().Length) {
param += ", ";

8
src/AddIns/BackendBindings/CSharpBinding/Project/Src/Project/CSharpProject.cs

@ -22,11 +22,9 @@ namespace CSharpBinding @@ -22,11 +22,9 @@ namespace CSharpBinding
/// </summary>
public class CSharpProject : CompilableProject
{
[Browsable(false)]
public override IAmbience Ambience {
get {
return CSharpAmbience.Instance;
}
public override IAmbience GetAmbience()
{
return new CSharpAmbience();
}
public override string Language {

11
src/AddIns/BackendBindings/Python/PythonBinding/Test/Utils/MockProject.cs

@ -59,10 +59,9 @@ namespace PythonBinding.Tests.Utils @@ -59,10 +59,9 @@ namespace PythonBinding.Tests.Utils
}
}
public ICSharpCode.SharpDevelop.Dom.IAmbience Ambience {
get {
throw new NotImplementedException();
}
public ICSharpCode.SharpDevelop.Dom.IAmbience GetAmbience()
{
throw new NotImplementedException();
}
public string FileName {
@ -302,7 +301,7 @@ namespace PythonBinding.Tests.Utils @@ -302,7 +301,7 @@ namespace PythonBinding.Tests.Utils
public void StartBuild(ProjectBuildOptions buildOptions, IBuildFeedbackSink feedbackSink)
{
throw new NotImplementedException();
}
#endregion
}
#endregion
}
}

8
src/AddIns/BackendBindings/VBNetBinding/Project/Src/Project/VBNetProject.cs

@ -41,11 +41,9 @@ namespace VBNetBinding @@ -41,11 +41,9 @@ namespace VBNetBinding
}
}
[Browsable(false)]
public override IAmbience Ambience {
get {
return VBNetAmbience.Instance;
}
public override IAmbience GetAmbience()
{
return new VBNetAmbience();
}
public VBNetProject(IMSBuildEngineProvider provider, string fileName, string projectName)

7
src/AddIns/BackendBindings/VBNetBinding/Project/Src/VBNetCompletionBinding.cs

@ -130,11 +130,12 @@ namespace VBNetBinding @@ -130,11 +130,12 @@ namespace VBNetBinding
editor.Document.TextContent);
if (rr != null && rr.ResolvedType != null) {
ClassFinder context = new ClassFinder(ParserService.GetParseInformation(editor.FileName), editor.ActiveTextAreaControl.Caret.Line, t1.col);
VBNetAmbience ambience = new VBNetAmbience();
if (CodeGenerator.CanUseShortTypeName(rr.ResolvedType, context))
VBNetAmbience.Instance.ConversionFlags = ConversionFlags.None;
ambience.ConversionFlags = ConversionFlags.None;
else
VBNetAmbience.Instance.ConversionFlags = ConversionFlags.UseFullyQualifiedTypeNames;
string typeName = VBNetAmbience.Instance.Convert(rr.ResolvedType);
ambience.ConversionFlags = ConversionFlags.UseFullyQualifiedTypeNames;
string typeName = ambience.Convert(rr.ResolvedType);
editor.Document.Replace(curLine.Offset + t1.col - 1, 1, typeName);
editor.ActiveTextAreaControl.Caret.Column += typeName.Length - 1;
return true;

1
src/Main/Base/Project/ICSharpCode.SharpDevelop.csproj

@ -139,7 +139,6 @@ @@ -139,7 +139,6 @@
<Compile Include="Src\Services\DisplayBinding\DisplayBindingService.cs" />
<Compile Include="Src\Internal\ConditionEvaluators\ProjectActiveEvaluator.cs" />
<Compile Include="Src\Services\AmbienceService\NetAmbience.cs" />
<Compile Include="Src\Services\AmbienceService\AmbienceReflectionDecorator.cs" />
<Compile Include="Src\Services\AmbienceService\AmbienceService.cs" />
<Compile Include="Src\Services\AmbienceService\CodeDOMGeneratorUtility.cs" />
<Compile Include="Src\Internal\ConditionEvaluators\WindowOpenEvaluator.cs" />

87
src/Main/Base/Project/Resources/NewFileDialog.xfrm

@ -1,97 +1,95 @@ @@ -1,97 +1,95 @@
<Components version="1.0">
<System.Windows.Forms.Form>
<Name value="MyForm" />
<ShowInTaskbar value="False" />
<FormBorderStyle value="FixedDialog" />
<ClientSize value="{Width=510, Height=366}" />
<MinimizeBox value="False" />
<DockPadding value="" />
<MinimumSize value="350, 190" />
<MaximizeBox value="False" />
<ShowInTaskbar value="False" />
<Text value="${res:Dialog.NewFile.DialogName}" />
<ClientSize value="{Width=510, Height=366}" />
<AcceptButton value="openButton [System.Windows.Forms.Button], Text: ${res:Global.CreateButtonText}" />
<CancelButton value="cancelButton [System.Windows.Forms.Button], Text: ${res:Global.CancelButtonText}" />
<MaximizeBox value="False" />
<Controls>
<System.Windows.Forms.Label>
<Name value="descriptionLabel" />
<Location value="8, 306" />
<BorderStyle value="Fixed3D" />
<Size value="494, 19" />
<TextAlign value="MiddleLeft" />
<Anchor value="Bottom, Left, Right" />
<TabIndex value="1" />
<Size value="{Width=494, Height=19}" />
<Location value="{X=8,Y=306}" />
<BorderStyle value="Fixed3D" />
</System.Windows.Forms.Label>
<System.Windows.Forms.Button>
<Name value="cancelButton" />
<Location value="{X=427,Y=336}" />
<DialogResult value="Cancel" />
<Location value="427, 336" />
<Text value="${res:Global.CancelButtonText}" />
<Size value="75, 23" />
<Anchor value="Bottom, Right" />
<TabIndex value="3" />
<DialogResult value="Cancel" />
</System.Windows.Forms.Button>
<System.Windows.Forms.Button>
<Name value="openButton" />
<Location value="{X=347,Y=336}" />
<Location value="347, 336" />
<Text value="${res:Global.CreateButtonText}" />
<Size value="75, 23" />
<Anchor value="Bottom, Right" />
<TabIndex value="2" />
</System.Windows.Forms.Button>
<System.Windows.Forms.Panel>
<Name value="backgroundPanel" />
<Location value="{X=8,Y=8}" />
<Size value="{Width=494, Height=290}" />
<DockPadding value="" />
<Anchor value="Top, Bottom, Left, Right" />
<Location value="8, 8" />
<TabIndex value="0" />
<Size value="494, 290" />
<Anchor value="Top, Bottom, Left, Right" />
<Controls>
<System.Windows.Forms.Panel>
<Name value="templatePanel" />
<Location value="{X=148,Y=0}" />
<Size value="{Width=346, Height=290}" />
<DockPadding value="" />
<Location value="178, 0" />
<TabIndex value="2" />
<Size value="316, 290" />
<Dock value="Fill" />
<Controls>
<System.Windows.Forms.ListView>
<Name value="templateListView" />
<Dock value="Fill" />
<MultiSelect value="False" />
<Location value="0, 23" />
<TabIndex value="1" />
<Location value="{X=0,Y=23}" />
<Size value="{Width=346, Height=267}" />
<Size value="316, 267" />
<HideSelection value="False" />
</System.Windows.Forms.ListView>
<System.Windows.Forms.Panel>
<Name value="panel2" />
<Location value="{X=0,Y=0}" />
<Size value="{Width=346, Height=23}" />
<DockPadding value="" />
<Location value="0, 0" />
<TabIndex value="4" />
<Size value="316, 23" />
<Dock value="Top" />
<Controls>
<System.Windows.Forms.Label>
<Name value="label2" />
<Location value="0, 0" />
<Text value="${res:Dialog.NewFile.TemplateText}" />
<Size value="247, 23" />
<TextAlign value="BottomLeft" />
<Anchor value="Top, Left, Right" />
<TabIndex value="0" />
<Size value="{Width=277, Height=23}" />
<Location value="{X=0,Y=0}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.RadioButton>
<Name value="largeIconsRadioButton" />
<Location value="{X=323,Y=0}" />
<Size value="{Width=22, Height=22}" />
<Location value="293, 0" />
<Size value="22, 22" />
<Appearance value="Button" />
<Anchor value="Top, Right" />
<TabIndex value="3" />
<Appearance value="Button" />
</System.Windows.Forms.RadioButton>
<System.Windows.Forms.RadioButton>
<Name value="smallIconsRadioButton" />
<Location value="{X=299,Y=0}" />
<Size value="{Width=22, Height=22}" />
<Location value="269, 0" />
<Size value="22, 22" />
<Appearance value="Button" />
<Anchor value="Top, Right" />
<TabIndex value="2" />
<Appearance value="Button" />
</System.Windows.Forms.RadioButton>
</Controls>
</System.Windows.Forms.Panel>
@ -99,38 +97,35 @@ @@ -99,38 +97,35 @@
</System.Windows.Forms.Panel>
<System.Windows.Forms.Splitter>
<Name value="splitter" />
<Location value="174, 0" />
<TabIndex value="1" />
<Size value="{Width=4, Height=290}" />
<Location value="{X=174,Y=0}" />
<Size value="4, 290" />
</System.Windows.Forms.Splitter>
<System.Windows.Forms.Panel>
<Name value="categoryPanel" />
<Location value="{X=0,Y=0}" />
<Size value="{Width=174, Height=290}" />
<DockPadding value="" />
<Location value="0, 0" />
<TabIndex value="0" />
<Size value="174, 290" />
<Dock value="Left" />
<Controls>
<System.Windows.Forms.TreeView>
<Name value="categoryTreeView" />
<ImageIndex value="-1" />
<Dock value="Fill" />
<TabIndex value="1" />
<Scrollable value="False" />
<Location value="{X=0,Y=23}" />
<SelectedImageIndex value="-1" />
<Size value="{Width=174, Height=267}" />
<HotTracking value="True" />
<Location value="0, 23" />
<Scrollable value="False" />
<Dock value="Fill" />
<Size value="174, 267" />
<HideSelection value="False" />
</System.Windows.Forms.TreeView>
<System.Windows.Forms.Label>
<Name value="label" />
<Location value="0, 0" />
<Text value="${res:Dialog.NewFile.CategoryText}" />
<Size value="174, 23" />
<TextAlign value="BottomLeft" />
<TabIndex value="0" />
<Size value="{Width=174, Height=23}" />
<Location value="{X=0,Y=0}" />
<Dock value="Top" />
<TabIndex value="0" />
</System.Windows.Forms.Label>
</Controls>
</System.Windows.Forms.Panel>
@ -138,4 +133,4 @@ @@ -138,4 +133,4 @@
</System.Windows.Forms.Panel>
</Controls>
</System.Windows.Forms.Form>
</Components>
</Components>

97
src/Main/Base/Project/Resources/NewFileWithNameDialog.xfrm

@ -1,114 +1,112 @@ @@ -1,114 +1,112 @@
<Components version="1.0">
<System.Windows.Forms.Form>
<Name value="MyForm" />
<ShowInTaskbar value="False" />
<FormBorderStyle value="FixedDialog" />
<ClientSize value="{Width=542, Height=372}" />
<MinimumSize value="350, 200" />
<MinimizeBox value="False" />
<DockPadding value="" />
<MaximizeBox value="False" />
<ShowInTaskbar value="False" />
<Text value="${res:Dialog.NewFile.DialogName}" />
<ClientSize value="{Width=542, Height=372}" />
<AcceptButton value="openButton [System.Windows.Forms.Button], Text: ${res:Global.CreateButtonText}" />
<CancelButton value="cancelButton [System.Windows.Forms.Button], Text: ${res:Global.CancelButtonText}" />
<MaximizeBox value="False" />
<Controls>
<System.Windows.Forms.TextBox>
<Name value="fileNameTextBox" />
<Anchor value="Bottom, Left, Right" />
<TabIndex value="3" />
<Location value="{X=112,Y=316}" />
<Size value="{Width=424, Height=21}" />
<Text value="" />
<Location value="112, 316" />
<Anchor value="Bottom, Left, Right" />
<Size value="424, 20" />
</System.Windows.Forms.TextBox>
<System.Windows.Forms.Label>
<Name value="label3" />
<ImageAlign value="MiddleRight" />
<Location value="8, 316" />
<Text value="${res:Dialog.NewFile.FileNameLabel}" />
<Size value="100, 23" />
<TextAlign value="MiddleRight" />
<ImageAlign value="MiddleRight" />
<Anchor value="Bottom, Left" />
<TabIndex value="2" />
<Location value="{X=8,Y=316}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.Label>
<Name value="descriptionLabel" />
<Location value="8, 292" />
<BorderStyle value="Fixed3D" />
<Size value="526, 17" />
<TextAlign value="MiddleLeft" />
<Anchor value="Bottom, Left, Right" />
<TabIndex value="1" />
<Size value="{Width=526, Height=17}" />
<Location value="{X=8,Y=292}" />
<BorderStyle value="Fixed3D" />
</System.Windows.Forms.Label>
<System.Windows.Forms.Button>
<Name value="cancelButton" />
<Location value="{X=460,Y=344}" />
<DialogResult value="Cancel" />
<Location value="460, 344" />
<Text value="${res:Global.CancelButtonText}" />
<Size value="75, 23" />
<Anchor value="Bottom, Right" />
<TabIndex value="5" />
<DialogResult value="Cancel" />
</System.Windows.Forms.Button>
<System.Windows.Forms.Button>
<Name value="openButton" />
<Location value="{X=380,Y=344}" />
<Location value="380, 344" />
<Text value="${res:Global.CreateButtonText}" />
<Size value="75, 23" />
<Anchor value="Bottom, Right" />
<TabIndex value="4" />
</System.Windows.Forms.Button>
<System.Windows.Forms.Panel>
<Name value="backgroundPanel" />
<Location value="{X=8,Y=8}" />
<Size value="{Width=528, Height=280}" />
<DockPadding value="" />
<Anchor value="Top, Bottom, Left, Right" />
<Location value="8, 8" />
<TabIndex value="0" />
<Size value="528, 280" />
<Anchor value="Top, Bottom, Left, Right" />
<Controls>
<System.Windows.Forms.Panel>
<Name value="templatePanel" />
<Location value="{X=147,Y=0}" />
<Size value="{Width=381, Height=280}" />
<DockPadding value="" />
<Location value="147, 0" />
<TabIndex value="2" />
<Size value="381, 280" />
<Dock value="Fill" />
<Controls>
<System.Windows.Forms.ListView>
<Name value="templateListView" />
<Dock value="Fill" />
<MultiSelect value="False" />
<Location value="0, 23" />
<TabIndex value="1" />
<Location value="{X=0,Y=23}" />
<Size value="{Width=381, Height=257}" />
<Size value="381, 257" />
<HideSelection value="False" />
</System.Windows.Forms.ListView>
<System.Windows.Forms.Panel>
<Name value="panel2" />
<Location value="{X=0,Y=0}" />
<Size value="{Width=381, Height=23}" />
<DockPadding value="" />
<Location value="0, 0" />
<TabIndex value="4" />
<Size value="381, 23" />
<Dock value="Top" />
<Controls>
<System.Windows.Forms.Label>
<Name value="label2" />
<Location value="0, 0" />
<Text value="${res:Dialog.NewFile.TemplateText}" />
<Size value="312, 23" />
<TextAlign value="BottomLeft" />
<Anchor value="Top, Left, Right" />
<TabIndex value="0" />
<Size value="{Width=312, Height=23}" />
<Location value="{X=0,Y=0}" />
</System.Windows.Forms.Label>
<System.Windows.Forms.RadioButton>
<Name value="largeIconsRadioButton" />
<Location value="{X=358,Y=0}" />
<Size value="{Width=22, Height=22}" />
<Location value="358, 0" />
<Size value="22, 22" />
<Appearance value="Button" />
<Anchor value="Top, Right" />
<TabIndex value="3" />
<Appearance value="Button" />
</System.Windows.Forms.RadioButton>
<System.Windows.Forms.RadioButton>
<Name value="smallIconsRadioButton" />
<Location value="{X=334,Y=0}" />
<Size value="{Width=22, Height=22}" />
<Location value="334, 0" />
<Size value="22, 22" />
<Appearance value="Button" />
<Anchor value="Top, Right" />
<TabIndex value="2" />
<Appearance value="Button" />
</System.Windows.Forms.RadioButton>
</Controls>
</System.Windows.Forms.Panel>
@ -116,38 +114,35 @@ @@ -116,38 +114,35 @@
</System.Windows.Forms.Panel>
<System.Windows.Forms.Splitter>
<Name value="splitter" />
<Location value="144, 0" />
<TabIndex value="1" />
<Size value="{Width=3, Height=280}" />
<Location value="{X=144,Y=0}" />
<Size value="3, 280" />
</System.Windows.Forms.Splitter>
<System.Windows.Forms.Panel>
<Name value="categoryPanel" />
<Location value="{X=0,Y=0}" />
<Size value="{Width=144, Height=280}" />
<DockPadding value="" />
<Location value="0, 0" />
<TabIndex value="0" />
<Size value="174, 280" />
<Dock value="Left" />
<Controls>
<System.Windows.Forms.TreeView>
<Name value="categoryTreeView" />
<ImageIndex value="-1" />
<Dock value="Fill" />
<TabIndex value="1" />
<Scrollable value="False" />
<Location value="{X=0,Y=23}" />
<SelectedImageIndex value="-1" />
<Size value="{Width=144, Height=257}" />
<HotTracking value="True" />
<Location value="0, 23" />
<Scrollable value="False" />
<Dock value="Fill" />
<Size value="144, 257" />
<HideSelection value="False" />
</System.Windows.Forms.TreeView>
<System.Windows.Forms.Label>
<Name value="label" />
<Location value="0, 0" />
<Text value="${res:Dialog.NewFile.CategoryText}" />
<Size value="144, 23" />
<TextAlign value="BottomLeft" />
<TabIndex value="0" />
<Size value="{Width=144, Height=23}" />
<Location value="{X=0,Y=0}" />
<Dock value="Top" />
<TabIndex value="0" />
</System.Windows.Forms.Label>
</Controls>
</System.Windows.Forms.Panel>

1
src/Main/Base/Project/Src/Gui/Dialogs/NewProjectDialog.Designer.cs generated

@ -302,6 +302,7 @@ namespace ICSharpCode.SharpDevelop.Project.Dialogs @@ -302,6 +302,7 @@ namespace ICSharpCode.SharpDevelop.Project.Dialogs
this.Controls.Add(this.bottomPanel);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(405, 290);
this.Name = "NewProjectDialog";
this.ShowIcon = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;

241
src/Main/Base/Project/Src/Gui/Dialogs/ReferenceDialog/SelectReferenceDialog.cs

@ -15,29 +15,6 @@ using ICSharpCode.SharpDevelop.Project; @@ -15,29 +15,6 @@ using ICSharpCode.SharpDevelop.Project;
namespace ICSharpCode.SharpDevelop.Gui
{
public interface IReferencePanel
{
void AddReference();
}
public interface ISelectReferenceDialog
{
/// <summary>
/// Project to create references for.
/// </summary>
IProject ConfigureProject { get; }
void AddReference(string referenceName, string referenceType, string referenceLocation, ReferenceProjectItem projectItem);
}
public enum ReferenceType {
Assembly,
Typelib,
Gac,
Project
}
/// <summary>
/// Summary description for Form2.
/// </summary>
@ -49,7 +26,7 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -49,7 +26,7 @@ namespace ICSharpCode.SharpDevelop.Gui
private System.Windows.Forms.TabPage gacTabPage;
private System.Windows.Forms.TabPage projectTabPage;
private System.Windows.Forms.TabPage browserTabPage;
TabPage comTabPage = new TabPage();
private System.Windows.Forms.TabPage comTabPage;
private System.Windows.Forms.Label referencesLabel;
private System.Windows.Forms.ColumnHeader referenceHeader;
private System.Windows.Forms.ColumnHeader typeHeader;
@ -86,13 +63,25 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -86,13 +63,25 @@ namespace ICSharpCode.SharpDevelop.Gui
InitializeComponent();
Translate(this);
gacTabPage.Controls.Add(new GacReferencePanel(this));
projectTabPage.Controls.Add(new ProjectReferencePanel(this));
browserTabPage.Controls.Add(new AssemblyReferencePanel(this));
comTabPage.Controls.Add(new COMReferencePanel(this));
}
void Translate(Control ctl)
{
ctl.Text = StringParser.Parse(ctl.Text);
foreach (Control c in ctl.Controls)
Translate(c);
if (ctl is ListView) {
foreach (ColumnHeader h in ((ListView)ctl).Columns) {
h.Text = StringParser.Parse(h.Text);
}
}
}
public void AddReference(string referenceName, string referenceType, string referenceLocation, ReferenceProjectItem projectItem)
{
if (projectItem == null)
@ -155,16 +144,17 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -155,16 +144,17 @@ namespace ICSharpCode.SharpDevelop.Gui
private void InitializeComponent()
{
this.referenceTabControl = new System.Windows.Forms.TabControl();
this.referencesListView = new System.Windows.Forms.ListView();
this.selectButton = new System.Windows.Forms.Button();
this.removeButton = new System.Windows.Forms.Button();
this.gacTabPage = new System.Windows.Forms.TabPage();
this.projectTabPage = new System.Windows.Forms.TabPage();
this.browserTabPage = new System.Windows.Forms.TabPage();
this.referencesLabel = new System.Windows.Forms.Label();
this.comTabPage = new System.Windows.Forms.TabPage();
this.referencesListView = new System.Windows.Forms.ListView();
this.referenceHeader = new System.Windows.Forms.ColumnHeader();
this.typeHeader = new System.Windows.Forms.ColumnHeader();
this.locationHeader = new System.Windows.Forms.ColumnHeader();
this.selectButton = new System.Windows.Forms.Button();
this.removeButton = new System.Windows.Forms.Button();
this.referencesLabel = new System.Windows.Forms.Label();
this.okButton = new System.Windows.Forms.Button();
this.cancelButton = new System.Windows.Forms.Button();
this.helpButton = new System.Windows.Forms.Button();
@ -173,150 +163,187 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -173,150 +163,187 @@ namespace ICSharpCode.SharpDevelop.Gui
//
// referenceTabControl
//
this.referenceTabControl.Controls.AddRange(new System.Windows.Forms.Control[] {
this.gacTabPage,
this.projectTabPage,
this.browserTabPage,
this.comTabPage
});
this.referenceTabControl.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.referenceTabControl.Controls.Add(this.gacTabPage);
this.referenceTabControl.Controls.Add(this.projectTabPage);
this.referenceTabControl.Controls.Add(this.browserTabPage);
this.referenceTabControl.Controls.Add(this.comTabPage);
this.referenceTabControl.Location = new System.Drawing.Point(8, 8);
this.referenceTabControl.Name = "referenceTabControl";
this.referenceTabControl.SelectedIndex = 0;
this.referenceTabControl.Size = new System.Drawing.Size(472, 224);
this.referenceTabControl.TabIndex = 0;
//
// referencesListView
//
this.referencesListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.referenceHeader,
this.typeHeader,
this.locationHeader});
this.referencesListView.Location = new System.Drawing.Point(8, 256);
this.referencesListView.Size = new System.Drawing.Size(472, 97);
this.referencesListView.TabIndex = 3;
this.referencesListView.View = System.Windows.Forms.View.Details;
this.referencesListView.FullRowSelect = true;
//
// selectButton
//
this.selectButton.Location = new System.Drawing.Point(488, 32);
this.selectButton.TabIndex = 1;
this.selectButton.Text = ResourceService.GetString("Dialog.SelectReferenceDialog.SelectButton");
this.selectButton.Click += new EventHandler(SelectReference);
this.selectButton.FlatStyle = FlatStyle.System;
//
// removeButton
//
this.removeButton.Location = new System.Drawing.Point(488, 256);
this.removeButton.TabIndex = 4;
this.removeButton.Text = ResourceService.GetString("Global.RemoveButtonText");
this.removeButton.Click += new EventHandler(RemoveReference);
this.removeButton.FlatStyle = FlatStyle.System;
//
// gacTabPage
//
this.gacTabPage.Location = new System.Drawing.Point(4, 22);
this.gacTabPage.Name = "gacTabPage";
this.gacTabPage.Size = new System.Drawing.Size(464, 198);
this.gacTabPage.TabIndex = 0;
this.gacTabPage.Text = ResourceService.GetString("Dialog.SelectReferenceDialog.GacTabPage");
this.gacTabPage.Text = "${res:Dialog.SelectReferenceDialog.GacTabPage}";
this.gacTabPage.UseVisualStyleBackColor = true;
//
// projectTabPage
//
this.projectTabPage.Location = new System.Drawing.Point(4, 22);
this.projectTabPage.Name = "projectTabPage";
this.projectTabPage.Size = new System.Drawing.Size(464, 198);
this.projectTabPage.TabIndex = 1;
this.projectTabPage.Text = ResourceService.GetString("Dialog.SelectReferenceDialog.ProjectTabPage");
this.projectTabPage.Text = "${res:Dialog.SelectReferenceDialog.ProjectTabPage}";
this.projectTabPage.UseVisualStyleBackColor = true;
//
// browserTabPage
//
this.browserTabPage.Location = new System.Drawing.Point(4, 22);
this.browserTabPage.Name = "browserTabPage";
this.browserTabPage.Size = new System.Drawing.Size(464, 198);
this.browserTabPage.TabIndex = 2;
this.browserTabPage.Text = ResourceService.GetString("Dialog.SelectReferenceDialog.BrowserTabPage");
this.browserTabPage.Text = "${res:Dialog.SelectReferenceDialog.BrowserTabPage}";
this.browserTabPage.UseVisualStyleBackColor = true;
//
// comTabPage
//
this.comTabPage.Location = new System.Drawing.Point(4, 22);
this.comTabPage.Name = "comTabPage";
this.comTabPage.Size = new System.Drawing.Size(464, 198);
this.comTabPage.TabIndex = 2;
this.comTabPage.Text = "COM";
this.comTabPage.UseVisualStyleBackColor = true;
//
// referencesLabel
//
this.referencesLabel.Location = new System.Drawing.Point(8, 240);
this.referencesLabel.Size = new System.Drawing.Size(472, 16);
this.referencesLabel.TabIndex = 2;
this.referencesLabel.Text = ResourceService.GetString("Dialog.SelectReferenceDialog.ReferencesLabel");
// referencesListView
//
this.referencesListView.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.referencesListView.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.referenceHeader,
this.typeHeader,
this.locationHeader});
this.referencesListView.FullRowSelect = true;
this.referencesListView.Location = new System.Drawing.Point(8, 265);
this.referencesListView.Name = "referencesListView";
this.referencesListView.Size = new System.Drawing.Size(472, 97);
this.referencesListView.TabIndex = 3;
this.referencesListView.UseCompatibleStateImageBehavior = false;
this.referencesListView.View = System.Windows.Forms.View.Details;
//
// referenceHeader
//
this.referenceHeader.Text = ResourceService.GetString("Dialog.SelectReferenceDialog.ReferenceHeader");
this.referenceHeader.Text = "${res:Dialog.SelectReferenceDialog.ReferenceHeader}";
this.referenceHeader.Width = 183;
//
// typeHeader
//
this.typeHeader.Text = ResourceService.GetString("Dialog.SelectReferenceDialog.TypeHeader");
this.typeHeader.Text = "${res:Dialog.SelectReferenceDialog.TypeHeader}";
this.typeHeader.Width = 57;
//
// locationHeader
//
this.locationHeader.Text = ResourceService.GetString("Dialog.SelectReferenceDialog.LocationHeader");
this.locationHeader.Text = "${res:Dialog.SelectReferenceDialog.LocationHeader}";
this.locationHeader.Width = 228;
//
// selectButton
//
this.selectButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.selectButton.Location = new System.Drawing.Point(488, 32);
this.selectButton.Name = "selectButton";
this.selectButton.Size = new System.Drawing.Size(75, 23);
this.selectButton.TabIndex = 1;
this.selectButton.Text = "${res:Dialog.SelectReferenceDialog.SelectButton}";
//
// removeButton
//
this.removeButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.removeButton.Location = new System.Drawing.Point(488, 256);
this.removeButton.Name = "removeButton";
this.removeButton.Size = new System.Drawing.Size(75, 23);
this.removeButton.TabIndex = 4;
this.removeButton.Text = "${res:Global.RemoveButtonText}";
//
// referencesLabel
//
this.referencesLabel.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.referencesLabel.Location = new System.Drawing.Point(8, 240);
this.referencesLabel.Name = "referencesLabel";
this.referencesLabel.Size = new System.Drawing.Size(472, 16);
this.referencesLabel.TabIndex = 2;
this.referencesLabel.Text = "${res:Dialog.SelectReferenceDialog.ReferencesLabel}";
//
// okButton
//
this.okButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.okButton.DialogResult = System.Windows.Forms.DialogResult.OK;
this.okButton.Location = new System.Drawing.Point(312, 368);
this.okButton.Location = new System.Drawing.Point(395, 368);
this.okButton.Name = "okButton";
this.okButton.Size = new System.Drawing.Size(75, 23);
this.okButton.TabIndex = 5;
this.okButton.Text = ResourceService.GetString("Global.OKButtonText");
this.okButton.Click += OkButtonClick;
this.okButton.Text = "${res:Global.OKButtonText}";
//
// cancelButton
//
this.cancelButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.cancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.cancelButton.Location = new System.Drawing.Point(400, 368);
this.cancelButton.Location = new System.Drawing.Point(483, 368);
this.cancelButton.Name = "cancelButton";
this.cancelButton.Size = new System.Drawing.Size(75, 23);
this.cancelButton.TabIndex = 6;
this.cancelButton.Text = ResourceService.GetString("Global.CancelButtonText");
this.cancelButton.FlatStyle = FlatStyle.System;
//
this.cancelButton.Text = "${res:Global.CancelButtonText}";
//
// helpButton
//
this.helpButton.Location = new System.Drawing.Point(488, 368);
this.helpButton.Location = new System.Drawing.Point(140, 368);
this.helpButton.Name = "helpButton";
this.helpButton.Size = new System.Drawing.Size(75, 23);
this.helpButton.TabIndex = 7;
this.helpButton.Text = ResourceService.GetString("Global.HelpButtonText");
this.helpButton.FlatStyle = FlatStyle.System;
//
this.helpButton.Text = "${res:Global.HelpButtonText}";
this.helpButton.Visible = false;
//
// SelectReferenceDialog
//
this.AcceptButton = this.okButton;
// this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.CancelButton = this.cancelButton;
this.ClientSize = new System.Drawing.Size(570, 399);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.helpButton,
this.cancelButton,
this.okButton,
this.referencesLabel,
this.removeButton,
this.selectButton,
this.referencesListView,
this.referenceTabControl});
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.Controls.Add(this.helpButton);
this.Controls.Add(this.cancelButton);
this.Controls.Add(this.okButton);
this.Controls.Add(this.referencesLabel);
this.Controls.Add(this.removeButton);
this.Controls.Add(this.selectButton);
this.Controls.Add(this.referencesListView);
this.Controls.Add(this.referenceTabControl);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.MinimumSize = new System.Drawing.Size(280, 350);
this.Name = "SelectReferenceDialog";
this.ShowInTaskbar = false;
this.Text = ResourceService.GetString("Dialog.SelectReferenceDialog.DialogName");
this.Text = "${res:Dialog.SelectReferenceDialog.DialogName}";
this.referenceTabControl.ResumeLayout(false);
this.ResumeLayout(false);
}
}
public interface IReferencePanel
{
void AddReference();
}
public interface ISelectReferenceDialog
{
/// <summary>
/// Project to create references for.
/// </summary>
IProject ConfigureProject { get; }
void AddReference(string referenceName, string referenceType, string referenceLocation, ReferenceProjectItem projectItem);
}
public enum ReferenceType {
Assembly,
Typelib,
Gac,
Project
}
}

11
src/Main/Base/Project/Src/Gui/Pads/ClassBrowser/ClassBrowser.cs

@ -105,18 +105,17 @@ namespace ICSharpCode.SharpDevelop.Gui.ClassBrowser @@ -105,18 +105,17 @@ namespace ICSharpCode.SharpDevelop.Gui.ClassBrowser
UpdateToolbars();
}
List<ICompilationUnit[]> pending = new List<ICompilationUnit[]> ();
List<ParseInformationEventArgs> pending = new List<ParseInformationEventArgs>();
// running on main thread, invoked by the parser thread when a compilation unit changed
void UpdateThread()
{
lock (pending) {
foreach (ICompilationUnit[] units in pending) {
ICompilationUnit nonNullUnit = units[1] ?? units[0];
foreach (ParseInformationEventArgs e in pending) {
foreach (TreeNode node in classBrowserTreeView.Nodes) {
AbstractProjectNode prjNode = node as AbstractProjectNode;
if (prjNode != null && prjNode.Project.IsFileInProject(nonNullUnit.FileName)) {
prjNode.UpdateParseInformation(units[0], units[1]);
if (e.ProjectContent.Project == prjNode.Project) {
prjNode.UpdateParseInformation(e.OldCompilationUnit, e.NewCompilationUnit);
}
}
}
@ -127,7 +126,7 @@ namespace ICSharpCode.SharpDevelop.Gui.ClassBrowser @@ -127,7 +126,7 @@ namespace ICSharpCode.SharpDevelop.Gui.ClassBrowser
public void ParserServiceParseInformationUpdated(object sender, ParseInformationEventArgs e)
{
lock (pending) {
pending.Add(new ICompilationUnit[] { e.OldCompilationUnit, e.NewCompilationUnit});
pending.Add(e);
}
WorkbenchSingleton.SafeThreadAsyncCall(UpdateThread);
}

2
src/Main/Base/Project/Src/Gui/Pads/ClassBrowser/Nodes/ClassNode.cs

@ -33,7 +33,7 @@ namespace ICSharpCode.SharpDevelop.Gui.ClassBrowser @@ -33,7 +33,7 @@ namespace ICSharpCode.SharpDevelop.Gui.ClassBrowser
internal static string GetText(IClass c)
{
if (ICSharpCode.Core.PropertyService.Initialized) {
IAmbience ambience = AmbienceService.CurrentAmbience;
IAmbience ambience = c.ProjectContent.Language.GetAmbience();
ambience.ConversionFlags = ConversionFlags.ShowTypeParameterList;
return ambience.Convert(c);
} else {

27
src/Main/Base/Project/Src/Gui/Pads/ClassBrowser/Nodes/ProjectNode.cs

@ -41,20 +41,20 @@ namespace ICSharpCode.SharpDevelop.Gui.ClassBrowser @@ -41,20 +41,20 @@ namespace ICSharpCode.SharpDevelop.Gui.ClassBrowser
if (oldUnit != null) {
foreach (IClass c in oldUnit.Classes) {
classDictionary[c.FullyQualifiedName] = c.GetCompoundClass();
wasUpdatedDictionary[c.FullyQualifiedName] = false;
classDictionary[c.DotNetName] = c.GetCompoundClass();
wasUpdatedDictionary[c.DotNetName] = false;
}
}
if (unit != null) {
foreach (IClass c in unit.Classes) {
TreeNode path = GetNodeByPath(c.Namespace, true);
ClassNode node = GetNodeByName(path.Nodes, c.Name) as ClassNode;
ClassNode node = GetNodeByClass(path.Nodes, c);
if (node != null) {
node.Class = c.GetCompoundClass();
} else {
new ClassNode(Project, c.GetCompoundClass()).AddTo(path);
}
wasUpdatedDictionary[c.FullyQualifiedName] = true;
wasUpdatedDictionary[c.DotNetName] = true;
}
}
foreach (KeyValuePair<string, bool> entry in wasUpdatedDictionary) {
@ -62,7 +62,7 @@ namespace ICSharpCode.SharpDevelop.Gui.ClassBrowser @@ -62,7 +62,7 @@ namespace ICSharpCode.SharpDevelop.Gui.ClassBrowser
IClass c = classDictionary[entry.Key];
TreeNode path = GetNodeByPath(c.Namespace, true);
ClassNode node = GetNodeByName(path.Nodes, c.Name) as ClassNode;
ClassNode node = GetNodeByClass(path.Nodes, c);
if (node != null) {
CompoundClass cc = c as CompoundClass;
@ -99,7 +99,7 @@ namespace ICSharpCode.SharpDevelop.Gui.ClassBrowser @@ -99,7 +99,7 @@ namespace ICSharpCode.SharpDevelop.Gui.ClassBrowser
foreach (ProjectItem item in Project.GetItemsOfType(ItemType.Compile)) {
ParseInformation parseInformation = ParserService.GetParseInformation(item.FileName);
if (parseInformation != null) {
InsertParseInformation(parseInformation.BestCompilationUnit as ICompilationUnit);
InsertParseInformation(parseInformation.BestCompilationUnit);
}
}
}
@ -109,7 +109,7 @@ namespace ICSharpCode.SharpDevelop.Gui.ClassBrowser @@ -109,7 +109,7 @@ namespace ICSharpCode.SharpDevelop.Gui.ClassBrowser
{
foreach (IClass c in unit.Classes) {
TreeNode path = GetNodeByPath(c.Namespace, true);
TreeNode node = GetNodeByName(path.Nodes, c.Name);
TreeNode node = GetNodeByClass(path.Nodes, c);
if (node == null) {
new ClassNode(Project, c.GetCompoundClass()).AddTo(path);
}
@ -172,5 +172,18 @@ namespace ICSharpCode.SharpDevelop.Gui.ClassBrowser @@ -172,5 +172,18 @@ namespace ICSharpCode.SharpDevelop.Gui.ClassBrowser
}
return null;
}
static ClassNode GetNodeByClass(TreeNodeCollection collection, IClass c)
{
string fullyQualifiedName = c.FullyQualifiedName;
foreach (TreeNode node in collection) {
ClassNode cn = node as ClassNode;
if (cn != null) {
if (fullyQualifiedName == cn.Class.FullyQualifiedName && c.TypeParameters.Count == cn.Class.TypeParameters.Count)
return cn;
}
}
return null;
}
}
}

10
src/Main/Base/Project/Src/Project/AbstractProject.cs

@ -159,7 +159,7 @@ namespace ICSharpCode.SharpDevelop.Project @@ -159,7 +159,7 @@ namespace ICSharpCode.SharpDevelop.Project
}
#endregion
#region Language Properties / Ambience
#region Language Properties / GetAmbience
[Browsable(false)]
public virtual ICSharpCode.SharpDevelop.Dom.LanguageProperties LanguageProperties {
get {
@ -167,11 +167,9 @@ namespace ICSharpCode.SharpDevelop.Project @@ -167,11 +167,9 @@ namespace ICSharpCode.SharpDevelop.Project
}
}
[Browsable(false)]
public virtual ICSharpCode.SharpDevelop.Dom.IAmbience Ambience {
get {
return null;
}
public virtual ICSharpCode.SharpDevelop.Dom.IAmbience GetAmbience()
{
return null;
}
#endregion

5
src/Main/Base/Project/Src/Project/IProject.cs

@ -68,10 +68,9 @@ namespace ICSharpCode.SharpDevelop.Project @@ -68,10 +68,9 @@ namespace ICSharpCode.SharpDevelop.Project
/// <summary>
/// Gets the ambience used for the project. This member is thread-safe.
/// Because the IAmbience interface is not thread-safe, every call returns a new instance.
/// </summary>
ICSharpCode.SharpDevelop.Dom.IAmbience Ambience {
get;
}
ICSharpCode.SharpDevelop.Dom.IAmbience GetAmbience();
/// <summary>
/// Gets the name of the project file.

97
src/Main/Base/Project/Src/Services/AmbienceService/AmbienceReflectionDecorator.cs

@ -1,97 +0,0 @@ @@ -1,97 +0,0 @@
// <file>
// <copyright see="prj:///doc/copyright.txt"/>
// <license see="prj:///doc/license.txt"/>
// <owner name="Mike Krüger" email="mike@icsharpcode.net"/>
// <version>$Revision$</version>
// </file>
using System;
using ICSharpCode.SharpDevelop.Dom;
namespace ICSharpCode.SharpDevelop
{
/// <summary>
/// This class wraps a ILanguageConversion to System.Reflection
/// </summary>
public class AmbienceReflectionDecorator : IAmbience
{
IAmbience conv;
public ConversionFlags ConversionFlags {
get {
return conv.ConversionFlags;
}
set {
conv.ConversionFlags = value;
}
}
public string Convert(IClass c)
{
return conv.Convert(c);
}
public string ConvertEnd(IClass c)
{
return conv.ConvertEnd(c);
}
public string Convert(IField field)
{
return conv.Convert(field);
}
public string Convert(IProperty property)
{
return conv.Convert(property);
}
public string Convert(IEvent e)
{
return conv.Convert(e);
}
public string Convert(IMethod m)
{
return conv.Convert(m);
}
public string ConvertEnd(IMethod m)
{
return conv.ConvertEnd(m);
}
public string Convert(IParameter param)
{
return conv.Convert(param);
}
public string Convert(IReturnType returnType)
{
return conv.Convert(returnType);
}
public AmbienceReflectionDecorator(IAmbience conv)
{
if (conv == null) {
throw new System.ArgumentNullException("conv");
}
this.conv = conv;
}
public string WrapAttribute(string attribute)
{
return conv.WrapAttribute(attribute);
}
public string WrapComment(string comment)
{
return conv.WrapComment(comment);
}
public string GetIntrinsicTypeName(string dotNetTypeName)
{
return conv.GetIntrinsicTypeName(dotNetTypeName);
}
}
}

15
src/Main/Base/Project/Src/Services/AmbienceService/AmbienceService.cs

@ -75,27 +75,22 @@ namespace ICSharpCode.SharpDevelop @@ -75,27 +75,22 @@ namespace ICSharpCode.SharpDevelop
}
}
static AmbienceReflectionDecorator defaultAmbience;
static IAmbience defaultAmbience;
public static AmbienceReflectionDecorator CurrentAmbience {
public static IAmbience CurrentAmbience {
get {
if (UseProjectAmbienceIfPossible) {
ICSharpCode.SharpDevelop.Project.IProject p = ICSharpCode.SharpDevelop.Project.ProjectService.CurrentProject;
if (p != null) {
IAmbience ambience = p.Ambience;
if (ambience != null) {
return new AmbienceReflectionDecorator(ambience);
}
return p.GetAmbience();
}
}
if (defaultAmbience == null) {
string language = DefaultAmbienceName;
IAmbience ambience = (IAmbience)AddInTree.BuildItem("/SharpDevelop/Workbench/Ambiences/" + language, null);
if (ambience == null) {
defaultAmbience = (IAmbience)AddInTree.BuildItem("/SharpDevelop/Workbench/Ambiences/" + language, null);
if (defaultAmbience == null) {
MessageService.ShowError("${res:ICSharpCode.SharpDevelop.Services.AmbienceService.AmbienceNotFoundError}");
return null;
}
defaultAmbience = new AmbienceReflectionDecorator(ambience);
}
return defaultAmbience;
}

20
src/Main/Base/Project/Src/Services/ParserService/ParseInformationEventHandler.cs

@ -15,36 +15,36 @@ namespace ICSharpCode.SharpDevelop @@ -15,36 +15,36 @@ namespace ICSharpCode.SharpDevelop
public class ParseInformationEventArgs : EventArgs
{
string fileName;
IProjectContent projectContent;
ICompilationUnit oldCompilationUnit;
ICompilationUnit newCompilationUnit;
public string FileName {
get {
return fileName;
}
get { return fileName; }
}
public IProjectContent ProjectContent {
get { return projectContent; }
}
/// <summary>
/// Gets the old compilation unit.
/// </summary>
public ICompilationUnit OldCompilationUnit {
get {
return oldCompilationUnit;
}
get { return oldCompilationUnit; }
}
/// <summary>
/// The new compilation unit.
/// </summary>
public ICompilationUnit NewCompilationUnit {
get {
return newCompilationUnit;
}
get { return newCompilationUnit; }
}
public ParseInformationEventArgs(string fileName, ICompilationUnit oldCompilationUnit, ICompilationUnit newCompilationUnit)
public ParseInformationEventArgs(string fileName, IProjectContent projectContent, ICompilationUnit oldCompilationUnit, ICompilationUnit newCompilationUnit)
{
this.fileName = fileName;
this.projectContent = projectContent;
this.oldCompilationUnit = oldCompilationUnit;
this.newCompilationUnit = newCompilationUnit;
}

14
src/Main/Base/Project/Src/Services/ParserService/ParserService.cs

@ -593,7 +593,7 @@ namespace ICSharpCode.SharpDevelop @@ -593,7 +593,7 @@ namespace ICSharpCode.SharpDevelop
TaskService.UpdateCommentTags(fileName, parserOutput.TagComments);
}
try {
OnParseInformationUpdated(new ParseInformationEventArgs(fileName, oldUnit, parserOutput));
OnParseInformationUpdated(new ParseInformationEventArgs(fileName, fileProjectContent, oldUnit, parserOutput));
} catch (Exception e) {
MessageService.ShowError(e);
}
@ -643,7 +643,8 @@ namespace ICSharpCode.SharpDevelop @@ -643,7 +643,8 @@ namespace ICSharpCode.SharpDevelop
}
/// <summary>
/// Registers a compilation unit in the parser service. Used by unit tests.
/// Registers a compilation unit in the parser service.
/// Does not fire the OnParseInformationUpdated event, please use this for unit tests only!
/// </summary>
public static ParseInformation RegisterParseInformation(string fileName, ICompilationUnit cu)
{
@ -672,9 +673,14 @@ namespace ICSharpCode.SharpDevelop @@ -672,9 +673,14 @@ namespace ICSharpCode.SharpDevelop
}
ICompilationUnit oldUnit = parseInfo.MostRecentCompilationUnit;
if (oldUnit != null) {
parseInfo.MostRecentCompilationUnit.ProjectContent.RemoveCompilationUnit(oldUnit);
IProjectContent pc = parseInfo.MostRecentCompilationUnit.ProjectContent;
pc.RemoveCompilationUnit(oldUnit);
try {
OnParseInformationUpdated(new ParseInformationEventArgs(fileName, pc, oldUnit, null));
} catch (Exception e) {
MessageService.ShowError(e);
}
}
OnParseInformationUpdated(new ParseInformationEventArgs(fileName, oldUnit, null));
}
public static IExpressionFinder GetExpressionFinder(string fileName)

2
src/Main/Base/Test/GenericResolverTests.cs

@ -361,7 +361,7 @@ class D : Program { @@ -361,7 +361,7 @@ class D : Program {
// overrides T<A,B> - type arguments are identified by position
}
}";
IAmbience ambience = Dom.CSharp.CSharpAmbience.Instance;
IAmbience ambience = new Dom.CSharp.CSharpAmbience();
ambience.ConversionFlags = ConversionFlags.UseFullyQualifiedMemberNames | ConversionFlags.ShowTypeParameterList;
MemberResolveResult mrr;

7
src/Main/Base/Test/Utils/MockProject.cs

@ -21,10 +21,9 @@ namespace ICSharpCode.SharpDevelop.Tests.Utils @@ -21,10 +21,9 @@ namespace ICSharpCode.SharpDevelop.Tests.Utils
{
}
public override IAmbience Ambience {
get {
return new MockAmbience();
}
public override IAmbience GetAmbience()
{
return null;
}
}
}

13
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/Ambience.cs

@ -105,6 +105,19 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -105,6 +105,19 @@ namespace ICSharpCode.SharpDevelop.Dom
public abstract class AbstractAmbience : IAmbience
{
#if DEBUG
int ownerThread = System.Threading.Thread.CurrentThread.ManagedThreadId;
#endif
[System.Diagnostics.Conditional("DEBUG")]
protected void CheckThread()
{
#if DEBUG
if (ownerThread != System.Threading.Thread.CurrentThread.ManagedThreadId)
throw new Exception("Ambience may only be used by the thread that created it");
#endif
}
ConversionFlags conversionFlags = ConversionFlags.StandardConversionFlags;
public ConversionFlags ConversionFlags {

20
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/CSharp/CSharpAmbience.cs

@ -19,12 +19,6 @@ namespace ICSharpCode.SharpDevelop.Dom.CSharp @@ -19,12 +19,6 @@ namespace ICSharpCode.SharpDevelop.Dom.CSharp
get { return ICSharpCode.NRefactory.Ast.TypeReference.PrimitiveTypesCSharpReverse; }
}
static CSharpAmbience instance = new CSharpAmbience();
public static CSharpAmbience Instance {
get { return instance; }
}
bool ModifierIsSet(ModifierEnum modifier, ModifierEnum query)
{
return (modifier & query) == query;
@ -79,6 +73,8 @@ namespace ICSharpCode.SharpDevelop.Dom.CSharp @@ -79,6 +73,8 @@ namespace ICSharpCode.SharpDevelop.Dom.CSharp
public override string Convert(IClass c)
{
CheckThread();
StringBuilder builder = new StringBuilder();
builder.Append(ConvertAccessibility(c.Modifiers));
@ -210,6 +206,8 @@ namespace ICSharpCode.SharpDevelop.Dom.CSharp @@ -210,6 +206,8 @@ namespace ICSharpCode.SharpDevelop.Dom.CSharp
public override string Convert(IField field)
{
CheckThread();
StringBuilder builder = new StringBuilder();
builder.Append(ConvertAccessibility(field.Modifiers));
@ -266,6 +264,8 @@ namespace ICSharpCode.SharpDevelop.Dom.CSharp @@ -266,6 +264,8 @@ namespace ICSharpCode.SharpDevelop.Dom.CSharp
public override string Convert(IProperty property)
{
CheckThread();
StringBuilder builder = new StringBuilder();
builder.Append(ConvertAccessibility(property.Modifiers));
@ -333,6 +333,8 @@ namespace ICSharpCode.SharpDevelop.Dom.CSharp @@ -333,6 +333,8 @@ namespace ICSharpCode.SharpDevelop.Dom.CSharp
public override string Convert(IEvent e)
{
CheckThread();
StringBuilder builder = new StringBuilder();
builder.Append(ConvertAccessibility(e.Modifiers));
@ -371,6 +373,8 @@ namespace ICSharpCode.SharpDevelop.Dom.CSharp @@ -371,6 +373,8 @@ namespace ICSharpCode.SharpDevelop.Dom.CSharp
public override string Convert(IMethod m)
{
CheckThread();
StringBuilder builder = new StringBuilder();
builder.Append(ConvertAccessibility(m.Modifiers));
@ -453,6 +457,8 @@ namespace ICSharpCode.SharpDevelop.Dom.CSharp @@ -453,6 +457,8 @@ namespace ICSharpCode.SharpDevelop.Dom.CSharp
public override string Convert(IReturnType returnType)
{
CheckThread();
if (returnType == null) {
return String.Empty;
}
@ -499,6 +505,8 @@ namespace ICSharpCode.SharpDevelop.Dom.CSharp @@ -499,6 +505,8 @@ namespace ICSharpCode.SharpDevelop.Dom.CSharp
public override string Convert(IParameter param)
{
CheckThread();
StringBuilder builder = new StringBuilder();
if (IncludeHtmlMarkup) {

14
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/LanguageProperties.cs

@ -56,6 +56,15 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -56,6 +56,15 @@ namespace ICSharpCode.SharpDevelop.Dom
}
}
/// <summary>
/// Gets the ambience for this language. Because the IAmbience interface is not thread-safe, every call
/// creates a new instance.
/// </summary>
public virtual IAmbience GetAmbience()
{
return new CSharp.CSharpAmbience();
}
/// <summary>
/// Gets the CodeDomProvider for this language. Can return null!
/// </summary>
@ -375,6 +384,11 @@ namespace ICSharpCode.SharpDevelop.Dom @@ -375,6 +384,11 @@ namespace ICSharpCode.SharpDevelop.Dom
}
}
public override IAmbience GetAmbience()
{
return new VBNet.VBNetAmbience();
}
public override string IndexerExpressionStartToken {
get { return "("; }
}

20
src/Main/ICSharpCode.SharpDevelop.Dom/Project/Src/VBNet/VBNetAmbience.cs

@ -18,12 +18,6 @@ namespace ICSharpCode.SharpDevelop.Dom.VBNet @@ -18,12 +18,6 @@ namespace ICSharpCode.SharpDevelop.Dom.VBNet
get { return ICSharpCode.NRefactory.Ast.TypeReference.PrimitiveTypesVBReverse; }
}
static VBNetAmbience instance = new VBNetAmbience();
public static VBNetAmbience Instance {
get { return instance; }
}
string GetModifier(IEntity decoration)
{
StringBuilder builder = new StringBuilder();
@ -78,6 +72,8 @@ namespace ICSharpCode.SharpDevelop.Dom.VBNet @@ -78,6 +72,8 @@ namespace ICSharpCode.SharpDevelop.Dom.VBNet
public override string Convert(IClass c)
{
CheckThread();
StringBuilder builder = new StringBuilder();
builder.Append(ConvertAccessibility(c.Modifiers));
@ -241,6 +237,8 @@ namespace ICSharpCode.SharpDevelop.Dom.VBNet @@ -241,6 +237,8 @@ namespace ICSharpCode.SharpDevelop.Dom.VBNet
public override string Convert(IField field)
{
CheckThread();
if (field == null)
throw new ArgumentNullException("field");
@ -285,6 +283,8 @@ namespace ICSharpCode.SharpDevelop.Dom.VBNet @@ -285,6 +283,8 @@ namespace ICSharpCode.SharpDevelop.Dom.VBNet
public override string Convert(IProperty property)
{
CheckThread();
StringBuilder builder = new StringBuilder();
builder.Append(ConvertAccessibility(property.Modifiers));
@ -348,6 +348,8 @@ namespace ICSharpCode.SharpDevelop.Dom.VBNet @@ -348,6 +348,8 @@ namespace ICSharpCode.SharpDevelop.Dom.VBNet
public override string Convert(IEvent e)
{
CheckThread();
if (e == null)
throw new ArgumentNullException("e");
@ -387,6 +389,8 @@ namespace ICSharpCode.SharpDevelop.Dom.VBNet @@ -387,6 +389,8 @@ namespace ICSharpCode.SharpDevelop.Dom.VBNet
public override string Convert(IMethod m)
{
CheckThread();
StringBuilder builder = new StringBuilder();
if (ShowModifiers && m.IsExtensionMethod) {
builder.Append("<Extension> ");
@ -467,6 +471,8 @@ namespace ICSharpCode.SharpDevelop.Dom.VBNet @@ -467,6 +471,8 @@ namespace ICSharpCode.SharpDevelop.Dom.VBNet
public override string Convert(IReturnType returnType)
{
CheckThread();
if (returnType == null) {
return String.Empty;
}
@ -513,6 +519,8 @@ namespace ICSharpCode.SharpDevelop.Dom.VBNet @@ -513,6 +519,8 @@ namespace ICSharpCode.SharpDevelop.Dom.VBNet
public override string Convert(IParameter param)
{
CheckThread();
if (param == null)
throw new ArgumentNullException("param");

Loading…
Cancel
Save