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