Skip to content

Commit d13fd2c

Browse files
authored
Merge pull request #166 from SeeSharpSoft/master
Release 2.8.1
2 parents 3b3dcb0 + 98e4f2f commit d13fd2c

File tree

10 files changed

+66
-27
lines changed

10 files changed

+66
-27
lines changed

.travis.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ jdk:
55
env:
66
- IDEA_VERSION=IC-2017.3.1 GRAMMAR_KIT_VERSION=2017.1.2
77
- IDEA_VERSION=IC-2018.3.2 GRAMMAR_KIT_VERSION=2017.1.7
8-
- IDEA_VERSION=IC-2019.1.3 GRAMMAR_KIT_VERSION=2017.1.7
9-
# - IDEA_VERSION=PC-LATEST-EAP-SNAPSHOT GRAMMAR_KIT_VERSION=07f30a1e7666f36ae780f614b6bbc89690ba36c3
8+
- IDEA_VERSION=PC-LATEST-EAP-SNAPSHOT GRAMMAR_KIT_VERSION=2019.3
109

1110
script: xvfb-run gradle check
1211

CHANGELOG

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
1+
2.8.1
2+
Nov 22, 2019
3+
4+
FIX: scrolling within table editor #164
5+
16
2.8.0
2-
???
7+
Oct 12, 2019
38

49
NEW: improved font handling in table editor #122
510
FIX: proper font handling in balloon tooltips

README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[![Plugin version](https://img.shields.io/jetbrains/plugin/d/10037-csv-plugin.svg)](https://plugins.jetbrains.com/plugin/10037-csv-plugin)
2-
[![Build Status](https://travis-ci.org/SeeSharpSoft/intellij-csv-validator.svg?branch=master)](https://travis-ci.org/SeeSharpSoft/intellij-csv-validator)
2+
[![Build Status](https://travis-ci.com/SeeSharpSoft/intellij-csv-validator.svg?branch=master)](https://travis-ci.com/SeeSharpSoft/intellij-csv-validator)
33
[![Coverage Status](https://coveralls.io/repos/github/SeeSharpSoft/intellij-csv-validator/badge.svg?branch=master)](https://coveralls.io/github/SeeSharpSoft/intellij-csv-validator?branch=master)
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)
@@ -30,6 +30,10 @@ This enables default editor features like syntax validation, highlighting and in
3030

3131
(see [full changelog](./CHANGELOG))
3232

33+
**Please note**
34+
35+
Due to a bug in all editions of IntelliJ 2019.2.\*, the plugin now comes in two versions. Both versions are identical except a configuration workaround, which is only part of the version ending with *-192*. This version is not compatible - and will therefore not work properly - with never versions (>= 2019.3.\*) of the IntelliJ IDE.
36+
3337
### Syntax parser & validation
3438

3539
The CSV syntax parser follows the standard defined in [IETF 4180](https://www.ietf.org/rfc/rfc4180.txt) but tolerates leading and trailing whitespaces of escaped text and accepts basically every literal as text data.
@@ -54,12 +58,12 @@ This led to a variety of CSV derivatives like semicolon or pipe separated values
5458
The plugin supports project specific separator setting.
5559
New separators can be added fairly easy in the parser definition of the source code.
5660

57-
#### TSV
61+
#### TSV/PSV
5862

59-
Tab (↹) can be explicitly set as a separator for CSV files.
60-
Additionally the file type TSV was introduced as a kind of CSV language.
61-
For TSV files the same formatter and code style settings are applied as for CSV itself, but the separator is considered to be a tab.
62-
All functionality that is available for plain CSV files (inspections, intentions, structure view, etc.) can be used for TSV as well.
63+
Comma (,), semicolon (;), tab (↹) and pipe (|) can be explicitly set as a separator for CSV files.
64+
Additionally the file types TSV (Tab-Separated-Values) and PSV (Pipe-Separated-Values) were introduced as a kind of CSV language.
65+
For TSV and PSV files the same formatter and code style settings are applied as for CSV itself, but the separator is considered to be a tab or a pipe respectively.
66+
All functionality that is available for plain CSV files (inspections, intentions, structure view, etc.) can be used for TSV and PSV as well.
6367

6468
### Table Editor
6569

build.gradle

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jacocoTestReport {
2424
}
2525

2626
group 'net.seesharpsoft.intellij.plugins'
27-
version '2.8.0'
27+
version '2.8.1'
2828

2929
apply plugin: 'java'
3030
sourceCompatibility = javaVersion
@@ -71,7 +71,7 @@ idea {
7171
apply plugin: 'org.jetbrains.intellij'
7272
intellij {
7373
// IDE version - https://www.jetbrains.com/intellij-repository/releases
74-
version = System.getenv().getOrDefault('IDEA_VERSION', 'IC-191.5701.16')
74+
version = System.getenv().getOrDefault('IDEA_VERSION', 'IC-2019.1.3')
7575
pluginName = 'CSV Plugin'
7676
instrumentCode = true
7777
updateSinceUntilBuild = false
@@ -98,7 +98,7 @@ grammarKit {
9898
jflexRelease = '1.7.0-1'
9999

100100
// tag or short commit hash of Grammar-Kit to use - https://github.com/JetBrains/Grammar-Kit
101-
grammarKitRelease = System.getenv().getOrDefault('GRAMMAR_KIT_VERSION', '2017.1.7')
101+
grammarKitRelease = System.getenv().getOrDefault('GRAMMAR_KIT_VERSION', '2019.1.1')
102102
}
103103

104104
import org.jetbrains.grammarkit.tasks.GenerateLexer
Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,32 @@
11
package net.seesharpsoft.intellij.plugins.csv.editor.table.swing;
22

3+
import javax.swing.*;
34
import java.awt.event.MouseWheelEvent;
45
import java.awt.event.MouseWheelListener;
56

67
public class CsvTableEditorMouseWheelListener extends CsvTableEditorUtilBase implements MouseWheelListener {
78

8-
public static final int SCROLL_FACTOR = 3;
9+
public static final int ZOOM_FACTOR = 3;
10+
11+
protected static final int SCROLL_FACTOR = 100;
912

1013
public CsvTableEditorMouseWheelListener(CsvTableEditorSwing csvTableEditorArg) {
1114
super(csvTableEditorArg);
1215
}
1316

1417
@Override
1518
public void mouseWheelMoved(MouseWheelEvent mouseWheelEvent) {
16-
1719
if (mouseWheelEvent.isControlDown()) {
1820
int scrolled = mouseWheelEvent.getUnitsToScroll();
19-
int amount = -(scrolled / SCROLL_FACTOR);
21+
int amount = -(scrolled / ZOOM_FACTOR);
2022
if (amount == 0) {
2123
return;
2224
}
2325
csvTableEditor.changeFontSize(amount);
26+
} else {
27+
JScrollPane scrollPane = csvTableEditor.getTableScrollPane();
28+
JScrollBar vScrollbar = scrollPane.getVerticalScrollBar();
29+
vScrollbar.setValue(vScrollbar.getValue() + (int)(SCROLL_FACTOR * mouseWheelEvent.getPreciseWheelRotation()));
2430
}
2531
}
2632
}

src/main/java/net/seesharpsoft/intellij/plugins/csv/editor/table/swing/CsvTableEditorSwing.form

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@
218218
</grid>
219219
</children>
220220
</scrollpane>
221-
<scrollpane id="6b9c5">
221+
<scrollpane id="6b9c5" binding="tableScrollPane">
222222
<constraints>
223223
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="7" hsize-policy="7" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
224224
</constraints>

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ public class CsvTableEditorSwing extends CsvTableEditor implements TableDataChan
5858
private JCheckBox cbFixedHeaders;
5959
private JCheckBox cbAutoColumnWidthOnOpen;
6060
protected LinkLabel lnkAdjustColumnWidth;
61+
private JScrollPane tableScrollPane;
6162

6263
private JTable rowHeadersTable;
6364

@@ -340,6 +341,10 @@ protected JBTable getTable() {
340341
return this.tblEditor;
341342
}
342343

344+
protected JScrollPane getTableScrollPane() {
345+
return this.tableScrollPane;
346+
}
347+
343348
protected DefaultTableModel getTableModel() {
344349
return (DefaultTableModel) tblEditor.getModel();
345350
}

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,7 @@
4444

4545
<change-notes><![CDATA[
4646
<pre style="font-family: sans-serif">
47-
NEW: improved font handling in table editor #122
48-
FIX: proper font handling in balloon tooltips
47+
FIX: scrolling within table editor #164
4948
5049
NOTE: IDE versions prior to 2017.3.* are no longer supported!
5150
</pre>
Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,48 @@
11
package net.seesharpsoft.intellij.plugins.csv.editor.table.swing;
22

3-
import net.seesharpsoft.intellij.plugins.csv.editor.table.CsvTableEditor;
43
import org.mockito.Mockito;
54

65
import javax.swing.*;
7-
import java.awt.event.InputEvent;
8-
import java.awt.event.MouseEvent;
96
import java.awt.event.MouseWheelEvent;
107

118
public class CsvTableEditorMouseWheelListenerTest extends CsvTableEditorSwingTestBase {
129

13-
public void testWheeledOnCsvTable() {
10+
@Override
11+
protected String getTestFile() { return "AnyFile.csv"; }
12+
13+
public void testZoomOnCsvTable() {
1414
CsvTableEditorSwing fileEditor = Mockito.spy(this.fileEditor);
15-
15+
1616
MouseWheelEvent wheelEvent = new MouseWheelEvent(fileEditor.getTable(),
1717
MouseWheelEvent.MOUSE_WHEEL,JComponent.WHEN_FOCUSED,
1818
MouseWheelEvent.CTRL_MASK,0,0,0,false,MouseWheelEvent.WHEEL_UNIT_SCROLL,
1919
3,-1);
2020

2121
CsvTableEditorMouseWheelListener spiedMouseWheelListener = fileEditor.tableEditorMouseWheelListener;
2222

23-
int size=fileEditor.getTable().getFont().getSize();
23+
int size = fileEditor.getTable().getFont().getSize();
24+
spiedMouseWheelListener.mouseWheelMoved(wheelEvent);
25+
int new_size = fileEditor.getTable().getFont().getSize();
26+
27+
assertEquals(size + 1, new_size);
28+
}
29+
30+
public void testScrollOnCsvTable() {
31+
CsvTableEditorSwing fileEditor = Mockito.spy(this.fileEditor);
32+
33+
MouseWheelEvent wheelEvent = new MouseWheelEvent(fileEditor.getTable(),
34+
MouseWheelEvent.MOUSE_WHEEL,JComponent.WHEN_FOCUSED,
35+
0,0,0,0,false, MouseWheelEvent.WHEEL_UNIT_SCROLL,
36+
1,1);
37+
38+
CsvTableEditorMouseWheelListener spiedMouseWheelListener = fileEditor.tableEditorMouseWheelListener;
39+
40+
int scrollValue = fileEditor.getTableScrollPane().getVerticalScrollBar().getValue();
41+
assertEquals(0, scrollValue);
2442
spiedMouseWheelListener.mouseWheelMoved(wheelEvent);
25-
int new_size=fileEditor.getTable().getFont().getSize();
43+
scrollValue = fileEditor.getTableScrollPane().getVerticalScrollBar().getValue();
2644

27-
assertTrue(new_size == size + 1);
45+
// 90 is max in this case
46+
assertEquals(90, scrollValue);
2847
}
2948
}

src/test/java/net/seesharpsoft/intellij/plugins/csv/editor/table/swing/CsvTableEditorSwingTestBase.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,13 @@ protected String getTestDataPath() {
1919
return "./src/test/resources/editor";
2020
}
2121

22+
protected String getTestFile() { return "TableEditorFile.csv"; }
23+
2224
@Override
2325
protected void setUp() throws Exception {
2426
super.setUp();
2527
initializeEditorSettings(CsvEditorSettingsExternalizable.getInstance());
26-
myFixture.configureByFiles("TableEditorFile.csv");
28+
myFixture.configureByFiles(getTestFile());
2729

2830
fileEditor = new CsvTableEditorSwing(this.getProject(), myFixture.getFile().getVirtualFile());
2931
fileEditor.selectNotify();

0 commit comments

Comments
 (0)