Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSami Wagiaalla2013-05-29 20:34:11 +0000
committerCamilo Bernal2013-05-31 14:38:49 +0000
commit165a24b085b5f04530fb21200f242377f83a3288 (patch)
tree1422ca21b4b8dd5b3ddce888a58d08e05ca9306c
parent6c727f642814cb99227329029978f7d9b277fad5 (diff)
downloadorg.eclipse.linuxtools-165a24b085b5f04530fb21200f242377f83a3288.tar.gz
org.eclipse.linuxtools-165a24b085b5f04530fb21200f242377f83a3288.tar.xz
org.eclipse.linuxtools-165a24b085b5f04530fb21200f242377f83a3288.zip
Remove code for saving Graph settings
... Since graph settings are now saved as part of the Run Configuration. Change-Id: I8f187b089dc1c3a4f7a31b9c97627867aab19b51 Reviewed-on: https://git.eclipse.org/r/13418 Tested-by: Hudson CI Reviewed-by: Camilo Bernal <cabernal@redhat.com> IP-Clean: Camilo Bernal <cabernal@redhat.com> Tested-by: Camilo Bernal <cabernal@redhat.com>
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphingapi.core.tests/src/org/eclipse/linuxtools/systemtap/graphingapi/core/tests/datasets/row/RowParserTest.java33
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphingapi.core.tests/src/org/eclipse/linuxtools/systemtap/graphingapi/core/tests/datasets/table/TableParserTest.java34
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphingapi.core/src/org/eclipse/linuxtools/systemtap/graphingapi/core/datasets/IDataSetParser.java12
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphingapi.core/src/org/eclipse/linuxtools/systemtap/graphingapi/core/datasets/row/RowParser.java38
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphingapi.core/src/org/eclipse/linuxtools/systemtap/graphingapi/core/datasets/table/TableParser.java42
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/dataset/DataSetFactory.java14
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/dataset/DataSetWizard.java72
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/dataset/ParsingWizardPage.java6
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/dataset/SelectRowParsingWizardPage.java80
-rw-r--r--systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/dataset/SelectTableParsingWizardPage.java82
10 files changed, 24 insertions, 389 deletions
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.core.tests/src/org/eclipse/linuxtools/systemtap/graphingapi/core/tests/datasets/row/RowParserTest.java b/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.core.tests/src/org/eclipse/linuxtools/systemtap/graphingapi/core/tests/datasets/row/RowParserTest.java
index fa678f97be..4f5b78c743 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.core.tests/src/org/eclipse/linuxtools/systemtap/graphingapi/core/tests/datasets/row/RowParserTest.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.core.tests/src/org/eclipse/linuxtools/systemtap/graphingapi/core/tests/datasets/row/RowParserTest.java
@@ -14,13 +14,9 @@ package org.eclipse.linuxtools.systemtap.graphingapi.core.tests.datasets.row;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
import org.eclipse.linuxtools.systemtap.graphingapi.core.datasets.IDataEntry;
-import org.eclipse.linuxtools.systemtap.graphingapi.core.datasets.row.RowDataSet;
import org.eclipse.linuxtools.systemtap.graphingapi.core.datasets.row.RowParser;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.XMLMemento;
import org.junit.Before;
import org.junit.Test;
@@ -29,12 +25,8 @@ public class RowParserTest {
@Before
public void setUp() {
parser = new RowParser(new String[] {"\\d+", "(\\D+)", "\\d+", "\\D+"});
-
- IMemento m = XMLMemento.createWriteRoot("a");
- parser.saveXML(m);
- parser2 = new RowParser(m);
}
-
+
@Test
public void testParse() {
assertNull(parser.parse(null));
@@ -42,34 +34,13 @@ public class RowParserTest {
assertNull(parser.parse(new StringBuilder("asdf")));
assertNull(parser.parse(new StringBuilder("1, ")));
assertNull(parser.parse(new StringBuilder("1, 3")));
-
- IDataEntry entry = parser.parse(new StringBuilder("1, (2), 3, 4, 5"));
- assertNotNull(entry);
- assertEquals(2, entry.getColCount());
- assertEquals(1, entry.getRowCount());
- assertEquals("1", entry.getRow(0)[0]);
- entry = parser2.parse(new StringBuilder("1, 2, 3, 4, 5"));
+ IDataEntry entry = parser.parse(new StringBuilder("1, (2), 3, 4, 5"));
assertNotNull(entry);
assertEquals(2, entry.getColCount());
assertEquals(1, entry.getRowCount());
assertEquals("1", entry.getRow(0)[0]);
}
-
- @Test
- public void testSaveXML() {
- IMemento m = XMLMemento.createWriteRoot("a");
- parser.saveXML(m);
- assertSame(RowDataSet.ID, m.getString("dataset"));
- IMemento[] children = m.getChildren("Series");
- assertEquals(2, children.length);
- assertSame("\\d+", children[0].getString("parsingExpression"));
- assertSame("(\\D+)", children[0].getString("parsingSpacer"));
- assertSame("\\d+", children[1].getString("parsingExpression"));
- assertSame("\\D+", children[1].getString("parsingSpacer"));
- }
-
RowParser parser;
- RowParser parser2;
}
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.core.tests/src/org/eclipse/linuxtools/systemtap/graphingapi/core/tests/datasets/table/TableParserTest.java b/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.core.tests/src/org/eclipse/linuxtools/systemtap/graphingapi/core/tests/datasets/table/TableParserTest.java
index 8c48ab0741..7acdc9631e 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.core.tests/src/org/eclipse/linuxtools/systemtap/graphingapi/core/tests/datasets/table/TableParserTest.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.core.tests/src/org/eclipse/linuxtools/systemtap/graphingapi/core/tests/datasets/table/TableParserTest.java
@@ -14,13 +14,9 @@ package org.eclipse.linuxtools.systemtap.graphingapi.core.tests.datasets.table;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
import org.eclipse.linuxtools.systemtap.graphingapi.core.datasets.IDataEntry;
-import org.eclipse.linuxtools.systemtap.graphingapi.core.datasets.table.TableDataSet;
import org.eclipse.linuxtools.systemtap.graphingapi.core.datasets.table.TableParser;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.XMLMemento;
import org.junit.Before;
import org.junit.Test;
@@ -29,11 +25,8 @@ public class TableParserTest {
@Before
public void setUp() {
parser = new TableParser(new String[] {"\\d+", "(\\D+)", "\\d+", "\\D+"}, "\n\n");
-
- IMemento m = XMLMemento.createWriteRoot("a");
- parser.saveXML(m);
- parser2 = new TableParser(m);
}
+
@Test
public void testParse() {
assertNull(parser.parse(null));
@@ -41,36 +34,13 @@ public class TableParserTest {
assertNull(parser.parse(new StringBuilder("asdf")));
assertNull(parser.parse(new StringBuilder("1, ")));
assertNull(parser.parse(new StringBuilder("1, 3")));
-
- IDataEntry entry = parser.parse(new StringBuilder("1, (2), 3, 4, 5\n\n"));
- assertNotNull(entry);
- assertEquals(2, entry.getColCount());
- assertEquals(2, entry.getRowCount());
- assertEquals("1", entry.getRow(0)[0]);
- entry = parser2.parse(new StringBuilder("1, 2, 3, 4, 5\n\n"));
+ IDataEntry entry = parser.parse(new StringBuilder("1, (2), 3, 4, 5\n\n"));
assertNotNull(entry);
assertEquals(2, entry.getColCount());
assertEquals(2, entry.getRowCount());
assertEquals("1", entry.getRow(0)[0]);
}
- @Test
- public void testSaveXML() {
- IMemento m = XMLMemento.createWriteRoot("a");
- parser.saveXML(m);
- assertSame(TableDataSet.ID, m.getString("dataset"));
- IMemento[] children = m.getChildren("Series");
- assertEquals(2, children.length);
- assertSame("\\d+", children[0].getString("parsingExpression"));
- assertSame("(\\D+)", children[0].getString("parsingSpacer"));
- assertSame("\\d+", children[1].getString("parsingExpression"));
- assertSame("\\D+", children[1].getString("parsingSpacer"));
-
- IMemento child = m.getChild("Delimiter");
- assertSame("\n\n", child.getString("parsingExpression"));
- }
-
TableParser parser;
- TableParser parser2;
}
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.core/src/org/eclipse/linuxtools/systemtap/graphingapi/core/datasets/IDataSetParser.java b/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.core/src/org/eclipse/linuxtools/systemtap/graphingapi/core/datasets/IDataSetParser.java
index 8617800243..e4a09853ac 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.core/src/org/eclipse/linuxtools/systemtap/graphingapi/core/datasets/IDataSetParser.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.core/src/org/eclipse/linuxtools/systemtap/graphingapi/core/datasets/IDataSetParser.java
@@ -11,20 +11,8 @@
package org.eclipse.linuxtools.systemtap.graphingapi.core.datasets;
-import org.eclipse.ui.IMemento;
public interface IDataSetParser {
IDataEntry parse(StringBuilder entry);
- boolean saveXML(IMemento target);
-
- String XMLDataSetSettings = "DataSetSettings"; //$NON-NLS-1$
- String XMLparsingExpression = "parsingExpression"; //$NON-NLS-1$
- String XMLparsingSpacer = "parsingSpacer"; //$NON-NLS-1$
- String XMLColumn = "Column"; //$NON-NLS-1$
- String XMLdataset = "dataset"; //$NON-NLS-1$
- String XMLFile = "File"; //$NON-NLS-1$
- String XMLSeries = "Series"; //$NON-NLS-1$
- String XMLname = "name"; //$NON-NLS-1$
- String XMLDelimiter = "Delimiter"; //$NON-NLS-1$
}
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.core/src/org/eclipse/linuxtools/systemtap/graphingapi/core/datasets/row/RowParser.java b/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.core/src/org/eclipse/linuxtools/systemtap/graphingapi/core/datasets/row/RowParser.java
index 0a1a62d499..bf32d39bd4 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.core/src/org/eclipse/linuxtools/systemtap/graphingapi/core/datasets/row/RowParser.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.core/src/org/eclipse/linuxtools/systemtap/graphingapi/core/datasets/row/RowParser.java
@@ -17,7 +17,6 @@ import java.util.regex.Pattern;
import org.eclipse.linuxtools.systemtap.graphingapi.core.datasets.IDataEntry;
import org.eclipse.linuxtools.systemtap.graphingapi.core.datasets.IDataSetParser;
-import org.eclipse.ui.IMemento;
@@ -27,27 +26,19 @@ public class RowParser implements IDataSetParser {
buildPattern();
}
- public RowParser(IMemento source) {
- IMemento[] children = source.getChildren(IDataSetParser.XMLSeries);
- regEx = new String[children.length<<1];
- for(int j=0; j<children.length; j++) {
- regEx[j<<1] = children[j].getString(IDataSetParser.XMLparsingExpression);
- regEx[(j<<1)+1] = children[j].getString(IDataSetParser.XMLparsingSpacer);
- }
- buildPattern();
- }
-
private void buildPattern() {
StringBuilder wholeRegExpr = new StringBuilder();
- for(int i=0; i<regEx.length; i++)
+ for(int i=0; i<regEx.length; i++) {
wholeRegExpr.append('(' + regEx[i] + ')');
+ }
wholePattern = Pattern.compile(wholeRegExpr.toString());
}
@Override
public IDataEntry parse(StringBuilder s) {
- if(null == s)
+ if(null == s) {
return null;
+ }
RowEntry e = null;
Matcher wholeMatcher = wholePattern.matcher(s);
@@ -60,12 +51,15 @@ public class RowParser implements IDataSetParser {
for(int i=0; i<regEx.length; i++) {
group++;
- for(j=0; j<regEx[i].length(); j++)
- if(regEx[i].charAt(j) == ')')
+ for(j=0; j<regEx[i].length(); j++) {
+ if(regEx[i].charAt(j) == ')') {
group++;
+ }
+ }
- if(0 == (i&1))
+ if(0 == (i&1)) {
data[i>>1] = wholeMatcher.group(group);
+ }
}
e.putRow(0, data);
s.delete(0, wholeMatcher.end());
@@ -74,18 +68,6 @@ public class RowParser implements IDataSetParser {
return e;
}
- @Override
- public boolean saveXML(IMemento target) {
- target.putString(IDataSetParser.XMLdataset, RowDataSet.ID);
- IMemento child2;
- for(int i=0; i<regEx.length>>1; i++) {
- child2 = target.createChild(IDataSetParser.XMLSeries);
- child2.putString(IDataSetParser.XMLparsingExpression, regEx[i<<1]);
- child2.putString(IDataSetParser.XMLparsingSpacer, regEx[(i<<1)+1]);
- }
- return true;
- }
-
private String[] regEx;
private Pattern wholePattern;
}
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.core/src/org/eclipse/linuxtools/systemtap/graphingapi/core/datasets/table/TableParser.java b/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.core/src/org/eclipse/linuxtools/systemtap/graphingapi/core/datasets/table/TableParser.java
index 7d0cd5f412..8abacade15 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.core/src/org/eclipse/linuxtools/systemtap/graphingapi/core/datasets/table/TableParser.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.core/src/org/eclipse/linuxtools/systemtap/graphingapi/core/datasets/table/TableParser.java
@@ -17,7 +17,6 @@ import java.util.regex.Pattern;
import org.eclipse.linuxtools.systemtap.graphingapi.core.datasets.IDataEntry;
import org.eclipse.linuxtools.systemtap.graphingapi.core.datasets.IDataSetParser;
-import org.eclipse.ui.IMemento;
@@ -28,30 +27,20 @@ public class TableParser implements IDataSetParser {
buildPattern();
}
- public TableParser(IMemento source) {
- IMemento[] children = source.getChildren(IDataSetParser.XMLSeries);
- regEx = new String[children.length<<1];
- for(int j=0; j<children.length; j++) {
- regEx[j<<1] = children[j].getString(IDataSetParser.XMLparsingExpression);
- regEx[(j<<1)+1] = children[j].getString(IDataSetParser.XMLparsingSpacer);
- }
- IMemento del = source.getChild(IDataSetParser.XMLDelimiter);
- delimiter = del.getString(IDataSetParser.XMLparsingExpression);
- buildPattern();
- }
-
private void buildPattern() {
StringBuilder wholeRegExpr = new StringBuilder();
- for(int i=0; i<regEx.length; i++)
+ for(int i=0; i<regEx.length; i++) {
wholeRegExpr.append('(' + regEx[i] + ')');
+ }
wholePattern = Pattern.compile(wholeRegExpr.toString());
delimPattern = Pattern.compile(delimiter);
}
@Override
public IDataEntry parse(StringBuilder s) {
- if(null == s)
+ if(null == s) {
return null;
+ }
TableEntry e = null;
@@ -70,12 +59,15 @@ public class TableParser implements IDataSetParser {
data = new Object[regEx.length>>1];
for(int i=0; i<regEx.length; i++) {
group++;
- for(j=0; j<regEx[i].length(); j++)
- if(regEx[i].charAt(j) == ')')
+ for(j=0; j<regEx[i].length(); j++) {
+ if(regEx[i].charAt(j) == ')') {
group++;
+ }
+ }
- if(0 == (i&1))
+ if(0 == (i&1)) {
data[i>>1] = wholeMatcher.group(group);
+ }
}
e.add(data);
}
@@ -85,20 +77,6 @@ public class TableParser implements IDataSetParser {
return e;
}
- @Override
- public boolean saveXML(IMemento target) {
- target.putString(IDataSetParser.XMLdataset, TableDataSet.ID);
- IMemento child;
- for(int i=0; i<regEx.length>>1; i++) {
- child = target.createChild(IDataSetParser.XMLSeries);
- child.putString(IDataSetParser.XMLparsingExpression, regEx[i<<1]);
- child.putString(IDataSetParser.XMLparsingSpacer, regEx[(i<<1)+1]);
- }
- child = target.createChild(IDataSetParser.XMLDelimiter);
- child.putString(IDataSetParser.XMLparsingExpression, delimiter);
- return true;
- }
-
private String[] regEx;
private String delimiter;
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/dataset/DataSetFactory.java b/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/dataset/DataSetFactory.java
index 63c499bfe8..be899aed87 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/dataset/DataSetFactory.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/dataset/DataSetFactory.java
@@ -13,17 +13,13 @@ package org.eclipse.linuxtools.systemtap.graphingapi.ui.wizards.dataset;
import org.eclipse.linuxtools.internal.systemtap.graphingapi.ui.Localization;
import org.eclipse.linuxtools.systemtap.graphingapi.core.datasets.IDataSet;
-import org.eclipse.linuxtools.systemtap.graphingapi.core.datasets.IDataSetParser;
import org.eclipse.linuxtools.systemtap.graphingapi.core.datasets.IFilteredDataSet;
import org.eclipse.linuxtools.systemtap.graphingapi.core.datasets.row.FilteredRowDataSet;
import org.eclipse.linuxtools.systemtap.graphingapi.core.datasets.row.RowDataSet;
-import org.eclipse.linuxtools.systemtap.graphingapi.core.datasets.row.RowParser;
import org.eclipse.linuxtools.systemtap.graphingapi.core.datasets.table.FilteredTableDataSet;
import org.eclipse.linuxtools.systemtap.graphingapi.core.datasets.table.TableDataSet;
-import org.eclipse.linuxtools.systemtap.graphingapi.core.datasets.table.TableParser;
import org.eclipse.linuxtools.systemtap.graphingapi.ui.datadisplay.DataGrid;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IMemento;
@@ -86,16 +82,6 @@ public final class DataSetFactory {
return page;
}
- public static IDataSetParser createParserXML(String id, IMemento source) {
- if(id.equals(ids[0])) {
- return new RowParser(source);
- } else if(id.equals(ids[1])) {
- return new TableParser(source);
- }
-
- return null;
- }
-
public static DataGrid getDataGrid(Composite composite, IDataSet set) {
if(set instanceof RowDataSet) {
return new DataGrid(composite, set, DataGrid.NONE);
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/dataset/DataSetWizard.java b/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/dataset/DataSetWizard.java
index 56f2175888..e75dcc6ebd 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/dataset/DataSetWizard.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/dataset/DataSetWizard.java
@@ -12,9 +12,6 @@
package org.eclipse.linuxtools.systemtap.graphingapi.ui.wizards.dataset;
import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.FileWriter;
import java.io.IOException;
import org.eclipse.jface.dialogs.IPageChangedListener;
@@ -26,11 +23,8 @@ import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.linuxtools.internal.systemtap.graphingapi.ui.Localization;
import org.eclipse.linuxtools.systemtap.graphingapi.core.datasets.IDataSet;
import org.eclipse.linuxtools.systemtap.graphingapi.core.datasets.IDataSetParser;
-import org.eclipse.ui.IMemento;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
-import org.eclipse.ui.WorkbenchException;
-import org.eclipse.ui.XMLMemento;
public class DataSetWizard extends Wizard implements INewWizard {
public DataSetWizard(File metaFile, String scriptFile) {
@@ -75,7 +69,6 @@ public class DataSetWizard extends Wizard implements INewWizard {
@Override
public boolean performFinish() {
- writeParsingExpression();
return true;
}
@@ -87,71 +80,6 @@ public class DataSetWizard extends Wizard implements INewWizard {
return dataSet;
}
- private boolean writeParsingExpression() {
- XMLMemento data = copyExisting();
- if(null == data) {
- data = XMLMemento.createWriteRoot(IDataSetParser.XMLDataSetSettings);
- }
-
- try {
- IMemento child = data.createChild(IDataSetParser.XMLFile, scriptFile);
-
- saveColumns(child, dataSet.getTitles());
- parser.saveXML(child);
-
- FileWriter writer = new FileWriter(metaFile);
- data.save(writer);
- writer.close();
- } catch(FileNotFoundException fnfe) {
- return false;
- } catch(IOException e) {
- return false;
- }
-
- return true;
- }
-
- protected XMLMemento copyExisting() {
- XMLMemento data = null;
- try {
- FileReader reader = new FileReader(metaFile);
- if(!reader.ready()) {
- reader.close();
- return null;
- }
-
- data = XMLMemento.createReadRoot(reader, IDataSetParser.XMLDataSetSettings);
- IMemento[] children = data.getChildren(IDataSetParser.XMLFile);
-
- data = XMLMemento.createWriteRoot(IDataSetParser.XMLDataSetSettings);
-
- IMemento child;
- String dataSetID;
- for(int i=0; i<children.length; i++) {
- if(!scriptFile.equals(children[i].getID())) {
- child = data.createChild(IDataSetParser.XMLFile, children[i].getID());
- dataSetID = children[i].getString(IDataSetParser.XMLdataset);
- child.putString(IDataSetParser.XMLdataset, dataSetID);
-
- DataSetFactory.getParsingWizardPage(dataSetID).copyExisting(children[i], child);
- }
- }
- } catch(FileNotFoundException fnfe) {
- } catch(IOException ioe) {
- } catch(WorkbenchException we) {}
-
- return data;
- }
-
- protected boolean saveColumns(IMemento target, String[] columns) {
- IMemento child;
- for(String column: columns) {
- child = target.createChild(IDataSetParser.XMLColumn);
- child.putString(IDataSetParser.XMLname, column);
- }
- return true;
- }
-
protected boolean openFile() {
try {
if (!metaFile.exists()) {
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/dataset/ParsingWizardPage.java b/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/dataset/ParsingWizardPage.java
index 3a49c9929e..001a653067 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/dataset/ParsingWizardPage.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/dataset/ParsingWizardPage.java
@@ -22,7 +22,6 @@ import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IMemento;
@@ -103,8 +102,6 @@ public abstract class ParsingWizardPage extends WizardPage {
}
}
- readParsingExpression();
-
//Do this after readingParsingExpressions so events arn't fired
for(int i=0; i<txtRegExpr.length; i++) {
if(0 != i%COLUMNS) {
@@ -196,9 +193,6 @@ public abstract class ParsingWizardPage extends WizardPage {
return true;
}
- abstract boolean readParsingExpression();
- abstract void copyExisting(IMemento oldMeta, IMemento newMeta);
-
protected class TextModifyListener implements ModifyListener {
@Override
public void modifyText(ModifyEvent e) {
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/dataset/SelectRowParsingWizardPage.java b/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/dataset/SelectRowParsingWizardPage.java
index 66c79607e4..2df2da7888 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/dataset/SelectRowParsingWizardPage.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/dataset/SelectRowParsingWizardPage.java
@@ -11,20 +11,13 @@
package org.eclipse.linuxtools.systemtap.graphingapi.ui.wizards.dataset;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
import java.util.regex.PatternSyntaxException;
import org.eclipse.linuxtools.internal.systemtap.graphingapi.ui.Localization;
-import org.eclipse.linuxtools.systemtap.graphingapi.core.datasets.IDataSetParser;
import org.eclipse.linuxtools.systemtap.graphingapi.core.datasets.row.RowDataSet;
import org.eclipse.linuxtools.systemtap.graphingapi.core.datasets.row.RowParser;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.WorkbenchException;
-import org.eclipse.ui.XMLMemento;
public class SelectRowParsingWizardPage extends ParsingWizardPage {
@@ -44,79 +37,6 @@ public class SelectRowParsingWizardPage extends ParsingWizardPage {
}
@Override
- protected boolean readParsingExpression() {
- if(null == wizard.metaFile && !wizard.openFile()) {
- return false;
- }
-
- try {
- FileReader reader = new FileReader(wizard.metaFile);
-
- if(!reader.ready()) {
- reader.close();
- return false;
- }
-
- XMLMemento data = XMLMemento.createReadRoot(reader, IDataSetParser.XMLDataSetSettings);
-
- IMemento[] children = data.getChildren(IDataSetParser.XMLFile);
- int i;
- for(i=0; i<children.length; i++) {
- if(children[i].getID().equals(wizard.scriptFile)) {
- break;
- }
- }
-
- if(i>=children.length) {
- return false;
- }
-
- if(0 != children[i].getString(IDataSetParser.XMLdataset).compareTo(RowDataSet.ID)) {
- return false;
- }
-
- IMemento[] children2 = children[i].getChildren(IDataSetParser.XMLColumn);
- txtSeries.setText("" + children2.length); //$NON-NLS-1$
- for(int j=0; j<children2.length; j++) {
- txtRegExpr[j*COLUMNS].setText(children2[j].getString(IDataSetParser.XMLname));
- }
-
- children2 = children[i].getChildren(IDataSetParser.XMLSeries);
- txtSeries.setText("" + children2.length); //$NON-NLS-1$
- for(int j=0; j<children2.length; j++) {
- txtRegExpr[j*COLUMNS+1].setText(children2[j].getString(IDataSetParser.XMLparsingExpression));
- txtRegExpr[j*COLUMNS+2].setText(children2[j].getString(IDataSetParser.XMLparsingSpacer));
- }
-
- reader.close();
- } catch(FileNotFoundException fnfe) {
- return false;
- } catch(WorkbenchException we) {
- return false;
- } catch(IOException ioe) {
- return false;
- }
-
- return true;
- }
-
- @Override
- protected void copyExisting(IMemento oldMeta, IMemento newMeta) {
- IMemento[] children = oldMeta.getChildren(IDataSetParser.XMLColumn);
- IMemento child;
- for(IMemento memento :children) {
- child = newMeta.createChild(IDataSetParser.XMLColumn);
- child.putString(IDataSetParser.XMLname, memento.getString(IDataSetParser.XMLname));
- }
- children = oldMeta.getChildren(IDataSetParser.XMLSeries);
- for(IMemento memento :children) {
- child = newMeta.createChild(IDataSetParser.XMLSeries);
- child.putString(IDataSetParser.XMLparsingExpression, memento.getString(IDataSetParser.XMLparsingExpression));
- child.putString(IDataSetParser.XMLparsingSpacer, memento.getString(IDataSetParser.XMLparsingSpacer));
- }
- }
-
- @Override
public boolean checkComplete() {
if(super.checkComplete()) {
try {
diff --git a/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/dataset/SelectTableParsingWizardPage.java b/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/dataset/SelectTableParsingWizardPage.java
index c246c6f429..d0a9bde9f5 100644
--- a/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/dataset/SelectTableParsingWizardPage.java
+++ b/systemtap/org.eclipse.linuxtools.systemtap.graphingapi.ui/src/org/eclipse/linuxtools/systemtap/graphingapi/ui/wizards/dataset/SelectTableParsingWizardPage.java
@@ -11,22 +11,15 @@
package org.eclipse.linuxtools.systemtap.graphingapi.ui.wizards.dataset;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
import java.util.regex.PatternSyntaxException;
import org.eclipse.linuxtools.internal.systemtap.graphingapi.ui.Localization;
-import org.eclipse.linuxtools.systemtap.graphingapi.core.datasets.IDataSetParser;
import org.eclipse.linuxtools.systemtap.graphingapi.core.datasets.table.TableDataSet;
import org.eclipse.linuxtools.systemtap.graphingapi.core.datasets.table.TableParser;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Text;
-import org.eclipse.ui.IMemento;
-import org.eclipse.ui.WorkbenchException;
-import org.eclipse.ui.XMLMemento;
@@ -55,81 +48,6 @@ public class SelectTableParsingWizardPage extends ParsingWizardPage {
}
@Override
- protected boolean readParsingExpression() {
- if(null == wizard.metaFile && !wizard.openFile()) {
- return false;
- }
-
- try {
- FileReader reader = new FileReader(wizard.metaFile);
-
- if(!reader.ready()) {
- reader.close();
- return false;
- }
-
- XMLMemento data = XMLMemento.createReadRoot(reader, IDataSetParser.XMLDataSetSettings);
-
- IMemento[] children = data.getChildren(IDataSetParser.XMLFile);
- int i;
- for(i=0; i<children.length; i++) {
- if(children[i].getID().equals(wizard.scriptFile)) {
- break;
- }
- }
-
- if(i>=children.length) {
- return false;
- }
-
- if(0 != children[i].getString(IDataSetParser.XMLdataset).compareTo(TableDataSet.ID)) {
- return false;
- }
-
- IMemento[] children2 = children[i].getChildren(IDataSetParser.XMLColumn);
- txtSeries.setText("" + children2.length); //$NON-NLS-1$
- for(int j=0; j<children2.length; j++) {
- txtRegExpr[j*COLUMNS].setText(children2[j].getString(IDataSetParser.XMLname));
- }
-
- children2 = children[i].getChildren(IDataSetParser.XMLSeries);
- txtSeries.setText("" + children2.length); //$NON-NLS-1$
- for(int j=0; j<children2.length; j++) {
- txtRegExpr[j*COLUMNS+1].setText(children2[j].getString(IDataSetParser.XMLparsingExpression));
- txtRegExpr[j*COLUMNS+2].setText(children2[j].getString(IDataSetParser.XMLparsingSpacer));
- }
- txtDelim.setText(children[i].getChild(IDataSetParser.XMLDelimiter).getString(IDataSetParser.XMLparsingExpression));
-
- reader.close();
- } catch(FileNotFoundException fnfe) {
- return false;
- } catch(WorkbenchException we) {
- return false;
- } catch(IOException ioe) {
- return false;
- }
-
- return true;
- }
-
- @Override
- protected void copyExisting(IMemento oldMeta, IMemento newMeta) {
- IMemento[] children = oldMeta.getChildren(IDataSetParser.XMLColumn);
- IMemento child;
- for(IMemento memento:children) {
- child = newMeta.createChild(IDataSetParser.XMLColumn);
- child.putString(IDataSetParser.XMLname, memento.getString(IDataSetParser.XMLname));
- }
- children = oldMeta.getChildren(IDataSetParser.XMLSeries);
- for(IMemento memento:children) {
- child = newMeta.createChild(IDataSetParser.XMLSeries);
- child.putString(IDataSetParser.XMLparsingExpression, memento.getString(IDataSetParser.XMLparsingExpression));
- child.putString(IDataSetParser.XMLparsingSpacer, memento.getString(IDataSetParser.XMLparsingSpacer));
- }
- newMeta.createChild(IDataSetParser.XMLDelimiter).putString(IDataSetParser.XMLparsingExpression, oldMeta.getChild(IDataSetParser.XMLDelimiter).getString(IDataSetParser.XMLparsingExpression));
- }
-
- @Override
public boolean checkComplete() {
if(super.checkComplete() && txtDelim.getText().length() > 0) {
try {

Back to the top