| 1 | /******************************************************************************* |
| 2 | * Copyright (c) 2009, 2010 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 | * Alvaro Sanchez-Leon (alvsan09@gmail.com) - Initial API and implementation |
| 11 | *******************************************************************************/ |
| 12 | package org.eclipse.linuxtools.lttng.state.resource; |
| 13 | |
| 14 | import org.eclipse.linuxtools.lttng.TraceDebug; |
| 15 | import org.eclipse.linuxtools.lttng.model.LTTngTreeNodeGeneric; |
| 16 | import org.eclipse.linuxtools.lttng.state.resource.ILTTngStateResource.GlobalStateMode; |
| 17 | |
| 18 | /** |
| 19 | * @author alvaro |
| 20 | * |
| 21 | */ |
| 22 | public class LTTngStateResource extends |
| 23 | LTTngTreeNodeGeneric<LTTngStateResource> { |
| 24 | |
| 25 | // ======================================================================== |
| 26 | // Data |
| 27 | // ======================================================================= |
| 28 | private GlobalStateMode fstateMode = GlobalStateMode.LTT_STATEMODE_UNKNOWN; |
| 29 | private final ILttngStateContext fcontext; |
| 30 | |
| 31 | // ======================================================================+ |
| 32 | // Constructors |
| 33 | // ======================================================================= |
| 34 | |
| 35 | public LTTngStateResource(Long id, LTTngStateResource parent, String name, |
| 36 | ILttngStateContext context, Object value) { |
| 37 | super(id, parent, name, value); |
| 38 | fcontext = context; |
| 39 | } |
| 40 | |
| 41 | public LTTngStateResource(Long id, String name, ILttngStateContext context, |
| 42 | Object value) { |
| 43 | super(id, name, value); |
| 44 | fcontext = context; |
| 45 | } |
| 46 | |
| 47 | // ======================================================================== |
| 48 | // Methods |
| 49 | // ======================================================================= |
| 50 | /* |
| 51 | * (non-Javadoc) |
| 52 | * |
| 53 | * @see |
| 54 | * org.eclipse.linuxtools.lttng.control.LTTngStateTreeNodeGeneric#getChildren |
| 55 | * () |
| 56 | */ |
| 57 | @Override |
| 58 | public LTTngStateResource[] getChildren() { |
| 59 | return childrenToArray(fchildren.values(), this.getClass()); |
| 60 | } |
| 61 | |
| 62 | /* |
| 63 | * (non-Javadoc) |
| 64 | * |
| 65 | * @see |
| 66 | * org.eclipse.linuxtools.lttng.state.resource.ILTTngStateResource#getStateMode |
| 67 | * () |
| 68 | */ |
| 69 | public GlobalStateMode getStateMode() { |
| 70 | return fstateMode; |
| 71 | } |
| 72 | |
| 73 | /** |
| 74 | * @param stateMode |
| 75 | */ |
| 76 | public void setStateMode(GlobalStateMode stateMode) { |
| 77 | if (stateMode != null) { |
| 78 | fstateMode = stateMode; |
| 79 | } else { |
| 80 | TraceDebug.debug("Received input is null !"); //$NON-NLS-1$ |
| 81 | } |
| 82 | } |
| 83 | |
| 84 | /* |
| 85 | * (non-Javadoc) |
| 86 | * |
| 87 | * @see |
| 88 | * org.eclipse.linuxtools.lttng.state.resource.ILTTngStateResource#getContext |
| 89 | * () |
| 90 | */ |
| 91 | public ILttngStateContext getContext() { |
| 92 | return fcontext; |
| 93 | } |
| 94 | |
| 95 | } |