1 /**********************************************************************
2 * Copyright (c) 2012 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 * Bernd Hufmann - Initial API and implementation
11 **********************************************************************/
12 package org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.impl
;
14 import org
.eclipse
.core
.commands
.ExecutionException
;
15 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
16 import org
.eclipse
.core
.runtime
.NullProgressMonitor
;
17 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.ISessionInfo
;
18 import org
.eclipse
.linuxtools
.lttng
.ui
.views
.control
.model
.ITraceControlComponent
;
21 * <b><u>TraceSessionGroup</u></b>
23 * Implementation of the trace session group.
26 public class TraceSessionGroup
extends TraceControlComponent
{
27 // ------------------------------------------------------------------------
29 // ------------------------------------------------------------------------
31 * Path to icon file for this component.
33 public static final String TRACE_SESSIONS_ICON_FILE
= "icons/obj16/sessions.gif"; //$NON-NLS-1$
35 // ------------------------------------------------------------------------
37 // ------------------------------------------------------------------------
39 // ------------------------------------------------------------------------
41 // ------------------------------------------------------------------------
44 * @param name - the name of the component.
45 * @param parent - the parent of this component.
47 public TraceSessionGroup(String name
, ITraceControlComponent parent
) {
49 setImage(TRACE_SESSIONS_ICON_FILE
);
52 // ------------------------------------------------------------------------
54 // ------------------------------------------------------------------------
56 // ------------------------------------------------------------------------
58 // ------------------------------------------------------------------------
60 * Retrieves the sessions information from the node.
61 * @throws ExecutionException
63 public void getSessionsFromNode() throws ExecutionException
{
64 getSessionsFromNode(new NullProgressMonitor());
68 * Retrieves the sessions information from the node.
69 * @param monitor - a progress monitor
70 * @throws ExecutionException
72 public void getSessionsFromNode(IProgressMonitor monitor
) throws ExecutionException
{
73 String
[] sessionNames
= getControlService().getSessionNames(monitor
);
74 for (int i
= 0; i
< sessionNames
.length
; i
++) {
75 TraceSessionComponent session
= new TraceSessionComponent(sessionNames
[i
], this);
77 session
.getConfigurationFromNode(monitor
);
82 * Creates a session with given session name and location.
83 * @param sessionName - a session name to create
84 * @param sessionPath - a path for storing the traces (use null for default)
85 * @return the session information
86 * throws ExecutionExecption
88 public void createSession(String sessionName
, String sessionPath
) throws ExecutionException
{
89 createSession(sessionName
, sessionPath
, new NullProgressMonitor());
93 * Creates a session with given session name and location.
94 * @param sessionName - a session name to create
95 * @param sessionPath - a path for storing the traces (use null for default)
96 * @Param monitor - a progress monitor
97 * @return the session information
98 * throws ExecutionExecption
100 public void createSession(String sessionName
, String sessionPath
, IProgressMonitor monitor
) throws ExecutionException
{
101 ISessionInfo sessionInfo
= getControlService().createSession(sessionName
, sessionPath
, monitor
);
102 if (sessionInfo
!= null) {
103 TraceSessionComponent session
= new TraceSessionComponent(sessionInfo
.getName(), TraceSessionGroup
.this);
105 session
.getConfigurationFromNode(monitor
);
110 * Destroys a session with given session name.
111 * @param session - a session component to destroy
112 * throws ExecutionExecption
114 public void destroySession(TraceSessionComponent session
) throws ExecutionException
{
115 destroySession(session
, new NullProgressMonitor());
119 * Destroys a session with given session name.
120 * @param session - a session component to destroy
121 * @param monitor - a progress monitor
122 * throws ExecutionExecption
124 public void destroySession(TraceSessionComponent session
, IProgressMonitor monitor
) throws ExecutionException
{
125 getControlService().destroySession(session
.getName(), monitor
);
126 session
.removeAllChildren();
127 removeChild(session
);