Skip to content

Commit

Permalink
Merge pull request #166 from SeeSharpSoft/master
Browse files Browse the repository at this point in the history
Release 2.8.1
  • Loading branch information
SeeSharpSoft committed Nov 25, 2019
2 parents 3b3dcb0 + 98e4f2f commit d13fd2c
Show file tree
Hide file tree
Showing 10 changed files with 66 additions and 27 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Expand Up @@ -5,8 +5,7 @@ jdk:
env:
- IDEA_VERSION=IC-2017.3.1 GRAMMAR_KIT_VERSION=2017.1.2
- IDEA_VERSION=IC-2018.3.2 GRAMMAR_KIT_VERSION=2017.1.7
- IDEA_VERSION=IC-2019.1.3 GRAMMAR_KIT_VERSION=2017.1.7
# - IDEA_VERSION=PC-LATEST-EAP-SNAPSHOT GRAMMAR_KIT_VERSION=07f30a1e7666f36ae780f614b6bbc89690ba36c3
- IDEA_VERSION=PC-LATEST-EAP-SNAPSHOT GRAMMAR_KIT_VERSION=2019.3

script: xvfb-run gradle check

Expand Down
7 changes: 6 additions & 1 deletion CHANGELOG
@@ -1,5 +1,10 @@
2.8.1
Nov 22, 2019

FIX: scrolling within table editor #164

2.8.0
???
Oct 12, 2019

NEW: improved font handling in table editor #122
FIX: proper font handling in balloon tooltips
Expand Down
16 changes: 10 additions & 6 deletions README.md
@@ -1,5 +1,5 @@
[![Plugin version](https://img.shields.io/jetbrains/plugin/d/10037-csv-plugin.svg)](https://plugins.jetbrains.com/plugin/10037-csv-plugin)
[![Build Status](https://travis-ci.org/SeeSharpSoft/intellij-csv-validator.svg?branch=master)](https://travis-ci.org/SeeSharpSoft/intellij-csv-validator)
[![Build Status](https://travis-ci.com/SeeSharpSoft/intellij-csv-validator.svg?branch=master)](https://travis-ci.com/SeeSharpSoft/intellij-csv-validator)
[![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)
[![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)
[![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)
Expand Down Expand Up @@ -30,6 +30,10 @@ This enables default editor features like syntax validation, highlighting and in

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

**Please note**

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.

### Syntax parser & validation

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.
Expand All @@ -54,12 +58,12 @@ This led to a variety of CSV derivatives like semicolon or pipe separated values
The plugin supports project specific separator setting.
New separators can be added fairly easy in the parser definition of the source code.

#### TSV
#### TSV/PSV

Tab (↹) can be explicitly set as a separator for CSV files.
Additionally the file type TSV was introduced as a kind of CSV language.
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.
All functionality that is available for plain CSV files (inspections, intentions, structure view, etc.) can be used for TSV as well.
Comma (,), semicolon (;), tab (↹) and pipe (|) can be explicitly set as a separator for CSV files.
Additionally the file types TSV (Tab-Separated-Values) and PSV (Pipe-Separated-Values) were introduced as a kind of CSV language.
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.
All functionality that is available for plain CSV files (inspections, intentions, structure view, etc.) can be used for TSV and PSV as well.

### Table Editor

Expand Down
6 changes: 3 additions & 3 deletions build.gradle
Expand Up @@ -24,7 +24,7 @@ jacocoTestReport {
}

group 'net.seesharpsoft.intellij.plugins'
version '2.8.0'
version '2.8.1'

apply plugin: 'java'
sourceCompatibility = javaVersion
Expand Down Expand Up @@ -71,7 +71,7 @@ idea {
apply plugin: 'org.jetbrains.intellij'
intellij {
// IDE version - https://www.jetbrains.com/intellij-repository/releases
version = System.getenv().getOrDefault('IDEA_VERSION', 'IC-191.5701.16')
version = System.getenv().getOrDefault('IDEA_VERSION', 'IC-2019.1.3')
pluginName = 'CSV Plugin'
instrumentCode = true
updateSinceUntilBuild = false
Expand All @@ -98,7 +98,7 @@ grammarKit {
jflexRelease = '1.7.0-1'

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

import org.jetbrains.grammarkit.tasks.GenerateLexer
Expand Down
@@ -1,26 +1,32 @@
package net.seesharpsoft.intellij.plugins.csv.editor.table.swing;

import javax.swing.*;
import java.awt.event.MouseWheelEvent;
import java.awt.event.MouseWheelListener;

public class CsvTableEditorMouseWheelListener extends CsvTableEditorUtilBase implements MouseWheelListener {

public static final int SCROLL_FACTOR = 3;
public static final int ZOOM_FACTOR = 3;

protected static final int SCROLL_FACTOR = 100;

public CsvTableEditorMouseWheelListener(CsvTableEditorSwing csvTableEditorArg) {
super(csvTableEditorArg);
}

@Override
public void mouseWheelMoved(MouseWheelEvent mouseWheelEvent) {

if (mouseWheelEvent.isControlDown()) {
int scrolled = mouseWheelEvent.getUnitsToScroll();
int amount = -(scrolled / SCROLL_FACTOR);
int amount = -(scrolled / ZOOM_FACTOR);
if (amount == 0) {
return;
}
csvTableEditor.changeFontSize(amount);
} else {
JScrollPane scrollPane = csvTableEditor.getTableScrollPane();
JScrollBar vScrollbar = scrollPane.getVerticalScrollBar();
vScrollbar.setValue(vScrollbar.getValue() + (int)(SCROLL_FACTOR * mouseWheelEvent.getPreciseWheelRotation()));
}
}
}
Expand Up @@ -218,7 +218,7 @@
</grid>
</children>
</scrollpane>
<scrollpane id="6b9c5">
<scrollpane id="6b9c5" binding="tableScrollPane">
<constraints>
<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"/>
</constraints>
Expand Down
Expand Up @@ -58,6 +58,7 @@ public class CsvTableEditorSwing extends CsvTableEditor implements TableDataChan
private JCheckBox cbFixedHeaders;
private JCheckBox cbAutoColumnWidthOnOpen;
protected LinkLabel lnkAdjustColumnWidth;
private JScrollPane tableScrollPane;

private JTable rowHeadersTable;

Expand Down Expand Up @@ -340,6 +341,10 @@ protected JBTable getTable() {
return this.tblEditor;
}

protected JScrollPane getTableScrollPane() {
return this.tableScrollPane;
}

protected DefaultTableModel getTableModel() {
return (DefaultTableModel) tblEditor.getModel();
}
Expand Down
3 changes: 1 addition & 2 deletions src/main/resources/META-INF/plugin.xml
Expand Up @@ -44,8 +44,7 @@

<change-notes><![CDATA[
<pre style="font-family: sans-serif">
NEW: improved font handling in table editor #122
FIX: proper font handling in balloon tooltips
FIX: scrolling within table editor #164
NOTE: IDE versions prior to 2017.3.* are no longer supported!
</pre>
Expand Down
@@ -1,29 +1,48 @@
package net.seesharpsoft.intellij.plugins.csv.editor.table.swing;

import net.seesharpsoft.intellij.plugins.csv.editor.table.CsvTableEditor;
import org.mockito.Mockito;

import javax.swing.*;
import java.awt.event.InputEvent;
import java.awt.event.MouseEvent;
import java.awt.event.MouseWheelEvent;

public class CsvTableEditorMouseWheelListenerTest extends CsvTableEditorSwingTestBase {

public void testWheeledOnCsvTable() {
@Override
protected String getTestFile() { return "AnyFile.csv"; }

public void testZoomOnCsvTable() {
CsvTableEditorSwing fileEditor = Mockito.spy(this.fileEditor);

MouseWheelEvent wheelEvent = new MouseWheelEvent(fileEditor.getTable(),
MouseWheelEvent.MOUSE_WHEEL,JComponent.WHEN_FOCUSED,
MouseWheelEvent.CTRL_MASK,0,0,0,false,MouseWheelEvent.WHEEL_UNIT_SCROLL,
3,-1);

CsvTableEditorMouseWheelListener spiedMouseWheelListener = fileEditor.tableEditorMouseWheelListener;

int size=fileEditor.getTable().getFont().getSize();
int size = fileEditor.getTable().getFont().getSize();
spiedMouseWheelListener.mouseWheelMoved(wheelEvent);
int new_size = fileEditor.getTable().getFont().getSize();

assertEquals(size + 1, new_size);
}

public void testScrollOnCsvTable() {
CsvTableEditorSwing fileEditor = Mockito.spy(this.fileEditor);

MouseWheelEvent wheelEvent = new MouseWheelEvent(fileEditor.getTable(),
MouseWheelEvent.MOUSE_WHEEL,JComponent.WHEN_FOCUSED,
0,0,0,0,false, MouseWheelEvent.WHEEL_UNIT_SCROLL,
1,1);

CsvTableEditorMouseWheelListener spiedMouseWheelListener = fileEditor.tableEditorMouseWheelListener;

int scrollValue = fileEditor.getTableScrollPane().getVerticalScrollBar().getValue();
assertEquals(0, scrollValue);
spiedMouseWheelListener.mouseWheelMoved(wheelEvent);
int new_size=fileEditor.getTable().getFont().getSize();
scrollValue = fileEditor.getTableScrollPane().getVerticalScrollBar().getValue();

assertTrue(new_size == size + 1);
// 90 is max in this case
assertEquals(90, scrollValue);
}
}
Expand Up @@ -19,11 +19,13 @@ protected String getTestDataPath() {
return "./src/test/resources/editor";
}

protected String getTestFile() { return "TableEditorFile.csv"; }

@Override
protected void setUp() throws Exception {
super.setUp();
initializeEditorSettings(CsvEditorSettingsExternalizable.getInstance());
myFixture.configureByFiles("TableEditorFile.csv");
myFixture.configureByFiles(getTestFile());

fileEditor = new CsvTableEditorSwing(this.getProject(), myFixture.getFile().getVirtualFile());
fileEditor.selectNotify();
Expand Down

0 comments on commit d13fd2c

Please sign in to comment.