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
.linuxtools
.tmf
.core
.analysis
;
16 * This class listens when new analysis modules are created and registers an
17 * output if the module corresponds to the output specifications
19 * @author Geneviève Bastien
22 public class TmfNewAnalysisOutputListener
implements ITmfNewAnalysisModuleListener
{
24 private final String fAnalysisId
;
25 private final Class
<?
extends IAnalysisModule
> fAnalysisModuleClass
;
26 private final IAnalysisOutput fOutput
;
32 * The analysis output to add if the analysis corresponds to the
35 * The analysis ID of the single analysis to match
37 * The module class this output applies to
39 public TmfNewAnalysisOutputListener(IAnalysisOutput output
, String analysisId
, Class
<?
extends IAnalysisModule
> moduleClass
) {
41 fAnalysisId
= analysisId
;
42 fAnalysisModuleClass
= moduleClass
;
46 public void moduleCreated(IAnalysisModule module
) {
47 if (fAnalysisId
!= null) {
48 if (module
.getId().equals(fAnalysisId
)) {
49 module
.registerOutput(fOutput
);
51 } else if (fAnalysisModuleClass
!= null) {
52 if (fAnalysisModuleClass
.isAssignableFrom(module
.getClass())) {
53 module
.registerOutput(fOutput
);