Mercurial > projects > dwt2
comparison org.eclipse.jface/src/org/eclipse/jface/viewers/ICellModifier.d @ 12:bc29606a740c
Added dwt-addons in original directory structure of eclipse.org
author | Frank Benoit <benoit@tionex.de> |
---|---|
date | Sat, 14 Mar 2009 18:23:29 +0100 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
11:43904fec5dca | 12:bc29606a740c |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2000, 2006 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 * Port to the D programming language: | |
11 * Frank Benoit <benoit@tionex.de> | |
12 *******************************************************************************/ | |
13 module org.eclipse.jface.viewers.ICellModifier; | |
14 | |
15 import java.lang.all; | |
16 | |
17 /** | |
18 * A cell modifier is used to access the data model from a cell | |
19 * editor in an abstract way. It offers methods to: | |
20 * <ul> | |
21 * <li>to check if a a model element's property can be edited or not</li> | |
22 * <li>retrieve a value a model element's property</li> | |
23 * <li>to store a cell editor's value back into the model | |
24 * element's property</li> | |
25 * </ul> | |
26 * <p> | |
27 * This interface should be implemented by classes that wish to | |
28 * act as cell modifiers. | |
29 * </p> | |
30 */ | |
31 public interface ICellModifier { | |
32 /** | |
33 * Checks whether the given property of the given element can be | |
34 * modified. | |
35 * | |
36 * @param element the element | |
37 * @param property the property | |
38 * @return <code>true</code> if the property can be modified, | |
39 * and <code>false</code> if it is not modifiable | |
40 */ | |
41 public bool canModify(Object element, String property); | |
42 | |
43 /** | |
44 * Returns the value for the given property of the given element. | |
45 * Returns <code>null</code> if the element does not have the given property. | |
46 * | |
47 * @param element the element | |
48 * @param property the property | |
49 * @return the property value | |
50 */ | |
51 public Object getValue(Object element, String property); | |
52 | |
53 /** | |
54 * Modifies the value for the given property of the given element. | |
55 * Has no effect if the element does not have the given property, | |
56 * or if the property cannot be modified. | |
57 * <p> | |
58 * Note that it is possible for an SWT Item to be passed instead of | |
59 * the model element. To handle this case in a safe way, use: | |
60 * <pre> | |
61 * if (element instanceof Item) { | |
62 * element = ((Item) element).getData(); | |
63 * } | |
64 * // modify the element's property here | |
65 * </pre> | |
66 * </p> | |
67 * | |
68 * @param element the model element or SWT Item (see above) | |
69 * @param property the property | |
70 * @param value the new property value | |
71 * | |
72 * @see org.eclipse.swt.widgets.Item | |
73 */ | |
74 public void modify(Object element, String property, Object value); | |
75 } |