Move alltests plugin to the Trace Compass namespace
[deliverable/tracecompass.git] / org.eclipse.tracecompass.tmf.core / src / org / eclipse / linuxtools / tmf / core / analysis / TmfNewAnalysisOutputListener.java
CommitLineData
b63291e6
GB
1/*******************************************************************************
2 * Copyright (c) 2014 École Polytechnique de Montréal
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 * Geneviève Bastien - Initial API and implementation
11 *******************************************************************************/
12
13package org.eclipse.linuxtools.tmf.core.analysis;
14
15/**
16 * This class listens when new analysis modules are created and registers an
17 * output if the module corresponds to the output specifications
18 *
19 * @author Geneviève Bastien
20 * @since 3.0
21 */
22public class TmfNewAnalysisOutputListener implements ITmfNewAnalysisModuleListener {
23
24 private final String fAnalysisId;
25 private final Class<? extends IAnalysisModule> fAnalysisModuleClass;
26 private final IAnalysisOutput fOutput;
27
28 /**
29 * Constructor
30 *
31 * @param output
32 * The analysis output to add if the analysis corresponds to the
33 * ID or class
34 * @param analysisId
35 * The analysis ID of the single analysis to match
36 * @param moduleClass
37 * The module class this output applies to
38 */
39 public TmfNewAnalysisOutputListener(IAnalysisOutput output, String analysisId, Class<? extends IAnalysisModule> moduleClass) {
40 fOutput = output;
41 fAnalysisId = analysisId;
42 fAnalysisModuleClass = moduleClass;
43 }
44
45 @Override
46 public void moduleCreated(IAnalysisModule module) {
47 if (fAnalysisId != null) {
48 if (module.getId().equals(fAnalysisId)) {
49 module.registerOutput(fOutput);
50 }
51 } else if (fAnalysisModuleClass != null) {
52 if (fAnalysisModuleClass.isAssignableFrom(module.getClass())) {
53 module.registerOutput(fOutput);
54 }
55 }
56 }
57
58}
This page took 0.039342 seconds and 5 git commands to generate.