1 /*******************************************************************************
2 * Copyright (c) 2013, 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
.tracecompass
.tmf
.core
.trace
.ITmfTrace
;
16 import org
.eclipse
.tracecompass
.tmf
.core
.trace
.TmfTraceManager
;
19 * Abstract class for parameter providers, implements methods and
20 * functionalities to warn the analysis module of parameter changed
22 * @author Geneviève Bastien
25 public abstract class TmfAbstractAnalysisParamProvider
implements IAnalysisParameterProvider
{
28 * The module registered with this provider
30 private IAnalysisModule fModule
;
33 public void registerModule(IAnalysisModule module
) {
35 throw new IllegalArgumentException();
37 ITmfTrace selectedTrace
= TmfTraceManager
.getInstance().getActiveTrace();
38 /* If no trace is active, just register the module */
39 if (selectedTrace
== null) {
43 IAnalysisModule selectedModule
= selectedTrace
.getAnalysisModule(module
.getId());
44 /* register only if the module is for the currently selected trace */
45 if (selectedModule
== module
) {
51 * Gets the analysis module
53 * @return the {@link IAnalysisModule} associated with this provider
55 protected IAnalysisModule
getModule() {
60 * Notify the registered module that the said parameter has a new value. The
61 * analysis module will decide what to do with this information
64 * Name of the modified parameter
66 protected void notifyParameterChanged(String name
) {
67 IAnalysisModule module
= fModule
;
68 if (module
!= null && name
!= null) {
69 module
.notifyParameterChanged(name
);