Commit | Line | Data |
---|---|---|
0505c6fc BH |
1 | /******************************************************************************* |
2 | * Copyright (c) 2013 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: | |
080600d9 | 10 | * Alexandre Montplaisir - Initial API and implementation |
0505c6fc BH |
11 | *******************************************************************************/ |
12 | ||
080600d9 | 13 | package org.eclipse.linuxtools.tmf.ui.properties; |
0505c6fc BH |
14 | |
15 | import org.eclipse.jface.viewers.CellEditor; | |
16 | import org.eclipse.jface.viewers.TextCellEditor; | |
17 | import org.eclipse.swt.SWT; | |
18 | import org.eclipse.swt.widgets.Composite; | |
19 | import org.eclipse.ui.views.properties.PropertyDescriptor; | |
20 | import org.eclipse.ui.views.properties.TextPropertyDescriptor; | |
21 | ||
22 | /** | |
23 | * A uneditable version of a {@link TextPropertyDescriptor}. | |
24 | * | |
25 | * @author Alexandre Montplaisir | |
26 | * @since 2.0 | |
27 | */ | |
28 | public class ReadOnlyTextPropertyDescriptor extends PropertyDescriptor { | |
29 | ||
30 | /** | |
31 | * Creates an property descriptor with the given id and display name. | |
32 | * | |
33 | * @param id | |
34 | * The id of the property | |
35 | * @param displayName | |
36 | * The name to display for the property | |
37 | */ | |
38 | public ReadOnlyTextPropertyDescriptor(Object id, String displayName) { | |
39 | super(id, displayName); | |
40 | } | |
41 | ||
42 | @Override | |
43 | public CellEditor createPropertyEditor(Composite parent) { | |
44 | CellEditor editor = new TextCellEditor(parent, SWT.READ_ONLY); | |
45 | if (getValidator() != null) { | |
46 | editor.setValidator(getValidator()); | |
47 | } | |
48 | return editor; | |
49 | } | |
50 | ||
51 | } |