From 06b9339e3b09514f583a9aa61559f17024f8e365 Mon Sep 17 00:00:00 2001
From: Bernd Hufmann
+ * Property source implementation for the base event component.
+ *
+ * Base property source implementation.
+ *
+ * Property source implementation for the kernl provider component.
+ * TraceControlPropertiesTest
contains tests for the all property class.
+ *
+ */
+@SuppressWarnings("nls")
+public class TraceControlPropertiesTest extends TestCase {
+
+ // ------------------------------------------------------------------------
+ // Test data
+ // ------------------------------------------------------------------------
+
+ // ------------------------------------------------------------------------
+ // Static methods
+ // ------------------------------------------------------------------------
+
+ /**
+ * Returns test setup used when executing test case stand-alone.
+ * @return Test setup class
+ */
+ public static Test suite() {
+ return new ModelImplTestSetup(new TestSuite(TraceControlPropertiesTest.class));
+ }
+
+ // ------------------------------------------------------------------------
+ // Housekeeping
+ // ------------------------------------------------------------------------
+
+ /**
+ * Perform pre-test initialization.
+ *
+ * @throws Exception
+ * if the initialization fails for some reason
+ *
+ */
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ }
+
+ /**
+ * Perform post-test clean-up.
+ *
+ * @throws Exception
+ * if the clean-up fails for some reason
+ *
+ */
+ @Override
+ @After
+ public void tearDown() throws Exception {
+ }
+
+ /**
+ * Run the TraceControlComponent.
+ */
+ public void testTraceControlComponents()
+ throws Exception {
+
+ TestRemoteSystemProxy proxy = new TestRemoteSystemProxy();
+
+ ITraceControlComponent root = TraceControlTestFacility.getInstance().getControlView().getTraceControlRoot();
+
+ @SuppressWarnings("restriction")
+ IHost host = new Host(new SystemProfile("myProfile", true));
+ host.setHostName("127.0.0.1");
+
+ TargetNodeComponent node = new TargetNodeComponent("myNode", root, host, proxy);
+
+ root.addChild(node);
+ node.connect();
+
+ TraceControlTestFacility.getInstance().waitForJobs();
+
+ // ------------------------------------------------------------------------
+ // Verify Node Properties (adapter)
+ // ------------------------------------------------------------------------
+ Object adapter = node.getAdapter(IPropertySource.class);
+ assertNotNull(adapter);
+ assertTrue(adapter instanceof TargetNodePropertySource);
+
+ TargetNodePropertySource source = (TargetNodePropertySource)adapter;
+
+ assertNull(source.getEditableValue());
+ assertFalse(source.isPropertySet(TargetNodePropertySource.TARGET_NODE_NAME_PROPERTY_ID));
+ assertNotNull(source.getPropertyDescriptors());
+
+ assertEquals("myNode", source.getPropertyValue(TargetNodePropertySource.TARGET_NODE_NAME_PROPERTY_ID));
+ assertEquals("127.0.0.1", source.getPropertyValue(TargetNodePropertySource.TARGET_NODE_ADDRESS_PROPERTY_ID));
+ assertEquals(TargetNodeState.CONNECTED.name(), source.getPropertyValue(TargetNodePropertySource.TARGET_NODE_STATE_PROPERTY_ID));
+ assertNull(source.getPropertyValue("test"));
+
+ adapter = node.getAdapter(IChannelInfo.class);
+ assertNull(adapter);
+
+ ITraceControlComponent[] groups = node.getChildren();
+ assertNotNull(groups);
+ assertEquals(2, groups.length);
+
+ ITraceControlComponent[] providers = groups[0].getChildren();
+
+ assertNotNull(providers);
+ assertEquals(3, providers.length);
+
+ // ------------------------------------------------------------------------
+ // Verify Kernel Provider Properties (adapter)
+ // ------------------------------------------------------------------------
+ KernelProviderComponent kernelProvider = (KernelProviderComponent) providers[0];
+
+ adapter = kernelProvider.getAdapter(IPropertySource.class);
+ assertNotNull(adapter);
+ assertTrue(adapter instanceof KernelProviderPropertySource);
+
+ KernelProviderPropertySource kernelSource = (KernelProviderPropertySource)adapter;
+ assertNotNull(kernelSource.getPropertyDescriptors());
+
+ assertEquals("Kernel", kernelSource.getPropertyValue(KernelProviderPropertySource.KERNEL_PROVIDER_NAME_PROPERTY_ID));
+
+ // ------------------------------------------------------------------------
+ // Verify UST Provider Properties (adapter)
+ // ------------------------------------------------------------------------
+ UstProviderComponent ustProvider = (UstProviderComponent) providers[1];
+
+ adapter = ustProvider.getAdapter(IPropertySource.class);
+ assertNotNull(adapter);
+ assertTrue(adapter instanceof UstProviderPropertySource);
+
+ UstProviderPropertySource ustSource = (UstProviderPropertySource)adapter;
+ assertNotNull(ustSource.getPropertyDescriptors());
+
+ assertEquals("/home/user/git/lttng-ust/tests/hello.cxx/.libs/lt-hello", ustSource.getPropertyValue(UstProviderPropertySource.UST_PROVIDER_NAME_PROPERTY_ID));
+ assertEquals(String.valueOf(9379), ustSource.getPropertyValue(UstProviderPropertySource.UST_PROVIDER_PID_PROPERTY_ID));
+
+ // ------------------------------------------------------------------------
+ // Verify Base Event Properties (adapter)
+ // ------------------------------------------------------------------------
+ ITraceControlComponent[] events = ustProvider.getChildren();
+ assertNotNull(events);
+ assertEquals(2, events.length);
+
+ BaseEventComponent baseEventInfo = (BaseEventComponent) events[0];
+ assertNotNull(baseEventInfo);
+
+ adapter = baseEventInfo.getAdapter(IPropertySource.class);
+ assertNotNull(adapter);
+ assertTrue(adapter instanceof BaseEventPropertySource);
+
+ BaseEventPropertySource baseSource = (BaseEventPropertySource)adapter;
+ assertNotNull(baseSource.getPropertyDescriptors());
+
+ assertEquals("ust_tests_hello:tptest_sighandler", baseSource.getPropertyValue(BaseEventPropertySource.BASE_EVENT_NAME_PROPERTY_ID));
+ assertEquals(TraceEventType.TRACEPOINT.name(), baseSource.getPropertyValue(BaseEventPropertySource.BASE_EVENT_TYPE_PROPERTY_ID));
+ assertEquals(TraceLogLevel.TRACE_MODULE.name(), baseSource.getPropertyValue(BaseEventPropertySource.BASE_EVENT_LOGLEVEL_PROPERTY_ID));
+
+ // ------------------------------------------------------------------------
+ // Verify Session Properties (adapter)
+ // ------------------------------------------------------------------------
+ ITraceControlComponent[] sessions = groups[1].getChildren();
+ assertNotNull(sessions);
+ assertEquals(2, sessions.length);
+
+ TraceSessionComponent session = (TraceSessionComponent)sessions[1];
+
+ adapter = session.getAdapter(IPropertySource.class);
+ assertNotNull(adapter);
+ assertTrue(adapter instanceof TraceSessionPropertySource);
+
+ TraceSessionPropertySource sessionSource = (TraceSessionPropertySource)adapter;
+ assertNotNull(sessionSource.getPropertyDescriptors());
+
+ assertEquals("mysession", sessionSource.getPropertyValue(TraceSessionPropertySource.TRACE_SESSION_NAME_PROPERTY_ID));
+ assertEquals("/home/user/lttng-traces/mysession-20120129-084256", sessionSource.getPropertyValue(TraceSessionPropertySource.TRACE_SESSION_PATH_PROPERTY_ID));
+ assertEquals(TraceSessionState.ACTIVE.name(), sessionSource.getPropertyValue(TraceSessionPropertySource.TRACE_SESSION_STATE_PROPERTY_ID));
+
+ // ------------------------------------------------------------------------
+ // Verify Domain Provider Properties (adapter)
+ // ------------------------------------------------------------------------
+ ITraceControlComponent[] domains = session.getChildren();
+ assertNotNull(domains);
+ assertEquals(2, domains.length);
+
+ TraceDomainComponent domain = (TraceDomainComponent) domains[0];
+ adapter = domain.getAdapter(IPropertySource.class);
+ assertNotNull(adapter);
+ assertTrue(adapter instanceof TraceDomainPropertySource);
+
+ TraceDomainPropertySource domainSource = (TraceDomainPropertySource)adapter;
+ assertNotNull(domainSource.getPropertyDescriptors());
+
+ assertEquals("Kernel", domainSource.getPropertyValue(TraceDomainPropertySource.TRACE_DOMAIN_NAME_PROPERTY_ID));
+
+ ITraceControlComponent[] channels = domains[0].getChildren();
+ assertNotNull(channels);
+ assertEquals(2, channels.length);
+
+ // ------------------------------------------------------------------------
+ // Verify Channel Properties (adapter)
+ // ------------------------------------------------------------------------
+ assertTrue(channels[0] instanceof TraceChannelComponent);
+ TraceChannelComponent channel = (TraceChannelComponent) channels[0];
+
+ adapter = channel.getAdapter(IPropertySource.class);
+ assertNotNull(adapter);
+ assertTrue(adapter instanceof TraceChannelPropertySource);
+
+ TraceChannelPropertySource channelSource = (TraceChannelPropertySource)adapter;
+ assertNotNull(channelSource.getPropertyDescriptors());
+
+ assertEquals("channel0", channelSource.getPropertyValue(TraceChannelPropertySource.TRACE_CHANNEL_NAME_PROPERTY_ID));
+ assertEquals(String.valueOf(4), channelSource.getPropertyValue(TraceChannelPropertySource.TRACE_CHANNEL_NO_SUBBUFFERS_PROPERTY_ID));
+ assertEquals(TraceEnablement.ENABLED.name(), channelSource.getPropertyValue(TraceChannelPropertySource.TRACE_CHANNEL_STATE_PROPERTY_ID));
+ assertEquals(String.valueOf(false), channelSource.getPropertyValue(TraceChannelPropertySource.TRACE_CHANNEL_OVERWRITE_MODE_PROPERTY_ID));
+ assertEquals("splice()", channelSource.getPropertyValue(TraceChannelPropertySource.TRACE_CHANNEL_OUTPUT_TYPE_PROPERTY_ID));
+ assertEquals(String.valueOf(200), channelSource.getPropertyValue(TraceChannelPropertySource.TRACE_CHANNEL_READ_TIMER_PROPERTY_ID));
+ assertEquals(String.valueOf(262144), channelSource.getPropertyValue(TraceChannelPropertySource.TRACE_CHANNEL_SUBBUFFER_SIZE_PROPERTY_ID));
+ assertEquals(String.valueOf(0), channelSource.getPropertyValue(TraceChannelPropertySource.TRACE_CHANNEL_SWITCH_TIMER_PROPERTY_ID));
+
+ // ------------------------------------------------------------------------
+ // Verify Event Properties (adapter)
+ // ------------------------------------------------------------------------
+ ITraceControlComponent[] channel0Events = channel.getChildren();
+ assertNotNull(channel0Events);
+ assertEquals(2, channel0Events.length);
+ assertTrue(channel0Events[0] instanceof TraceEventComponent);
+
+ TraceEventComponent event = (TraceEventComponent) channel0Events[0];
+
+ adapter = event.getAdapter(IPropertySource.class);
+ assertNotNull(adapter);
+ assertTrue(adapter instanceof TraceEventPropertySource);
+
+ TraceEventPropertySource eventSource = (TraceEventPropertySource)adapter;
+ assertNotNull(eventSource.getPropertyDescriptors());
+
+ assertEquals("block_rq_remap", eventSource.getPropertyValue(TraceEventPropertySource.TRACE_EVENT_NAME_PROPERTY_ID));
+ assertEquals(TraceLogLevel.TRACE_EMERG.name(), eventSource.getPropertyValue(TraceEventPropertySource.TRACE_EVENT_LOGLEVEL_PROPERTY_ID));
+ assertEquals(TraceEventType.TRACEPOINT.name(), eventSource.getPropertyValue(TraceEventPropertySource.TRACE_EVENT_TYPE_PROPERTY_ID));
+ assertEquals(TraceEnablement.ENABLED.name(), eventSource.getPropertyValue(TraceEventPropertySource.TRACE_EVENT_STATE_PROPERTY_ID));
+ }
+}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui.tests/src/org/eclipse/linuxtools/lttng/ui/tests/control/model/component/TraceControlTreeModelTest.java b/org.eclipse.linuxtools.lttng.ui.tests/src/org/eclipse/linuxtools/lttng/ui/tests/control/model/component/TraceControlTreeModelTest.java
index ee19a1346a..bc7c604ef1 100644
--- a/org.eclipse.linuxtools.lttng.ui.tests/src/org/eclipse/linuxtools/lttng/ui/tests/control/model/component/TraceControlTreeModelTest.java
+++ b/org.eclipse.linuxtools.lttng.ui.tests/src/org/eclipse/linuxtools/lttng/ui/tests/control/model/component/TraceControlTreeModelTest.java
@@ -45,8 +45,7 @@ import org.junit.After;
import org.junit.Before;
/**
- * The class TraceControlComponentTest
contains tests for the class {@link TraceControlComponent}
.
- *
+ * The class TraceControlTreeModelTest
contains tests for the tree component classes.
*/
@SuppressWarnings("nls")
public class TraceControlTreeModelTest extends TestCase {
@@ -116,26 +115,6 @@ public class TraceControlTreeModelTest extends TestCase {
TraceControlTestFacility.getInstance().waitForJobs();
- // ------------------------------------------------------------------------
- // Verify Node Properties (adapter)
- // ------------------------------------------------------------------------
- Object adapter = node.getAdapter(IPropertySource.class);
- assertNotNull(adapter);
- assertTrue(adapter instanceof TargetNodePropertySource);
-
- TargetNodePropertySource source = (TargetNodePropertySource)adapter;
-
- assertNull(source.getEditableValue());
- assertFalse(source.isPropertySet(TargetNodePropertySource.TARGET_NODE_NAME_PROPERTY_ID));
- assertNotNull(source.getPropertyDescriptors());
-
- assertEquals("myNode", source.getPropertyValue(TargetNodePropertySource.TARGET_NODE_NAME_PROPERTY_ID));
- assertEquals("127.0.0.1", source.getPropertyValue(TargetNodePropertySource.TARGET_NODE_ADDRESS_PROPERTY_ID));
- assertNull(source.getPropertyValue("test"));
-
- adapter = node.getAdapter(IChannelInfo.class);
- assertNull(adapter);
-
// ------------------------------------------------------------------------
// Verify Parameters of TargetNodeComponent
// ------------------------------------------------------------------------
@@ -592,5 +571,4 @@ public class TraceControlTreeModelTest extends TestCase {
ustProvider.setPid(pid);
}
-
}
\ No newline at end of file
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/Messages.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/Messages.java
index 220c58e84a..edc486ea0e 100644
--- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/Messages.java
+++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/Messages.java
@@ -62,6 +62,28 @@ final public class Messages extends NLS {
public static String TraceControl_ProviderDisplayName;
public static String TraceControl_KernelProviderDisplayName;
+ // Property names
+ public static String TraceControl_SessionNamePropertyName;
+ public static String TraceControl_EventNamePropertyName;
+ public static String TraceControl_EventTypePropertyName;
+ public static String TraceControl_LogLevelPropertyName;
+ public static String TraceControl_StatePropertyName;
+ public static String TraceControl_DomainNamePropertyName;
+ public static String TraceControl_ChannelNamePropertyName;
+ public static String TraceControl_OverwriteModePropertyName;
+ public static String TraceControl_SubBufferSizePropertyName;
+ public static String TraceControl_NbSubBuffersPropertyName;
+ public static String TraceControl_SwitchTimerPropertyName;
+ public static String TraceControl_ReadTimerPropertyName;
+ public static String TraceControl_OutputTypePropertyName;
+ public static String TraceControl_HostNamePropertyName;
+ public static String TraceControl_HostAddressPropertyName;
+ public static String TraceControl_SessionPathPropertyName;
+ public static String TraceControl_ProviderNamePropertyName;
+ public static String TraceControl_ProcessIdPropertyName;
+
+
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/messages.properties b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/messages.properties
index 2fbf6d9d80..d6252261ca 100644
--- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/messages.properties
+++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/messages.properties
@@ -17,11 +17,11 @@ TraceControl_NewNodeCreationFailure=Creation of new connection failed
# Dialogs
TraceControl_NewDialogTitle=New Connection
TraceControl_NewNodeExistingConnetionsGroupName=Existing Connections
-TraceControl_NewNodeEditButtonName=Edit host information
-TraceControl_NewNodeComboToolTip=List of existing connections (host name - host address
-TraceControl_NewNodeNameLabel=Node Name
+TraceControl_NewNodeEditButtonName=Edit connection information
+TraceControl_NewNodeComboToolTip=List of existing connections (connection name - host name)
+TraceControl_NewNodeNameLabel=Connection Name
TraceControl_NewNodeNameTooltip=Alias to be displayed for node to connect to.
-TraceControl_NewNodeAddressLabel=Node Address
+TraceControl_NewNodeAddressLabel=Host Name
TraceControl_NewNodeAddressTooltip=IP Address or DNS name of node to connect to.
TraceControl_AlreadyExistsError=Node name already exists in Control View
@@ -35,3 +35,23 @@ TraceControl_ChannelDisplayName=Channel
TraceControl_EventDisplayName=Event
TraceControl_ProviderDisplayName=Provider
TraceControl_KernelProviderDisplayName=Kernel
+
+# Property names
+TraceControl_SessionNamePropertyName=Session Name
+TraceControl_EventNamePropertyName=Event Name
+TraceControl_EventTypePropertyName=Event Type
+TraceControl_LogLevelPropertyName=Log Level
+TraceControl_StatePropertyName=State
+TraceControl_DomainNamePropertyName=Domain Name
+TraceControl_ChannelNamePropertyName=Channel Name
+TraceControl_OverwriteModePropertyName=Overwrite Mode
+TraceControl_SubBufferSizePropertyName=Sub Buffer Size
+TraceControl_NbSubBuffersPropertyName=Number of Sub Buffers
+TraceControl_SwitchTimerPropertyName=Switch Timer Interval
+TraceControl_ReadTimerPropertyName=Read Timer Interval
+TraceControl_OutputTypePropertyName=Output Type
+TraceControl_HostNamePropertyName=Connection Name
+TraceControl_HostAddressPropertyName=Host Name
+TraceControl_SessionPathPropertyName=Session Path
+TraceControl_ProviderNamePropertyName=Provider Name
+TraceControl_ProcessIdPropertyName=Process ID
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/BaseEventComponent.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/BaseEventComponent.java
index 14fc9dac13..a0eea7de01 100644
--- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/BaseEventComponent.java
+++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/BaseEventComponent.java
@@ -15,6 +15,8 @@ import org.eclipse.linuxtools.lttng.ui.views.control.model.IBaseEventInfo;
import org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceControlComponent;
import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceEventType;
import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceLogLevel;
+import org.eclipse.linuxtools.lttng.ui.views.control.property.BaseEventPropertySource;
+import org.eclipse.ui.views.properties.IPropertySource;
/**
* BaseEventComponent
@@ -111,6 +113,18 @@ public class BaseEventComponent extends TraceControlComponent {
fEventInfo.setLogLevel(levelName);
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceControlComponent#getAdapter(java.lang.Class)
+ */
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Object getAdapter(Class adapter) {
+ if (adapter == IPropertySource.class) {
+ return new BaseEventPropertySource(this);
+ }
+ return null;
+ }
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/KernelProviderComponent.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/KernelProviderComponent.java
index bb3e809226..6bd35375dc 100644
--- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/KernelProviderComponent.java
+++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/KernelProviderComponent.java
@@ -17,6 +17,8 @@ import java.util.List;
import org.eclipse.linuxtools.lttng.ui.views.control.model.IBaseEventInfo;
import org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceControlComponent;
+import org.eclipse.linuxtools.lttng.ui.views.control.property.KernelProviderPropertySource;
+import org.eclipse.ui.views.properties.IPropertySource;
/**
* KernelProviderComponent
@@ -67,9 +69,21 @@ public class KernelProviderComponent extends TraceControlComponent {
}
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceControlComponent#getAdapter(java.lang.Class)
+ */
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Object getAdapter(Class adapter) {
+ if (adapter == IPropertySource.class) {
+ return new KernelProviderPropertySource(this);
+ }
+ return null;
+ }
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
-
}
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TargetNodeComponent.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TargetNodeComponent.java
index d0758dbb40..fa65f35be8 100644
--- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TargetNodeComponent.java
+++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TargetNodeComponent.java
@@ -226,6 +226,8 @@ public class TargetNodeComponent extends TraceControlComponent implements ICommu
// Note: result might be null!
if(status.isOK()) {
handleConnected();
+ } else {
+ handleDisconnected();
}
}
});
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TraceChannelComponent.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TraceChannelComponent.java
index ec037c6e09..f443d28d66 100644
--- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TraceChannelComponent.java
+++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TraceChannelComponent.java
@@ -17,7 +17,9 @@ import org.eclipse.linuxtools.lttng.ui.views.control.model.IChannelInfo;
import org.eclipse.linuxtools.lttng.ui.views.control.model.IEventInfo;
import org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceControlComponent;
import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceEnablement;
+import org.eclipse.linuxtools.lttng.ui.views.control.property.TraceChannelPropertySource;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.views.properties.IPropertySource;
/**
@@ -194,6 +196,19 @@ public class TraceChannelComponent extends TraceControlComponent {
public void setState(String stateName) {
fChannelInfo.setState(stateName);
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceControlComponent#getAdapter(java.lang.Class)
+ */
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Object getAdapter(Class adapter) {
+ if (adapter == IPropertySource.class) {
+ return new TraceChannelPropertySource(this);
+ }
+ return null;
+ }
+
// ------------------------------------------------------------------------
// Operations
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TraceDomainComponent.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TraceDomainComponent.java
index 36ed3400cf..ec1febbde5 100644
--- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TraceDomainComponent.java
+++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TraceDomainComponent.java
@@ -15,6 +15,8 @@ import org.eclipse.linuxtools.lttng.ui.views.control.Messages;
import org.eclipse.linuxtools.lttng.ui.views.control.model.IChannelInfo;
import org.eclipse.linuxtools.lttng.ui.views.control.model.IDomainInfo;
import org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceControlComponent;
+import org.eclipse.linuxtools.lttng.ui.views.control.property.TraceDomainPropertySource;
+import org.eclipse.ui.views.properties.IPropertySource;
/**
* TraceDomainComponent
@@ -71,6 +73,18 @@ public class TraceDomainComponent extends TraceControlComponent {
}
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceControlComponent#getAdapter(java.lang.Class)
+ */
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Object getAdapter(Class adapter) {
+ if (adapter == IPropertySource.class) {
+ return new TraceDomainPropertySource(this);
+ }
+ return null;
+ }
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TraceEventComponent.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TraceEventComponent.java
index 49c00d4f5c..6e76601024 100644
--- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TraceEventComponent.java
+++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TraceEventComponent.java
@@ -18,7 +18,9 @@ import org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceControlComponen
import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceEnablement;
import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceEventType;
import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceLogLevel;
+import org.eclipse.linuxtools.lttng.ui.views.control.property.TraceEventPropertySource;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.views.properties.IPropertySource;
/**
@@ -160,6 +162,19 @@ public class TraceEventComponent extends TraceControlComponent {
fEventInfo.setLogLevel(levelName);
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceControlComponent#getAdapter(java.lang.Class)
+ */
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Object getAdapter(Class adapter) {
+ if (adapter == IPropertySource.class) {
+ return new TraceEventPropertySource(this);
+ }
+ return null;
+ }
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TraceSessionComponent.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TraceSessionComponent.java
index 4376cce749..b7c29acaaf 100644
--- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TraceSessionComponent.java
+++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/TraceSessionComponent.java
@@ -20,7 +20,9 @@ import org.eclipse.linuxtools.lttng.ui.views.control.model.IDomainInfo;
import org.eclipse.linuxtools.lttng.ui.views.control.model.ISessionInfo;
import org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceControlComponent;
import org.eclipse.linuxtools.lttng.ui.views.control.model.TraceSessionState;
+import org.eclipse.linuxtools.lttng.ui.views.control.property.TraceSessionPropertySource;
import org.eclipse.swt.graphics.Image;
+import org.eclipse.ui.views.properties.IPropertySource;
/**
* TraceSessionComponent
@@ -157,6 +159,19 @@ public class TraceSessionComponent extends TraceControlComponent {
fSessionInfo.setSessionPath(sessionPath);
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceControlComponent#getAdapter(java.lang.Class)
+ */
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Object getAdapter(Class adapter) {
+ if (adapter == IPropertySource.class) {
+ return new TraceSessionPropertySource(this);
+ }
+ return null;
+ }
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/UstProviderComponent.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/UstProviderComponent.java
index 102edae67c..58269c4442 100644
--- a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/UstProviderComponent.java
+++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/model/impl/UstProviderComponent.java
@@ -15,6 +15,8 @@ package org.eclipse.linuxtools.lttng.ui.views.control.model.impl;
import org.eclipse.linuxtools.lttng.ui.views.control.model.IBaseEventInfo;
import org.eclipse.linuxtools.lttng.ui.views.control.model.ITraceControlComponent;
import org.eclipse.linuxtools.lttng.ui.views.control.model.IUstProviderInfo;
+import org.eclipse.linuxtools.lttng.ui.views.control.property.UstProviderPropertySource;
+import org.eclipse.ui.views.properties.IPropertySource;
/**
* UstProviderComponent
@@ -87,6 +89,19 @@ public class UstProviderComponent extends TraceControlComponent {
fProviderInfo.setPid(pid);
}
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceControlComponent#getAdapter(java.lang.Class)
+ */
+ @SuppressWarnings("rawtypes")
+ @Override
+ public Object getAdapter(Class adapter) {
+ if (adapter == IPropertySource.class) {
+ return new UstProviderPropertySource(this);
+ }
+ return null;
+ }
+
// ------------------------------------------------------------------------
// Operations
// ------------------------------------------------------------------------
diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/property/BaseEventPropertySource.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/property/BaseEventPropertySource.java
new file mode 100644
index 0000000000..05ab56cff8
--- /dev/null
+++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/property/BaseEventPropertySource.java
@@ -0,0 +1,108 @@
+/**********************************************************************
+ * Copyright (c) 2012 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
+ **********************************************************************/
+package org.eclipse.linuxtools.lttng.ui.views.control.property;
+
+import org.eclipse.linuxtools.lttng.ui.views.control.Messages;
+import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.BaseEventComponent;
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.TextPropertyDescriptor;
+
+/**
+ * BaseEventPropertySource
+ *
+ * Property source implementation for the trace channel component. + *
+ */ +public class TraceChannelPropertySource extends BasePropertySource { + + // ------------------------------------------------------------------------ + // Constants + // ------------------------------------------------------------------------ + /** + * The trace channel 'name' property ID. + */ + public static final String TRACE_CHANNEL_NAME_PROPERTY_ID = "trace.channel.name"; //$NON-NLS-1$ + /** + * The trace channel 'state' ID. + */ + public static final String TRACE_CHANNEL_STATE_PROPERTY_ID = "trace.channel.state"; //$NON-NLS-1$ + /** + * The trace channel 'overwrite mode' property ID. + */ + public static final String TRACE_CHANNEL_OVERWRITE_MODE_PROPERTY_ID = "trace.channel.overwrite.mode"; //$NON-NLS-1$ + /** + * The trace channel 'sub-buffer size' property ID. + */ + public static final String TRACE_CHANNEL_SUBBUFFER_SIZE_PROPERTY_ID = "trace.channel.subbuffer.size"; //$NON-NLS-1$ + /** + * The trace channel 'number of sub-buffers' property ID. + */ + public static final String TRACE_CHANNEL_NO_SUBBUFFERS_PROPERTY_ID = "trace.channel.no.subbuffers"; //$NON-NLS-1$ + /** + * The trace channel 'switch timer interval' property ID. + */ + public static final String TRACE_CHANNEL_SWITCH_TIMER_PROPERTY_ID = "trace.channel.switch.timer"; //$NON-NLS-1$ + /** + * The trace channel 'read timer interval' property ID. + */ + public static final String TRACE_CHANNEL_READ_TIMER_PROPERTY_ID = "trace.channel.read.timer"; //$NON-NLS-1$ + /** + * The trace channel 'output type' property ID. + */ + public static final String TRACE_CHANNEL_OUTPUT_TYPE_PROPERTY_ID = "trace.channel.output.type"; //$NON-NLS-1$ + /** + * The trace channel 'name' property name. + */ + public static final String TRACE_CHANNEL_NAME_PROPERTY_NAME = Messages.TraceControl_ChannelNamePropertyName; + /** + * The trace channel 'state' property name. + */ + public static final String TRACE_CHANNEL_STATE_PROPERTY_NAME = Messages.TraceControl_StatePropertyName; + /** + * The trace channel 'overwrite mode' property name. + */ + public static final String TRACE_CHANNEL_OVERWRITE_MODE_PROPERTY_NAME = Messages.TraceControl_OverwriteModePropertyName; + /** + * The trace channel 'sub-buffer size' property name. + */ + public static final String TRACE_CHANNEL_SUBBUFFER_SIZE_PROPERTY_NAME = Messages.TraceControl_SubBufferSizePropertyName; + /** + * The trace channel 'sub-buffer size' property name. + */ + public static final String TRACE_CHANNEL_NO_SUBBUFFERS_PROPERTY_NAME = Messages.TraceControl_NbSubBuffersPropertyName; + /** + * The trace channel 'switch timer interval' property name. + */ + public static final String TRACE_CHANNEL_SWITCH_TIMER_PROPERTY_NAME = Messages.TraceControl_SwitchTimerPropertyName; + /** + * The trace channel 'read timer interval' property name. + */ + public static final String TRACE_CHANNEL_READ_TIMER_PROPERTY_NAME = Messages.TraceControl_ReadTimerPropertyName; + /** + * The trace channel 'output type' property name. + */ + public static final String TRACE_CHANNEL_OUTPUT_TYPEPROPERTY_NAME = Messages.TraceControl_OutputTypePropertyName; + + // ------------------------------------------------------------------------ + // Attributes + // ------------------------------------------------------------------------ + /** + * The channel component which this property source is for. + */ + private final TraceChannelComponent fChannel; + + // ------------------------------------------------------------------------ + // Constructors + // ------------------------------------------------------------------------ + /** + * Constructor + * @param component - the channel component + */ + public TraceChannelPropertySource(TraceChannelComponent component) { + fChannel = component; + } + + // ------------------------------------------------------------------------ + // Operations + // ------------------------------------------------------------------------ + + /* + * (non-Javadoc) + * @see org.eclipse.linuxtools.lttng.ui.views.control.property.BasePropertySource#getPropertyDescriptors() + */ + @Override + public IPropertyDescriptor[] getPropertyDescriptors() { + return new IPropertyDescriptor[] { + new TextPropertyDescriptor(TRACE_CHANNEL_NAME_PROPERTY_ID, TRACE_CHANNEL_NAME_PROPERTY_NAME), + new TextPropertyDescriptor(TRACE_CHANNEL_STATE_PROPERTY_ID, TRACE_CHANNEL_STATE_PROPERTY_NAME), + new TextPropertyDescriptor(TRACE_CHANNEL_OVERWRITE_MODE_PROPERTY_ID, TRACE_CHANNEL_OVERWRITE_MODE_PROPERTY_NAME), + new TextPropertyDescriptor(TRACE_CHANNEL_SUBBUFFER_SIZE_PROPERTY_ID, TRACE_CHANNEL_SUBBUFFER_SIZE_PROPERTY_NAME), + new TextPropertyDescriptor(TRACE_CHANNEL_NO_SUBBUFFERS_PROPERTY_ID, TRACE_CHANNEL_NO_SUBBUFFERS_PROPERTY_NAME), + new TextPropertyDescriptor(TRACE_CHANNEL_SWITCH_TIMER_PROPERTY_ID, TRACE_CHANNEL_SWITCH_TIMER_PROPERTY_NAME), + new TextPropertyDescriptor(TRACE_CHANNEL_READ_TIMER_PROPERTY_ID, TRACE_CHANNEL_READ_TIMER_PROPERTY_NAME), + new TextPropertyDescriptor(TRACE_CHANNEL_OUTPUT_TYPE_PROPERTY_ID, TRACE_CHANNEL_OUTPUT_TYPEPROPERTY_NAME)}; + } + + /* + * (non-Javadoc) + * @see org.eclipse.linuxtools.lttng.ui.views.control.property.BasePropertySource#getPropertyValue(java.lang.Object) + */ + @Override + public Object getPropertyValue(Object id) { + if(TRACE_CHANNEL_NAME_PROPERTY_ID.equals(id)) { + return fChannel.getName(); + } + if (TRACE_CHANNEL_STATE_PROPERTY_ID.equals(id)) { + return fChannel.getState().name(); + } + if(TRACE_CHANNEL_OVERWRITE_MODE_PROPERTY_ID.equals(id)) { + return String.valueOf(fChannel.isOverwriteMode()); + } + if(TRACE_CHANNEL_SUBBUFFER_SIZE_PROPERTY_ID.equals(id)) { + return String.valueOf(fChannel.getSubBufferSize()); + } + if(TRACE_CHANNEL_NO_SUBBUFFERS_PROPERTY_ID.equals(id)) { + return String.valueOf(fChannel.getNumberOfSubBuffers()); + } + if(TRACE_CHANNEL_SWITCH_TIMER_PROPERTY_ID.equals(id)) { + return String.valueOf(fChannel.getSwitchTimer()); + } + if(TRACE_CHANNEL_READ_TIMER_PROPERTY_ID.equals(id)) { + return String.valueOf(fChannel.getReadTimer()); + } + if(TRACE_CHANNEL_OUTPUT_TYPE_PROPERTY_ID.equals(id)) { + return fChannel.getOutputType(); + } + return null; + } + +} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/property/TraceDomainPropertySource.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/property/TraceDomainPropertySource.java new file mode 100644 index 0000000000..875ecb3f1f --- /dev/null +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/property/TraceDomainPropertySource.java @@ -0,0 +1,84 @@ +/********************************************************************** + * Copyright (c) 2012 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 + **********************************************************************/ +package org.eclipse.linuxtools.lttng.ui.views.control.property; + +import org.eclipse.linuxtools.lttng.ui.views.control.Messages; +import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceDomainComponent; +import org.eclipse.ui.views.properties.IPropertyDescriptor; +import org.eclipse.ui.views.properties.TextPropertyDescriptor; + +/** + * TraceDomainPropertySource + *+ * Property source implementation for the trace domain component. + *
+ */ +public class TraceDomainPropertySource extends BasePropertySource { + + // ------------------------------------------------------------------------ + // Constants + // ------------------------------------------------------------------------ + + /** + * The trace domain 'name' property ID. + */ + public static final String TRACE_DOMAIN_NAME_PROPERTY_ID = "trace.domain.name"; //$NON-NLS-1$ + /** + * The trace domain 'name' property name. + */ + public static final String TRACE_DOMAIN_NAME_PROPERTY_NAME = Messages.TraceControl_DomainNamePropertyName; + + // ------------------------------------------------------------------------ + // Attributes + // ------------------------------------------------------------------------ + /** + * The trace domain component which this property source is for. + */ + private final TraceDomainComponent fBaseEvent; + + // ------------------------------------------------------------------------ + // Constructors + // ------------------------------------------------------------------------ + /** + * Constructor + * @param component - the trace domain component + */ + public TraceDomainPropertySource(TraceDomainComponent component) { + fBaseEvent = component; + } + + // ------------------------------------------------------------------------ + // Operations + // ------------------------------------------------------------------------ + /* + * (non-Javadoc) + * @see org.eclipse.linuxtools.lttng.ui.views.control.property.BasePropertySource#getPropertyDescriptors() + */ + @Override + public IPropertyDescriptor[] getPropertyDescriptors() { + return new IPropertyDescriptor[] { + new TextPropertyDescriptor(TRACE_DOMAIN_NAME_PROPERTY_ID, TRACE_DOMAIN_NAME_PROPERTY_NAME)}; + } + + /* + * (non-Javadoc) + * @see org.eclipse.linuxtools.lttng.ui.views.control.property.BasePropertySource#getPropertyValue(java.lang.Object) + */ + @Override + public Object getPropertyValue(Object id) { + if(TRACE_DOMAIN_NAME_PROPERTY_ID.equals(id)) { + return fBaseEvent.getName(); + } + return null; + } + +} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/property/TraceEventPropertySource.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/property/TraceEventPropertySource.java new file mode 100644 index 0000000000..9d5e69b79d --- /dev/null +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/property/TraceEventPropertySource.java @@ -0,0 +1,119 @@ +/********************************************************************** + * Copyright (c) 2012 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 + **********************************************************************/ +package org.eclipse.linuxtools.lttng.ui.views.control.property; + +import org.eclipse.linuxtools.lttng.ui.views.control.Messages; +import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceEventComponent; +import org.eclipse.ui.views.properties.IPropertyDescriptor; +import org.eclipse.ui.views.properties.TextPropertyDescriptor; + +/** + * TraceEventPropertySource + *+ * Property source implementation for the trace event component. + *
+ */ +public class TraceEventPropertySource extends BasePropertySource { + + // ------------------------------------------------------------------------ + // Constants + // ------------------------------------------------------------------------ + /** + * The trace event 'name' property ID. + */ + public static final String TRACE_EVENT_NAME_PROPERTY_ID = "trace.event.name"; //$NON-NLS-1$ + /** + * The trace event 'type' property ID. + */ + public static final String TRACE_EVENT_TYPE_PROPERTY_ID = "trace.event.type"; //$NON-NLS-1$ + /** + * The trace event 'log level' property ID. + */ + public static final String TRACE_EVENT_LOGLEVEL_PROPERTY_ID = "trace.event.loglevel"; //$NON-NLS-1$ + /** + * The trace event 'state' property ID. + */ + public static final String TRACE_EVENT_STATE_PROPERTY_ID = "trace.event.state"; //$NON-NLS-1$ + /** + * The trace event 'name' property name. + */ + public static final String TRACE_EVENT_NAME_PROPERTY_NAME = Messages.TraceControl_EventNamePropertyName; + /** + * The trace event 'type' property name. + */ + public static final String TRACE_EVENT_TYPE_PROPERTY_NAME = Messages.TraceControl_EventTypePropertyName; + /** + * The trace event 'log level' property name. + */ + public static final String TRACE_EVENT_LOGLEVEL_PROPERTY_NAME = Messages.TraceControl_LogLevelPropertyName; + /** + * The trace event 'state' property name. + */ + public static final String TRACE_EVENT_STATE_PROPERTY_NAME = Messages.TraceControl_StatePropertyName; + + // ------------------------------------------------------------------------ + // Attributes + // ------------------------------------------------------------------------ + /** + * The event component which this property source is for. + */ + private final TraceEventComponent fEvent; + + // ------------------------------------------------------------------------ + // Constructors + // ------------------------------------------------------------------------ + /** + * Constructor + * @param component - the base event component + */ + public TraceEventPropertySource(TraceEventComponent component) { + fEvent = component; + } + + // ------------------------------------------------------------------------ + // Operations + // ------------------------------------------------------------------------ + /* + * (non-Javadoc) + * @see org.eclipse.linuxtools.lttng.ui.views.control.property.BasePropertySource#getPropertyDescriptors() + */ + @Override + public IPropertyDescriptor[] getPropertyDescriptors() { + return new IPropertyDescriptor[] { + new TextPropertyDescriptor(TRACE_EVENT_NAME_PROPERTY_ID, TRACE_EVENT_NAME_PROPERTY_NAME), + new TextPropertyDescriptor(TRACE_EVENT_TYPE_PROPERTY_ID, TRACE_EVENT_TYPE_PROPERTY_NAME), + new TextPropertyDescriptor(TRACE_EVENT_LOGLEVEL_PROPERTY_ID, TRACE_EVENT_LOGLEVEL_PROPERTY_NAME), + new TextPropertyDescriptor(TRACE_EVENT_STATE_PROPERTY_ID, TRACE_EVENT_STATE_PROPERTY_NAME)}; + } + + /* + * (non-Javadoc) + * @see org.eclipse.linuxtools.lttng.ui.views.control.property.BasePropertySource#getPropertyValue(java.lang.Object) + */ + @Override + public Object getPropertyValue(Object id) { + if(TRACE_EVENT_NAME_PROPERTY_ID.equals(id)) { + return fEvent.getName(); + } + if (TRACE_EVENT_TYPE_PROPERTY_ID.equals(id)) { + return fEvent.getEventType().name(); + } + if (TRACE_EVENT_LOGLEVEL_PROPERTY_ID.equals(id)) { + return fEvent.getLogLevel().name(); + } + if (TRACE_EVENT_STATE_PROPERTY_ID.equals(id)) { + return fEvent.getState().name(); + } + return null; + } + +} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/property/TraceSessionPropertySource.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/property/TraceSessionPropertySource.java new file mode 100644 index 0000000000..bfff2b9b02 --- /dev/null +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/property/TraceSessionPropertySource.java @@ -0,0 +1,106 @@ +/********************************************************************** + * Copyright (c) 2012 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 + **********************************************************************/ +package org.eclipse.linuxtools.lttng.ui.views.control.property; + +import org.eclipse.linuxtools.lttng.ui.views.control.Messages; +import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.TraceSessionComponent; +import org.eclipse.ui.views.properties.IPropertyDescriptor; +import org.eclipse.ui.views.properties.TextPropertyDescriptor; + +/** + * TraceSessionPropertySource + *+ * Property source implementation for the trace session component. + *
+ */ +public class TraceSessionPropertySource extends BasePropertySource { + + // ------------------------------------------------------------------------ + // Constants + // ------------------------------------------------------------------------ + /** + * The trace session name property ID. + */ + public static final String TRACE_SESSION_NAME_PROPERTY_ID = "trace.session.name"; //$NON-NLS-1$ + /** + * The trace session path property ID. + */ + public static final String TRACE_SESSION_PATH_PROPERTY_ID = "trace.session.path"; //$NON-NLS-1$ + /** + * The trace session state ID. + */ + public static final String TRACE_SESSION_STATE_PROPERTY_ID = "trace.session.state"; //$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. + */ + 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; + + // ------------------------------------------------------------------------ + // Attributes + // ------------------------------------------------------------------------ + /** + * The session component which this property source is for. + */ + private final TraceSessionComponent fSession; + + // ------------------------------------------------------------------------ + // Constructors + // ------------------------------------------------------------------------ + /** + * Constructor + * @param component - the session component + */ + 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)}; + } + + /* + * (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)) { + return fSession.getName(); + } + if(TRACE_SESSION_PATH_PROPERTY_ID.equals(id)) { + return fSession.getSessionPath(); + } + if (TRACE_SESSION_STATE_PROPERTY_ID.equals(id)) { + return fSession.getSessionState().name(); + } + return null; + } +} diff --git a/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/property/UstProviderPropertySource.java b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/property/UstProviderPropertySource.java new file mode 100644 index 0000000000..a239d7ef61 --- /dev/null +++ b/org.eclipse.linuxtools.lttng.ui/src/org/eclipse/linuxtools/lttng/ui/views/control/property/UstProviderPropertySource.java @@ -0,0 +1,95 @@ +/********************************************************************** + * Copyright (c) 2012 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 + **********************************************************************/ +package org.eclipse.linuxtools.lttng.ui.views.control.property; + +import org.eclipse.linuxtools.lttng.ui.views.control.Messages; +import org.eclipse.linuxtools.lttng.ui.views.control.model.impl.UstProviderComponent; +import org.eclipse.ui.views.properties.IPropertyDescriptor; +import org.eclipse.ui.views.properties.TextPropertyDescriptor; + +/** + * UstProviderPropertySource + *+ * Property source implementation for the UST provider component. + *
+ */ +public class UstProviderPropertySource extends BasePropertySource { + + // ------------------------------------------------------------------------ + // Constants + // ------------------------------------------------------------------------ + /** + * The UST provider 'name' property ID. + */ + public static final String UST_PROVIDER_NAME_PROPERTY_ID = "ust.provider.name"; //$NON-NLS-1$ + /** + * The UST provider 'PID' property ID. + */ + public static final String UST_PROVIDER_PID_PROPERTY_ID = "ust.provider.pid"; //$NON-NLS-1$ + /** + * The UST provider 'name' property name. + */ + public static final String UST_PROVIDER_NAME_PROPERTY_NAME = Messages.TraceControl_ProviderNamePropertyName; + /** + * The UST provider 'type' property name. + */ + public static final String UST_PROVIDER_PID_PROPERTY_NAME = Messages.TraceControl_ProcessIdPropertyName; + + // ------------------------------------------------------------------------ + // Attributes + // ------------------------------------------------------------------------ + /** + * The UST provider component which this property source is for. + */ + private UstProviderComponent fUstProvider; + + // ------------------------------------------------------------------------ + // Constructors + // ------------------------------------------------------------------------ + /** + * Constructor + * @param component - the UST provider component + */ + public UstProviderPropertySource(UstProviderComponent component) { + fUstProvider = component; + } + + // ------------------------------------------------------------------------ + // Operations + // ------------------------------------------------------------------------ + /* + * (non-Javadoc) + * @see org.eclipse.linuxtools.lttng.ui.views.control.property.BasePropertySource#getPropertyDescriptors() + */ + @Override + public IPropertyDescriptor[] getPropertyDescriptors() { + return new IPropertyDescriptor[] { + new TextPropertyDescriptor(UST_PROVIDER_NAME_PROPERTY_ID, UST_PROVIDER_NAME_PROPERTY_NAME), + new TextPropertyDescriptor(UST_PROVIDER_PID_PROPERTY_ID, UST_PROVIDER_PID_PROPERTY_NAME)}; + } + + /* + * (non-Javadoc) + * @see org.eclipse.linuxtools.lttng.ui.views.control.property.BasePropertySource#getPropertyValue(java.lang.Object) + */ + @Override + public Object getPropertyValue(Object id) { + if(UST_PROVIDER_NAME_PROPERTY_ID.equals(id)) { + return fUstProvider.getName(); + } + if (UST_PROVIDER_PID_PROPERTY_ID.equals(id)) { + return String.valueOf(fUstProvider.getPid()); + } + return null; + } + +} -- 2.34.1