Remove the generic location (replace by Comparable)
[deliverable/tracecompass.git] / org.eclipse.linuxtools.tmf.ui / src / org / eclipse / linuxtools / internal / tmf / ui / parsers / custom / CustomTxtTrace.java
index 57f72582b9f9c048f49b735f7c4aada880efec3e..c12031e5afc8033edc481497be587827658516d9 100644 (file)
@@ -1,18 +1,17 @@
 /*******************************************************************************\r
  * Copyright (c) 2010 Ericsson\r
- * \r
+ *\r
  * All rights reserved. This program and the accompanying materials are\r
  * made available under the terms of the Eclipse Public License v1.0 which\r
  * accompanies this distribution, and is available at\r
  * http://www.eclipse.org/legal/epl-v10.html\r
- * \r
+ *\r
  * Contributors:\r
  *   Patrick Tasse - Initial API and implementation\r
  *******************************************************************************/\r
 \r
 package org.eclipse.linuxtools.internal.tmf.ui.parsers.custom;\r
 \r
-import java.io.File;\r
 import java.io.FileNotFoundException;\r
 import java.io.IOException;\r
 import java.util.HashMap;\r
@@ -21,297 +20,302 @@ import java.util.List;
 import java.util.Map.Entry;\r
 import java.util.regex.Matcher;\r
 \r
+import org.eclipse.core.resources.IProject;\r
+import org.eclipse.core.resources.IResource;\r
+import org.eclipse.linuxtools.internal.tmf.ui.Activator;\r
 import org.eclipse.linuxtools.internal.tmf.ui.parsers.custom.CustomTxtTraceDefinition.InputLine;\r
-import org.eclipse.linuxtools.tmf.core.event.TmfEvent;\r
+import org.eclipse.linuxtools.tmf.core.event.ITmfEvent;\r
 import org.eclipse.linuxtools.tmf.core.event.TmfTimestamp;\r
+import org.eclipse.linuxtools.tmf.core.exceptions.TmfTraceException;\r
 import org.eclipse.linuxtools.tmf.core.io.BufferedRandomAccessFile;\r
 import org.eclipse.linuxtools.tmf.core.trace.ITmfContext;\r
+import org.eclipse.linuxtools.tmf.core.trace.ITmfEventParser;\r
 import org.eclipse.linuxtools.tmf.core.trace.ITmfLocation;\r
 import org.eclipse.linuxtools.tmf.core.trace.TmfContext;\r
-import org.eclipse.linuxtools.tmf.core.trace.TmfLocation;\r
+import org.eclipse.linuxtools.tmf.core.trace.TmfLongLocation;\r
 import org.eclipse.linuxtools.tmf.core.trace.TmfTrace;\r
 \r
-public class CustomTxtTrace extends TmfTrace<CustomTxtEvent> {\r
+public class CustomTxtTrace extends TmfTrace implements ITmfEventParser {\r
 \r
-    private static final TmfLocation<Long> NULL_LOCATION = new TmfLocation<Long>((Long) null);\r
+    private static final TmfLongLocation NULL_LOCATION = new TmfLongLocation((Long) null);\r
     private static final int DEFAULT_CACHE_SIZE = 100;\r
 \r
-    private CustomTxtTraceDefinition fDefinition;\r
-    private CustomTxtEventType fEventType;\r
+    private final CustomTxtTraceDefinition fDefinition;\r
+    private final CustomTxtEventType fEventType;\r
+    private BufferedRandomAccessFile fFile;\r
 \r
-    public CustomTxtTrace(CustomTxtTraceDefinition definition) {\r
+    public CustomTxtTrace(final CustomTxtTraceDefinition definition) {\r
         fDefinition = definition;\r
         fEventType = new CustomTxtEventType(fDefinition);\r
+        setCacheSize(DEFAULT_CACHE_SIZE);\r
     }\r
 \r
-    public CustomTxtTrace(String name, CustomTxtTraceDefinition definition, String path, int pageSize) throws FileNotFoundException {\r
-        super(name, CustomTxtEvent.class, path, (pageSize > 0) ? pageSize : DEFAULT_CACHE_SIZE, true);\r
-        fDefinition = definition;\r
-        fEventType = new CustomTxtEventType(fDefinition);\r
+    public CustomTxtTrace(final IResource resource, final CustomTxtTraceDefinition definition, final String path, final int cacheSize) throws TmfTraceException {\r
+        this(definition);\r
+        setCacheSize((cacheSize > 0) ? cacheSize : DEFAULT_CACHE_SIZE);\r
+        initTrace(resource, path, CustomTxtEvent.class);\r
     }\r
 \r
     @Override\r
-    public void initTrace(String name, String path, Class<CustomTxtEvent> eventType) throws FileNotFoundException {\r
-        super.initTrace(name, path, eventType);\r
+    public void initTrace(final IResource resource, final String path, final Class<? extends ITmfEvent> eventType) throws TmfTraceException {\r
+        super.initTrace(resource, path, eventType);\r
+        try {\r
+            fFile = new BufferedRandomAccessFile(getPath(), "r"); //$NON-NLS-1$\r
+        } catch (IOException e) {\r
+            throw new TmfTraceException(e.getMessage(), e);\r
+        }\r
+        indexTrace(false);\r
     }\r
 \r
     @Override\r
-    public TmfContext seekLocation(ITmfLocation<?> location) {\r
-        CustomTxtTraceContext context = new CustomTxtTraceContext(NULL_LOCATION, ITmfContext.INITIAL_RANK);\r
-        if (NULL_LOCATION.equals(location) || !new File(getPath()).isFile()) {\r
+    public synchronized void dispose() {\r
+        super.dispose();\r
+        if (fFile != null) {\r
+            try {\r
+                fFile.close();\r
+            } catch (IOException e) {\r
+            } finally {\r
+                fFile = null;\r
+            }\r
+        }\r
+    }\r
+\r
+    @Override\r
+    public synchronized TmfContext seekEvent(final ITmfLocation location) {\r
+        final CustomTxtTraceContext context = new CustomTxtTraceContext(NULL_LOCATION, ITmfContext.UNKNOWN_RANK);\r
+        if (NULL_LOCATION.equals(location) || fFile == null) {\r
             return context;\r
         }\r
-        BufferedRandomAccessFile raFile = null; \r
         try {\r
-                       raFile = new BufferedRandomAccessFile(getPath(), "r"); //$NON-NLS-1$\r
-            if (location != null && location.getLocation() instanceof Long) {\r
-                raFile.seek((Long)location.getLocation());\r
+            if (location == null) {\r
+                fFile.seek(0);\r
+            } else if (location.getLocationData() instanceof Long) {\r
+                fFile.seek((Long) location.getLocationData());\r
             }\r
             String line;\r
-            long rawPos = raFile.getFilePointer();\r
-            while ((line = raFile.getNextLine()) != null) {\r
-                for (InputLine input : getFirstLines()) {\r
-                    Matcher matcher = input.getPattern().matcher(line);\r
+            long rawPos = fFile.getFilePointer();\r
+            while ((line = fFile.getNextLine()) != null) {\r
+                for (final InputLine input : getFirstLines()) {\r
+                    final Matcher matcher = input.getPattern().matcher(line);\r
                     if (matcher.find()) {\r
-                        context.setLocation(new TmfLocation<Long>(rawPos));\r
-                        context.raFile = raFile;\r
+                        context.setLocation(new TmfLongLocation(rawPos));\r
                         context.firstLineMatcher = matcher;\r
                         context.firstLine = line;\r
-                        context.nextLineLocation = raFile.getFilePointer();\r
+                        context.nextLineLocation = fFile.getFilePointer();\r
                         context.inputLine = input;\r
                         return context;\r
                     }\r
                 }\r
-                rawPos = raFile.getFilePointer();\r
+                rawPos = fFile.getFilePointer();\r
             }\r
             return context;\r
-        } catch (FileNotFoundException e) {\r
-            e.printStackTrace();\r
+        } catch (final FileNotFoundException e) {\r
+            Activator.getDefault().logError("Error seeking event. File not found: " + getPath(), e); //$NON-NLS-1$\r
             return context;\r
-        } catch (IOException e) {\r
-            e.printStackTrace();\r
+        } catch (final IOException e) {\r
+            Activator.getDefault().logError("Error seeking event. File: " + getPath(), e); //$NON-NLS-1$\r
             return context;\r
-        } finally {\r
-               if (raFile != null) {\r
-                       try {\r
-                                       raFile.close();\r
-                               } catch (IOException e) {\r
-                               }\r
-               }\r
         }\r
-        \r
+\r
     }\r
 \r
     @Override\r
-    public TmfContext seekLocation(double ratio) {\r
-       BufferedRandomAccessFile raFile = null; \r
+    public synchronized TmfContext seekEvent(final double ratio) {\r
+        if (fFile == null) {\r
+            return new CustomTxtTraceContext(NULL_LOCATION, ITmfContext.UNKNOWN_RANK);\r
+        }\r
         try {\r
-                       raFile = new BufferedRandomAccessFile(getPath(), "r"); //$NON-NLS-1$\r
-            long pos = (long) (ratio * raFile.length());\r
+            long pos = (long) (ratio * fFile.length());\r
             while (pos > 0) {\r
-                raFile.seek(pos - 1);\r
-                if (raFile.read() == '\n') break;\r
+                fFile.seek(pos - 1);\r
+                if (fFile.read() == '\n') {\r
+                    break;\r
+                }\r
                 pos--;\r
             }\r
-            ITmfLocation<?> location = new TmfLocation<Long>(pos);\r
-            TmfContext context = seekLocation(location);\r
+            final ITmfLocation location = new TmfLongLocation(pos);\r
+            final TmfContext context = seekEvent(location);\r
             context.setRank(ITmfContext.UNKNOWN_RANK);\r
             return context;\r
-        } catch (FileNotFoundException e) {\r
-            e.printStackTrace();\r
-            return new CustomTxtTraceContext(NULL_LOCATION, ITmfContext.INITIAL_RANK);\r
-        } catch (IOException e) {\r
-            e.printStackTrace();\r
-            return new CustomTxtTraceContext(NULL_LOCATION, ITmfContext.INITIAL_RANK);\r
-        } finally {\r
-               if (raFile != null) {\r
-                       try {\r
-                                       raFile.close();\r
-                               } catch (IOException e) {\r
-                               }\r
-               }\r
+        } catch (final IOException e) {\r
+            Activator.getDefault().logError("Error seeking event. File: " + getPath(), e); //$NON-NLS-1$\r
+            return new CustomTxtTraceContext(NULL_LOCATION, ITmfContext.UNKNOWN_RANK);\r
         }\r
     }\r
 \r
     @Override\r
-    public double getLocationRatio(ITmfLocation<?> location) {\r
-       BufferedRandomAccessFile raFile = null; \r
+    public synchronized double getLocationRatio(final ITmfLocation location) {\r
+        if (fFile == null) {\r
+            return 0;\r
+        }\r
         try {\r
-            if (location.getLocation() instanceof Long) {\r
-                               raFile = new BufferedRandomAccessFile(getPath(), "r"); //$NON-NLS-1$\r
-                return (double) ((Long) location.getLocation()) / raFile.length();\r
+            if (location.getLocationData() instanceof Long) {\r
+                return (double) ((Long) location.getLocationData()) / fFile.length();\r
             }\r
-        } catch (FileNotFoundException e) {\r
-            e.printStackTrace();\r
-        } catch (IOException e) {\r
-            e.printStackTrace();\r
-        } finally {\r
-               if (raFile != null) {\r
-                       try {\r
-                                       raFile.close();\r
-                               } catch (IOException e) {\r
-                               }\r
-               }\r
+        } catch (final IOException e) {\r
+            Activator.getDefault().logError("Error seeking event. File: " + getPath(), e); //$NON-NLS-1$\r
         }\r
         return 0;\r
     }\r
 \r
     @Override\r
-    public ITmfLocation<?> getCurrentLocation() {\r
+    public ITmfLocation getCurrentLocation() {\r
         // TODO Auto-generated method stub\r
         return null;\r
     }\r
 \r
     @Override\r
-    public synchronized TmfEvent getNextEvent(ITmfContext context) {\r
-        ITmfContext savedContext = context.clone();\r
-        TmfEvent event = parseEvent(context);\r
+    public synchronized CustomTxtEvent parseEvent(final ITmfContext tmfContext) {\r
+        ITmfContext context = seekEvent(tmfContext.getLocation());\r
+        return parse(context);\r
+    }\r
+\r
+    @Override\r
+    public synchronized CustomTxtEvent getNext(final ITmfContext context) {\r
+        final ITmfContext savedContext = context.clone();\r
+        final CustomTxtEvent event = parse(context);\r
         if (event != null) {\r
-            updateIndex(savedContext, savedContext.getRank(), event.getTimestamp());\r
-            context.updateRank(1);\r
+            updateAttributes(savedContext, event.getTimestamp());\r
+            context.increaseRank();\r
         }\r
         return event;\r
     }\r
 \r
-    @Override\r
-    public TmfEvent parseEvent(ITmfContext tmfContext) {\r
+    private synchronized CustomTxtEvent parse(final ITmfContext tmfContext) {\r
+        if (fFile == null) {\r
+            return null;\r
+        }\r
         if (!(tmfContext instanceof CustomTxtTraceContext)) {\r
             return null;\r
         }\r
-        \r
-        CustomTxtTraceContext context = (CustomTxtTraceContext) tmfContext;\r
-        if (!(context.getLocation().getLocation() instanceof Long) || NULL_LOCATION.equals(context.getLocation())) {\r
+\r
+        final CustomTxtTraceContext context = (CustomTxtTraceContext) tmfContext;\r
+        if (!(context.getLocation().getLocationData() instanceof Long) || NULL_LOCATION.equals(context.getLocation())) {\r
             return null;\r
         }\r
 \r
         CustomTxtEvent event = parseFirstLine(context);\r
 \r
-        HashMap<InputLine, Integer> countMap = new HashMap<InputLine, Integer>();\r
+        final HashMap<InputLine, Integer> countMap = new HashMap<InputLine, Integer>();\r
         InputLine currentInput = null;\r
         if (context.inputLine.childrenInputs != null && context.inputLine.childrenInputs.size() > 0) {\r
             currentInput = context.inputLine.childrenInputs.get(0);\r
             countMap.put(currentInput, 0);\r
         }\r
-        \r
-        synchronized (context.raFile) {\r
-            try {\r
-                if (context.raFile.getFilePointer() != context.nextLineLocation) {\r
-                    context.raFile.seek(context.nextLineLocation);\r
-                }\r
-                String line;\r
-                long rawPos = context.raFile.getFilePointer();\r
-                while ((line = context.raFile.getNextLine()) != null) {\r
-                    boolean processed = false;\r
-                    if (currentInput == null) {\r
-                        for (InputLine input : getFirstLines()) {\r
-                            Matcher matcher = input.getPattern().matcher(line);\r
-                            if (matcher.find()) {\r
-                                context.setLocation(new TmfLocation<Long>(rawPos));\r
-                                context.firstLineMatcher = matcher;\r
-                                context.firstLine = line;\r
-                                context.nextLineLocation = context.raFile.getFilePointer();\r
-                                context.inputLine = input;\r
-                                return event;\r
-                            }\r
+\r
+        try {\r
+            if (fFile.getFilePointer() != context.nextLineLocation) {\r
+                fFile.seek(context.nextLineLocation);\r
+            }\r
+            String line;\r
+            long rawPos = fFile.getFilePointer();\r
+            while ((line = fFile.getNextLine()) != null) {\r
+                boolean processed = false;\r
+                if (currentInput == null) {\r
+                    for (final InputLine input : getFirstLines()) {\r
+                        final Matcher matcher = input.getPattern().matcher(line);\r
+                        if (matcher.find()) {\r
+                            context.setLocation(new TmfLongLocation(rawPos));\r
+                            context.firstLineMatcher = matcher;\r
+                            context.firstLine = line;\r
+                            context.nextLineLocation = fFile.getFilePointer();\r
+                            context.inputLine = input;\r
+                            return event;\r
                         }\r
-                    } else {\r
-                        if (countMap.get(currentInput) >= currentInput.getMinCount()) {\r
-                            List<InputLine> nextInputs = currentInput.getNextInputs(countMap);\r
-                            if (nextInputs.size() == 0 || nextInputs.get(nextInputs.size() - 1).getMinCount() == 0) {\r
-                                for (InputLine input : getFirstLines()) {\r
-                                    Matcher matcher = input.getPattern().matcher(line);\r
-                                    if (matcher.find()) {\r
-                                        context.setLocation(new TmfLocation<Long>(rawPos));\r
-                                        context.firstLineMatcher = matcher;\r
-                                        context.firstLine = line;\r
-                                        context.nextLineLocation = context.raFile.getFilePointer();\r
-                                        context.inputLine = input;\r
-                                        return event;\r
-                                    }\r
+                    }\r
+                } else {\r
+                    if (countMap.get(currentInput) >= currentInput.getMinCount()) {\r
+                        final List<InputLine> nextInputs = currentInput.getNextInputs(countMap);\r
+                        if (nextInputs.size() == 0 || nextInputs.get(nextInputs.size() - 1).getMinCount() == 0) {\r
+                            for (final InputLine input : getFirstLines()) {\r
+                                final Matcher matcher = input.getPattern().matcher(line);\r
+                                if (matcher.find()) {\r
+                                    context.setLocation(new TmfLongLocation(rawPos));\r
+                                    context.firstLineMatcher = matcher;\r
+                                    context.firstLine = line;\r
+                                    context.nextLineLocation = fFile.getFilePointer();\r
+                                    context.inputLine = input;\r
+                                    return event;\r
                                 }\r
                             }\r
-                            for (InputLine input : nextInputs) {\r
-                                Matcher matcher = input.getPattern().matcher(line);\r
-                                if (matcher.find()) {\r
-                                    event.processGroups(input, matcher);\r
-                                    currentInput = input;\r
-                                    if (countMap.get(currentInput) == null) {\r
-                                        countMap.put(currentInput, 1);\r
-                                    } else {\r
-                                        countMap.put(currentInput, countMap.get(currentInput) + 1);\r
+                        }\r
+                        for (final InputLine input : nextInputs) {\r
+                            final Matcher matcher = input.getPattern().matcher(line);\r
+                            if (matcher.find()) {\r
+                                event.processGroups(input, matcher);\r
+                                currentInput = input;\r
+                                if (countMap.get(currentInput) == null) {\r
+                                    countMap.put(currentInput, 1);\r
+                                } else {\r
+                                    countMap.put(currentInput, countMap.get(currentInput) + 1);\r
+                                }\r
+                                Iterator<InputLine> iter = countMap.keySet().iterator();\r
+                                while (iter.hasNext()) {\r
+                                    final InputLine inputLine = iter.next();\r
+                                    if (inputLine.level > currentInput.level) {\r
+                                        iter.remove();\r
                                     }\r
-                                    Iterator<InputLine> iter = countMap.keySet().iterator();\r
-                                    while (iter.hasNext()) {\r
-                                        InputLine inputLine = iter.next();\r
-                                        if (inputLine.level > currentInput.level) {\r
-                                            iter.remove();\r
+                                }\r
+                                if (currentInput.childrenInputs != null && currentInput.childrenInputs.size() > 0) {\r
+                                    currentInput = currentInput.childrenInputs.get(0);\r
+                                    countMap.put(currentInput, 0);\r
+                                } else if (countMap.get(currentInput) >= currentInput.getMaxCount()) {\r
+                                    if (currentInput.getNextInputs(countMap).size() > 0) {\r
+                                        currentInput = currentInput.getNextInputs(countMap).get(0);\r
+                                        if (countMap.get(currentInput) == null) {\r
+                                            countMap.put(currentInput, 0);\r
                                         }\r
-                                    }\r
-                                    if (currentInput.childrenInputs != null && currentInput.childrenInputs.size() > 0) {\r
-                                        currentInput = currentInput.childrenInputs.get(0);\r
-                                        countMap.put(currentInput, 0);\r
-                                    } else {\r
-                                        if (countMap.get(currentInput) >= currentInput.getMaxCount()) {\r
-                                            if (currentInput.getNextInputs(countMap).size() > 0) {\r
-                                                currentInput = currentInput.getNextInputs(countMap).get(0);\r
-                                                if (countMap.get(currentInput) == null) {\r
-                                                    countMap.put(currentInput, 0);\r
-                                                }\r
-                                                iter = countMap.keySet().iterator();\r
-                                                while (iter.hasNext()) {\r
-                                                    InputLine inputLine = iter.next();\r
-                                                    if (inputLine.level > currentInput.level) {\r
-                                                        iter.remove();\r
-                                                    }\r
-                                                }\r
-                                            } else {\r
-                                                currentInput = null;\r
+                                        iter = countMap.keySet().iterator();\r
+                                        while (iter.hasNext()) {\r
+                                            final InputLine inputLine = iter.next();\r
+                                            if (inputLine.level > currentInput.level) {\r
+                                                iter.remove();\r
                                             }\r
                                         }\r
+                                    } else {\r
+                                        currentInput = null;\r
                                     }\r
-                                    processed = true;\r
-                                    break;\r
                                 }\r
+                                processed = true;\r
+                                break;\r
                             }\r
                         }\r
-                        if (! processed) {\r
-                            Matcher matcher = currentInput.getPattern().matcher(line);\r
-                            if (matcher.find()) {\r
-                                event.processGroups(currentInput, matcher);\r
-                                countMap.put(currentInput, countMap.get(currentInput) + 1);\r
-                                if (currentInput.childrenInputs != null && currentInput.childrenInputs.size() > 0) {\r
-                                    currentInput = currentInput.childrenInputs.get(0);\r
-                                    countMap.put(currentInput, 0);\r
-                                } else {\r
-                                    if (countMap.get(currentInput) >= currentInput.getMaxCount()) {\r
-                                        if (currentInput.getNextInputs(countMap).size() > 0) {\r
-                                            currentInput = currentInput.getNextInputs(countMap).get(0);\r
-                                            if (countMap.get(currentInput) == null) {\r
-                                                countMap.put(currentInput, 0);\r
-                                            }\r
-                                            Iterator<InputLine> iter = countMap.keySet().iterator();\r
-                                            while (iter.hasNext()) {\r
-                                                InputLine inputLine = iter.next();\r
-                                                if (inputLine.level > currentInput.level) {\r
-                                                    iter.remove();\r
-                                                }\r
-                                            }\r
-                                        } else {\r
-                                            currentInput = null;\r
+                    }\r
+                    if (! processed) {\r
+                        final Matcher matcher = currentInput.getPattern().matcher(line);\r
+                        if (matcher.find()) {\r
+                            event.processGroups(currentInput, matcher);\r
+                            countMap.put(currentInput, countMap.get(currentInput) + 1);\r
+                            if (currentInput.childrenInputs != null && currentInput.childrenInputs.size() > 0) {\r
+                                currentInput = currentInput.childrenInputs.get(0);\r
+                                countMap.put(currentInput, 0);\r
+                            } else if (countMap.get(currentInput) >= currentInput.getMaxCount()) {\r
+                                if (currentInput.getNextInputs(countMap).size() > 0) {\r
+                                    currentInput = currentInput.getNextInputs(countMap).get(0);\r
+                                    if (countMap.get(currentInput) == null) {\r
+                                        countMap.put(currentInput, 0);\r
+                                    }\r
+                                    final Iterator<InputLine> iter = countMap.keySet().iterator();\r
+                                    while (iter.hasNext()) {\r
+                                        final InputLine inputLine = iter.next();\r
+                                        if (inputLine.level > currentInput.level) {\r
+                                            iter.remove();\r
                                         }\r
                                     }\r
+                                } else {\r
+                                    currentInput = null;\r
                                 }\r
                             }\r
-                            ((StringBuffer) event.getContent().getValue()).append("\n").append(line); //$NON-NLS-1$\r
                         }\r
+                        ((StringBuffer) event.getContent().getValue()).append("\n").append(line); //$NON-NLS-1$\r
                     }\r
-                    rawPos = context.raFile.getFilePointer();\r
                 }\r
-            } catch (IOException e) {\r
-                e.printStackTrace();\r
+                rawPos = fFile.getFilePointer();\r
             }\r
+        } catch (final IOException e) {\r
+            Activator.getDefault().logError("Error seeking event. File: " + getPath(), e); //$NON-NLS-1$\r
         }\r
-        for(Entry<InputLine, Integer> entry : countMap.entrySet()) {\r
+        for (final Entry<InputLine, Integer> entry : countMap.entrySet()) {\r
             if (entry.getValue() < entry.getKey().getMinCount()) {\r
                 event = null;\r
             }\r
@@ -323,15 +327,23 @@ public class CustomTxtTrace extends TmfTrace<CustomTxtEvent> {
     public List<InputLine> getFirstLines() {\r
         return fDefinition.inputs;\r
     }\r
-    \r
-    public CustomTxtEvent parseFirstLine(CustomTxtTraceContext context) {\r
-        CustomTxtEvent event = new CustomTxtEvent(fDefinition, this, (TmfTimestamp) TmfTimestamp.ZERO, "", fEventType, ""); //$NON-NLS-1$ //$NON-NLS-2$\r
+\r
+    public CustomTxtEvent parseFirstLine(final CustomTxtTraceContext context) {\r
+        final CustomTxtEvent event = new CustomTxtEvent(fDefinition, this, TmfTimestamp.ZERO, "", fEventType, ""); //$NON-NLS-1$ //$NON-NLS-2$\r
         event.processGroups(context.inputLine, context.firstLineMatcher);\r
-        event.setContent(new CustomEventContent(event, context.firstLine));\r
+        event.setContent(new CustomEventContent(event, new StringBuffer(context.firstLine)));\r
         return event;\r
     }\r
-    \r
+\r
     public CustomTraceDefinition getDefinition() {\r
         return fDefinition;\r
     }\r
+\r
+    /* (non-Javadoc)\r
+     * @see org.eclipse.linuxtools.tmf.core.trace.ITmfTrace#validate(org.eclipse.core.resources.IProject, java.lang.String)\r
+     */\r
+    @Override\r
+    public boolean validate(IProject project, String path) {\r
+        return fileExists(path);\r
+    }\r
 }\r
This page took 0.031845 seconds and 5 git commands to generate.