Skip to main content
summaryrefslogtreecommitdiffstats
blob: 2d03bf112a13732969fefd83246e16687e8d089e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/**
 * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
 * 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:
 *    Eike Stepper - initial API and implementation
 */
package org.eclipse.emf.cdo.internal.ui.properties;

import org.eclipse.ui.views.properties.IPropertyDescriptor;
import org.eclipse.ui.views.properties.IPropertySource;
import org.eclipse.ui.views.properties.PropertyDescriptor;

import java.util.ArrayList;
import java.util.List;

/**
 * @author Eike Stepper
 */
public abstract class CDOPropertySource<OBJECT> implements IPropertySource
{
  private List<IPropertyDescriptor> descriptors = new ArrayList<IPropertyDescriptor>();

  private OBJECT object;

  public CDOPropertySource(OBJECT object)
  {
    this.object = object;
  }

  public OBJECT getObject()
  {
    return object;
  }

  public IPropertyDescriptor[] getPropertyDescriptors()
  {
    return descriptors.toArray(new IPropertyDescriptor[descriptors.size()]);
  }

  public PropertyDescriptor addPropertyDescriptor(String category, Object id, String displayName, String description)
  {
    PropertyDescriptor descriptor = new PropertyDescriptor(id, displayName);
    descriptor.setCategory(category);
    descriptor.setDescription(description);

    descriptors.add(descriptor);
    return descriptor;
  }

  public boolean isPropertySet(Object id)
  {
    return true;
  }

  public void resetPropertyValue(Object id)
  {
  }

  public void setPropertyValue(Object id, Object value)
  {
  }

  public Object getEditableValue()
  {
    return null;
  }
}

Back to the top