lttng.control: Adding support for the LOG4J domain in the Control view
[deliverable/tracecompass.git] / lttng / org.eclipse.tracecompass.lttng2.control.ui / src / org / eclipse / tracecompass / internal / lttng2 / control / ui / views / handlers / EnableLoggerHandler.java
1 /**********************************************************************
2 * Copyright (c) 2016 Ericsson
3 *
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
8 *
9 * Contributors:
10 * Bruno Roy - Initial API and implementation
11 **********************************************************************/
12 package org.eclipse.tracecompass.internal.lttng2.control.ui.views.handlers;
13
14 import java.util.List;
15
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;
22
23 /**
24 * Command handler implementation to enable one or more loggers.
25 *
26 * @author Bruno Roy
27 */
28 public class EnableLoggerHandler extends ChangeLoggerStateHandler {
29
30 // ------------------------------------------------------------------------
31 // Accessors
32 // ------------------------------------------------------------------------
33
34 @Override
35 protected TraceEnablement getNewState() {
36 return TraceEnablement.ENABLED;
37 }
38
39 // ------------------------------------------------------------------------
40 // Operations
41 // ------------------------------------------------------------------------
42
43 @Override
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);
49 } else {
50 domain.enableLogLevel(loggerNames, logLevelType, logLevel, null, domain.getDomain(), monitor);
51 }
52 }
53 }
This page took 0.032671 seconds and 5 git commands to generate.