tmf/lttng: Remove unneeded (non-Javadoc) comments
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / internal / tmf / ui / parsers / wizards / CustomTxtParserOutputWizardPage.java
index 6ba1886686bd0a53c80a32de6efe3db840f69ed6..581de842926c846ad2fc34cb1268782e0f316079 100644 (file)
@@ -1,3 +1,15 @@
+/*******************************************************************************
+ * Copyright (c) 2013 Ericsson
+ *
+ * All rights reserved. This program and the accompanying materials are
+ * made available under the terms of the Eclipse Public License v1.0 which
+ * accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ *   Patrick Tassé - Initial API and implementation
+ *******************************************************************************/
+
 package org.eclipse.linuxtools.internal.tmf.ui.parsers.wizards;
 
 import java.io.File;
@@ -8,14 +20,14 @@ import java.util.Iterator;
 import java.util.List;
 
 import org.eclipse.jface.wizard.WizardPage;
-import org.eclipse.linuxtools.internal.tmf.ui.Messages;
 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.tmf.core.exceptions.TmfTraceException;
-import org.eclipse.linuxtools.tmf.core.trace.ITmfTrace;
+import org.eclipse.linuxtools.tmf.core.timestamp.TmfTimeRange;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.custom.SashForm;
 import org.eclipse.swt.custom.ScrolledComposite;
@@ -28,6 +40,11 @@ import org.eclipse.swt.widgets.Button;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Text;
 
+/**
+ * Output wizard page for custom text trace parsers.
+ *
+ * @author Patrick Tassé
+ */
 public class CustomTxtParserOutputWizardPage extends WizardPage {
 
     private static final Image upImage = Activator.getDefault().getImageFromPath("/icons/elcl16/up_button.gif"); //$NON-NLS-1$
@@ -47,6 +64,12 @@ public class CustomTxtParserOutputWizardPage extends WizardPage {
     CustomEventsTable previewTable;
     File tmpFile;
 
+    /**
+     * Constructor
+     *
+     * @param wizard
+     *            The wizard to which this page belongs
+     */
     protected CustomTxtParserOutputWizardPage(final CustomTxtParserWizard wizard) {
         super("CustomParserOutputWizardPage"); //$NON-NLS-1$
         setTitle(wizard.inputPage.getTitle());
@@ -87,8 +110,9 @@ public class CustomTxtParserOutputWizardPage extends WizardPage {
         previewTable = new CustomEventsTable(new CustomTxtTraceDefinition(), tableContainer, 0);
         previewTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
 
-        if (wizard.definition != null)
+        if (wizard.definition != null) {
             loadDefinition(wizard.definition);
+        }
         setControl(container);
 
     }
@@ -99,16 +123,13 @@ public class CustomTxtParserOutputWizardPage extends WizardPage {
         super.dispose();
     }
 
-    private void loadDefinition(final CustomTxtTraceDefinition definition) {
-        for (final OutputColumn outputColumn : definition.outputs) {
+    private void loadDefinition(final CustomTxtTraceDefinition def) {
+        for (final OutputColumn outputColumn : def.outputs) {
             final Output output = new Output(outputsContainer, outputColumn.name);
             outputs.add(output);
         }
     }
 
-    /* (non-Javadoc)
-     * @see org.eclipse.jface.dialogs.DialogPage#setVisible(boolean)
-     */
     @Override
     public void setVisible(final boolean visible) {
         if (visible) {
@@ -120,11 +141,12 @@ public class CustomTxtParserOutputWizardPage extends WizardPage {
             while (iter.hasNext()) {
                 final Output output = iter.next();
                 boolean found = false;
-                for (final String name : outputNames)
+                for (final String name : outputNames) {
                     if (output.name.equals(name)) {
                         found = true;
                         break;
                     }
+                }
                 if (!found) {
                     output.dispose();
                     iter.remove();
@@ -134,25 +156,29 @@ public class CustomTxtParserOutputWizardPage extends WizardPage {
             // create outputs that have been added in the input page
             for (final String name : outputNames) {
                 boolean found = false;
-                for (final Output output : outputs)
+                for (final Output output : outputs) {
                     if (output.name.equals(name)) {
                         found = true;
                         break;
                     }
-                if (!found)
+                }
+                if (!found) {
                     outputs.add(new Output(outputsContainer, name));
+                }
             }
 
             outputsContainer.layout();
             outputsScrolledComposite.setMinSize(outputsContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).x, outputsContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y-5);
             updatePreviewTable();
-            if (sash.getSize().y > outputsContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y + previewTable.getTable().getItemHeight())
+            if (sash.getSize().y > outputsContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y + previewTable.getTable().getItemHeight()) {
                 sash.setWeights(new int[] {outputsContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y, sash.getSize().y - outputsContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y});
-            else
+            } else {
                 sash.setWeights(new int[] {outputsContainer.computeSize(SWT.DEFAULT, SWT.DEFAULT).y, previewTable.getTable().getItemHeight()});
+            }
             setPageComplete(true);
-        } else
+        } else {
             setPageComplete(false);
+        }
         super.setVisible(visible);
     }
 
@@ -198,7 +224,8 @@ public class CustomTxtParserOutputWizardPage extends WizardPage {
             writer.write(wizard.inputPage.getInputText());
             writer.close();
 
-            final ITmfTrace<?> trace = new CustomTxtTrace(null, definition, tmpFile.getAbsolutePath(), CACHE_SIZE);
+            final CustomTxtTrace trace = new CustomTxtTrace(null, definition, tmpFile.getAbsolutePath(), CACHE_SIZE);
+            trace.getIndexer().buildIndex(0, TmfTimeRange.ETERNITY, false);
             previewTable.dispose();
             previewTable = new CustomEventsTable(definition, tableContainer, CACHE_SIZE);
             previewTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
@@ -213,11 +240,18 @@ public class CustomTxtParserOutputWizardPage extends WizardPage {
         container.layout();
     }
 
+    /**
+     * Extract the list of output columns from the page's contents.
+     *
+     * @return The output columns
+     */
     public List<OutputColumn> extractOutputs() {
         int numColumns = 0;
-        for (int i = 0; i < outputs.size(); i++)
-            if (outputs.get(i).enabledButton.getSelection())
+        for (int i = 0; i < outputs.size(); i++) {
+            if (outputs.get(i).enabledButton.getSelection()) {
                 numColumns++;
+            }
+        }
         final List<OutputColumn> outputColumns = new ArrayList<OutputColumn>(numColumns);
         numColumns = 0;
         for (int i = 0; i < outputs.size(); i++) {
@@ -290,6 +324,11 @@ public class CustomTxtParserOutputWizardPage extends WizardPage {
         }
     }
 
+    /**
+     * Get the trace definition.
+     *
+     * @return The trace definition
+     */
     public CustomTxtTraceDefinition getDefinition() {
         return definition;
     }
This page took 0.025929 seconds and 5 git commands to generate.