Browse Source

Sort ExtTreeView only when expanding a node for the first time instead of every time a node is expanded.

OverrideMethodsCodeGenerator now shows methods from base classes when the base class definition is in another part of the class.

git-svn-id: svn://svn.sharpdevelop.net/sharpdevelop/trunk@1076 1ccf3a8d-04fe-1044-b7c0-cef0b8235c61
shortcuts
Daniel Grunwald 20 years ago
parent
commit
7c58827869
  1. 4
      src/AddIns/Misc/UnitTesting/Src/TestTreeView.cs
  2. 4
      src/Libraries/NRefactory/NRefactory.sln
  3. 16
      src/Libraries/NRefactory/Test/General/UnitTest.cs
  4. 1
      src/Libraries/NRefactory/Test/Parser/Statements/LocalVariableDeclarationTests.cs
  5. 6
      src/Main/Base/Project/Src/Gui/Components/ExtTreeView/ExtTreeNode.cs
  6. 26
      src/Main/Base/Project/Src/Gui/Components/ExtTreeView/ExtTreeView.cs
  7. 2
      src/Main/Base/Project/Src/TextEditor/Commands/CodeGenerators/CodeGenerator.cs

4
src/AddIns/Misc/UnitTesting/Src/TestTreeView.cs

@ -345,13 +345,13 @@ namespace ICSharpCode.UnitTesting @@ -345,13 +345,13 @@ namespace ICSharpCode.UnitTesting
// solution node clicked, but has only 1 project
node = node.Nodes[0];
}
if (node.Level == 2 && node.Parent.Nodes.Count == 1) {
while (node.Level >= 2 && node.Parent.Nodes.Count == 1) {
// namespace node clicked, but project has only 1 namespace
node = node.Parent;
}
if (node.Level == 1) {
foreach (IProject p in ProjectService.OpenSolution.Projects) {
if (p.Name == node.Text) {
if (Path.GetFileNameWithoutExtension(p.OutputAssemblyFullPath) == node.Text) {
return p;
}
}

4
src/Libraries/NRefactory/NRefactory.sln

@ -1,11 +1,9 @@ @@ -1,11 +1,9 @@
Microsoft Visual Studio Solution File, Format Version 9.00
# SharpDevelop 2.0.0.973
# SharpDevelop 2.0.0.1073
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactory", "Project\NRefactory.csproj", "{3A9AE6AA-BC07-4A2F-972C-581E3AE2F195}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactoryTests", "Test\NRefactoryTests.csproj", "{870115DD-960A-4406-A6B9-600BCDC36A03}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "nunit.framework.dll", "..\NUnit.Framework\nunit.framework.dll.csproj", "{83DD7E12-A705-4DBA-9D71-09C8973D9382}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NRefactoryASTGenerator", "NRefactoryASTGenerator\NRefactoryASTGenerator.csproj", "{B22522AA-B5BF-4A58-AC6D-D4B45805521F}"
EndProject
Global

16
src/Libraries/NRefactory/Test/General/UnitTest.cs

@ -84,21 +84,5 @@ namespace ICSharpCode.NRefactory.Tests @@ -84,21 +84,5 @@ namespace ICSharpCode.NRefactory.Tests
}
}
}
[Test]
public void TestIfINode()
{
Type[] allTypes = typeof(INode).Assembly.GetTypes();
foreach (Type type in allTypes) {
if (!type.IsInterface &&
!type.IsEnum &&
(type.BaseType == typeof(System.Delegate)) &&
(type.GetInterface(typeof(IAstVisitor).FullName) == null) &&
(type.FullName != "ICSharpCode.NRefactory.Parser.Error") &&
(type.FullName != "ICSharpCode.NRefactory.Tests.StructuralTest")) {
Assert.IsNotNull(type.GetInterface(typeof(INode).FullName), type.FullName + " is not INode");
}
}
}
}
}

1
src/Libraries/NRefactory/Test/Parser/Statements/LocalVariableDeclarationTests.cs

@ -211,6 +211,7 @@ namespace ICSharpCode.NRefactory.Tests.AST @@ -211,6 +211,7 @@ namespace ICSharpCode.NRefactory.Tests.AST
Assert.AreEqual(5, ((PrimitiveExpression)lvd.Variables[0].Initializer).Value);
}
[Test]
public void VBNetLocalVariableNamedOverrideDeclarationTest()
{
LocalVariableDeclaration lvd = ParseUtilVBNet.ParseStatement<LocalVariableDeclaration>("Dim override As Integer = 5");

6
src/Main/Base/Project/Src/Gui/Components/ExtTreeView/ExtTreeNode.cs

@ -20,6 +20,12 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -20,6 +20,12 @@ namespace ICSharpCode.SharpDevelop.Gui
protected bool isInitialized = false;
string image = null;
internal bool IsInitialized {
get {
return isInitialized;
}
}
public virtual string ContextmenuAddinTreePath {
get {
return contextmenuAddinTreePath;

26
src/Main/Base/Project/Src/Gui/Components/ExtTreeView/ExtTreeView.cs

@ -175,35 +175,45 @@ namespace ICSharpCode.SharpDevelop.Gui @@ -175,35 +175,45 @@ namespace ICSharpCode.SharpDevelop.Gui
SortNodes((parent == null) ? Nodes : parent.Nodes, false);
}
#endregion
bool inRefresh = false;
bool inRefresh;
protected override void OnBeforeExpand(TreeViewCancelEventArgs e)
{
base.OnBeforeExpand(e);
if (e.Node == null)
return;
inRefresh = true;
BeginUpdate();
try {
if (e.Node is ExtTreeNode) {
if (((ExtTreeNode)e.Node).IsInitialized == false) {
if (!inRefresh) {
inRefresh = true;
BeginUpdate();
}
}
((ExtTreeNode)e.Node).Expanding();
}
SortNodes(e.Node.Nodes, false);
if (inRefresh) {
SortNodes(e.Node.Nodes, false);
}
} catch (Exception ex) {
// catch error to prevent corrupting the TreeView component
MessageService.ShowError(ex);
}
if (e.Node.Nodes.Count == 0) {
// when the node's subnodes have been removed by Expanding, AfterExpand is not called
inRefresh = false;
EndUpdate();
if (inRefresh) {
inRefresh = false;
EndUpdate();
}
}
}
protected override void OnAfterExpand(TreeViewEventArgs e)
{
base.OnAfterExpand(e);
inRefresh = false;
EndUpdate();
if (inRefresh) {
inRefresh = false;
EndUpdate();
}
}

2
src/Main/Base/Project/Src/TextEditor/Commands/CodeGenerators/CodeGenerator.cs

@ -27,7 +27,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Commands @@ -27,7 +27,7 @@ namespace ICSharpCode.SharpDevelop.DefaultEditor.Commands
public void Initialize(IClass currentClass)
{
this.currentClass = currentClass;
this.currentClass = currentClass.DefaultReturnType.GetUnderlyingClass();
this.codeGen = currentClass.ProjectContent.Language.CodeGenerator;
this.classFinderContext = new ClassFinder(currentClass, currentClass.Region.BeginLine + 1, 0);
this.InitContent();

Loading…
Cancel
Save