Skip to content

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
wieslawsoltes committed Oct 3, 2013
1 parent 8cf4921 commit 03104a5
Showing 1 changed file with 13 additions and 22 deletions.
35 changes: 13 additions & 22 deletions CanvasDiagram.Editor/TreeEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -258,45 +258,36 @@ public static void AddDiagram(ITreeItem project,

public static void DeleteSolution(ITreeItem solution)
{
var tree = solution.GetParent() as ITree;
var projects = solution.GetItems().ToList();
foreach (var project in solution.GetItems().ToList())
DeleteProject(solution, project);

foreach (var project in projects)
{
var diagrams = project.GetItems().ToList();

foreach (var diagram in diagrams)
project.Remove(diagram);
(solution.GetParent() as ITree).Remove(solution as ITreeItem);
}

solution.Remove(project);
}
public static void DeleteProject(ITreeItem solution, ITreeItem project)
{
foreach (var diagram in project.GetItems().ToList())
project.Remove(diagram);

tree.Remove(solution as ITreeItem);
solution.Remove(project);
}

public static void DeleteProject(ITreeItem project)
{
var solution = project.GetParent() as ITreeItem;
var diagrams = project.GetItems().ToList();

foreach (var diagram in diagrams)
foreach (var diagram in project.GetItems().ToList())
project.Remove(diagram);

solution.Remove(project);
(project.GetParent() as ITreeItem).Remove(project);
}

public static void DeleteDiagram(ITreeItem diagram)
{
var project = diagram.GetParent() as ITreeItem;

project.Remove(diagram);
(diagram.GetParent() as ITreeItem).Remove(diagram);
}

public static void Clear(ITree tree)
{
var items = tree.GetItems().ToList();

foreach (var item in items)
foreach (var item in tree.GetItems().ToList())
DeleteSolution(item);
}

Expand Down

0 comments on commit 03104a5

Please sign in to comment.