diff --git a/CHANGELOG b/CHANGELOG index 7c3eb04e..4f231f43 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,9 @@ +2.0.1 +Dec 02, 2018 + +FIX: disabling table editor for large files +FIX: applying row height for newly opened files + 2.0.0 Nov 20, 2018 diff --git a/gradle.properties b/gradle.properties index bcd2e46b..d79e82d6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,7 @@ # https://www.jetbrains.com/intellij-repository/snapshots name='CSV Plugin' -pluginVersion=2.0.0 +pluginVersion=2.0.1 javaVersion=1.8 javaTargetVersion=1.8 downloadIntellijSources=false diff --git a/src/main/java/net/seesharpsoft/intellij/plugins/csv/editor/table/CsvTableEditor.java b/src/main/java/net/seesharpsoft/intellij/plugins/csv/editor/table/CsvTableEditor.java index 0444b4f9..c1b68abb 100644 --- a/src/main/java/net/seesharpsoft/intellij/plugins/csv/editor/table/CsvTableEditor.java +++ b/src/main/java/net/seesharpsoft/intellij/plugins/csv/editor/table/CsvTableEditor.java @@ -14,6 +14,7 @@ import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.PsiDocumentManager; import com.intellij.psi.PsiElement; +import com.intellij.psi.PsiFile; import net.seesharpsoft.intellij.plugins.csv.CsvColumnInfoMap; import net.seesharpsoft.intellij.plugins.csv.CsvHelper; import net.seesharpsoft.intellij.plugins.csv.editor.table.api.TableDataHandler; @@ -38,7 +39,7 @@ public abstract class CsvTableEditor implements FileEditor, FileEditorLocation { protected final UserDataHolder userDataHolder; protected final Document document; protected final PropertyChangeSupport changeSupport; - protected final CsvFile csvFile; + protected final PsiFile psiFile; protected final String currentSeparator; protected final TableDataHandler dataManagement; @@ -54,9 +55,9 @@ public CsvTableEditor(@NotNull Project projectArg, @NotNull VirtualFile fileArg) this.userDataHolder = new UserDataHolderBase(); this.document = FileDocumentManager.getInstance().getDocument(this.file); PsiDocumentManager documentManager = PsiDocumentManager.getInstance(project); - this.csvFile = (CsvFile) documentManager.getPsiFile(this.document); + this.psiFile = documentManager.getPsiFile(this.document); this.changeSupport = new PropertyChangeSupport(this); - this.currentSeparator = CsvCodeStyleSettings.getCurrentSeparator(this.project, this.csvFile.getLanguage()); + this.currentSeparator = CsvCodeStyleSettings.getCurrentSeparator(this.project, this.psiFile.getLanguage()); this.dataManagement = new TableDataHandler(this, TableDataHandler.MAX_SIZE); } @@ -96,7 +97,7 @@ public boolean isEditable() { } public boolean hasErrors() { - return columnInfoMap != null && columnInfoMap.hasErrors(); + return !isValid() || (columnInfoMap != null && columnInfoMap.hasErrors()); } protected Object[][] storeStateChange(Object[][] data) { @@ -192,7 +193,8 @@ public boolean isModified() { @Override public boolean isValid() { - return this.csvFile.isValid(); + CsvFile csvFile = this.getCsvFile(); + return csvFile != null && csvFile.isValid(); } @Override @@ -270,6 +272,11 @@ public Project getProject() { return this.project; } + @Nullable + public CsvFile getCsvFile() { + return this.psiFile instanceof CsvFile ? (CsvFile)psiFile : null; + } + public TableDataHandler getDataHandler() { return this.dataManagement; } diff --git a/src/main/java/net/seesharpsoft/intellij/plugins/csv/editor/table/CsvTableEditorProvider.java b/src/main/java/net/seesharpsoft/intellij/plugins/csv/editor/table/CsvTableEditorProvider.java index b29fa0a1..464c116c 100644 --- a/src/main/java/net/seesharpsoft/intellij/plugins/csv/editor/table/CsvTableEditorProvider.java +++ b/src/main/java/net/seesharpsoft/intellij/plugins/csv/editor/table/CsvTableEditorProvider.java @@ -38,8 +38,8 @@ public FileEditorPolicy getPolicy() { @Override public boolean accept(@NotNull Project project, @NotNull VirtualFile file) { - return CsvEditorSettingsExternalizable.getInstance().getEditorPrio() != CsvEditorSettingsExternalizable.EditorPrio.TEXT_ONLY && - CsvFileEditorProvider.isCsvFile(file) && !SingleRootFileViewProvider.isTooLargeForContentLoading(file); + return CsvEditorSettingsExternalizable.getInstance().getEditorPrio() != CsvEditorSettingsExternalizable.EditorPrio.TEXT_ONLY && CsvFileEditorProvider.isCsvFile(file) && + !SingleRootFileViewProvider.isTooLargeForIntelligence(file); } @NotNull diff --git a/src/main/java/net/seesharpsoft/intellij/plugins/csv/editor/table/swing/CsvTableEditorSwing.java b/src/main/java/net/seesharpsoft/intellij/plugins/csv/editor/table/swing/CsvTableEditorSwing.java index fab5a1fa..e0146ddc 100644 --- a/src/main/java/net/seesharpsoft/intellij/plugins/csv/editor/table/swing/CsvTableEditorSwing.java +++ b/src/main/java/net/seesharpsoft/intellij/plugins/csv/editor/table/swing/CsvTableEditorSwing.java @@ -12,6 +12,7 @@ import net.seesharpsoft.intellij.plugins.csv.editor.CsvEditorSettingsExternalizable; import net.seesharpsoft.intellij.plugins.csv.editor.table.*; import net.seesharpsoft.intellij.plugins.csv.editor.table.api.TableDataChangeEvent; +import net.seesharpsoft.intellij.plugins.csv.psi.CsvFile; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -113,6 +114,8 @@ private void initializedUIComponents() { KeyStroke.getKeyStroke(KeyEvent.VK_Z, InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK), JComponent.WHEN_FOCUSED); tblEditor.registerKeyboardAction(this.tableEditorActions.redo, KeyStroke.getKeyStroke(KeyEvent.VK_Y, InputEvent.CTRL_MASK), JComponent.WHEN_FOCUSED); + + applyRowLines(getFileEditorState().getRowLines()); } @@ -284,6 +287,11 @@ protected DefaultTableModel getTableModel() { @Override protected void updateUIComponents() { + CsvFile csvFile = getCsvFile(); + if (csvFile == null) { + return; + } + CsvColumnInfoMap newColumnInfoMap = csvFile.getMyColumnInfoMap(); if (Objects.equals(columnInfoMap, newColumnInfoMap)) { return; diff --git a/src/main/resources/META-INF/plugin.xml b/src/main/resources/META-INF/plugin.xml index a7194f41..7af0f6c8 100644 --- a/src/main/resources/META-INF/plugin.xml +++ b/src/main/resources/META-INF/plugin.xml @@ -48,7 +48,8 @@ -NEW: !!! Table Editor !!! +FIX: disabling table editor for large files +FIX: applying row height for newly opened files ]]>