1 package eu
.etaxonomy
.taxeditor
.prototype2
.view
;
3 import java
.beans
.PropertyChangeEvent
;
4 import java
.beans
.PropertyChangeListener
;
6 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
7 import org
.eclipse
.ui
.IEditorInput
;
8 import org
.eclipse
.ui
.IEditorSite
;
9 import org
.eclipse
.ui
.PartInitException
;
10 import org
.eclipse
.ui
.part
.MultiPageEditorPart
;
12 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
16 * Generates the tabbed editor with Name view on top and tabs for
17 * "Facts", "Specimen", "Geography", etc.
22 public class MultiPageTaxonView
extends MultiPageEditorPart
{
24 public static final String ID
= "eu.etaxonomy.taxeditor.prototype2.view.multipagetaxonview";
28 protected void createPages() {
31 addPage(0, new NameEditorView(), getEditorInput());
32 setPageText(0, "Name");
34 addPage(1, new NameEditorView(), getEditorInput());
35 setPageText(1, "Descriptive");
37 addPage(2, new NameEditorView(), getEditorInput());
38 setPageText(2, "Concepts");
40 addPage(3, new NameEditorView(), getEditorInput());
41 setPageText(3, "Geographic");
43 } catch (PartInitException e
) {
44 // TODO Auto-generated catch block
52 public void doSave(IProgressMonitor monitor
) {
53 // TODO Auto-generated method stub
58 public void doSaveAs() {
59 // TODO Auto-generated method stub
64 public boolean isSaveAsAllowed() {
65 // TODO Auto-generated method stub
70 public void init(IEditorSite site
, IEditorInput input
) throws PartInitException
{
72 if (!(input
instanceof IEditorInput
))
73 throw new PartInitException(
74 "Invalid Input: Must be IFileEditorInput");
76 // Get taxon from editor input
77 if (input
.getAdapter(Taxon
.class) != null) {
78 taxon
= (Taxon
) input
.getAdapter(Taxon
.class);
83 // Listen for name changes fired when taxon is saved;
84 // change tab for this taxon editor accordingly
85 taxon
.addPropertyChangeListener("name", new PropertyChangeListener() {
86 public void propertyChange(PropertyChangeEvent e
) {
87 setPartName(taxon
.getName().getTitleCache());
91 // Any taxon that has been saved will by necessity have a name;
92 // only a new taxon will not
93 if (taxon
.getName().getTitleCache() == null)
94 setPartName("New taxon");
96 setPartName(taxon
.getName().getTitleCache());