Skip to content

Commit 7306e99

Browse files
authored
Merge pull request #149 from SeeSharpSoft/master
Release 2.6.2
2 parents 39f422c + 8fb68c9 commit 7306e99

File tree

6 files changed

+36
-6
lines changed

6 files changed

+36
-6
lines changed

CHANGELOG

+6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
2.6.2
2+
Aug 09, 2019
3+
4+
FIX: AssertionError: Already disposed: Project (Disposed) #147
5+
FIX: No fallback font used in table editor #145
6+
17
2.6.1
28
Aug 01, 2019
39

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
[![Known Vulnerabilities](https://snyk.io/test/github/SeeSharpSoft/intellij-csv-validator/badge.svg?targetFile=build.gradle)](https://snyk.io/test/github/SeeSharpSoft/intellij-csv-validator?targetFile=build.gradle)
55
[![Codacy Badge](https://api.codacy.com/project/badge/Grade/97769359388e44bfb7101346d510fccf)](https://www.codacy.com/app/github_124/intellij-csv-validator?utm_source=github.com&utm_medium=referral&utm_content=SeeSharpSoft/intellij-csv-validator&utm_campaign=Badge_Grade)
66
[![BCH compliance](https://bettercodehub.com/edge/badge/SeeSharpSoft/intellij-csv-validator?branch=master)](https://bettercodehub.com/results/SeeSharpSoft/intellij-csv-validator/)
7+
[![Donate](https://img.shields.io/badge/Paypal-Donate-yellow)](https://paypal.me/knerzbert)
78

89
# Lightweight CSV Plugin for JetBrains IDE family
910

build.gradle

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ plugins {
1414
id 'org.jetbrains.intellij' version '0.4.9'
1515
id 'jacoco'
1616
id 'com.github.kt3k.coveralls' version '2.8.2'
17+
id "com.github.ManifestClasspath" version "0.1.0-RELEASE"
1718
}
1819

1920
jacocoTestReport {

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
# https://www.jetbrains.com/intellij-repository/snapshots
44

55
name='CSV Plugin'
6-
pluginVersion=2.6.1
6+
pluginVersion=2.6.2
77
javaVersion=1.8
88
javaTargetVersion=1.8
99
downloadIntellijSources=false

src/main/java/net/seesharpsoft/intellij/plugins/csv/editor/table/CsvTableEditor.java

+25-4
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
import com.intellij.openapi.fileEditor.*;
1212
import com.intellij.openapi.project.Project;
1313
import com.intellij.openapi.util.Key;
14+
import com.intellij.openapi.util.SystemInfo;
1415
import com.intellij.openapi.util.UserDataHolder;
1516
import com.intellij.openapi.util.UserDataHolderBase;
1617
import com.intellij.openapi.vfs.ReadonlyStatusHandler;
@@ -30,6 +31,8 @@
3031
import org.jetbrains.annotations.Nullable;
3132

3233
import javax.swing.*;
34+
import javax.swing.plaf.FontUIResource;
35+
import javax.swing.text.StyleContext;
3336
import java.awt.*;
3437
import java.beans.PropertyChangeListener;
3538
import java.beans.PropertyChangeSupport;
@@ -108,8 +111,11 @@ public CsvColumnInfoMap<PsiElement> getColumnInfoMap() {
108111
}
109112

110113
public boolean hasErrors() {
114+
if (!isValid()) {
115+
return true;
116+
}
111117
CsvColumnInfoMap columnInfoMap = getColumnInfoMap();
112-
return !isValid() || (columnInfoMap != null && columnInfoMap.hasErrors());
118+
return (columnInfoMap != null && columnInfoMap.hasErrors());
113119
}
114120

115121
protected Object[][] storeStateChange(Object[][] data) {
@@ -129,7 +135,8 @@ public void saveChanges(final String content) {
129135
return;
130136
}
131137
ApplicationManager.getApplication().invokeLater(() -> {
132-
if (!this.document.isWritable() && ReadonlyStatusHandler.getInstance(this.project).ensureFilesWritable(this.file).hasReadonlyFiles()) {
138+
if (project == null || project.isDisposed() ||
139+
(!this.document.isWritable() && ReadonlyStatusHandler.getInstance(this.project).ensureFilesWritable(this.file).hasReadonlyFiles())) {
133140
return;
134141
}
135142
ApplicationManager.getApplication().runWriteAction(() ->
@@ -206,6 +213,9 @@ public boolean isModified() {
206213

207214
@Override
208215
public boolean isValid() {
216+
if (file == null || !file.isValid()) {
217+
return false;
218+
}
209219
CsvFile csvFile = this.getCsvFile();
210220
return csvFile != null && csvFile.isValid();
211221
}
@@ -277,7 +287,7 @@ public int compareTo(@NotNull FileEditorLocation o) {
277287

278288
@Nullable
279289
public StructureViewBuilder getStructureViewBuilder() {
280-
return file != null && file.isValid() ? StructureViewBuilder.PROVIDER.getStructureViewBuilder(file.getFileType(), file, this.project) : null;
290+
return isValid() ? StructureViewBuilder.PROVIDER.getStructureViewBuilder(file.getFileType(), file, this.project) : null;
281291
}
282292

283293
@Nullable
@@ -292,6 +302,9 @@ public Project getProject() {
292302

293303
@Nullable
294304
public final CsvFile getCsvFile() {
305+
if (project == null || project.isDisposed()) {
306+
return null;
307+
}
295308
if (this.psiFile == null || !this.psiFile.isValid()) {
296309
this.document = FileDocumentManager.getInstance().getDocument(this.file);
297310
PsiDocumentManager documentManager = PsiDocumentManager.getInstance(project);
@@ -310,7 +323,15 @@ public final int getRowCount() {
310323
}
311324

312325
public Font getFont() {
313-
return EditorColorsManager.getInstance().getGlobalScheme().getFont(EditorFontType.PLAIN);
326+
// the one-liner to be used requires 172.2465.6 - compatibility
327+
// return UIUtil.getFontWithFallback(EditorColorsManager.getInstance().getGlobalScheme().getFont(EditorFontType.PLAIN));
328+
329+
Font font = EditorColorsManager.getInstance().getGlobalScheme().getFont(EditorFontType.PLAIN);
330+
String familyName = font.getFamily();
331+
int style = font.getStyle();
332+
int size = font.getSize();
333+
Font fontWithFallback = SystemInfo.isMac ? new Font(familyName, style, size) : (new StyleContext()).getFont(familyName, style, size);
334+
return fontWithFallback instanceof FontUIResource ? (FontUIResource)fontWithFallback : new FontUIResource(fontWithFallback);
314335
}
315336

316337
protected int getStringWidth(String text) {

src/main/resources/META-INF/plugin.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@
4646

4747
<change-notes><![CDATA[
4848
<pre style="font-family: sans-serif">
49-
NEW: plugin logo icons added (Thx to FineVisuals for support)
49+
FIX: AssertionError: Already disposed Project #147
50+
FIX: No fallback font used in table editor #145
5051
</pre>
5152
]]>
5253
</change-notes>

0 commit comments

Comments
 (0)