Commit 58365a89 authored by Ahmed Ashour's avatar Ahmed Ashour Committed by skylot

fix(gui): remove tree children expansions as well (PR #630)

parent 172f7f75
...@@ -78,13 +78,26 @@ public class JadxProject { ...@@ -78,13 +78,26 @@ public class JadxProject {
public void removeTreeExpansion(String[] expansion) { public void removeTreeExpansion(String[] expansion) {
for (Iterator<String[]> it = treeExpansions.iterator(); it.hasNext(); ) { for (Iterator<String[]> it = treeExpansions.iterator(); it.hasNext(); ) {
if (Arrays.equals(it.next(), expansion)) { if (isParentOfExpansion(expansion, it.next())) {
it.remove(); it.remove();
} }
} }
changed(); changed();
} }
private boolean isParentOfExpansion(String[] parent, String[] child) {
if (Arrays.equals(parent, child)) {
return true;
}
for (int i = child.length - parent.length; i > 0; i--) {
String[] arr = Arrays.copyOfRange(child, i, child.length);
if (Arrays.equals(parent, arr)) {
return true;
}
}
return false;
}
private void changed() { private void changed() {
if (settings.isAutoSaveProject()) { if (settings.isAutoSaveProject()) {
save(); save();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment