Skip to content

Commit 6212a9b

Browse files
committed
[INTERNAL] Resolve merge conflicts and revert changes towards v2019.2
1 parent afcf20e commit 6212a9b

25 files changed

+190
-90
lines changed

.travis.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ jdk:
33
- openjdk8
44

55
env:
6-
- IDEA_VERSION=IC-192.5728.98 GRAMMAR_KIT_VERSION=2017.1.6
7-
- IDEA_VERSION=PC-LATEST-EAP-SNAPSHOT GRAMMAR_KIT_VERSION=2017.1.6
6+
- IDEA_VERSION=IC-2017.3.1 GRAMMAR_KIT_VERSION=2017.1.2
7+
- 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
810

911
script: xvfb-run gradle check
1012

@@ -14,9 +16,9 @@ after_success:
1416
jobs:
1517
include:
1618
- if: (branch = master AND type = push) OR (type = pull_request)
17-
env: IDEA_VERSION=IC-192.5728.98 GRAMMAR_KIT_VERSION=2017.1.6
19+
env: IDEA_VERSION=IC-191.5701.16 GRAMMAR_KIT_VERSION=2017.1.7
1820
script: xvfb-run gradle check verifyPlugin
1921
- stage: deploy
2022
if: branch IN (Testing, Staging, Stable) AND type = push
21-
env: IDEA_VERSION=IC-192.5728.98 GRAMMAR_KIT_VERSION=2017.1.6 JI_CHANNELS=$TRAVIS_BRANCH
23+
env: IDEA_VERSION=IC-191.5701.16 GRAMMAR_KIT_VERSION=2017.1.7 JI_CHANNELS=$TRAVIS_BRANCH
2224
script: xvfb-run gradle publishPlugin

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
# Lightweight CSV Plugin for JetBrains IDE family
1010

11-
Compatible with _IntelliJ IDEA PhpStorm WebStorm PyCharm RubyMine AppCode CLion Gogland DataGrip Rider MPS Android Studio_ - __2016.3.2 and newer__
11+
Compatible with _IntelliJ IDEA PhpStorm WebStorm PyCharm RubyMine AppCode CLion Gogland DataGrip Rider MPS Android Studio_ - __2017.3.1 and newer__
1212

1313
This plugin introduces CSV (_Comma-Separated Values_) as a language to Jetbrains IDE with a syntax definition, structured language elements and associated file types (.csv/.tsv/.psv).
1414
This enables default editor features like syntax validation, highlighting and inspections for CSV-alike files.

build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,11 @@ 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-192.5728.98')
74+
version = System.getenv().getOrDefault('IDEA_VERSION', 'IC-191.5701.16')
7575
pluginName = 'CSV Plugin'
7676
instrumentCode = true
7777
updateSinceUntilBuild = false
78-
downloadSources = false
78+
downloadSources = true
7979
}
8080
publishPlugin {
8181
token = System.getenv().getOrDefault('JI_TOKEN', '')
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package net.seesharpsoft.intellij.plugins.csv;
2+
3+
import com.intellij.openapi.fileTypes.FileTypeConsumer;
4+
import com.intellij.openapi.fileTypes.FileTypeFactory;
5+
import org.jetbrains.annotations.NotNull;
6+
7+
public class CsvFileTypeFactory extends FileTypeFactory {
8+
@Override
9+
public void createFileTypes(@NotNull FileTypeConsumer fileTypeConsumer) {
10+
fileTypeConsumer.consume(CsvFileType.INSTANCE, String.join(FileTypeConsumer.EXTENSION_DELIMITER, new String[] {"csv"}));
11+
}
12+
}

src/main/java/net/seesharpsoft/intellij/plugins/csv/editor/CsvEditorSettingsExternalizable.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,7 @@ public void setTableAutoColumnWidthOnOpen(boolean tableAutoColumnWidthOnOpen) {
243243
public boolean isAdvancedFontHandling() {
244244
return getState().ADVANCED_FONT_HANDLING;
245245
}
246+
246247
public void setAdvancedFontHandling(boolean advancedFontHandling) {
247248
getState().ADVANCED_FONT_HANDLING = advancedFontHandling;
248249
}

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

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import com.intellij.util.ui.UIUtil;
1010
import net.seesharpsoft.intellij.plugins.csv.editor.CsvEditorSettingsExternalizable;
1111
import net.seesharpsoft.intellij.plugins.csv.settings.CsvColorSettings;
12+
import org.jetbrains.annotations.NotNull;
1213

1314
import javax.swing.*;
1415
import javax.swing.border.EmptyBorder;
@@ -80,13 +81,13 @@ public Component getTableCellRendererComponent(JTable table, Object value, boole
8081
myTextArea.setBorder(new EmptyBorder(1, 2, 1, 2));
8182
}
8283

84+
this.setText(value == null ? "" : value.toString());
85+
8386
final int columnWidth = table.getColumnModel().getColumn(column).getWidth();
8487
final int rowHeight = table.getRowHeight(row);
85-
this.setFont(table.getFont());
88+
8689
this.setSize(columnWidth, rowHeight);
8790
this.validate();
88-
myTextArea.setText((value == null) ? "" : value.toString());
89-
myTextArea.setFont(table.getFont());
9091
myTextArea.setSize(columnWidth, rowHeight);
9192
myTextArea.validate();
9293

@@ -118,30 +119,30 @@ public Object getCellEditorValue() {
118119
return myTextArea.getText();
119120
}
120121

121-
@Override
122-
public void setText(String text) {
123-
if (CsvEditorSettingsExternalizable.getInstance().isAdvancedFontHandling()) {
124-
setFont(determineFont(text));
125-
}
126-
super.setText(text);
122+
protected void setText(@NotNull String text) {
123+
Font font = determineFont(text);
124+
this.setFont(font);
125+
myTextArea.setFont(font);
126+
myTextArea.setText(text);
127127
}
128128

129-
public Font determineFont(String text) {
130-
Font baseFont = UIUtil.getFontWithFallback(EditorColorsManager.getInstance().getGlobalScheme().getFont(EditorFontType.PLAIN));
131-
132-
FontFallbackIterator it = new FontFallbackIterator();
133-
it.setPreferredFont(baseFont.getFamily(), baseFont.getSize());
134-
it.setFontStyle(baseFont.getStyle());
135-
it.start(text, 0, text.length());
129+
protected Font determineFont(@NotNull String text) {
130+
Font finalFont = UIUtil.getFontWithFallback(EditorColorsManager.getInstance().getGlobalScheme().getFont(EditorFontType.PLAIN));
136131

137-
Font finalFont = baseFont;
138-
for(; !it.atEnd(); it.advance()) {
139-
Font font = it.getFont();
140-
if(!font.getFamily().equals(baseFont.getFamily())) {
141-
finalFont = font;
142-
break;
132+
if (CsvEditorSettingsExternalizable.getInstance().isAdvancedFontHandling()) {
133+
FontFallbackIterator it = new FontFallbackIterator();
134+
it.setPreferredFont(finalFont.getFamily(), finalFont.getSize());
135+
it.setFontStyle(finalFont.getStyle());
136+
it.start(text, 0, text.length());
137+
for (; !it.atEnd(); it.advance()) {
138+
Font font = it.getFont();
139+
if (!font.getFamily().equals(finalFont.getFamily())) {
140+
finalFont = font;
141+
break;
142+
}
143143
}
144144
}
145+
145146
return finalFont;
146147
}
147148

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package net.seesharpsoft.intellij.plugins.psv;
2+
3+
import com.intellij.openapi.fileTypes.FileTypeConsumer;
4+
import com.intellij.openapi.fileTypes.FileTypeFactory;
5+
import org.jetbrains.annotations.NotNull;
6+
7+
public class PsvFileTypeFactory extends FileTypeFactory {
8+
@Override
9+
public void createFileTypes(@NotNull FileTypeConsumer fileTypeConsumer) {
10+
fileTypeConsumer.consume(PsvFileType.INSTANCE, String.join(FileTypeConsumer.EXTENSION_DELIMITER, new String[] {"psv"}));
11+
}
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
package net.seesharpsoft.intellij.plugins.tsv;
2+
3+
import com.intellij.openapi.fileTypes.FileTypeConsumer;
4+
import com.intellij.openapi.fileTypes.FileTypeFactory;
5+
import org.jetbrains.annotations.NotNull;
6+
7+
public class TsvFileTypeFactory extends FileTypeFactory {
8+
@Override
9+
public void createFileTypes(@NotNull FileTypeConsumer fileTypeConsumer) {
10+
fileTypeConsumer.consume(TsvFileType.INSTANCE, String.join(FileTypeConsumer.EXTENSION_DELIMITER, new String[] {"tsv", "tab"}));
11+
}
12+
}

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

Lines changed: 89 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -7,28 +7,27 @@
77

88
<description><![CDATA[
99
10-
<p>The <em>Table Editor</em> is a newly introduced feature of CSV Plugin v2.*. Support its ongoing development by <a href="https://github.com/SeeSharpSoft/intellij-csv-validator/issues">reporting issues, providing suggestions, contributing ideas/features</a> or by just <a href="https://plugins.jetbrains.com/plugin/10037-csv-plugin">giving it a thumbs up.</a></p>
10+
<p>Lightweight plugin for editing CSV/TSV/PSV files with a flexible table editor, syntax validation, structure highlighting, customizable coloring, new intentions and helpful inspections.</p>
1111
<br><hr/><br>
12-
13-
Lightweight CSV plugin that supports editing files in CSV/TSV format.<br><br>
1412
<b>Features:</b><br>
1513
<ul>
16-
<li>CSV/TSV/PSV file detection</li>
17-
<li>table editor</li>
14+
<li>support for CSV/TSV/PSV file extensions</li>
15+
<li>customizable table editor</li>
1816
<li>customizable text editor</li>
17+
<li>customizable column coloring</li>
1918
<li>syntax validation</li>
20-
<li>syntax highlighting (configurable)</li>
21-
<li>content formatting (configurable)</li>
19+
<li>syntax highlighting</li>
20+
<li>content formatting</li>
2221
<li>quick fix inspections</li>
2322
<li>intentions (Alt+Enter), e.g. Quote/Unquote (all), Shift Column Left/Right</li>
23+
<li>balloon help & spell checker</li>
2424
<li>structure view (header-entry layout)</li>
2525
<li>support for ',', ';', '|' or '&#8633;' as value separator</li>
2626
<li>highlight of active column values</li>
27-
<li>customizable column coloring</li>
2827
<li>tab (&#8633;) separator highlighting</li>
2928
</ul>
3029
31-
<b>TSV file support:</b> <em>TSV files are recognized as such but treated as a variant of CSV files, the same syntax highlighting and code style settings are applied.</em>
30+
<b>TSV/PSV file support:</b> <em>TSV/PSV files are recognized as such but treated as a variant of CSV files, the same syntax highlighting and code style settings are applied.</em>
3231
<br><br>
3332
<b>Code formatting:</b> <em>Default code formatting is 'Tabularize'. Can be changed in Settings -> Editor -> Code Style -> CSV</em>
3433
<br><br>
@@ -46,37 +45,24 @@
4645

4746
<change-notes><![CDATA[
4847
<pre style="font-family: sans-serif">
49-
FIX: Index out of bound error on multi line clear cells #151
48+
NEW: add separator selection to table editor #140
49+
FIX: coloring of table cells (e.g. selection mode)
50+
FIX: enter edit mode via keyboard (e.g. ENTER key in cell)
5051
</pre>
5152
]]>
5253
</change-notes>
5354

5455
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/build_number_ranges.html for description -->
55-
<idea-version since-build="192.5728.98"/>
56+
<idea-version since-build="173.2099.1" />
5657

5758
<!-- please see http://www.jetbrains.org/intellij/sdk/docs/basics/getting_started/plugin_compatibility.html
5859
on how to target different products -->
5960
<depends>com.intellij.modules.lang</depends>
6061

6162
<extensions defaultExtensionNs="com.intellij">
62-
<fileType name="CSV"
63-
implementationClass="net.seesharpsoft.intellij.plugins.csv.CsvFileType"
64-
extensions="csv"
65-
language="csv"
66-
fieldName="INSTANCE"
67-
/>
68-
<fileType name="TSV"
69-
implementationClass="net.seesharpsoft.intellij.plugins.tsv.TsvFileType"
70-
extensions="tsv;tab"
71-
language="tsv"
72-
fieldName="INSTANCE"
73-
/>
74-
<fileType name="PSV"
75-
implementationClass="net.seesharpsoft.intellij.plugins.psv.PsvFileType"
76-
extensions="psv"
77-
language="psv"
78-
fieldName="INSTANCE"
79-
/>
63+
<fileTypeFactory implementation="net.seesharpsoft.intellij.plugins.csv.CsvFileTypeFactory"/>
64+
<fileTypeFactory implementation="net.seesharpsoft.intellij.plugins.tsv.TsvFileTypeFactory"/>
65+
<fileTypeFactory implementation="net.seesharpsoft.intellij.plugins.psv.PsvFileTypeFactory"/>
8066

8167
<lang.parserDefinition language="csv"
8268
implementationClass="net.seesharpsoft.intellij.plugins.csv.CsvParserDefinition"/>
@@ -160,6 +146,77 @@ FIX: Index out of bound error on multi line clear cells #151
160146
</extensions>
161147

162148
<actions>
149+
<group id="CsvTableEditorColumnContextMenu"
150+
popup="true"
151+
>
152+
<separator />
153+
</group>
154+
<group id="CsvTableEditorRowContextMenu"
155+
popup="true"
156+
>
157+
<separator />
158+
</group>
159+
<action class="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$AddColumnBefore"
160+
id="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$AddColumnBefore"
161+
text="New column before (Ctrl+Left)"
162+
icon="/media/icons/add-column-before.png"
163+
>
164+
<add-to-group group-id="CsvTableEditorColumnContextMenu" anchor="first" />
165+
</action>
166+
<action class="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$AddColumnAfter"
167+
id="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$AddColumnAfter"
168+
text="New column after (Ctrl+Right)"
169+
icon="/media/icons/add-column.png"
170+
>
171+
<add-to-group group-id="CsvTableEditorColumnContextMenu" relative-to-action="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$AddColumnBefore" anchor="after" />
172+
</action>
173+
<action class="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$DeleteSelectedColumns"
174+
id="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$DeleteSelectedColumns"
175+
text="Delete selected column (Ctrl+Shift+Del)"
176+
icon="/media/icons/remove-column.png"
177+
>
178+
<add-to-group group-id="CsvTableEditorColumnContextMenu" relative-to-action="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$AddColumnAfter" anchor="after" />
179+
</action>
180+
181+
<action class="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$AddRowBefore"
182+
id="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$AddRowBefore"
183+
text="New row before (Ctrl+Up)"
184+
icon="/media/icons/add-row-before.png"
185+
>
186+
<add-to-group group-id="CsvTableEditorRowContextMenu" anchor="first" />
187+
</action>
188+
<action class="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$AddRowAfter"
189+
id="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$AddRowAfter"
190+
text="New row after (Ctrl+Down)"
191+
icon="/media/icons/add-row.png"
192+
>
193+
<add-to-group group-id="CsvTableEditorRowContextMenu" relative-to-action="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$AddRowBefore" anchor="after" />
194+
</action>
195+
<action class="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$DeleteSelectedRows"
196+
id="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$DeleteSelectedRows"
197+
text="Delete selected rows (Ctrl+Del)"
198+
icon="/media/icons/remove-row.png"
199+
>
200+
<add-to-group group-id="CsvTableEditorRowContextMenu" relative-to-action="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$AddRowAfter" anchor="after" />
201+
</action>
202+
203+
<action class="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$AdjustColumnWidths"
204+
id="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$AdjustColumnWidths"
205+
text="Adjust column widths"
206+
icon="/media/icons/adjust-column-width.png"
207+
>
208+
<add-to-group group-id="CsvTableEditorColumnContextMenu" />
209+
<add-to-group group-id="CsvTableEditorRowContextMenu" />
210+
</action>
211+
<action class="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$ResetColumnWidths"
212+
id="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$ResetColumnWidths"
213+
text="Reset column widths to default"
214+
icon="/media/icons/reset-column-width.png"
215+
>
216+
<add-to-group group-id="CsvTableEditorColumnContextMenu" relative-to-action="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$AdjustColumnWidths" anchor="after" />
217+
<add-to-group group-id="CsvTableEditorRowContextMenu" relative-to-action="net.seesharpsoft.intellij.plugins.csv.actions.CsvTableEditorActions$AdjustColumnWidths" anchor="after" />
218+
</action>
219+
163220
<group id="net.seesharpsoft.intellij.plugins.csv.actions.CsvChangeSeparatorActionGroup"
164221
class="net.seesharpsoft.intellij.plugins.csv.actions.CsvChangeSeparatorActionGroup"
165222
text="CSV Separator"
@@ -169,7 +226,10 @@ FIX: Index out of bound error on multi line clear cells #151
169226
icon="/media/icons/csv-icon.png"
170227
>
171228
<add-to-group group-id="EditorPopupMenu" anchor="last"/>
229+
<add-to-group group-id="CsvTableEditorColumnContextMenu" anchor="last"/>
230+
<add-to-group group-id="CsvTableEditorRowContextMenu" anchor="last"/>
172231
</group>
232+
173233
</actions>
174234

175235
</idea-plugin>

src/test/java/net/seesharpsoft/intellij/plugins/csv/actions/CsvChangeSeparatorActionTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
package net.seesharpsoft.intellij.plugins.csv.actions;
22

33
import com.intellij.openapi.actionSystem.Presentation;
4-
import com.intellij.testFramework.fixtures.BasePlatformTestCase;
4+
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
55
import net.seesharpsoft.intellij.plugins.csv.settings.CsvCodeStyleSettings;
66

7-
public class CsvChangeSeparatorActionTest extends BasePlatformTestCase {
7+
public class CsvChangeSeparatorActionTest extends LightPlatformCodeInsightFixtureTestCase {
88

99
@Override
1010
protected String getTestDataPath() {

0 commit comments

Comments
 (0)