2 * Copyright (C) 2009 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.propertysheet
.type
;
13 import java
.util
.Vector
;
15 import org
.apache
.log4j
.Logger
;
16 import org
.eclipse
.ui
.views
.properties
.IPropertyDescriptor
;
17 import org
.eclipse
.ui
.views
.properties
.IPropertySource
;
18 import org
.eclipse
.ui
.views
.properties
.PropertyDescriptor
;
20 import eu
.etaxonomy
.cdm
.model
.name
.TaxonNameBase
;
27 public class TypePropertySource
implements IPropertySource
{
28 private static Logger logger
= Logger
.getLogger(TypePropertySource
.class);
31 * The name whose types are being displayed.
33 private TaxonNameBase name
;
36 * If this is a property with a parent, the parent's property ID
38 private String parentid
;
41 * Property unique keys
43 public static final String P_ID_NAMETYPES
= "nametypes";
46 * Property display keys
48 public static final String P_NAMETYPES
= "Name Types";
50 protected static final String
[] TOP_LEVEL_PROPERTIES
= new String
[] {
53 protected Vector
<PropertyDescriptor
> descriptors
= new Vector
<PropertyDescriptor
>();
55 public TypePropertySource(TaxonNameBase name
) {
58 addDescriptor(P_ID_NAMETYPES
);
65 private void addDescriptor(String id
) {
66 // Name relations, listed in custom property descriptor
67 if (id
.equals(P_ID_NAMETYPES
)) {
68 descriptors
.addElement(
69 new TypePropertyDescriptor(P_ID_NAMETYPES
, P_NAMETYPES
, name
) {
70 protected void saveTypes(Set set
) {
71 setPropertyValue(P_ID_NAMETYPES
, set
);
80 * @see org.eclipse.ui.views.properties.IPropertySource#getEditableValue()
82 public Object
getEditableValue() {
87 * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyDescriptors()
89 public IPropertyDescriptor
[] getPropertyDescriptors() {
90 return (IPropertyDescriptor
[]) descriptors
.toArray(
91 new IPropertyDescriptor
[descriptors
.size()]);
95 * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
97 public Object
getPropertyValue(Object id
) {
102 * @see org.eclipse.ui.views.properties.IPropertySource#isPropertySet(java.lang.Object)
104 public boolean isPropertySet(Object id
) {
109 * @see org.eclipse.ui.views.properties.IPropertySource#resetPropertyValue(java.lang.Object)
111 public void resetPropertyValue(Object id
) {
116 * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
118 public void setPropertyValue(Object id
, Object value
) {