| 1 | /******************************************************************************* |
| 2 | * Copyright (c) 2014 Ericsson |
| 3 | * |
| 4 | * All rights reserved. This program and the accompanying materials are |
| 5 | * made available under the terms of the Eclipse Public License v1.0 which |
| 6 | * accompanies this distribution, and is available at |
| 7 | * http://www.eclipse.org/legal/epl-v10.html |
| 8 | * |
| 9 | * Contributors: |
| 10 | * Alexandre Montplaisir - Initial API and implementation |
| 11 | * Patrick Tasse - Add methods to get attribute paths |
| 12 | *******************************************************************************/ |
| 13 | |
| 14 | package org.eclipse.linuxtools.tmf.ui.views.callstack; |
| 15 | |
| 16 | import org.eclipse.linuxtools.tmf.core.callstack.CallStackStateProvider; |
| 17 | import org.eclipse.linuxtools.tmf.core.statesystem.TmfStateSystemAnalysisModule; |
| 18 | import org.eclipse.linuxtools.tmf.ui.analysis.TmfAnalysisViewOutput; |
| 19 | |
| 20 | /** |
| 21 | * The base classes for analyses who want to populate the CallStack View. |
| 22 | * |
| 23 | * @author Alexandre Montplaisir |
| 24 | * @since 3.0 |
| 25 | */ |
| 26 | public abstract class AbstractCallStackAnalysis extends TmfStateSystemAnalysisModule { |
| 27 | |
| 28 | private static final String[] DEFAULT_THREADS_PATTERN = |
| 29 | new String[] { CallStackStateProvider.THREADS, "*" }; //$NON-NLS-1$; |
| 30 | |
| 31 | private static final String[] DEFAULT_CALL_STACK_PATH = |
| 32 | new String[] { CallStackStateProvider.CALL_STACK }; |
| 33 | |
| 34 | /** |
| 35 | * Abstract constructor (should only be called via the sub-classes' |
| 36 | * constructors. |
| 37 | */ |
| 38 | public AbstractCallStackAnalysis() { |
| 39 | super(); |
| 40 | registerOutput(new TmfAnalysisViewOutput(CallStackView.ID)); |
| 41 | } |
| 42 | |
| 43 | /** |
| 44 | * Get the pattern of thread attributes. Override this method if the state |
| 45 | * system attributes do not match the default pattern defined by |
| 46 | * {@link CallStackStateProvider}. |
| 47 | * |
| 48 | * @return the absolute pattern of the thread attributes |
| 49 | * @since 3.1 |
| 50 | */ |
| 51 | public String[] getThreadsPattern() { |
| 52 | return DEFAULT_THREADS_PATTERN; |
| 53 | } |
| 54 | |
| 55 | /** |
| 56 | * Get the call stack attribute path relative to a thread attribute found by |
| 57 | * {@link #getThreadsPattern()}. Override this method if the state system |
| 58 | * attributes do not match the default pattern defined by |
| 59 | * {@link CallStackStateProvider}. |
| 60 | * |
| 61 | * @return the relative path of the call stack attribute |
| 62 | * @since 3.1 |
| 63 | */ |
| 64 | public String[] getCallStackPath() { |
| 65 | return DEFAULT_CALL_STACK_PATH; |
| 66 | } |
| 67 | } |