fix add-action in combination with tree-view node select

This commit is contained in:
Marcel Haßlinger 2021-11-09 19:49:28 +01:00
parent a34ae7e02f
commit 10b2698c06
2 changed files with 4 additions and 3 deletions

View File

@ -6,6 +6,7 @@ import com.intellij.openapi.actionSystem.AnActionEvent;
import de.marhali.easyi18n.service.WindowManager; import de.marhali.easyi18n.service.WindowManager;
import de.marhali.easyi18n.dialog.AddDialog; import de.marhali.easyi18n.dialog.AddDialog;
import de.marhali.easyi18n.util.PathUtil;
import de.marhali.easyi18n.util.TreeUtil; import de.marhali.easyi18n.util.TreeUtil;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
@ -42,7 +43,7 @@ public class AddAction extends AnAction {
TreePath path = manager.getTreeView().getTree().getSelectionPath(); TreePath path = manager.getTreeView().getTree().getSelectionPath();
if(path != null) { if(path != null) {
return TreeUtil.getFullPath(path) + "."; return TreeUtil.getFullPath(path) + PathUtil.DELIMITER;
} }
} else { // Table View } else { // Table View

View File

@ -25,12 +25,12 @@ public class TreeUtil {
String section = value instanceof PresentationData ? String section = value instanceof PresentationData ?
((PresentationData) value).getPresentableText() : String.valueOf(value); ((PresentationData) value).getPresentableText() : String.valueOf(value);
if(section == null) { // Skip empty sections if(value == null) { // Skip empty sections
continue; continue;
} }
if(builder.length() != 0) { if(builder.length() != 0) {
builder.append("."); builder.append(PathUtil.DELIMITER);
} }
builder.append(section); builder.append(section);