1 /**********************************************************************
2 * Copyright (c) 2016 Ericsson
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 * Bruno Roy - Initial API and implementation
11 **********************************************************************/
12 package org
.eclipse
.tracecompass
.internal
.lttng2
.control
.ui
.views
.handlers
;
14 import java
.util
.List
;
16 import org
.eclipse
.core
.commands
.ExecutionException
;
17 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
18 import org
.eclipse
.tracecompass
.internal
.lttng2
.control
.core
.model
.ITraceLogLevel
;
19 import org
.eclipse
.tracecompass
.internal
.lttng2
.control
.core
.model
.LogLevelType
;
20 import org
.eclipse
.tracecompass
.internal
.lttng2
.control
.core
.model
.TraceEnablement
;
21 import org
.eclipse
.tracecompass
.internal
.lttng2
.control
.ui
.views
.model
.impl
.TraceDomainComponent
;
24 * Command handler implementation to enable one or more loggers.
28 public class EnableLoggerHandler
extends ChangeLoggerStateHandler
{
30 // ------------------------------------------------------------------------
32 // ------------------------------------------------------------------------
35 protected TraceEnablement
getNewState() {
36 return TraceEnablement
.ENABLED
;
39 // ------------------------------------------------------------------------
41 // ------------------------------------------------------------------------
44 protected void changeState(TraceDomainComponent domain
, List
<String
> loggerNames
, ITraceLogLevel logLevel
, LogLevelType logLevelType
, IProgressMonitor monitor
) throws ExecutionException
{
45 // This conditional statement makes it possible to enable the same logger multiple
46 // times with different log levels (with the right-click enable, directly on the logger)
47 if (logLevelType
.equals(LogLevelType
.LOGLEVEL_ALL
)) {
48 domain
.enableEvents(loggerNames
, null, null, monitor
);
50 domain
.enableLogLevel(loggerNames
, logLevelType
, logLevel
, null, domain
.getDomain(), monitor
);