Skip to content

Commit

Permalink
Merge 002453e into e2913bd
Browse files Browse the repository at this point in the history
  • Loading branch information
SeeSharpSoft committed Aug 9, 2019
2 parents e2913bd + 002453e commit 416ecd2
Showing 1 changed file with 13 additions and 3 deletions.
Expand Up @@ -108,8 +108,11 @@ public CsvColumnInfoMap<PsiElement> getColumnInfoMap() {
}

public boolean hasErrors() {
if (!isValid()) {
return true;
}
CsvColumnInfoMap columnInfoMap = getColumnInfoMap();
return !isValid() || (columnInfoMap != null && columnInfoMap.hasErrors());
return (columnInfoMap != null && columnInfoMap.hasErrors());
}

protected Object[][] storeStateChange(Object[][] data) {
Expand All @@ -129,7 +132,8 @@ public void saveChanges(final String content) {
return;
}
ApplicationManager.getApplication().invokeLater(() -> {
if (!this.document.isWritable() && ReadonlyStatusHandler.getInstance(this.project).ensureFilesWritable(this.file).hasReadonlyFiles()) {
if (project == null || project.isDisposed() ||
(!this.document.isWritable() && ReadonlyStatusHandler.getInstance(this.project).ensureFilesWritable(this.file).hasReadonlyFiles())) {
return;
}
ApplicationManager.getApplication().runWriteAction(() ->
Expand Down Expand Up @@ -206,6 +210,9 @@ public boolean isModified() {

@Override
public boolean isValid() {
if (file == null || !file.isValid()) {
return false;
}
CsvFile csvFile = this.getCsvFile();
return csvFile != null && csvFile.isValid();
}
Expand Down Expand Up @@ -277,7 +284,7 @@ public int compareTo(@NotNull FileEditorLocation o) {

@Nullable
public StructureViewBuilder getStructureViewBuilder() {
return file != null && file.isValid() ? StructureViewBuilder.PROVIDER.getStructureViewBuilder(file.getFileType(), file, this.project) : null;
return isValid() ? StructureViewBuilder.PROVIDER.getStructureViewBuilder(file.getFileType(), file, this.project) : null;
}

@Nullable
Expand All @@ -292,6 +299,9 @@ public Project getProject() {

@Nullable
public final CsvFile getCsvFile() {
if (project == null || project.isDisposed()) {
return null;
}
if (this.psiFile == null || !this.psiFile.isValid()) {
this.document = FileDocumentManager.getInstance().getDocument(this.file);
PsiDocumentManager documentManager = PsiDocumentManager.getInstance(project);
Expand Down

0 comments on commit 416ecd2

Please sign in to comment.