Revision b0ce5b17
Added by Patrick Plitzner over 10 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/AbstractCdmEditorViewPart.java | ||
---|---|---|
1 | 1 |
/** |
2 |
*
|
|
2 |
* |
|
3 | 3 |
*/ |
4 | 4 |
package eu.etaxonomy.taxeditor.view; |
5 | 5 |
|
... | ... | |
7 | 7 |
import org.eclipse.ui.IEditorPart; |
8 | 8 |
|
9 | 9 |
import eu.etaxonomy.taxeditor.editor.ISecuredEditor; |
10 |
import eu.etaxonomy.taxeditor.model.AbstractUtility; |
|
10 | 11 |
import eu.etaxonomy.taxeditor.model.IDirtyMarkableSelectionProvider; |
11 |
import eu.etaxonomy.taxeditor.store.StoreUtil; |
|
12 | 12 |
|
13 | 13 |
/** |
14 | 14 |
* <p> |
15 | 15 |
* Abstract AbstractCdmEditorViewPart class. |
16 | 16 |
* </p> |
17 |
*
|
|
17 |
* |
|
18 | 18 |
* @author n.hoffmann |
19 | 19 |
* @created Sep 21, 2010 |
20 | 20 |
* @version 1.0 |
... | ... | |
23 | 23 |
|
24 | 24 |
/* |
25 | 25 |
* (non-Javadoc) |
26 |
*
|
|
26 |
* |
|
27 | 27 |
* @see |
28 | 28 |
* eu.etaxonomy.taxeditor.model.AbstractCdmViewPart#createPartControl(org |
29 | 29 |
* .eclipse.swt.widgets.Composite) |
... | ... | |
31 | 31 |
/** {@inheritDoc} */ |
32 | 32 |
@Override |
33 | 33 |
public void createPartControl(Composite parent) { |
34 |
|
|
35 | 34 |
super.createPartControl(parent); |
36 |
|
|
37 | 35 |
} |
38 | 36 |
|
39 | 37 |
/** |
40 | 38 |
* <p> |
41 | 39 |
* getEditor |
42 | 40 |
* </p> |
43 |
*
|
|
41 |
* |
|
44 | 42 |
* @return the currently active editor |
45 | 43 |
*/ |
46 | 44 |
public IEditorPart getEditor() { |
47 |
return StoreUtil.getActiveEditor();
|
|
45 |
return AbstractUtility.getActiveEditor();
|
|
48 | 46 |
} |
49 |
|
|
47 |
|
|
50 | 48 |
/** {@inheritDoc} */ |
51 | 49 |
@Override |
52 | 50 |
public void setFocus() { |
53 | 51 |
super.setFocus(); |
54 |
|
|
55 |
if(getEditor() != null && ISecuredEditor.class.isAssignableFrom(getEditor().getClass())){
|
|
52 |
|
|
53 |
if(getEditor() != null && ISecuredEditor.class.isAssignableFrom(getEditor().getClass())){ |
|
56 | 54 |
boolean doEnable = ((ISecuredEditor)getEditor()).permissionsSatisfied(); |
57 | 55 |
setEnabled(doEnable); |
58 | 56 |
} |
59 |
}
|
|
57 |
}
|
|
60 | 58 |
|
61 |
/** {@inheritDoc} */ |
|
62 |
@Override |
|
63 |
public void changed(Object object) { |
|
64 |
if (part instanceof AbstractCdmViewPart) { |
|
65 |
((AbstractCdmViewPart) part).changed(object); |
|
66 |
} else { |
|
67 |
IEditorPart editor = getEditor(); |
|
68 |
if (editor != null |
|
69 |
&& editor instanceof IDirtyMarkableSelectionProvider) { |
|
70 |
|
|
71 |
((IDirtyMarkableSelectionProvider) editor).changed(object); |
|
72 |
|
|
73 |
} |
|
74 |
} |
|
75 |
} |
|
59 |
/** {@inheritDoc} */ |
|
60 |
@Override |
|
61 |
public void changed(Object object) { |
|
62 |
if (part instanceof AbstractCdmViewPart) { |
|
63 |
((AbstractCdmViewPart) part).changed(object); |
|
64 |
} else { |
|
65 |
IEditorPart editor = getEditor(); |
|
66 |
if (editor != null && editor instanceof IDirtyMarkableSelectionProvider) { |
|
67 |
((IDirtyMarkableSelectionProvider) editor).changed(object); |
|
68 |
} |
|
69 |
} |
|
70 |
} |
|
76 | 71 |
|
77 | 72 |
} |
Also available in: Unified diff
merged trunk into branch