rename "copy reference" to "copy relative path" on file nodes (IDEA-160391)

This commit is contained in:
peter
2016-09-20 17:24:01 +02:00
parent 72f5f15010
commit 4b18f42d0c
@@ -76,6 +76,7 @@ public class CopyReferenceAction extends DumbAwareAction {
public void update(AnActionEvent e) {
boolean plural = false;
boolean enabled;
boolean paths = false;
DataContext dataContext = e.getDataContext();
Editor editor = CommonDataKeys.EDITOR.getData(dataContext);
@@ -86,6 +87,7 @@ public class CopyReferenceAction extends DumbAwareAction {
List<PsiElement> elements = getElementsToCopy(editor, dataContext);
enabled = !elements.isEmpty();
plural = elements.size() > 1;
paths = elements.stream().allMatch(el -> el instanceof PsiFileSystemItem && getQualifiedNameFromProviders(el) == null);
}
e.getPresentation().setEnabled(enabled);
@@ -95,7 +97,9 @@ public class CopyReferenceAction extends DumbAwareAction {
else {
e.getPresentation().setVisible(true);
}
e.getPresentation().setText(plural ? "Cop&y References" : "Cop&y Reference");
e.getPresentation().setText(
paths ? plural ? "Cop&y Relative Paths" : "Cop&y Relative Path"
: plural ? "Cop&y References" : "Cop&y Reference");
}
@Override