/*******************************************************************************
- * Copyright (c) 2010, 2013 Ericsson
+ * Copyright (c) 2010, 2014 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.linuxtools.internal.tmf.ui.Activator;
import org.eclipse.linuxtools.internal.tmf.ui.Messages;
-import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomEventsTable;
-import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTraceDefinition.OutputColumn;
-import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTxtTrace;
-import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTxtTraceDefinition;
+import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomEventTableColumns;
import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;
+import org.eclipse.linuxtools.tmf.core.parsers.custom.CustomTraceDefinition.OutputColumn;
+import org.eclipse.linuxtools.tmf.core.parsers.custom.CustomTxtTrace;
+import org.eclipse.linuxtools.tmf.core.parsers.custom.CustomTxtTraceDefinition;
import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
+import org.eclipse.linuxtools.tmf.core.trace.indexer.ITmfTraceIndexer;
+import org.eclipse.linuxtools.tmf.core.trace.indexer.checkpoint.TmfCheckpointIndexer;
+import org.eclipse.linuxtools.tmf.ui.viewers.events.TmfEventsTable;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.custom.ScrolledComposite;
private static final Image DOWN_IMAGE = Activator.getDefault().getImageFromPath("/icons/elcl16/down_button.gif"); //$NON-NLS-1$
private final CustomTxtParserWizard wizard;
private CustomTxtTraceDefinition definition;
- private List<Output> outputs = new ArrayList<Output>();
+ private List<Output> outputs = new ArrayList<>();
private Composite container;
private SashForm sash;
private ScrolledComposite outputsScrolledComposite;
private Composite outputsContainer;
private Composite tableContainer;
- private CustomEventsTable previewTable;
+ private TmfEventsTable previewTable;
private File tmpFile;
/**
tableLayout.marginHeight = 0;
tableLayout.marginWidth = 0;
tableContainer.setLayout(tableLayout);
- previewTable = new CustomEventsTable(new CustomTxtTraceDefinition(), tableContainer, 0);
+ previewTable = new TmfEventsTable(tableContainer, 0, CustomEventTableColumns.generateColumns(new CustomTxtTraceDefinition()));
previewTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
if (wizard.definition != null) {
private void updatePreviewTable() {
final int CACHE_SIZE = 50;
definition.outputs = extractOutputs();
+ tmpFile = Activator.getDefault().getStateLocation().addTrailingSeparator().append("customwizard.tmp").toFile(); //$NON-NLS-1$
- try {
- tmpFile = Activator.getDefault().getStateLocation().addTrailingSeparator().append("customwizard.tmp").toFile(); //$NON-NLS-1$
- final FileWriter writer = new FileWriter(tmpFile);
+ try (final FileWriter writer = new FileWriter(tmpFile);) {
writer.write(wizard.inputPage.getInputText());
- writer.close();
+ } catch (final IOException e) {
+ Activator.getDefault().logError("Error creating CustomTxtTrace. File:" + tmpFile.getAbsolutePath(), e); //$NON-NLS-1$
+ }
- final CustomTxtTrace trace = new CustomTxtTrace(null, definition, tmpFile.getAbsolutePath(), CACHE_SIZE);
+ try {
+ final CustomTxtTrace trace = new CustomTxtTrace(null, definition, tmpFile.getAbsolutePath(), CACHE_SIZE) {
+ @Override
+ protected ITmfTraceIndexer createIndexer(int interval) {
+ return new TmfCheckpointIndexer(this, interval);
+ }
+ };
trace.getIndexer().buildIndex(0, TmfTimeRange.ETERNITY, false);
previewTable.dispose();
- previewTable = new CustomEventsTable(definition, tableContainer, CACHE_SIZE);
+ previewTable = new TmfEventsTable(tableContainer, CACHE_SIZE, CustomEventTableColumns.generateColumns(definition));
previewTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
previewTable.setTrace(trace, true);
} catch (final TmfTraceException e) {
Activator.getDefault().logError("Error creating CustomTxtTrace. File:" + tmpFile.getAbsolutePath(), e); //$NON-NLS-1$
- } catch (final IOException e) {
- Activator.getDefault().logError("Error creating CustomTxtTrace. File:" + tmpFile.getAbsolutePath(), e); //$NON-NLS-1$
}
tableContainer.layout();
numColumns++;
}
}
- final List<OutputColumn> outputColumns = new ArrayList<OutputColumn>(numColumns);
+ final List<OutputColumn> outputColumns = new ArrayList<>(numColumns);
numColumns = 0;
for (int i = 0; i < outputs.size(); i++) {
final Output output = outputs.get(i);