~ubuntu-branches/ubuntu/utopic/eclipse-linuxtools/utopic

« back to all changes in this revision

Viewing changes to lttng/org.eclipse.linuxtools.lttng2.ui/src/org/eclipse/linuxtools/internal/lttng2/ui/views/control/property/TraceDomainPropertySource.java

  • Committer: Package Import Robot
  • Author(s): Jakub Adam
  • Date: 2014-05-12 18:11:40 UTC
  • mfrom: (3.1.2 sid)
  • Revision ID: package-import@ubuntu.com-20140512181140-w237r3vsah1tmybz
Tags: 2.2.1-1
* New upstream release.
* Refreshed d/patches.
* Removed eclipse-cdt-valgrind-remote package, all its functionality
  is now provided by eclipse-cdt-profiling-framework-remote.
* Added remove-license-feature.patch.
* Bump Standards-Version to 3.9.5.
* Enable eclipse-changelog package.
* Enable eclipse-rpm-editor package.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/**********************************************************************
2
 
 * Copyright (c) 2012 Ericsson
3
 
 * 
 
2
 * Copyright (c) 2012, 2013 Ericsson
 
3
 *
4
4
 * All rights reserved. This program and the accompanying materials are
5
5
 * made available under the terms of the Eclipse Public License v1.0 which
6
6
 * accompanies this distribution, and is available at
7
7
 * http://www.eclipse.org/legal/epl-v10.html
8
 
 * 
9
 
 * Contributors: 
10
 
 *   Bernd Hufmann - Initial API and implementation
 
8
 *
 
9
 * Contributors:
 
10
 *     Bernd Hufmann - Initial API and implementation
11
11
 **********************************************************************/
12
12
package org.eclipse.linuxtools.internal.lttng2.ui.views.control.property;
13
13
 
 
14
import org.eclipse.linuxtools.internal.lttng2.core.control.model.impl.BufferType;
14
15
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.messages.Messages;
15
16
import org.eclipse.linuxtools.internal.lttng2.ui.views.control.model.impl.TraceDomainComponent;
 
17
import org.eclipse.linuxtools.tmf.ui.properties.ReadOnlyTextPropertyDescriptor;
16
18
import org.eclipse.ui.views.properties.IPropertyDescriptor;
17
 
import org.eclipse.ui.views.properties.TextPropertyDescriptor;
18
19
 
19
20
/**
20
21
 * <p>
21
22
 * Property source implementation for the trace domain component.
22
23
 * </p>
23
 
 * 
 
24
 *
24
25
 * @author Bernd Hufmann
25
26
 */
26
27
public class TraceDomainPropertySource extends BasePropertySource {
34
35
     */
35
36
    public static final String TRACE_DOMAIN_NAME_PROPERTY_ID = "trace.domain.name"; //$NON-NLS-1$
36
37
    /**
37
 
     *  The trace domain 'name' property name. 
 
38
     *  The trace domain 'name' property name.
38
39
     */
39
40
    public static final String TRACE_DOMAIN_NAME_PROPERTY_NAME = Messages.TraceControl_DomainNamePropertyName;
40
 
    
 
41
    /**
 
42
     * The domain 'buffer type' property ID.
 
43
     */
 
44
    public static final String BUFFER_TYPE_PROPERTY_ID = "trace.domain.bufferType"; //$NON-NLS-1$
 
45
    /**
 
46
     * The domain 'buffer type' property name.
 
47
     */
 
48
    public static final String BUFER_TYPE_PROPERTY_NAME = Messages.TraceControl_BufferTypePropertyName;
 
49
 
41
50
    // ------------------------------------------------------------------------
42
51
    // Attributes
43
52
    // ------------------------------------------------------------------------
 
53
 
44
54
    /**
45
 
     * The trace domain component which this property source is for. 
 
55
     * The trace domain component which this property source is for.
46
56
     */
47
 
    private final TraceDomainComponent fBaseEvent;
48
 
    
 
57
    private final TraceDomainComponent fDomain;
 
58
 
49
59
    // ------------------------------------------------------------------------
50
60
    // Constructors
51
61
    // ------------------------------------------------------------------------
 
62
 
52
63
    /**
53
64
     * Constructor
54
65
     * @param component - the trace domain component
55
66
     */
56
67
    public TraceDomainPropertySource(TraceDomainComponent component) {
57
 
        fBaseEvent = component;
 
68
        fDomain = component;
58
69
    }
59
 
    
 
70
 
60
71
    // ------------------------------------------------------------------------
61
72
    // Operations
62
73
    // ------------------------------------------------------------------------
63
 
    /*
64
 
     * (non-Javadoc)
65
 
     * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.property.BasePropertySource#getPropertyDescriptors()
66
 
     */
 
74
 
67
75
    @Override
68
76
    public IPropertyDescriptor[] getPropertyDescriptors() {
 
77
        if (fDomain.getBufferType() == BufferType.BUFFER_TYPE_UNKNOWN) {
 
78
            return new IPropertyDescriptor[] {
 
79
                    new ReadOnlyTextPropertyDescriptor(TRACE_DOMAIN_NAME_PROPERTY_ID, TRACE_DOMAIN_NAME_PROPERTY_NAME) };
 
80
        }
 
81
 
69
82
        return new IPropertyDescriptor[] {
70
 
                new TextPropertyDescriptor(TRACE_DOMAIN_NAME_PROPERTY_ID, TRACE_DOMAIN_NAME_PROPERTY_NAME)};
 
83
                new ReadOnlyTextPropertyDescriptor(TRACE_DOMAIN_NAME_PROPERTY_ID, TRACE_DOMAIN_NAME_PROPERTY_NAME),
 
84
                new ReadOnlyTextPropertyDescriptor(BUFFER_TYPE_PROPERTY_ID, BUFER_TYPE_PROPERTY_NAME) };
71
85
    }
72
86
 
73
 
    /*
74
 
     * (non-Javadoc)
75
 
     * @see org.eclipse.linuxtools.internal.lttng2.ui.views.control.property.BasePropertySource#getPropertyValue(java.lang.Object)
76
 
     */
77
87
    @Override
78
88
    public Object getPropertyValue(Object id) {
 
89
        if(BUFFER_TYPE_PROPERTY_ID.equals(id)){
 
90
            return fDomain.getBufferType().getInName();
 
91
        }
 
92
 
79
93
        if(TRACE_DOMAIN_NAME_PROPERTY_ID.equals(id)) {
80
 
            return fBaseEvent.getName();
 
94
            return fDomain.getName();
81
95
        }
82
96
        return null;
83
97
    }