Skip to content

Commit

Permalink
feature: new constructor SpoonModelTree(CtElement)
Browse files Browse the repository at this point in the history
  • Loading branch information
pvojtechovsky committed Nov 23, 2017
1 parent 8866f11 commit 68f00d6
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/main/java/spoon/support/gui/SpoonModelTree.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import javax.swing.tree.TreePath;

import spoon.Launcher;
import spoon.reflect.declaration.CtElement;
import spoon.reflect.factory.Factory;
import spoon.support.SerializationModelStreamer;

Expand Down Expand Up @@ -81,6 +82,15 @@ public SpoonModelTree(Factory factory) {
initialize();
}

public SpoonModelTree(CtElement rootElement) {
super();
SpoonTreeBuilder cst = new SpoonTreeBuilder();
cst.scan(rootElement);
this.factory = rootElement.getFactory();
root = cst.getRoot();
initialize();
}

/**
* This method initializes jContentPane
*
Expand Down

0 comments on commit 68f00d6

Please sign in to comment.