X-Git-Url: http://drtracing.org/?a=blobdiff_plain;f=org.eclipse.linuxtools.lttng2.ui%2Fsrc%2Forg%2Feclipse%2Flinuxtools%2Finternal%2Flttng2%2Fui%2Fviews%2Fcontrol%2Fproperty%2FTraceSessionPropertySource.java;h=75f1c0f126694f24ca8515f1bf1a434782833fce;hb=152ba1a7fabe7175ba1a6f267eda2b3891cbcb63;hp=24db38580a98372b5916f5c8f0578220cf745cd0;hpb=dbd4432dd9f427af47e9755cbf67b18e2e47b001;p=deliverable%2Ftracecompass.git diff --git a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TraceSessionPropertySource.java b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TraceSessionPropertySource.java index 24db38580a..75f1c0f126 100644 --- a/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TraceSessionPropertySource.java +++ b/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TraceSessionPropertySource.java @@ -1,26 +1,29 @@ /********************************************************************** - * Copyright (c) 2012 Ericsson - * + * Copyright (c) 2012, 2014 Ericsson + * * All rights reserved. This program and the accompanying materials are * made available under the terms of the Eclipse Public License v1.0 which * accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Bernd Hufmann - Initial API and implementation + * + * Contributors: + * Bernd Hufmann - Initial API and implementation **********************************************************************/ package org.eclipse.linuxtools.internal.lttng2.ui.views.control.property; +import java.util.ArrayList; +import java.util.List; + import org.eclipse.linuxtools.internal.lttng2.ui.views.control.messages.Messages; import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceSessionComponent; +import org.eclipse.linuxtools.tmf.ui.properties.ReadOnlyTextPropertyDescriptor; import org.eclipse.ui.views.properties.IPropertyDescriptor; -import org.eclipse.ui.views.properties.TextPropertyDescriptor; /** *

* Property source implementation for the trace session component. *

- * + * * @author Bernd Hufmann */ public class TraceSessionPropertySource extends BasePropertySource { @@ -41,29 +44,57 @@ public class TraceSessionPropertySource extends BasePropertySource { */ public static final String TRACE_SESSION_STATE_PROPERTY_ID = "trace.session.state"; //$NON-NLS-1$ /** - * The trace session name property name. + * The trace snapshot path property ID. + */ + public static final String TRACE_SNAPSHOT_PATH_PROPERTY_ID = "trace.snapshot.path"; //$NON-NLS-1$ + /** + * The snapshot name property. + */ + public static final String TRACE_SNAPSHOT_NAME_PROPERTY_ID = "trace.snapshot.name"; //$NON-NLS-1$ + /** + * The snapshot ID property. + */ + public static final String TRACE_SNAPSHOT_ID_PROPERTY_ID = "trace.snapshot.id"; //$NON-NLS-1$ + + /** + * The trace session name property name. */ public static final String TRACE_SESSION_NAME_PROPERTY_NAME = Messages.TraceControl_SessionNamePropertyName; /** - * The trace session path property name. + * The trace session path property name. */ public static final String TRACE_SESSION_PATH_PROPERTY_NAME = Messages.TraceControl_SessionPathPropertyName; /** * The trace session state property name. */ public static final String TRACE_SESSION_STATE_PROPERTY_NAME = Messages.TraceControl_StatePropertyName; - + /** + * The snapshot path property name. + */ + public static final String TRACE_SNAPSHOT_PATH_PROPERTY_NAME = Messages.TraceControl_SnapshotPathPropertyName; + /** + * The trace snapshot name property name. + */ + public static final String TRACE_SNAPSHOT_NAME_PROPERTY_NAME = Messages.TraceControl_SnapshotNamePropertyName; + /** + * The trace snapshot ID property name. + */ + public static final String TRACE_SNAPSHOT_ID_PROPERTY_NAME = Messages.TraceControl_SnapshotIdPropertyName; + + // ------------------------------------------------------------------------ // Attributes // ------------------------------------------------------------------------ + /** - * The session component which this property source is for. + * The session component which this property source is for. */ private final TraceSessionComponent fSession; // ------------------------------------------------------------------------ // Constructors // ------------------------------------------------------------------------ + /** * Constructor * @param component - the session component @@ -71,26 +102,26 @@ public class TraceSessionPropertySource extends BasePropertySource { public TraceSessionPropertySource(TraceSessionComponent component) { fSession = component; } - + // ------------------------------------------------------------------------ // Operations // ------------------------------------------------------------------------ - /* - * (non-Javadoc) - * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors() - */ + @Override public IPropertyDescriptor[] getPropertyDescriptors() { - return new IPropertyDescriptor[] { - new TextPropertyDescriptor(TRACE_SESSION_NAME_PROPERTY_ID, TRACE_SESSION_NAME_PROPERTY_NAME), - new TextPropertyDescriptor(TRACE_SESSION_PATH_PROPERTY_ID, TRACE_SESSION_PATH_PROPERTY_NAME), - new TextPropertyDescriptor(TRACE_SESSION_STATE_PROPERTY_ID, TRACE_SESSION_STATE_PROPERTY_NAME)}; + List list = new ArrayList<>(); + list.add(new ReadOnlyTextPropertyDescriptor(TRACE_SESSION_NAME_PROPERTY_ID, TRACE_SESSION_NAME_PROPERTY_NAME)); + list.add(new ReadOnlyTextPropertyDescriptor(TRACE_SESSION_STATE_PROPERTY_ID, TRACE_SESSION_STATE_PROPERTY_NAME)); + if (fSession.isSnapshotSession()) { + list.add(new ReadOnlyTextPropertyDescriptor(TRACE_SNAPSHOT_NAME_PROPERTY_ID, TRACE_SNAPSHOT_NAME_PROPERTY_NAME)); + list.add(new ReadOnlyTextPropertyDescriptor(TRACE_SNAPSHOT_PATH_PROPERTY_ID, TRACE_SNAPSHOT_PATH_PROPERTY_NAME)); + list.add(new ReadOnlyTextPropertyDescriptor(TRACE_SNAPSHOT_ID_PROPERTY_ID, TRACE_SNAPSHOT_ID_PROPERTY_NAME)); + } else { + list.add(new ReadOnlyTextPropertyDescriptor(TRACE_SESSION_PATH_PROPERTY_ID, TRACE_SESSION_PATH_PROPERTY_NAME)); + } + return(list.toArray(new IPropertyDescriptor[list.size()])); } - /* - * (non-Javadoc) - * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object) - */ @Override public Object getPropertyValue(Object id) { if(TRACE_SESSION_NAME_PROPERTY_ID.equals(id)) { @@ -102,6 +133,15 @@ public class TraceSessionPropertySource extends BasePropertySource { if (TRACE_SESSION_STATE_PROPERTY_ID.equals(id)) { return fSession.getSessionState().name(); } + if (TRACE_SNAPSHOT_PATH_PROPERTY_ID.equals(id)) { + return (fSession.isSnapshotSession() ? fSession.getSnapshotInfo().getSnapshotPath() : ""); //$NON-NLS-1$ + } + if (TRACE_SNAPSHOT_NAME_PROPERTY_ID.equals(id)) { + return (fSession.isSnapshotSession() ? fSession.getSnapshotInfo().getName() : ""); //$NON-NLS-1$ + } + if (TRACE_SNAPSHOT_ID_PROPERTY_ID.equals(id)) { + return (fSession.isSnapshotSession() ? fSession.getSnapshotInfo().getId() : ""); //$NON-NLS-1$ + } return null; } }