Skip to content

Commit

Permalink
Core Editor: Show "+" icon next to new elements
Browse files Browse the repository at this point in the history
  • Loading branch information
ShadelessFox committed Mar 14, 2024
1 parent a936346 commit f1d098e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ public BaseNodeCommand(@NotNull Tree tree, @NotNull CoreNodeObject node) {
public void redo() {
super.redo();

node.setState(CoreNodeObject.State.CHANGED);
if (node.getState() == CoreNodeObject.State.UNCHANGED) {
node.setState(CoreNodeObject.State.CHANGED);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import com.shade.decima.model.rtti.types.RTTITypeArray;
import com.shade.decima.ui.editor.core.CoreNodeObject;
import com.shade.platform.ui.controls.tree.Tree;
import com.shade.platform.ui.controls.tree.TreeNode;
import com.shade.util.NotNull;

import javax.swing.tree.TreePath;
Expand Down Expand Up @@ -60,7 +61,13 @@ private void perform(boolean redo) {
node.unloadChildren();
tree.getModel().fireStructureChanged(node);

final TreePath path = tree.getModel().getTreePathToRoot(tree.getModel().getChild(node, leaf));
final TreeNode child = tree.getModel().getChild(node, leaf);

if (redo && child instanceof CoreNodeObject object) {
object.setState(CoreNodeObject.State.NEW);
}

final TreePath path = tree.getModel().getTreePathToRoot(child);
tree.setSelectionPath(path);
tree.scrollPathToVisible(path);
}
Expand Down

0 comments on commit f1d098e

Please sign in to comment.