1 /*******************************************************************************
2 * Copyright (c) 2014 École Polytechnique de Montréal
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
10 * Geneviève Bastien - Initial API and implementation
11 *******************************************************************************/
13 package org
.eclipse
.tracecompass
.tmf
.core
.analysis
;
15 import org
.eclipse
.jdt
.annotation
.NonNull
;
18 * This class listens when new analysis modules are created and registers an
19 * output if the module corresponds to the output specifications
21 * @author Geneviève Bastien
23 public class TmfNewAnalysisOutputListener
implements ITmfNewAnalysisModuleListener
{
25 private final String fAnalysisId
;
26 private final Class
<?
extends IAnalysisModule
> fAnalysisModuleClass
;
27 private final @NonNull IAnalysisOutput fOutput
;
33 * The analysis output to add if the analysis corresponds to the
36 * The analysis ID of the single analysis to match
38 * The module class this output applies to
40 public TmfNewAnalysisOutputListener(@NonNull IAnalysisOutput output
, String analysisId
, Class
<?
extends IAnalysisModule
> moduleClass
) {
42 fAnalysisId
= analysisId
;
43 fAnalysisModuleClass
= moduleClass
;
47 public void moduleCreated(IAnalysisModule module
) {
48 if (fAnalysisId
!= null) {
49 if (module
.getId().equals(fAnalysisId
)) {
50 module
.registerOutput(fOutput
);
52 } else if (fAnalysisModuleClass
!= null) {
53 if (fAnalysisModuleClass
.isAssignableFrom(module
.getClass())) {
54 module
.registerOutput(fOutput
);