Skip to content

Commit

Permalink
Merge 7e5a106 into aecc94d
Browse files Browse the repository at this point in the history
  • Loading branch information
SeeSharpSoft committed Feb 15, 2020
2 parents aecc94d + 7e5a106 commit cf06627
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
Expand Up @@ -22,7 +22,7 @@ public boolean isSelected(@NotNull AnActionEvent anActionEvent) {
if (psiFile == null) {
return false;
}
return CsvHelper.getValueSeparator(psiFile) == null;
return !CsvHelper.hasValueSeparatorAttribute(psiFile);
}

@Override
Expand All @@ -31,7 +31,6 @@ public void setSelected(@NotNull AnActionEvent anActionEvent, boolean selected)
if (psiFile == null) {
return;
}

CsvFileAttributes.getInstance(psiFile.getProject()).resetValueSeparator(psiFile);
FileContentUtilCore.reparseFiles(psiFile.getVirtualFile());

Expand Down
Expand Up @@ -120,10 +120,9 @@ public void resetValueSeparator(@NotNull PsiFile psiFile) {

public @NotNull
CsvValueSeparator getValueSeparator(Project project, VirtualFile virtualFile) {
if (project == null || virtualFile == null) {
if (project == null || virtualFile == null || !(virtualFile.getFileType() instanceof LanguageFileType)) {
return CsvEditorSettings.getInstance().getDefaultValueSeparator();
}
assert(virtualFile.getFileType() instanceof LanguageFileType);
Language language = ((LanguageFileType) virtualFile.getFileType()).getLanguage();
if (language instanceof CsvSeparatorHolder) {
return ((CsvSeparatorHolder) language).getSeparator();
Expand Down

0 comments on commit cf06627

Please sign in to comment.