| 1 | /******************************************************************************* |
| 2 | * Copyright (c) 2011 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 | * Bernd Hufmann - Initial API and implementation |
| 11 | * |
| 12 | *******************************************************************************/ |
| 13 | package org.eclipse.linuxtools.lttng.ui.tracecontrol.model.config; |
| 14 | |
| 15 | import org.eclipse.jface.viewers.IStructuredContentProvider; |
| 16 | import org.eclipse.jface.viewers.Viewer; |
| 17 | import org.eclipse.linuxtools.lttng.core.tracecontrol.model.config.TraceChannels; |
| 18 | |
| 19 | /** |
| 20 | * <b><u>TraceChannelTableContentProvider</u></b> |
| 21 | * <p> |
| 22 | * IStructuredContentProvider implementation for TableViewers in order to provide the content of a table |
| 23 | * used for displaying and configuring trace channel information. |
| 24 | * </p> |
| 25 | */ |
| 26 | public class TraceChannelTableContentProvider implements IStructuredContentProvider { |
| 27 | |
| 28 | // ------------------------------------------------------------------------ |
| 29 | // Attributes |
| 30 | // ----------------------------------------------------------------------- |
| 31 | |
| 32 | // ------------------------------------------------------------------------ |
| 33 | // Constructors |
| 34 | // ----------------------------------------------------------------------- |
| 35 | |
| 36 | // ------------------------------------------------------------------------ |
| 37 | // Operations |
| 38 | // ----------------------------------------------------------------------- |
| 39 | /* |
| 40 | * (non-Javadoc) |
| 41 | * @see org.eclipse.jface.viewers.IContentProvider#dispose() |
| 42 | */ |
| 43 | @Override |
| 44 | public void dispose() { |
| 45 | } |
| 46 | |
| 47 | /* |
| 48 | * (non-Javadoc) |
| 49 | * @see org.eclipse.jface.viewers.IContentProvider#inputChanged(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) |
| 50 | */ |
| 51 | @Override |
| 52 | public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { |
| 53 | } |
| 54 | |
| 55 | /* |
| 56 | * (non-Javadoc) |
| 57 | * @see org.eclipse.jface.viewers.IStructuredContentProvider#getElements(java.lang.Object) |
| 58 | */ |
| 59 | @Override |
| 60 | public Object[] getElements(Object inputElement) { |
| 61 | if (inputElement instanceof TraceChannels) { |
| 62 | return ((TraceChannels)inputElement).values().toArray(); |
| 63 | } |
| 64 | return null; |
| 65 | } |
| 66 | } |