L
z_k+4!abyl-(Uqz!DBL_7VZUY^=^&|b>VtljG_s?LD|xi8ntF=pyCh;d_PB#P=Blow0pyJFYJD3N-xgmh{Wlx4r+${eOQl;6JW^{cOO$eL)KRe-pX>*Y*EADezAR|IeX8Kz=)T+Z)2~
z+W!9>^MAYho4Wt^?Kh9Lx82`7{;$^mKfZsh_WzG}fj{h9eeq}Cf71T{aTb3qbpHd_
z?5$?`d))t#z5fdQtBm^(;H@_y*WUsED(e0f^;b3WAE*wHe~q>f7R3e0SpcO
z_rQOuuz!X8Rk8U8();
- listeners = new ArrayList();
- header = new ArrayList();
+ rows = new ArrayList<>();
+ listeners = new ArrayList<>();
+ header = new ArrayList<>();
}
// TODO : all abstract methods should be moved to a specific interface
/**
* Check if first line in the file will be considered as the file header
+ *
* @return true if the first line in the file represents the header
*/
public abstract boolean isFirstLineHeader();
/**
* Check search in the text must be case sensitive
+ *
* @return true if the search must be case sensitive.
*/
public abstract boolean getSensitiveSearch();
/**
* Get custom delimiter to use as a separator
+ *
* @return the delimiter
*/
public abstract char getCustomDelimiter();
/**
* Get the character that defines comment lines
- * @return the comment line starting character. If no comments are allowed in this
- * file, then Character.UNASSIGNED constant must be returned;
+ *
+ * @return the comment line starting character. If no comments are allowed in
+ * this file, then Character.UNASSIGNED constant must be returned;
*
*/
public abstract char getCommentChar();
/**
* Get custom text qualifier to use as a text qualifier in the data
+ *
* @return the text qualifier character to use as a text qualifier in the data
*/
public abstract char getTextQualifier();
/**
* check if the text qualifier has to be use for all fields or not
+ *
* @return true if the text qualifier is to be used for all data fields
*/
public abstract boolean useQualifier();
/**
* Get the delimiter used to separate different values in a same csv cell
+ *
* @return the delimiter used to separate values
*/
public abstract String getInCellDelimiter();
-
+
/**
- * Get the pattern to identify a column header where values can be splitted with the inCellDelimiter
- * and displayed in a table instead of a textfield
+ * Get the pattern to identify a column header where values can be splitted with
+ * the inCellDelimiter and displayed in a table instead of a textfield
+ *
* @return the regex
*/
public abstract String getRegexTableMarker();
@@ -104,14 +112,14 @@ public AbstractCSVFile() {
/**
* @param text
*/
- public void setInput(String text) {
+ public void setInput(final String text) {
readLines(text);
}
/**
* @param display
*/
- public void displayFirstLine(boolean display) {
+ public void displayFirstLine(final boolean display) {
displayFirstLine = display;
}
@@ -119,14 +127,13 @@ public void displayFirstLine(boolean display) {
* @param reader
* @return
*/
- protected CsvReader initializeReader (Reader reader)
- {
- CsvReader csvReader = new CsvReader(reader);
+ protected CsvReader initializeReader(final Reader reader) {
+ final CsvReader csvReader = new CsvReader(reader);
- char customDelimiter = getCustomDelimiter();
+ final char customDelimiter = getCustomDelimiter();
csvReader.setDelimiter(customDelimiter);
- char commentChar = getCommentChar();
+ final char commentChar = getCommentChar();
if (commentChar != Character.UNASSIGNED) {
csvReader.setComment(commentChar);
// prevent loss of comment in csv source file
@@ -142,11 +149,11 @@ protected CsvReader initializeReader (Reader reader)
/**
* @param fileText
*/
- protected void readLines(String fileText) {
+ protected void readLines(final String fileText) {
rows.clear();
try {
- CsvReader csvReader = initializeReader(new StringReader(fileText));
+ final CsvReader csvReader = initializeReader(new StringReader(fileText));
// case when the first line is the encoding
if (!displayFirstLine) {
csvReader.skipLine();
@@ -154,16 +161,15 @@ protected void readLines(String fileText) {
boolean setHeader = false;
while (csvReader.readRecord()) {
- String[] rowValues = csvReader.getValues();
- CSVRow csvRow = new CSVRow(rowValues, this);
+ final String[] rowValues = csvReader.getValues();
+ final CSVRow csvRow = new CSVRow(rowValues, this);
if (!rowValues[0].startsWith(String.valueOf(getCommentChar()))) {
if (isFirstLineHeader() && !setHeader) {
setHeader = true;
csvRow.setHeader(true);
populateHeaders(rowValues);
}
- }
- else {
+ } else {
csvRow.setCommentLine(true);
}
rows.add(csvRow);
@@ -178,7 +184,7 @@ protected void readLines(String fileText) {
}
csvReader.close();
- } catch (Exception e) {
+ } catch (final Exception e) {
System.out.println("exception in readLines " + e);
e.printStackTrace();
}
@@ -190,17 +196,17 @@ protected void readLines(String fileText) {
/**
* @param entries
*/
- private void populateHeaders (String[] entries) {
+ private void populateHeaders(final String[] entries) {
header.clear();
if (entries != null) {
- for (String entry : entries) {
+ for (final String entry : entries) {
header.add(entry);
}
-/* for (int i = header.size(); i < nbOfColumns; i++) {
- header.add("");
- }*/
+ /*
+ * for (int i = header.size(); i < nbOfColumns; i++) { header.add(""); }
+ */
} else {
for (int i = 1; i < nbOfColumns + 1; i++) {
header.add("Column" + i);
@@ -218,7 +224,7 @@ public ArrayList getHeader() {
/**
* @return
*/
- public String[] getArrayHeader () {
+ public String[] getArrayHeader() {
return header.toArray(new String[header.size()]);
}
@@ -228,42 +234,40 @@ public String[] getArrayHeader () {
/**
*
*/
- public void addRow () {
- CSVRow row = CSVRow.createEmptyLine(nbOfColumns, this);
+ public void addRow() {
+ final CSVRow row = CSVRow.createEmptyLine(nbOfColumns, this);
addRow(row);
}
/**
* @param row
*/
- public void addRow (CSVRow row) {
+ public void addRow(final CSVRow row) {
rows.add(row);
}
/**
* @param row
*/
- public void addRowAfterElement (CSVRow row) {
- CSVRow newRow = CSVRow.createEmptyLine(nbOfColumns, this);
- int indexRow = findRow(row);
+ public void addRowAfterElement(final CSVRow row) {
+ final CSVRow newRow = CSVRow.createEmptyLine(nbOfColumns, this);
+ final int indexRow = findRow(row);
if (indexRow != -1) {
rows.add(indexRow, newRow);
- }
- else {
+ } else {
addRow(newRow);
}
}
-
+
/**
* @param row
*/
- public void duplicateRow (CSVRow row) {
- CSVRow newRow = new CSVRow(row, this);
- int indexRow = findRow(row);
+ public void duplicateRow(final CSVRow row) {
+ final CSVRow newRow = new CSVRow(row, this);
+ final int indexRow = findRow(row);
if (indexRow != -1) {
rows.add(indexRow, newRow);
- }
- else {
+ } else {
addRow(newRow);
}
}
@@ -272,9 +276,9 @@ public void duplicateRow (CSVRow row) {
* @param row
* @return
*/
- public int findRow (CSVRow findRow) {
+ public int findRow(final CSVRow findRow) {
for (int i = 0; i <= getArrayRows(true).length; i++) {
- CSVRow row = getRowAt(i);
+ final CSVRow row = getRowAt(i);
if (row.equals(findRow)) {
return i;
}
@@ -292,10 +296,10 @@ public List getRows() {
/**
* @return
*/
- public Object[] getArrayRows (boolean includeCommentLine) {
+ public Object[] getArrayRows(final boolean includeCommentLine) {
// filter header and comment rows
- ArrayList myrows = new ArrayList();
- for (CSVRow row : rows) {
+ final ArrayList myrows = new ArrayList<>();
+ for (final CSVRow row : rows) {
// should we return the comment line
if (row.isCommentLine()) {
if (includeCommentLine) {
@@ -314,36 +318,37 @@ else if (!row.isHeader()) {
* @param index
* @return
*/
- public CSVRow getRowAt (int index) {
+ public CSVRow getRowAt(final int index) {
return rows.get(index);
}
/**
- * @see org.fhsolution.eclipse.plugins.csvedit.model.IRowChangesListener#rowChanged(org.fhsolution.eclipse.plugins.csvedit.model.CSVRow, int)
+ * @see org.fhsolution.eclipse.plugins.csvedit.model.IRowChangesListener#rowChanged(org.fhsolution.eclipse.plugins.csvedit.model.CSVRow,
+ * int)
*/
- public void rowChanged (CSVRow row, int rowIndex) {
- for (ICsvFileModelListener l : listeners) {
- ((ICsvFileModelListener) l).entryChanged(row, rowIndex);
+ @Override
+ public void rowChanged(final CSVRow row, final int rowIndex) {
+ for (final ICsvFileModelListener l : listeners) {
+ l.entryChanged(row, rowIndex);
}
}
/**
* @param rowIndex
*/
- public void removeRow (int rowIndex) {
+ public void removeRow(final int rowIndex) {
rows.remove(rowIndex);
}
/**
*
*/
- public void removeRow (CSVRow row) {
+ public void removeRow(final CSVRow row) {
if (!rows.remove(row)) {
// TODO return error message
}
}
-
// ----------------------------------
// Helper method on column management
// ----------------------------------
@@ -351,10 +356,10 @@ public void removeRow (CSVRow row) {
/**
* @param colName
*/
- public void addColumn (String colName) {
+ public void addColumn(final String colName) {
nbOfColumns++;
header.add(colName);
- for (CSVRow row : rows) {
+ for (final CSVRow row : rows) {
row.addElement("");
}
}
@@ -371,14 +376,14 @@ public int getColumnCount() {
*
* @param colIndex
*/
- public void removeColumn (int colIndex) {
+ public void removeColumn(final int colIndex) {
if (isFirstLineHeader()) {
header.remove(colIndex);
nbOfColumns--;
}
- for (CSVRow row : rows) {
+ for (final CSVRow row : rows) {
if (!row.isCommentLine()) {
- System.out.println("remove elmt:["+colIndex+"] in row [" + row +"]");
+ System.out.println("remove elmt:[" + colIndex + "] in row [" + row + "]");
row.removeElementAt(colIndex);
}
}
@@ -389,38 +394,39 @@ public void removeColumn (int colIndex) {
*
* @param colIndex
*/
- public void removeColumn (String columnName) {
+ public void removeColumn(final String columnName) {
if (columnName == null) {
return;
}
- int colIndex = header.indexOf(columnName);
+ final int colIndex = header.indexOf(columnName);
removeColumn(colIndex);
}
/**
* @param csvFileListener
*/
- public void removeModelListener (ICsvFileModelListener csvFileListener) {
+ public void removeModelListener(final ICsvFileModelListener csvFileListener) {
listeners.remove(csvFileListener);
}
/**
* @param csvFileListener
*/
- public void addModelListener (ICsvFileModelListener csvFileListener) {
- if (!listeners.contains(csvFileListener))
+ public void addModelListener(final ICsvFileModelListener csvFileListener) {
+ if (!listeners.contains(csvFileListener)) {
listeners.add(csvFileListener);
+ }
}
/**
* Initialize the CsvWriter
+ *
* @param writer
* @return
*/
- protected CsvWriter initializeWriter (Writer writer)
- {
- char delimiter = getCustomDelimiter();
- CsvWriter csvWriter = new CsvWriter(writer, delimiter);
+ protected CsvWriter initializeWriter(final Writer writer) {
+ final char delimiter = getCustomDelimiter();
+ final CsvWriter csvWriter = new CsvWriter(writer, delimiter);
csvWriter.setTextQualifier(getTextQualifier());
csvWriter.setForceQualifier(useQualifier());
csvWriter.setComment(getCommentChar());
@@ -430,32 +436,28 @@ protected CsvWriter initializeWriter (Writer writer)
/**
* @return
*/
- public String getTextRepresentation () {
+ public String getTextRepresentation() {
- StringWriter sw = new StringWriter();
+ final StringWriter sw = new StringWriter();
try {
- CsvWriter clw = initializeWriter(sw);
+ final CsvWriter clw = initializeWriter(sw);
/*
- if (isFirstLineHeader() && header.size() > 0) {
- String[] headerArray = new String[header.size()];
- for (int i=0; i 0) { String[] headerArray = new
+ * String[header.size()]; for (int i=0; i
-
- 4.0.0
-
- csvedit
- org.nodeclipse
- 1.2.0-SNAPSHOT
-
- csvedit.site
- eclipse-repository
- csvedit :: update site
+
+ 4.0.0
+
+ csvedit
+ org.nodeclipse
+ 1.2.0-SNAPSHOT
+
+ csvedit.site
+ eclipse-repository
+ csvedit :: update site
diff --git a/csvedit.target/csvedit.target b/csvedit.target/csvedit.target
new file mode 100644
index 0000000..6b2e3ca
--- /dev/null
+++ b/csvedit.target/csvedit.target
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ org.jumpmind.symmetric
+ symmetric-csv
+ 2.5.13
+ jar
+
+
+
+
+
\ No newline at end of file
diff --git a/csvedit.target/pom.xml b/csvedit.target/pom.xml
new file mode 100644
index 0000000..3aeae87
--- /dev/null
+++ b/csvedit.target/pom.xml
@@ -0,0 +1,13 @@
+
+
+ 4.0.0
+
+ org.nodeclipse
+ csvedit
+ 1.2.0-SNAPSHOT
+
+ csvedit.target
+ eclipse-target-definition
+
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 308f723..947ee38 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,99 +1,271 @@
-
- 4.0.0
- org.nodeclipse
- csvedit
- 1.2.0-SNAPSHOT
- pom
- csvedit :: parent
- csvedit parent
+
+ 4.0.0
+ org.nodeclipse
+ csvedit
+ 1.2.0-SNAPSHOT
+ pom
+ csvedit :: parent
+ csvedit parent
-
- 3.0
-
+
+ 17
+ 4.0.4
+ -Xmx512m -XX:MaxPermSize=256m
+ UTF-8
+
-
- 1.6
- 3.0
- 1.0.0
- -Xmx512m -XX:MaxPermSize=256m
- UTF-8
-
+
+ scm:git@github.com:gnl42/CsvEdit.git
+ scm:git@github.com:gnl42/CsvEdit.git
+ https://github.com/gnl42/CsvEdit
+
-
-
- luna
- p2
- http://download.eclipse.org/releases/luna
-
-
-
-
- sonatype-public
- http://repository.sonatype.org/content/groups/sonatype-public-grid
-
-
+
+
+
+
+ org.apache.maven.plugins
+ maven-javadoc-plugin
+ 3.5.0
+
+
+ org.apache.maven.plugins
+ maven-site-plugin
+ 3.12.1
+
+
+ org.apache.maven.plugins
+ maven-deploy-plugin
+ 3.1.1
+
+
+ org.codehaus.mojo
+ build-helper-maven-plugin
+ 3.4.0
+
+
+ org.apache.maven.plugins
+ maven-surefire-report-plugin
+ 3.1.2
+
+
+ org.apache.maven.plugins
+ maven-enforcer-plugin
+ 3.3.0
+
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+ 3.3.1
+
+
+ org.apache.maven.plugins
+ maven-clean-plugin
+ 3.3.1
+
+
+ org.apache.maven.plugins
+ maven-jxr-plugin
+ 3.3.0
+
+
+ org.eclipse.tycho
+ tycho-compiler-plugin
+ ${tycho.version}
+
+
+ org.eclipse.tycho
+ tycho-maven-plugin
+ ${tycho.version}
+ true
+
+
+ org.eclipse.tycho
+ tycho-p2-repository-plugin
+ ${tycho.version}
+
+
+ org.eclipse.tycho
+ tycho-source-plugin
+ ${tycho.version}
+
+
+ org.eclipse.tycho.extras
+ tycho-source-feature-plugin
+ ${tycho.version}
+
+
+ org.eclipse.tycho
+ tycho-p2-plugin
+ ${tycho.version}
+
+
+ org.eclipse.tycho
+ tycho-versions-plugin
+ ${tycho.version}
+
+
+ org.eclipse.tycho
+ tycho-p2-director-plugin
+ ${tycho.version}
+
+
+ org.eclipse.tycho
+ tycho-surefire-plugin
+ ${tycho.version}
+
+
+ org.eclipse.tycho
+ target-platform-configuration
+ ${tycho.version}
+
+
+ org.eclipse.tycho.extras
+ tycho-eclipserun-plugin
+ ${tycho.version}
+
+
+ org.eclipse.tycho.extras
+ tycho-pack200a-plugin
+ ${tycho.version}
+
+
+ org.eclipse.tycho.extras
+ tycho-pack200b-plugin
+ ${tycho.version}
+
+
+ org.eclipse.cbi.maven.plugins
+ eclipse-jarsigner-plugin
+ 1.4.2
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-resources-plugin
+
+ UTF-8
+
+
+
+ org.eclipse.tycho
+ tycho-compiler-plugin
+
+ 17
+ true
+ true
+
+
+
+ org.eclipse.tycho
+ tycho-maven-plugin
+ true
+
+
+ org.eclipse.tycho
+ tycho-p2-repository-plugin
+
+
+ org.eclipse.tycho
+ tycho-packaging-plugin
+ ${tycho.version}
+
+
+ org.codehaus.mojo
+ exec-maven-plugin
+ 3.1.0
+
+
+ org.eclipse.tycho
+ tycho-p2-plugin
+
+
+ attach-p2-metadata
+ package
+
+ p2-metadata
+
+
+
+
+
+ org.eclipse.tycho
+ tycho-versions-plugin
+
+
+ org.eclipse.tycho
+ tycho-surefire-plugin
+
+ false
+ true
+ true
+
+
+ ${ui.test.vmargs}
+
+
+ org.eclipse.equinox.launcher
+ 4
+ true
+
+
+
+
+
+
+
+
+ p2-installable-unit
+ org.eclipse.equinox.event
+
+
+
+
+
+ org.eclipse.tycho
+ target-platform-configuration
+
+
+
+ linux
+ gtk
+ x86_64
+
+
+ win32
+ win32
+ x86_64
+
+
+ macosx
+ cocoa
+ x86_64
+
+
+
+
+ org.nodeclipse
+ csvedit.target
+ 1.2.0-SNAPSHOT
+
+
+
+
+
+
-
-
-
- org.eclipse.tycho
- tycho-maven-plugin
- ${tycho.version}
- true
-
-
- org.eclipse.tycho
- target-platform-configuration
- ${tycho.version}
-
- p2
- consider
- true
-
-
-
-
-
-
-
- org.eclipse.tycho
- tycho-packaging-plugin
- ${tycho.version}
-
- yyyyMMdd-HHmm
-
-
-
- org.eclipse.tycho
- tycho-surefire-plugin
- ${tycho.version}
-
- true
-
- **/*Test.java
-
- ${tycho.test.jvmArgs}
-
- 60
-
-
-
- org.apache.maven.plugins
- maven-assembly-plugin
- 2.3
-
-
-
-
-
- csvedit.plugin
- csvedit.plugin.ui
- csvedit.feature
-
- csvedit.site
-
+
+ csvedit.target
+ csvedit.plugin
+ csvedit.plugin.ui
+ csvedit.feature
+ csvedit.site
+
\ No newline at end of file