Skip to content

Commit 5b74334

Browse files
authoredAug 3, 2020
Merge pull request #240 from SeeSharpSoft/master
Release 2.14.0
2 parents 6c03ef9 + ef37447 commit 5b74334

19 files changed

+404
-108
lines changed
 

‎CHANGELOG

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
2.14.0
2+
Aug 04, 2020
3+
4+
NEW: Predefined column colors (Rainbow-style)
5+
NEW: Enhanced color scheme switch
6+
NEW: Table Editor coloring
7+
18
2.13.0
29
Jul 20, 2020
310

‎README.md

+33-13
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,15 @@ Please note:
155155

156156
Enable zero-based column numbering. This affects the tooltip info of the text editor as well as column numbering of the table editor.
157157

158+
##### Value coloring
159+
160+
Choose the coloring method of values. Possible options are:
161+
162+
- _Rainbow (Column Color)_ - values are colored based on their column.
163+
- _Simple (Text Color)_ - values are colored based on the defined text color.
164+
165+
All colors can be adjusted via [CSV Color Scheme](#color-scheme) settings.
166+
158167
#### Text Editor
159168

160169
##### Highlighting
@@ -163,10 +172,6 @@ Enable zero-based column numbering. This affects the tooltip info of the text ed
163172

164173
The highlighting of the current caret row might interfere with custom background color settings and can be enabled/disabled for CSV/TSV/PSV files here.
165174

166-
###### Enable column highlighting
167-
168-
An easy way to switch *Column Highlighting* on or off (in text editor).
169-
170175
###### Highlight tab separator
171176

172177
Enable/disable highlighting (and choose the highlight color) of tab characters (↹) in their role as value separator (TSV). Tabs as part of a value are therefore not highlighted on purpose.
@@ -205,7 +210,7 @@ The maximum width of a single table column in _px_, which is used when adjusting
205210

206211
If selected, the table column widths are adjusted based on the column contents automatically when the table editor is opened. This setting can be changed in the table editor itself per file.
207212

208-
##### Keep/ignore linebreak at end of file
213+
##### Keep/ignore linebreak at file end
209214

210215
If the file ends with a completely empty line (no spaces or tabs either), the table editor will not show this line as empty values but ignore it. When table data is serialized, an existing empty line is kept at the end of the file.
211216

@@ -217,23 +222,22 @@ Enables/disables the info panel at the bottom of the table editor.
217222

218223
Always quotes a single value on save - even if not required.
219224

220-
##### Enable column highlighting
221-
222-
An easy way to switch *Column Highlighting* on or off (in table editor).
223-
224225
### Color Scheme
225226

226-
The different symbols of a CSV document, namely the separator (comma), the quotes, the escaped literals and the text elements itself, are highlighted by a coloring scheme that can be customized:
227+
The different symbols of a CSV document, namely the *separator* (e.g. comma, pipe, semicolon), the *quote* character, the *escaped literals* and the *text* elements itself, are colored based on the CSV color scheme settings:
227228

228-
- _File > Settings > Editor > Color Scheme > CSV_
229+
- _File > Settings > Editor > Color Scheme > CSV/TSV/PSV_
229230

230231
Preset colors are based on Jetbrains IDE defaults and support the different UI themes.
231232

232233
![Color scheme settings](./docs/colorsettings.png)
233234

234-
#### Column Highlighting Colors
235+
#### Column Colors
236+
237+
Besides the colors and font-style variants for the different CSV symbols, additionally up to 10 different column colors can be defined.
238+
Those colors are applied to the columns round robin.
239+
Column colors are taken into account when **Rainbow** is selected as [**Value Coloring**](#value-coloring) option in the [Editor Settings](#editor-settings).
235240

236-
Besides defining colors and font-style variants for the different CSV symbols, additionally up to 10 different column highlight colors can be defined. Those colors are applied to the columns round robin. Undefined column highlight colors will be skipped if they are not followed by any other color definition.
237241

238242
### Formatting
239243

@@ -401,6 +405,22 @@ You can also download the JAR package from the [Jetbrains plugin repository](htt
401405

402406
- _File > Settings > Plugins > Install plugin from disk..._
403407

408+
## Troubleshooting
409+
410+
#### CSV Plugin causes the IDE to stop working properly
411+
412+
Since version 2.11.0, the plugins requires the IntelliJ platform to be executed on JRE9 or higher. If this is not the case, the following error log can be noticed:
413+
414+
`com.intellij.diagnostic.PluginException: While loading class net.seesharpsoft.intellij.plugins.csv.CsvFileTypeOverrider: net/seesharpsoft/intellij/plugins/csv/CsvFileTypeOverrider has been compiled by a more recent version of the Java Runtime (class file version 53.0), this version of the Java Runtime only recognizes class file versions up to 52.0 [Plugin: net.seesharpsoft.intellij.plugins.csv]`
415+
416+
In some cases the error log doesn't seem to point this out in a noticable manner, but the IDE doesn't work correctly after enabling the plugin. Always disable the plugin first before continuing with the following steps.
417+
418+
Please read the [official instructions](https://intellij-support.jetbrains.com/hc/en-us/articles/206544879-Selecting-the-JDK-version-the-IDE-will-run-under) on how to switch to a newer JRE, or [manually install](https://github.com/SeeSharpSoft/intellij-csv-validator#installation) a [prior CSV plugin version](https://github.com/SeeSharpSoft/intellij-csv-validator/releases/tag/2.10.0).
419+
420+
#### Features of the CSV Plugin are not available
421+
422+
If another plugin for CSV files like [Rainbow CSV](https://plugins.jetbrains.com/plugin/12896-rainbow-csv) is enabled, this plugin might not be taken into account for parsing and presenting CSV file content.
423+
404424
## Contribution
405425

406426
Contributions are welcome. Please check [CONTRIBUTING.md](./CONTRIBUTING.md) for more information.

‎build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jacocoTestReport {
2424
}
2525

2626
group 'net.seesharpsoft.intellij.plugins'
27-
version '2.13.0'
27+
version '2.14.0'
2828

2929
apply plugin: 'java'
3030
sourceCompatibility = javaVersion

‎docs/colorsettings.png

-3.6 KB
Loading

‎docs/example.png

-3.19 KB
Loading

‎src/main/java/net/seesharpsoft/intellij/plugins/csv/CsvHelper.java

-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package net.seesharpsoft.intellij.plugins.csv;
22

3-
import com.intellij.ide.scratch.ScratchFileType;
43
import com.intellij.ide.scratch.ScratchUtil;
54
import com.intellij.lang.*;
65
import com.intellij.lexer.Lexer;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
package net.seesharpsoft.intellij.plugins.csv;
2+
3+
import com.intellij.ide.actions.ShowSettingsUtilImpl;
4+
import com.intellij.ide.plugins.IdeaPluginDescriptorImpl;
5+
import com.intellij.ide.plugins.PluginManager;
6+
import com.intellij.notification.*;
7+
import com.intellij.openapi.extensions.PluginId;
8+
import com.intellij.openapi.options.ShowSettingsUtil;
9+
import com.intellij.openapi.project.Project;
10+
import com.intellij.openapi.startup.StartupActivity;
11+
import net.seesharpsoft.intellij.plugins.csv.settings.CsvEditorSettings;
12+
import net.seesharpsoft.intellij.plugins.csv.settings.CsvEditorSettingsProvider;
13+
import org.jetbrains.annotations.NotNull;
14+
15+
import javax.swing.event.HyperlinkEvent;
16+
import java.awt.*;
17+
import java.io.IOException;
18+
import java.net.URI;
19+
20+
public class CsvPlugin implements StartupActivity {
21+
22+
protected static IdeaPluginDescriptorImpl getPluginDescriptor() {
23+
return (IdeaPluginDescriptorImpl)PluginManager.getPlugin(PluginId.getId("net.seesharpsoft.intellij.plugins.csv"));
24+
}
25+
26+
protected static String getVersion() {
27+
return getPluginDescriptor().getVersion();
28+
}
29+
30+
protected static String getChangeNotes() {
31+
return getPluginDescriptor().getChangeNotes();
32+
}
33+
34+
private static void openLink(Project project, String link) {
35+
if (!project.isDisposed() && link.startsWith("#")) {
36+
((ShowSettingsUtilImpl)ShowSettingsUtil.getInstance()).showSettingsDialog(project, link.substring(1), null);
37+
}
38+
if (Desktop.isDesktopSupported()) {
39+
Desktop desktop = Desktop.getDesktop();
40+
if (desktop.isSupported(Desktop.Action.BROWSE)) {
41+
try {
42+
desktop.browse(URI.create(link));
43+
} catch (IOException e) {
44+
e.printStackTrace();
45+
}
46+
}
47+
}
48+
}
49+
50+
@Override
51+
public void runActivity(@NotNull Project project) {
52+
if (CsvEditorSettings.getInstance().checkCurrentPluginVersion(getVersion())) {
53+
return;
54+
}
55+
56+
NotificationGroup notificationGroup = new NotificationGroup(
57+
"CsvPlugin", NotificationDisplayType.STICKY_BALLOON, true
58+
);
59+
60+
NotificationListener.Adapter notificationListener = new NotificationListener.Adapter() {
61+
@Override
62+
protected void hyperlinkActivated(@NotNull Notification notification, @NotNull HyperlinkEvent e) {
63+
openLink(project, e.getDescription());
64+
}
65+
};
66+
67+
Notification notification = notificationGroup.createNotification(
68+
"CSV Plugin " + getVersion() + " - Change Notes",
69+
getChangeNotes() +
70+
"<p><b>Customize plugin settings:</b> " +
71+
"<a href=\"#" + CsvEditorSettingsProvider.CSV_EDITOR_SETTINGS_ID + "\">Editor/General</a>, " +
72+
"<a href=\"#reference.settingsdialog.IDE.editor.colors.CSV/TSV/PSV\">Color Scheme</a>, " +
73+
"<a href=\"#preferences.sourceCode.CSV/TSV/PSV\">Formatting</a></p>" +
74+
"<br>" +
75+
"<p>Visit the <a href=\"https://github.com/SeeSharpSoft/intellij-csv-validator\">CSV Plugin GitHub</a> to read more about the available features & settings, " +
76+
"submit <a href=\"https://github.com/SeeSharpSoft/intellij-csv-validator/issues\">issues & feature request</a>, " +
77+
"or show your support by <a href=\"https://plugins.jetbrains.com/plugin/10037-csv-plugin\">rating this plugin</a>. <b>Thanks!</b></p>"
78+
,
79+
NotificationType.INFORMATION,
80+
notificationListener
81+
);
82+
83+
Notifications.Bus.notify(notification);
84+
}
85+
}

‎src/main/java/net/seesharpsoft/intellij/plugins/csv/editor/CsvAnnotator.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public void annotate(@NotNull final PsiElement element, @NotNull final Annotatio
6767

6868
Annotation annotation = holder.createAnnotation(CSV_COLUMN_INFO_SEVERITY, textRange, message, tooltip);
6969
annotation.setEnforcedTextAttributes(
70-
CsvEditorSettings.getInstance().isColumnHighlightingEnabled() ?
70+
CsvEditorSettings.getInstance().getValueColoring() == CsvEditorSettings.ValueColoring.RAINBOW ?
7171
CsvColorSettings.getTextAttributesOfColumn(columnInfo.getColumnIndex(), holder.getCurrentAnnotationSession()) :
7272
null
7373
);

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

+5
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package net.seesharpsoft.intellij.plugins.csv.editor.table.swing;
22

33
import com.intellij.openapi.editor.colors.EditorColorsManager;
4+
import com.intellij.openapi.editor.colors.EditorColorsScheme;
45
import com.intellij.openapi.project.Project;
56
import com.intellij.openapi.vfs.VirtualFile;
67
import com.intellij.psi.PsiElement;
@@ -94,6 +95,8 @@ protected void createUIComponents() {
9495
}
9596

9697
private void initializedUIComponents() {
98+
EditorColorsScheme editorColorsScheme = EditorColorsManager.getInstance().getGlobalScheme();
99+
97100
btnRedo.addActionListener(tableEditorActions.redo);
98101
btnUndo.addActionListener(tableEditorActions.undo);
99102
btnAddRow.addActionListener(tableEditorActions.addRow);
@@ -129,6 +132,8 @@ private void initializedUIComponents() {
129132
tblEditor.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
130133
tblEditor.setShowColumns(true);
131134
tblEditor.setFont(getFont());
135+
tblEditor.setBackground(editorColorsScheme.getDefaultBackground());
136+
tblEditor.setForeground(editorColorsScheme.getDefaultForeground());
132137
setTableRowHeight(0);
133138

134139
tblEditor.getColumnModel().addColumnModelListener(tableEditorListener);

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

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
package net.seesharpsoft.intellij.plugins.csv.editor.table.swing;
22

33
import com.intellij.openapi.editor.colors.EditorColorsManager;
4+
import com.intellij.openapi.editor.colors.EditorColorsScheme;
45
import com.intellij.openapi.editor.colors.EditorFontType;
56
import com.intellij.openapi.editor.impl.FontFallbackIterator;
67
import com.intellij.openapi.editor.markup.TextAttributes;
78
import com.intellij.openapi.util.UserDataHolder;
89
import com.intellij.ui.components.JBScrollPane;
910
import com.intellij.util.ui.UIUtil;
10-
import net.seesharpsoft.intellij.plugins.csv.settings.CsvEditorSettings;
1111
import net.seesharpsoft.intellij.plugins.csv.settings.CsvColorSettings;
1212
import org.jetbrains.annotations.NotNull;
1313

@@ -46,10 +46,7 @@ public MultiLineCellRenderer(CsvTableEditorKeyListener keyListener, UserDataHold
4646
}
4747

4848
private TextAttributes getColumnTextAttributes(int column) {
49-
if (CsvEditorSettings.getInstance().isTableColumnHighlightingEnabled()) {
50-
return CsvColorSettings.getTextAttributesOfColumn(column, myUserDataHolder);
51-
}
52-
return null;
49+
return CsvColorSettings.getTextAttributesOfColumn(column, myUserDataHolder);
5350
}
5451

5552
private Color getColumnForegroundColor(int column, Color fallback) {
@@ -64,6 +61,8 @@ private Color getColumnBackgroundColor(int column, Color fallback) {
6461

6562
@Override
6663
public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
64+
EditorColorsScheme editorColorsScheme = EditorColorsManager.getInstance().getGlobalScheme();
65+
6766
if (isSelected) {
6867
myTextArea.setForeground(table.getSelectionForeground());
6968
myTextArea.setBackground(table.getSelectionBackground());
@@ -74,8 +73,8 @@ public Component getTableCellRendererComponent(JTable table, Object value, boole
7473
if (hasFocus) {
7574
myTextArea.setBorder(UIManager.getBorder("Table.focusCellHighlightBorder"));
7675
if (table.isCellEditable(row, column)) {
77-
myTextArea.setForeground(UIManager.getColor("Table.focusCellForeground"));
78-
myTextArea.setBackground(UIManager.getColor("Table.focusCellBackground"));
76+
myTextArea.setForeground(UIManager.getColor(editorColorsScheme.getDefaultForeground()));
77+
myTextArea.setBackground(UIManager.getColor(editorColorsScheme.getDefaultBackground()));
7978
}
8079
} else {
8180
myTextArea.setBorder(new EmptyBorder(1, 2, 1, 2));

‎src/main/java/net/seesharpsoft/intellij/plugins/csv/settings/CsvColorSettings.java

+35-19
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package net.seesharpsoft.intellij.plugins.csv.settings;
22

3-
import com.intellij.openapi.editor.DefaultLanguageHighlighterColors;
43
import com.intellij.openapi.editor.colors.EditorColorsManager;
54
import com.intellij.openapi.editor.colors.EditorColorsScheme;
65
import com.intellij.openapi.editor.colors.TextAttributesKey;
@@ -11,6 +10,7 @@
1110
import com.intellij.openapi.options.colors.ColorSettingsPage;
1211
import com.intellij.openapi.util.Key;
1312
import com.intellij.openapi.util.UserDataHolder;
13+
import net.seesharpsoft.UnhandledSwitchCaseException;
1414
import net.seesharpsoft.intellij.plugins.csv.CsvIconProvider;
1515
import net.seesharpsoft.intellij.plugins.csv.highlighter.CsvSyntaxHighlighter;
1616
import org.jetbrains.annotations.NotNull;
@@ -25,10 +25,10 @@
2525

2626
public class CsvColorSettings implements ColorSettingsPage {
2727

28-
private static final Integer MAX_COLUMN_HIGHLIGHT_COLORS = 10;
28+
private static final Integer MAX_COLUMN_COLORING_COLORS = 10;
2929
private static final AttributesDescriptor[] DESCRIPTORS;
30-
private static final List<TextAttributesKey> COLUMN_HIGHLIGHT_ATTRIBUTES;
31-
private static final Key<List<TextAttributes>> COLUMN_HIGHLIGHT_TEXT_ATTRIBUTES_KEY = Key.create("CSV_PLUGIN_COLUMN_HIGHLIGHT_ATTRIBUTES");
30+
private static final List<TextAttributesKey> COLUMN_COLORING_ATTRIBUTES;
31+
private static final Key<List<TextAttributes>> COLUMN_COLORING_TEXT_ATTRIBUTES_KEY = Key.create("CSV_PLUGIN_COLUMN_COLORING_ATTRIBUTES");
3232

3333
static {
3434
List<AttributesDescriptor> attributesDescriptors = new ArrayList();
@@ -38,35 +38,51 @@ public class CsvColorSettings implements ColorSettingsPage {
3838
attributesDescriptors.add(new AttributesDescriptor("Escaped Text", CsvSyntaxHighlighter.ESCAPED_TEXT));
3939
attributesDescriptors.add(new AttributesDescriptor("Comment", CsvSyntaxHighlighter.COMMENT));
4040

41-
COLUMN_HIGHLIGHT_ATTRIBUTES = new ArrayList<>();
42-
for (int i = 0; i < MAX_COLUMN_HIGHLIGHT_COLORS; ++i) {
43-
TextAttributesKey textAttributesKey = createTextAttributesKey(String.format("CSV_COLUMN_HIGHLIGHT_ATTRIBUTE_%d", i + 1), DefaultLanguageHighlighterColors.STRING);
44-
COLUMN_HIGHLIGHT_ATTRIBUTES.add(textAttributesKey);
45-
attributesDescriptors.add(new AttributesDescriptor(String.format("Column Highlighting Color %d", i + 1), textAttributesKey));
41+
COLUMN_COLORING_ATTRIBUTES = new ArrayList<>();
42+
for (int i = 0; i < MAX_COLUMN_COLORING_COLORS; ++i) {
43+
TextAttributesKey textAttributesKey = createTextAttributesKey(String.format("CSV_PLUGIN_COLUMN_COLORING_ATTRIBUTE_%d", i + 1), CsvSyntaxHighlighter.TEXT);
44+
COLUMN_COLORING_ATTRIBUTES.add(textAttributesKey);
45+
attributesDescriptors.add(new AttributesDescriptor(String.format("Column Color %d", i + 1), textAttributesKey));
4646
}
4747
DESCRIPTORS = attributesDescriptors.toArray(new AttributesDescriptor[attributesDescriptors.size()]);
4848
}
4949

5050
public static TextAttributes getTextAttributesOfColumn(int columnIndex, UserDataHolder userDataHolder) {
51-
List<TextAttributes> textAttributeList = userDataHolder.getUserData(COLUMN_HIGHLIGHT_TEXT_ATTRIBUTES_KEY);
51+
List<TextAttributes> textAttributeList = userDataHolder.getUserData(COLUMN_COLORING_TEXT_ATTRIBUTES_KEY);
5252
if (textAttributeList == null) {
5353
EditorColorsScheme editorColorsScheme = EditorColorsManager.getInstance().getGlobalScheme();
5454
textAttributeList = new ArrayList<>();
5555
int maxIndex = 0;
56-
for (int colorDescriptorIndex = 0; colorDescriptorIndex < MAX_COLUMN_HIGHLIGHT_COLORS; ++colorDescriptorIndex) {
57-
TextAttributesKey textAttributesKey = COLUMN_HIGHLIGHT_ATTRIBUTES.get(colorDescriptorIndex);
58-
TextAttributes textAttributes = editorColorsScheme.getAttributes(textAttributesKey);
59-
textAttributeList.add(textAttributes);
60-
if (!textAttributesKey.getDefaultAttributes().equals(textAttributes)) {
61-
maxIndex = colorDescriptorIndex;
62-
}
56+
switch(CsvEditorSettings.getInstance().getValueColoring()) {
57+
case RAINBOW:
58+
maxIndex = applyColumnTextAttributes(editorColorsScheme, textAttributeList);
59+
break;
60+
case SIMPLE:
61+
textAttributeList.add(editorColorsScheme.getAttributes(CsvSyntaxHighlighter.TEXT));
62+
break;
63+
default:
64+
throw new UnhandledSwitchCaseException(CsvEditorSettings.getInstance().getValueColoring());
6365
}
6466
textAttributeList = textAttributeList.subList(0, maxIndex + 1);
65-
userDataHolder.putUserData(COLUMN_HIGHLIGHT_TEXT_ATTRIBUTES_KEY, textAttributeList);
67+
userDataHolder.putUserData(COLUMN_COLORING_TEXT_ATTRIBUTES_KEY, textAttributeList);
6668
}
6769
return textAttributeList.isEmpty() ? null : textAttributeList.get(columnIndex % textAttributeList.size());
6870
}
6971

72+
private static int applyColumnTextAttributes(EditorColorsScheme editorColorsScheme, List<TextAttributes> textAttributeList) {
73+
int maxIndex = 0;
74+
TextAttributes defaultTextAttributes = editorColorsScheme.getAttributes(CsvSyntaxHighlighter.TEXT);
75+
for (int colorDescriptorIndex = 0; colorDescriptorIndex < MAX_COLUMN_COLORING_COLORS; ++colorDescriptorIndex) {
76+
TextAttributesKey textAttributesKey = COLUMN_COLORING_ATTRIBUTES.get(colorDescriptorIndex);
77+
TextAttributes textAttributes = editorColorsScheme.getAttributes(textAttributesKey);
78+
textAttributeList.add(textAttributes);
79+
if (!textAttributes.equals(defaultTextAttributes)) {
80+
maxIndex = colorDescriptorIndex;
81+
}
82+
}
83+
return maxIndex;
84+
}
85+
7086
@Nullable
7187
@Override
7288
public Icon getIcon() {
@@ -85,7 +101,7 @@ public String getDemoText() {
85101
return "1,\"Eldon Base for stackable storage shelf, platinum\",Muhammed MacIntyre,3,-213.25,38.94,35,Nunavut,Storage & Organization,0.8\n" +
86102
"2,\"1.7 Cubic Foot Compact \"\"Cube\"\" Office Refrigerators\",Barry French,293,457.81,208.16,68.02,Nunavut,Appliances,0.58\n" +
87103
"3,\"Cardinal Slant-D® Ring Binder, Heavy Gauge Vinyl\",Barry French,293,46.71,8.69,2.99,Nunavut,Binders and Binder Accessories,0.39\n" +
88-
"4,R380,Clay Rozendal,483,1198.97,195.99,3.99,Nunavut,Telephones and Communication,0.58\n" +
104+
"#4,R380,Clay Rozendal,483,1198.97,195.99,3.99,Nunavut,Telephones and Communication,0.58\n" +
89105
"5,Holmes HEPA Air Purifier,Carlos Soltero,515,30.94,21.78,5.94,Nunavut,Appliances,0.5";
90106
}
91107

‎src/main/java/net/seesharpsoft/intellij/plugins/csv/settings/CsvEditorSettings.java

+35-21
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,7 @@
66
import com.intellij.openapi.components.Storage;
77
import com.intellij.openapi.editor.ex.EditorSettingsExternalizable;
88
import com.intellij.util.xmlb.annotations.OptionTag;
9-
import net.seesharpsoft.intellij.plugins.csv.CsvEscapeCharacter;
10-
import net.seesharpsoft.intellij.plugins.csv.CsvStorageHelper;
11-
import net.seesharpsoft.intellij.plugins.csv.CsvValueSeparator;
9+
import net.seesharpsoft.intellij.plugins.csv.*;
1210
import org.jetbrains.annotations.NotNull;
1311

1412
import java.awt.*;
@@ -42,10 +40,26 @@ public enum EditorPrio {
4240
TEXT_ONLY
4341
}
4442

43+
public enum ValueColoring {
44+
RAINBOW("Rainbow (Column Color)"),
45+
SIMPLE("Simple (Text Color)");
46+
47+
private final String display;
48+
49+
ValueColoring(String displayArg) {
50+
this.display = displayArg;
51+
}
52+
53+
public String getDisplay() {
54+
return this.display;
55+
}
56+
}
57+
4558
public static final class OptionSet {
59+
public String CURRENT_PLUGIN_VERSION;
60+
4661
public boolean CARET_ROW_SHOWN;
4762
public boolean USE_SOFT_WRAP;
48-
public boolean COLUMN_HIGHTLIGHTING = true;
4963
public boolean HIGHTLIGHT_TAB_SEPARATOR = true;
5064
public boolean SHOW_INFO_BALLOON = true;
5165
public String TAB_HIGHLIGHT_COLOR = "-7984";
@@ -54,7 +68,6 @@ public static final class OptionSet {
5468
public int TABLE_AUTO_MAX_COLUMN_WIDTH = TABLE_AUTO_MAX_COLUMN_WIDTH_DEFAULT;
5569
public int TABLE_DEFAULT_COLUMN_WIDTH = TABLE_DEFAULT_COLUMN_WIDTH_DEFAULT;
5670
public boolean TABLE_AUTO_COLUMN_WIDTH_ON_OPEN = false;
57-
public boolean TABLE_COLUMN_HIGHTLIGHTING = true;
5871
public boolean ZERO_BASED_COLUMN_NUMBERING = false;
5972

6073
public boolean SHOW_TABLE_EDITOR_INFO_PANEL = true;
@@ -66,6 +79,7 @@ public static final class OptionSet {
6679
public CsvValueSeparator DEFAULT_VALUE_SEPARATOR = VALUE_SEPARATOR_DEFAULT;
6780
public boolean KEEP_TRAILING_SPACES = false;
6881
public String COMMENT_INDICATOR = COMMENT_INDICATOR_DEFAULT;
82+
public ValueColoring VALUE_COLORING = ValueColoring.RAINBOW;
6983

7084
public OptionSet() {
7185
EditorSettingsExternalizable editorSettingsExternalizable = EditorSettingsExternalizable.getInstance();
@@ -121,14 +135,6 @@ public void setUseSoftWraps(boolean useSoftWraps) {
121135
getState().USE_SOFT_WRAP = useSoftWraps;
122136
}
123137

124-
public boolean isColumnHighlightingEnabled() {
125-
return getState().COLUMN_HIGHTLIGHTING;
126-
}
127-
128-
public void setColumnHighlightingEnabled(boolean columnHighlightingEnabled) {
129-
getState().COLUMN_HIGHTLIGHTING = columnHighlightingEnabled;
130-
}
131-
132138
public boolean isHighlightTabSeparator() {
133139
return getState().HIGHTLIGHT_TAB_SEPARATOR;
134140
}
@@ -193,14 +199,6 @@ public void setQuotingEnforced(boolean quotingEnforced) {
193199
getState().QUOTING_ENFORCED = quotingEnforced;
194200
}
195201

196-
public boolean isTableColumnHighlightingEnabled() {
197-
return getState().TABLE_COLUMN_HIGHTLIGHTING;
198-
}
199-
200-
public void setTableColumnHighlightingEnabled(boolean columnHighlightingEnabled) {
201-
getState().TABLE_COLUMN_HIGHTLIGHTING = columnHighlightingEnabled;
202-
}
203-
204202
public boolean isZeroBasedColumnNumbering() {
205203
return getState().ZERO_BASED_COLUMN_NUMBERING;
206204
}
@@ -286,4 +284,20 @@ public void setCommentIndicator(String commentIndicator) {
286284
public String getCommentIndicator() {
287285
return getState().COMMENT_INDICATOR;
288286
}
287+
288+
public ValueColoring getValueColoring() {
289+
return getState().VALUE_COLORING;
290+
}
291+
292+
public void setValueColoring(ValueColoring valueColoring) {
293+
getState().VALUE_COLORING = valueColoring;
294+
}
295+
296+
public boolean checkCurrentPluginVersion(String actualVersion) {
297+
if (!actualVersion.equals(getState().CURRENT_PLUGIN_VERSION)) {
298+
getState().CURRENT_PLUGIN_VERSION = actualVersion;
299+
return false;
300+
}
301+
return true;
302+
}
289303
}

‎src/main/java/net/seesharpsoft/intellij/plugins/csv/settings/CsvEditorSettingsProvider.form

+38-25
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
<?xml version="1.0" encoding="UTF-8"?>
22
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="net.seesharpsoft.intellij.plugins.csv.settings.CsvEditorSettingsProvider">
3-
<grid id="27dc6" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="8" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
3+
<grid id="27dc6" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="9" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
44
<margin top="0" left="0" bottom="0" right="0"/>
55
<constraints>
6-
<xy x="20" y="20" width="1180" height="798"/>
6+
<xy x="20" y="20" width="1180" height="836"/>
77
</constraints>
88
<properties>
99
<enabled value="true"/>
@@ -16,12 +16,12 @@
1616
<grid id="350ae" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
1717
<margin top="10" left="10" bottom="10" right="10"/>
1818
<constraints>
19-
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
19+
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
2020
</constraints>
2121
<properties/>
2222
<border type="line" title="Text Editor"/>
2323
<children>
24-
<grid id="d2422" layout-manager="GridLayoutManager" row-count="3" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
24+
<grid id="d2422" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
2525
<margin top="10" left="10" bottom="10" right="10"/>
2626
<constraints>
2727
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@@ -37,17 +37,9 @@
3737
<text value="Highlight caret row"/>
3838
</properties>
3939
</component>
40-
<component id="314e1" class="javax.swing.JCheckBox" binding="cbColumnHighlighting">
41-
<constraints>
42-
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
43-
</constraints>
44-
<properties>
45-
<text value="Enable column highlighting (Editor &gt; Color Scheme &gt; CSV &gt; Column Hightlighting Colors)"/>
46-
</properties>
47-
</component>
4840
<component id="57ffb" class="com.intellij.ui.CheckBoxWithColorChooser" binding="cbTabHighlightColor" custom-create="true">
4941
<constraints>
50-
<grid row="2" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
42+
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
5143
</constraints>
5244
<properties/>
5345
</component>
@@ -94,10 +86,10 @@
9486
</grid>
9587
</children>
9688
</grid>
97-
<grid id="3e325" layout-manager="GridLayoutManager" row-count="8" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
89+
<grid id="3e325" layout-manager="GridLayoutManager" row-count="7" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
9890
<margin top="10" left="10" bottom="10" right="10"/>
9991
<constraints>
100-
<grid row="6" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
92+
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
10193
</constraints>
10294
<properties/>
10395
<border type="line" title="Table Editor"/>
@@ -118,14 +110,6 @@
118110
<text value="Enforce value quoting"/>
119111
</properties>
120112
</component>
121-
<component id="f25dc" class="javax.swing.JCheckBox" binding="cbTableColumnHighlighting">
122-
<constraints>
123-
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
124-
</constraints>
125-
<properties>
126-
<text value="Enable column highlighting (Editor &gt; Color Scheme &gt; CSV &gt; Column Hightlighting Colors)"/>
127-
</properties>
128-
</component>
129113
<component id="e470c" class="javax.swing.JCheckBox" binding="cbFileEndLineBreak">
130114
<constraints>
131115
<grid row="4" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
@@ -251,7 +235,7 @@
251235
</grid>
252236
<vspacer id="ff292">
253237
<constraints>
254-
<grid row="7" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
238+
<grid row="8" column="0" row-span="1" col-span="1" vsize-policy="6" hsize-policy="1" anchor="0" fill="2" indent="0" use-parent-layout="false"/>
255239
</constraints>
256240
</vspacer>
257241
<grid id="95245" layout-manager="GridLayoutManager" row-count="1" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
@@ -395,7 +379,7 @@
395379
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
396380
</constraints>
397381
<properties>
398-
<text value="Line comment indicator (e.g. # or //):"/>
382+
<text value="Line comment indicator:"/>
399383
</properties>
400384
</component>
401385
<component id="a30e" class="javax.swing.JTextField" binding="tfCommentIndicator">
@@ -413,6 +397,35 @@
413397
</hspacer>
414398
</children>
415399
</grid>
400+
<grid id="b824f" layout-manager="GridLayoutManager" row-count="1" column-count="3" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
401+
<margin top="0" left="0" bottom="0" right="0"/>
402+
<constraints>
403+
<grid row="5" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
404+
</constraints>
405+
<properties/>
406+
<border type="none"/>
407+
<children>
408+
<component id="d69fd" class="javax.swing.JLabel">
409+
<constraints>
410+
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
411+
</constraints>
412+
<properties>
413+
<text value="Value Coloring:"/>
414+
</properties>
415+
</component>
416+
<component id="2e9e9" class="javax.swing.JComboBox" binding="comboValueColoring" custom-create="true">
417+
<constraints>
418+
<grid row="0" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="1" indent="0" use-parent-layout="false"/>
419+
</constraints>
420+
<properties/>
421+
</component>
422+
<hspacer id="1ebf6">
423+
<constraints>
424+
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
425+
</constraints>
426+
</hspacer>
427+
</children>
428+
</grid>
416429
</children>
417430
</grid>
418431
</form>

‎src/main/java/net/seesharpsoft/intellij/plugins/csv/settings/CsvEditorSettingsProvider.java

+8-9
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,12 @@ public class CsvEditorSettingsProvider implements EditorOptionsProvider {
2626
private JCheckBox cbCaretRowShown;
2727
private JPanel myMainPanel;
2828
private JCheckBox cbUseSoftWraps;
29-
private JCheckBox cbColumnHighlighting;
3029
private CheckBoxWithColorChooser cbTabHighlightColor;
3130
private JCheckBox cbShowInfoBalloonCheckBox;
3231
private JCheckBox cbShowInfoPanel;
3332
private JComboBox cbRowHeight;
3433
private JComboBox cbEditorUsage;
3534
private JCheckBox cbQuotingEnforced;
36-
private JCheckBox cbTableColumnHighlighting;
3735
private JCheckBox cbZeroBasedColumnNumbering;
3836
private JCheckBox cbFileEndLineBreak;
3937
private JFormattedTextField tfMaxColumnWidth;
@@ -43,6 +41,7 @@ public class CsvEditorSettingsProvider implements EditorOptionsProvider {
4341
private JComboBox comboValueSeparator;
4442
private JCheckBox cbKeepTrailingWhitespaces;
4543
private JTextField tfCommentIndicator;
44+
private JComboBox comboValueColoring;
4645

4746
@NotNull
4847
@Override
@@ -76,7 +75,6 @@ public boolean isModified() {
7675
CsvEditorSettings csvEditorSettings = CsvEditorSettings.getInstance();
7776
return isModified(cbCaretRowShown, csvEditorSettings.isCaretRowShown()) ||
7877
isModified(cbUseSoftWraps, csvEditorSettings.isUseSoftWraps()) ||
79-
isModified(cbColumnHighlighting, csvEditorSettings.isColumnHighlightingEnabled()) ||
8078
isModified(cbShowInfoBalloonCheckBox, csvEditorSettings.isShowInfoBalloon()) ||
8179
isModified(cbShowInfoPanel, csvEditorSettings.showTableEditorInfoPanel()) ||
8280
cbTabHighlightColor.isSelected() != csvEditorSettings.isHighlightTabSeparator() ||
@@ -85,7 +83,6 @@ public boolean isModified() {
8583
!Objects.equals(cbEditorUsage.getSelectedIndex(), csvEditorSettings.getEditorPrio().ordinal()) ||
8684
isModified(cbQuotingEnforced, csvEditorSettings.isQuotingEnforced()) ||
8785
!Objects.equals(cbEditorUsage.getSelectedIndex(), csvEditorSettings.getEditorPrio().ordinal()) ||
88-
isModified(cbTableColumnHighlighting, csvEditorSettings.isTableColumnHighlightingEnabled()) ||
8986
isModified(cbZeroBasedColumnNumbering, csvEditorSettings.isZeroBasedColumnNumbering()) ||
9087
isModified(cbFileEndLineBreak, csvEditorSettings.isFileEndLineBreak()) ||
9188
!tfMaxColumnWidth.getValue().equals(csvEditorSettings.getTableAutoMaxColumnWidth()) ||
@@ -94,23 +91,22 @@ public boolean isModified() {
9491
!Objects.equals(comboEscapeCharacter.getSelectedItem(), csvEditorSettings.getDefaultEscapeCharacter()) ||
9592
!Objects.equals(comboValueSeparator.getSelectedItem(), csvEditorSettings.getDefaultValueSeparator()) ||
9693
isModified(cbKeepTrailingWhitespaces, csvEditorSettings.getKeepTrailingSpaces()) ||
97-
isModified(tfCommentIndicator, csvEditorSettings.getCommentIndicator());
94+
isModified(tfCommentIndicator, csvEditorSettings.getCommentIndicator()) ||
95+
!Objects.equals(comboValueColoring.getSelectedItem(), csvEditorSettings.getValueColoring());
9896
}
9997

10098
@Override
10199
public void reset() {
102100
CsvEditorSettings csvEditorSettings = CsvEditorSettings.getInstance();
103101
cbCaretRowShown.setSelected(csvEditorSettings.isCaretRowShown());
104102
cbUseSoftWraps.setSelected(csvEditorSettings.isUseSoftWraps());
105-
cbColumnHighlighting.setSelected(csvEditorSettings.isColumnHighlightingEnabled());
106103
cbShowInfoBalloonCheckBox.setSelected(csvEditorSettings.isShowInfoBalloon());
107104
cbShowInfoPanel.setSelected(csvEditorSettings.showTableEditorInfoPanel());
108105
cbTabHighlightColor.setSelected(csvEditorSettings.isHighlightTabSeparator());
109106
cbTabHighlightColor.setColor(csvEditorSettings.getTabHighlightColor());
110107
cbRowHeight.setSelectedIndex(csvEditorSettings.getTableEditorRowHeight());
111108
cbEditorUsage.setSelectedIndex(csvEditorSettings.getEditorPrio().ordinal());
112109
cbQuotingEnforced.setSelected(csvEditorSettings.isQuotingEnforced());
113-
cbTableColumnHighlighting.setSelected(csvEditorSettings.isTableColumnHighlightingEnabled());
114110
cbZeroBasedColumnNumbering.setSelected(csvEditorSettings.isZeroBasedColumnNumbering());
115111
cbFileEndLineBreak.setSelected(csvEditorSettings.isFileEndLineBreak());
116112
tfMaxColumnWidth.setValue(csvEditorSettings.getTableAutoMaxColumnWidth());
@@ -120,22 +116,21 @@ public void reset() {
120116
comboValueSeparator.setSelectedItem(csvEditorSettings.getDefaultValueSeparator());
121117
cbKeepTrailingWhitespaces.setSelected(csvEditorSettings.getKeepTrailingSpaces());
122118
tfCommentIndicator.setText(csvEditorSettings.getCommentIndicator());
119+
comboValueColoring.setSelectedItem(csvEditorSettings.getValueColoring());
123120
}
124121

125122
@Override
126123
public void apply() throws ConfigurationException {
127124
CsvEditorSettings csvEditorSettings = CsvEditorSettings.getInstance();
128125
csvEditorSettings.setCaretRowShown(cbCaretRowShown.isSelected());
129126
csvEditorSettings.setUseSoftWraps(cbUseSoftWraps.isSelected());
130-
csvEditorSettings.setColumnHighlightingEnabled(cbColumnHighlighting.isSelected());
131127
csvEditorSettings.setShowInfoBalloon(cbShowInfoBalloonCheckBox.isSelected());
132128
csvEditorSettings.showTableEditorInfoPanel(cbShowInfoPanel.isSelected());
133129
csvEditorSettings.setHighlightTabSeparator(cbTabHighlightColor.isSelected());
134130
csvEditorSettings.setTabHighlightColor(cbTabHighlightColor.getColor());
135131
csvEditorSettings.setTableEditorRowHeight(cbRowHeight.getSelectedIndex());
136132
csvEditorSettings.setEditorPrio(CsvEditorSettings.EditorPrio.values()[cbEditorUsage.getSelectedIndex()]);
137133
csvEditorSettings.setQuotingEnforced(cbQuotingEnforced.isSelected());
138-
csvEditorSettings.setTableColumnHighlightingEnabled(cbTableColumnHighlighting.isSelected());
139134
csvEditorSettings.setZeroBasedColumnNumbering(cbZeroBasedColumnNumbering.isSelected());
140135
csvEditorSettings.setFileEndLineBreak(cbFileEndLineBreak.isSelected());
141136
csvEditorSettings.setTableAutoMaxColumnWidth((int) tfMaxColumnWidth.getValue());
@@ -145,6 +140,7 @@ public void apply() throws ConfigurationException {
145140
csvEditorSettings.setDefaultValueSeparator((CsvValueSeparator)comboValueSeparator.getSelectedItem());
146141
csvEditorSettings.setKeepTrailingSpaces(cbKeepTrailingWhitespaces.isSelected());
147142
csvEditorSettings.setCommentIndicator(tfCommentIndicator.getText());
143+
csvEditorSettings.setValueColoring((CsvEditorSettings.ValueColoring) comboValueColoring.getSelectedItem());
148144
}
149145

150146
protected void createUIComponents() {
@@ -154,6 +150,9 @@ protected void createUIComponents() {
154150
comboValueSeparator = new ComboBox(CsvValueSeparator.values());
155151
comboValueSeparator.setRenderer(new CustomDisplayListCellRenderer<CsvValueSeparator>(ec -> ec.getDisplay()));
156152

153+
comboValueColoring = new ComboBox(CsvEditorSettings.ValueColoring.values());
154+
comboValueColoring.setRenderer(new CustomDisplayListCellRenderer<CsvEditorSettings.ValueColoring>(ec -> ec.getDisplay()));
155+
157156
cbTabHighlightColor = new CheckBoxWithColorChooser("Highlight tab separator ");
158157
cbTabHighlightColor.setColor(Color.CYAN);
159158

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

+10-3
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
<description><![CDATA[
99
1010
<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><br>
11-
<img width="600" height="297" src="https://plugins.jetbrains.com/files/10037/screenshot_21096.png" /><br><br>
11+
<img width="600" height="297" src="https://plugins.jetbrains.com/files/10037/screenshot_22766.png" /><br><br>
1212
<p><b>Features:</b><br>
1313
<ul>
1414
<li>support for CSV/TSV/PSV file extensions</li>
@@ -33,7 +33,7 @@
3333
<p>
3434
<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>
3535
<br><br>
36-
<b>Code formatting:</b> <em>Default code formatting is 'Tabularize'. Can be changed in Settings -> Editor -> Code Style -> CSV</em>
36+
<b>Code formatting:</b> <em>Default code formatting is 'Tabularize'. Can be changed in Settings -> Editor -> Code Style -> CSV/TSV/PSV</em>
3737
<br><br>
3838
For more detailed information please have a look at the <a href="https://github.com/SeeSharpSoft/intellij-csv-validator/blob/master/README.md">README</a>.
3939
<br><br><br>
@@ -49,7 +49,9 @@
4949

5050
<change-notes><![CDATA[
5151
<pre style="font-family: sans-serif">
52-
NEW: Support for customizable line comments ('#' indicates a line comment per default - can be customized/deactivated via settings)
52+
NEW: Predefined column colors (Rainbow-style)
53+
NEW: Enhanced color scheme switch
54+
NEW: Table Editor coloring
5355
</pre>
5456
]]>
5557
</change-notes>
@@ -93,6 +95,9 @@ NEW: Support for customizable line comments ('#' indicates a line comment per de
9395

9496
<colorSettingsPage implementation="net.seesharpsoft.intellij.plugins.csv.settings.CsvColorSettings"/>
9597

98+
<additionalTextAttributes scheme="Default" file="misc/column_coloring_default.xml" />
99+
<additionalTextAttributes scheme="Darcula" file="misc/column_coloring_default_dark.xml" />
100+
96101
<applicationService
97102
serviceImplementation="net.seesharpsoft.intellij.plugins.csv.settings.CsvEditorSettings"/>
98103
<projectService serviceImplementation="net.seesharpsoft.intellij.plugins.csv.components.CsvFileAttributes"/>
@@ -158,6 +163,8 @@ NEW: Support for customizable line comments ('#' indicates a line comment per de
158163
</intentionAction>
159164

160165
<stripTrailingSpacesFilterFactory implementation="net.seesharpsoft.intellij.plugins.csv.settings.CsvStripTrailingSpacesFilterFactory" />
166+
167+
<postStartupActivity implementation="net.seesharpsoft.intellij.plugins.csv.CsvPlugin" />
161168
</extensions>
162169

163170
<actions>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Column color default values by Andrey Kolchanov: https://github.com/andrey4623/intellij-rainbow-csv
2+
3+
---
4+
MIT License
5+
6+
Copyright (c) 2019 Andrey Kolchanov
7+
8+
Permission is hereby granted, free of charge, to any person obtaining a copy
9+
of this software and associated documentation files (the "Software"), to deal
10+
in the Software without restriction, including without limitation the rights
11+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
copies of the Software, and to permit persons to whom the Software is
13+
furnished to do so, subject to the following conditions:
14+
15+
The above copyright notice and this permission notice shall be included in all
16+
copies or substantial portions of the Software.
17+
18+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
24+
SOFTWARE.
25+
---
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?xml version='1.0'?>
2+
<list>
3+
<option name="CSV_PLUGIN_COLUMN_COLORING_ATTRIBUTE_0">
4+
<value>
5+
<option name="FOREGROUND" value="1976D2" />
6+
</value>
7+
</option>
8+
<option name="CSV_PLUGIN_COLUMN_COLORING_ATTRIBUTE_1">
9+
<value>
10+
<option name="FOREGROUND" value="E65100" />
11+
</value>
12+
</option>
13+
<option name="CSV_PLUGIN_COLUMN_COLORING_ATTRIBUTE_2">
14+
<value>
15+
<option name="FOREGROUND" value="00C853" />
16+
</value>
17+
</option>
18+
<option name="CSV_PLUGIN_COLUMN_COLORING_ATTRIBUTE_3">
19+
<value>
20+
<option name="FOREGROUND" value="B388FF" />
21+
</value>
22+
</option>
23+
<option name="CSV_PLUGIN_COLUMN_COLORING_ATTRIBUTE_4">
24+
<value>
25+
<option name="FOREGROUND" value="F9A825" />
26+
</value>
27+
</option>
28+
<option name="CSV_PLUGIN_COLUMN_COLORING_ATTRIBUTE_5">
29+
<value>
30+
<option name="FOREGROUND" value="1B5E20" />
31+
</value>
32+
</option>
33+
<option name="CSV_PLUGIN_COLUMN_COLORING_ATTRIBUTE_6">
34+
<value>
35+
<option name="FOREGROUND" value="FF5722" />
36+
</value>
37+
</option>
38+
<option name="CSV_PLUGIN_COLUMN_COLORING_ATTRIBUTE_7">
39+
<value>
40+
<option name="FOREGROUND" value="5E35B1" />
41+
</value>
42+
</option>
43+
<option name="CSV_PLUGIN_COLUMN_COLORING_ATTRIBUTE_8">
44+
<value>
45+
<option name="FOREGROUND" value="1976D2" />
46+
</value>
47+
</option>
48+
<option name="CSV_PLUGIN_COLUMN_COLORING_ATTRIBUTE_9">
49+
<value>
50+
<option name="FOREGROUND" value="827717" />
51+
</value>
52+
</option>
53+
</list>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
<?xml version='1.0'?>
2+
<list>
3+
<option name="CSV_PLUGIN_COLUMN_COLORING_ATTRIBUTE_0">
4+
<value>
5+
<option name="FOREGROUND" value="FFA000" />
6+
</value>
7+
</option>
8+
<option name="CSV_PLUGIN_COLUMN_COLORING_ATTRIBUTE_1">
9+
<value>
10+
<option name="FOREGROUND" value="D32F2F" />
11+
</value>
12+
</option>
13+
<option name="CSV_PLUGIN_COLUMN_COLORING_ATTRIBUTE_2">
14+
<value>
15+
<option name="FOREGROUND" value="CE93D8" />
16+
</value>
17+
</option>
18+
<option name="CSV_PLUGIN_COLUMN_COLORING_ATTRIBUTE_3">
19+
<value>
20+
<option name="FOREGROUND" value="00897B" />
21+
</value>
22+
</option>
23+
<option name="CSV_PLUGIN_COLUMN_COLORING_ATTRIBUTE_4">
24+
<value>
25+
<option name="FOREGROUND" value="BCAAA4" />
26+
</value>
27+
</option>
28+
<option name="CSV_PLUGIN_COLUMN_COLORING_ATTRIBUTE_5">
29+
<value>
30+
<option name="FOREGROUND" value="8BC34A" />
31+
</value>
32+
</option>
33+
<option name="CSV_PLUGIN_COLUMN_COLORING_ATTRIBUTE_6">
34+
<value>
35+
<option name="FOREGROUND" value="80D8FF" />
36+
</value>
37+
</option>
38+
<option name="CSV_PLUGIN_COLUMN_COLORING_ATTRIBUTE_7">
39+
<value>
40+
<option name="FOREGROUND" value="E6EE9C" />
41+
</value>
42+
</option>
43+
<option name="CSV_PLUGIN_COLUMN_COLORING_ATTRIBUTE_8">
44+
<value>
45+
<option name="FOREGROUND" value="CFD8DC" />
46+
</value>
47+
</option>
48+
<option name="CSV_PLUGIN_COLUMN_COLORING_ATTRIBUTE_9">
49+
<value>
50+
<option name="FOREGROUND" value="B388FF" />
51+
</value>
52+
</option>
53+
</list>

‎src/test/java/net/seesharpsoft/intellij/plugins/csv/settings/CsvEditorSettingsProviderTest.java

+9-8
Original file line numberDiff line numberDiff line change
@@ -65,19 +65,20 @@ public void testResetAndModified() throws ConfigurationException {
6565
csvEditorSettings.loadState(new CsvEditorSettings.OptionSet());
6666
csvEditorSettings.setCaretRowShown(false);
6767
csvEditorSettings.setUseSoftWraps(true);
68-
csvEditorSettings.setColumnHighlightingEnabled(true);
6968
csvEditorSettings.setHighlightTabSeparator(false);
7069
csvEditorSettings.setShowInfoBalloon(false);
7170
csvEditorSettings.setTabHighlightColor(Color.BLACK);
7271
csvEditorSettings.setQuotingEnforced(true);
73-
csvEditorSettings.setTableColumnHighlightingEnabled(false);
7472
csvEditorSettings.setZeroBasedColumnNumbering(true);
7573
csvEditorSettings.setFileEndLineBreak(false);
7674
csvEditorSettings.setTableDefaultColumnWidth(500);
7775
csvEditorSettings.setTableAutoMaxColumnWidth(1000);
7876
csvEditorSettings.setTableAutoColumnWidthOnOpen(false);
7977
csvEditorSettings.setDefaultEscapeCharacter(CsvEscapeCharacter.BACKSLASH);
8078
csvEditorSettings.setDefaultValueSeparator(CsvValueSeparator.PIPE);
79+
csvEditorSettings.setKeepTrailingSpaces(true);
80+
csvEditorSettings.setCommentIndicator("//");
81+
csvEditorSettings.setValueColoring(CsvEditorSettings.ValueColoring.SIMPLE);
8182

8283
assertEquals(true, editorSettingsPanel.isModified());
8384

@@ -87,19 +88,20 @@ public void testResetAndModified() throws ConfigurationException {
8788

8889
assertEquals(false, csvEditorSettings.isCaretRowShown());
8990
assertEquals(true, csvEditorSettings.isUseSoftWraps());
90-
assertEquals(true, csvEditorSettings.isColumnHighlightingEnabled());
9191
assertEquals(false, csvEditorSettings.isHighlightTabSeparator());
9292
assertEquals(false, csvEditorSettings.isShowInfoBalloon());
9393
assertEquals(Color.BLACK, csvEditorSettings.getTabHighlightColor());
9494
assertEquals(true, csvEditorSettings.isQuotingEnforced());
95-
assertEquals(false, csvEditorSettings.isTableColumnHighlightingEnabled());
9695
assertEquals(true, csvEditorSettings.isZeroBasedColumnNumbering());
9796
assertEquals(false, csvEditorSettings.isFileEndLineBreak());
9897
assertEquals(500, csvEditorSettings.getTableDefaultColumnWidth());
9998
assertEquals(1000, csvEditorSettings.getTableAutoMaxColumnWidth());
10099
assertEquals(false, csvEditorSettings.isTableAutoColumnWidthOnOpen());
101100
assertEquals(CsvEscapeCharacter.BACKSLASH, csvEditorSettings.getDefaultEscapeCharacter());
102101
assertEquals(CsvValueSeparator.PIPE, csvEditorSettings.getDefaultValueSeparator());
102+
assertEquals(true, csvEditorSettings.getKeepTrailingSpaces());
103+
assertEquals("//", csvEditorSettings.getCommentIndicator());
104+
assertEquals( CsvEditorSettings.ValueColoring.SIMPLE, csvEditorSettings.getValueColoring());
103105

104106
editorSettingsPanel.disposeUIResources();
105107
}
@@ -112,12 +114,10 @@ public void testApply() throws ConfigurationException {
112114
editorSettingsPanel.reset();
113115
csvEditorSettings.setCaretRowShown(false);
114116
csvEditorSettings.setUseSoftWraps(true);
115-
csvEditorSettings.setColumnHighlightingEnabled(true);
116117
csvEditorSettings.setHighlightTabSeparator(false);
117118
csvEditorSettings.setShowInfoBalloon(false);
118119
csvEditorSettings.setTabHighlightColor(Color.BLACK);
119120
csvEditorSettings.setQuotingEnforced(true);
120-
csvEditorSettings.setTableColumnHighlightingEnabled(false);
121121
csvEditorSettings.setZeroBasedColumnNumbering(true);
122122
csvEditorSettings.setFileEndLineBreak(false);
123123
csvEditorSettings.setTableDefaultColumnWidth(500);
@@ -133,19 +133,20 @@ public void testApply() throws ConfigurationException {
133133
assertEquals(false, editorSettingsPanel.isModified());
134134
assertEquals(freshOptionSet.CARET_ROW_SHOWN, csvEditorSettings.isCaretRowShown());
135135
assertEquals(freshOptionSet.USE_SOFT_WRAP, csvEditorSettings.isUseSoftWraps());
136-
assertEquals(freshOptionSet.COLUMN_HIGHTLIGHTING, csvEditorSettings.isColumnHighlightingEnabled());
137136
assertEquals(freshOptionSet.HIGHTLIGHT_TAB_SEPARATOR, csvEditorSettings.isHighlightTabSeparator());
138137
assertEquals(freshOptionSet.SHOW_INFO_BALLOON, csvEditorSettings.isShowInfoBalloon());
139138
assertEquals(freshOptionSet.TAB_HIGHLIGHT_COLOR, "" + csvEditorSettings.getTabHighlightColor().getRGB());
140139
assertEquals(freshOptionSet.QUOTING_ENFORCED, csvEditorSettings.isQuotingEnforced());
141-
assertEquals(freshOptionSet.TABLE_COLUMN_HIGHTLIGHTING, csvEditorSettings.isTableColumnHighlightingEnabled());
142140
assertEquals(freshOptionSet.ZERO_BASED_COLUMN_NUMBERING, csvEditorSettings.isZeroBasedColumnNumbering());
143141
assertEquals(freshOptionSet.FILE_END_LINE_BREAK, csvEditorSettings.isFileEndLineBreak());
144142
assertEquals(freshOptionSet.TABLE_DEFAULT_COLUMN_WIDTH, csvEditorSettings.getTableDefaultColumnWidth());
145143
assertEquals(freshOptionSet.TABLE_AUTO_MAX_COLUMN_WIDTH, csvEditorSettings.getTableAutoMaxColumnWidth());
146144
assertEquals(freshOptionSet.TABLE_AUTO_COLUMN_WIDTH_ON_OPEN, csvEditorSettings.isTableAutoColumnWidthOnOpen());
147145
assertEquals(freshOptionSet.DEFAULT_ESCAPE_CHARACTER, csvEditorSettings.getDefaultEscapeCharacter());
148146
assertEquals(freshOptionSet.DEFAULT_VALUE_SEPARATOR, csvEditorSettings.getDefaultValueSeparator());
147+
assertEquals(freshOptionSet.KEEP_TRAILING_SPACES, csvEditorSettings.getKeepTrailingSpaces());
148+
assertEquals(freshOptionSet.COMMENT_INDICATOR, csvEditorSettings.getCommentIndicator());
149+
assertEquals(freshOptionSet.VALUE_COLORING, csvEditorSettings.getValueColoring());
149150

150151
editorSettingsPanel.disposeUIResources();
151152
}

0 commit comments

Comments
 (0)
Please sign in to comment.