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
24 public abstract class TmfAbstractAnalysisParamProvider
implements IAnalysisParameterProvider
{
27 * The module registered with this provider
29 private IAnalysisModule fModule
;
32 public void registerModule(IAnalysisModule module
) {
34 throw new IllegalArgumentException();
36 ITmfTrace selectedTrace
= TmfTraceManager
.getInstance().getActiveTrace();
37 /* If no trace is active, just register the module */
38 if (selectedTrace
== null) {
42 IAnalysisModule selectedModule
= selectedTrace
.getAnalysisModule(module
.getId());
43 /* register only if the module is for the currently selected trace */
44 if (selectedModule
== module
) {
50 * Gets the analysis module
52 * @return the {@link IAnalysisModule} associated with this provider
54 protected IAnalysisModule
getModule() {
59 * Notify the registered module that the said parameter has a new value. The
60 * analysis module will decide what to do with this information
63 * Name of the modified parameter
65 protected void notifyParameterChanged(String name
) {
66 IAnalysisModule module
= fModule
;
67 if (module
!= null && name
!= null) {
68 module
.notifyParameterChanged(name
);