Skip to content

Commit

Permalink
Merge branch 'hotfix-1.0.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
jamierocks committed Sep 11, 2016
2 parents 708aa31 + 0381ce2 commit 72b9cf2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ defaultTasks 'clean', 'licenseFormat', 'build'
// Project information
allprojects {
group = 'blue.lapis.nocturne'
version = '1.0.3'
version = '1.0.4'

sourceCompatibility = '1.8'
targetCompatibility = '1.8'
Expand Down
31 changes: 22 additions & 9 deletions src/main/java/blue/lapis/nocturne/gui/MainController.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,13 +41,11 @@
import blue.lapis.nocturne.util.Constants;
import blue.lapis.nocturne.util.helper.PropertiesHelper;
import blue.lapis.nocturne.util.helper.SceneHelper;

import javafx.event.ActionEvent;
import javafx.fxml.FXMLLoader;
import javafx.fxml.Initializable;
import javafx.scene.Node;
import javafx.scene.control.Alert;
import javafx.scene.control.Dialog;
import javafx.scene.control.MenuItem;
import javafx.scene.control.RadioMenuItem;
import javafx.scene.control.TabPane;
Expand All @@ -67,7 +65,6 @@
import java.util.Optional;
import java.util.ResourceBundle;
import java.util.function.BiConsumer;
import java.util.stream.Collectors;

/**
* The main JavaFX controller.
Expand Down Expand Up @@ -266,7 +263,7 @@ public void onLanguageSelect(ActionEvent actionEvent) throws IOException {

public void updateObfuscatedClassListView() {
if (Main.getLoadedJar() != null) {
TreeItem<String> root = generateTreeItem(Main.getLoadedJar().getObfuscatedHierarchy());
TreeItem<String> root = generateTreeItem(Main.getLoadedJar().getObfuscatedHierarchy(), obfTree.getRoot());
root.setExpanded(true);
obfTree.setRoot(root);
} else {
Expand All @@ -277,15 +274,15 @@ public void updateObfuscatedClassListView() {

public void updateDeobfuscatedClassListView() {
if (Main.getLoadedJar() != null) {
TreeItem<String> root = generateTreeItem(Main.getLoadedJar().getDeobfuscatedHierarchy());
TreeItem<String> root = generateTreeItem(Main.getLoadedJar().getDeobfuscatedHierarchy(), deobfTree.getRoot());
root.setExpanded(true);
deobfTree.setRoot(root);
} else {
deobfTree.setRoot(null);
}
}

public TreeItem<String> generateTreeItem(HierarchyElement element) {
public TreeItem<String> generateTreeItem(HierarchyElement element, TreeItem<String> oldTreeItem) {
TreeItem<String> treeItem;
if (element instanceof HierarchyNode) {
HierarchyNode node = (HierarchyNode) element;
Expand All @@ -297,11 +294,27 @@ public TreeItem<String> generateTreeItem(HierarchyElement element) {
} else {
treeItem = new TreeItem<>("(root)");
}
if (oldTreeItem != null) {
treeItem.setExpanded(oldTreeItem.isExpanded());
}
if (element instanceof Hierarchy
|| (element instanceof HierarchyNode && !((HierarchyNode) element).isTerminal())) {
treeItem.getChildren().addAll(
element.getChildren().stream().map(this::generateTreeItem).collect(Collectors.toList())
);
for (HierarchyNode node : element.getChildren()) {
if (oldTreeItem != null) {
boolean added = false;
for (TreeItem<String> child : oldTreeItem.getChildren()) {
if (node.getDisplayName().equalsIgnoreCase(child.getValue())) {
treeItem.getChildren().add(this.generateTreeItem(node, child));
added = true;
}
}
if (!added) {
treeItem.getChildren().add(this.generateTreeItem(node, null));
}
} else {
treeItem.getChildren().add(this.generateTreeItem(node, null));
}
}
}
treeItem.getChildren().setAll(treeItem.getChildren().sorted((t1, t2) -> {
boolean c1 = t1.getChildren().size() > 0;
Expand Down

0 comments on commit 72b9cf2

Please sign in to comment.