Project

General

Profile

Download (1.33 KB) Statistics
| Branch: | Tag: | Revision:
1
/**
2
 * 
3
 */
4
package eu.etaxonomy.taxeditor.propertysheet;
5

    
6
import org.eclipse.jface.dialogs.Dialog;
7
import org.eclipse.jface.viewers.CellEditor;
8
import org.eclipse.jface.viewers.DialogCellEditor;
9
import org.eclipse.swt.widgets.Composite;
10
import org.eclipse.swt.widgets.Control;
11
import org.eclipse.ui.views.properties.PropertyDescriptor;
12

    
13
import eu.etaxonomy.cdm.model.common.AnnotatableEntity;
14

    
15
/**
16
 * @author p.ciardelli
17
 *
18
 */
19
public class MarkersPropertyDescriptor extends PropertyDescriptor {
20
	private AnnotatableEntity entity;
21
	
22
	public MarkersPropertyDescriptor(Object id, String displayName, AnnotatableEntity entity) {
23
		super(id, displayName);
24
		this.entity = entity;
25
	}
26

    
27
    public CellEditor createPropertyEditor(Composite parent) {
28
        CellEditor editor = new DialogCellEditor(parent) {
29

    
30
        	protected MarkersDialog dialog;
31
        	
32
			@Override
33
			protected Object openDialogBox(
34
					Control cellEditorWindow) {
35
		        dialog = new MarkersDialog(cellEditorWindow.getShell(), entity);
36
		        int returnCode = ((MarkersDialog) dialog).open();
37
				if (returnCode == Dialog.OK) {
38
					return new MarkerPropertySource(entity);
39
				}
40
				return null;
41
			}
42
        	
43
        };
44
        if (getValidator() != null) {
45
			editor.setValidator(getValidator());
46
		}
47
        return editor;
48
    }	
49
}
(18-18/24)