-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FEATURE] value separator setting moved from code style to general
- Loading branch information
1 parent
2987e88
commit 0c27400
Showing
27 changed files
with
201 additions
and
176 deletions.
There are no files selected for viewing
30 changes: 30 additions & 0 deletions
30
src/main/java/net/seesharpsoft/intellij/plugins/csv/CsvEscapeCharacter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package net.seesharpsoft.intellij.plugins.csv; | ||
|
||
import java.util.regex.Pattern; | ||
|
||
public enum CsvEscapeCharacter { | ||
QUOTE("\"", "Double Quote (\")"), | ||
BACKSLASH("\\", "Backslash (\\)"); | ||
|
||
private final String myCharacter; | ||
private final String myDisplay; | ||
private final Pattern myPattern; | ||
|
||
CsvEscapeCharacter(String character, String display) { | ||
myCharacter = character; | ||
myDisplay = display; | ||
myPattern = Pattern.compile(Pattern.quote(myCharacter + "\"")); | ||
} | ||
|
||
public String getCharacter() { | ||
return myCharacter; | ||
} | ||
|
||
public String getDisplay() { | ||
return myDisplay; | ||
} | ||
|
||
public boolean isEscapedQuote(String text) { | ||
return myPattern.matcher(text).matches(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 1 addition & 2 deletions
3
src/main/java/net/seesharpsoft/intellij/plugins/csv/CsvLexerAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,9 @@ | ||
package net.seesharpsoft.intellij.plugins.csv; | ||
|
||
import com.intellij.lexer.FlexAdapter; | ||
import net.seesharpsoft.intellij.plugins.csv.settings.CsvEditorSettings; | ||
|
||
public class CsvLexerAdapter extends FlexAdapter { | ||
public CsvLexerAdapter(CsvEditorSettings.ValueSeparator separator, CsvEditorSettings.EscapeCharacter escapeCharacter) { | ||
public CsvLexerAdapter(CsvValueSeparator separator, CsvEscapeCharacter escapeCharacter) { | ||
super(new CsvLexer(null, separator, escapeCharacter)); | ||
} | ||
} |
4 changes: 1 addition & 3 deletions
4
src/main/java/net/seesharpsoft/intellij/plugins/csv/CsvSeparatorHolder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,5 @@ | ||
package net.seesharpsoft.intellij.plugins.csv; | ||
|
||
import net.seesharpsoft.intellij.plugins.csv.settings.CsvEditorSettings; | ||
|
||
public interface CsvSeparatorHolder { | ||
CsvEditorSettings.ValueSeparator getSeparator(); | ||
CsvValueSeparator getSeparator(); | ||
} |
32 changes: 32 additions & 0 deletions
32
src/main/java/net/seesharpsoft/intellij/plugins/csv/CsvValueSeparator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package net.seesharpsoft.intellij.plugins.csv; | ||
|
||
import java.util.regex.Pattern; | ||
|
||
public enum CsvValueSeparator { | ||
COMMA(",", "Comma (,)"), | ||
SEMICOLON(";", "Semicolon (;)"), | ||
PIPE("|", "Pipe (|)"), | ||
TAB("\t", "Tab (↹)"); | ||
|
||
private final String myCharacter; | ||
private final String myDisplay; | ||
private final Pattern myPattern; | ||
|
||
CsvValueSeparator(String character, String display) { | ||
myCharacter = character; | ||
myDisplay = display; | ||
myPattern = Pattern.compile(Pattern.quote(myCharacter)); | ||
} | ||
|
||
public String getCharacter() { | ||
return myCharacter; | ||
} | ||
|
||
public String getDisplay() { | ||
return myDisplay; | ||
} | ||
|
||
public boolean isValueSeparator(String text) { | ||
return myPattern.matcher(text).matches(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.