Working on the polytomous key editor
[taxeditor.git] / eu.etaxonomy.taxeditor.store / src / main / java / eu / etaxonomy / taxeditor / view / AbstractCdmEditorViewPart.java
1 /**
2 *
3 */
4 package eu.etaxonomy.taxeditor.view;
5
6 import org.eclipse.swt.widgets.Composite;
7 import org.eclipse.ui.IEditorPart;
8
9 import eu.etaxonomy.taxeditor.model.IDirtyMarkableSelectionProvider;
10 import eu.etaxonomy.taxeditor.store.StoreUtil;
11
12 /**
13 * <p>
14 * Abstract AbstractCdmEditorViewPart class.
15 * </p>
16 *
17 * @author n.hoffmann
18 * @created Sep 21, 2010
19 * @version 1.0
20 */
21 public abstract class AbstractCdmEditorViewPart extends AbstractCdmViewPart {
22
23 /*
24 * (non-Javadoc)
25 *
26 * @see
27 * eu.etaxonomy.taxeditor.model.AbstractCdmViewPart#createPartControl(org
28 * .eclipse.swt.widgets.Composite)
29 */
30 /** {@inheritDoc} */
31 @Override
32 public void createPartControl(Composite parent) {
33
34 super.createPartControl(parent);
35
36 // show viewer if there is an open editor
37 // if(getEditor() != null){
38 // showViewer(getEditor(), new StructuredSelection(getInitialInput()));
39 // }
40 }
41
42 /**
43 * <p>
44 * getEditor
45 * </p>
46 *
47 * @return the currently active editor
48 */
49 public IEditorPart getEditor() {
50 return StoreUtil.getActiveEditor();
51 }
52
53 /** {@inheritDoc} */
54 @Override
55 public void changed(Object object) {
56 if (part instanceof AbstractCdmViewPart) {
57 ((AbstractCdmViewPart) part).changed(object);
58 } else {
59 IEditorPart editor = getEditor();
60 if (editor != null
61 && editor instanceof IDirtyMarkableSelectionProvider) {
62
63 ((IDirtyMarkableSelectionProvider) editor).changed(object);
64
65 }
66 }
67 }
68
69 }