p2izing the editor
[taxeditor.git] / eclipseprojects / eu.etaxonomy.taxeditor.designproposal2 / src / eu / etaxonomy / taxeditor / designproposal2 / view / MultiPagePilosellaView.java
1 package eu.etaxonomy.taxeditor.designproposal2.view;
2
3 import org.eclipse.core.runtime.IProgressMonitor;
4 import org.eclipse.ui.IEditorInput;
5 import org.eclipse.ui.IEditorSite;
6 import org.eclipse.ui.PartInitException;
7 import org.eclipse.ui.part.MultiPageEditorPart;
8
9 import eu.etaxonomy.taxeditor.designproposal2.model.NameEditorInput;
10 import eu.etaxonomy.taxeditor.designproposal2.model.TaxonName;
11
12 public class MultiPagePilosellaView extends MultiPageEditorPart {
13
14 public static final String ID = "eu.etaxonomy.taxeditor.designproposal2.view.mpetestview";
15 private TaxonName taxonname;
16
17 @Override
18 protected void createPages() {
19 try {
20 if (taxonname.getName() == "Carduus") {
21 this.setPartName("Carduus L.");
22 addPage(0, new CarduusEditorView(), new NameEditorInput(new TaxonName()));
23 } else if (taxonname.getName() == "Pilosella") {
24 this.setPartName("Pilosella fuscoatra (Nägeli & Peter) Soják");
25 addPage(0, new PilosellaEditorView(), new NameEditorInput(new TaxonName()));
26 } else {
27 this.setPartName("New taxon");
28 addPage(0, new NameEditorView(), new NameEditorInput(new TaxonName()));
29 }
30 setPageText(0, "Name");
31
32 addPage(1, new EmptyEditorView(), new NameEditorInput(new TaxonName()));
33 setPageText(1, "Facts");
34
35 addPage(2, new EmptyEditorView(), new NameEditorInput(new TaxonName()));
36 setPageText(2, "Specimen");
37
38 addPage(3, new EmptyEditorView(), new NameEditorInput(new TaxonName()));
39 setPageText(3, "Geographic");
40
41 } catch (PartInitException e) {
42 // TODO Auto-generated catch block
43 e.printStackTrace();
44 }
45 }
46
47 @Override
48 public void doSave(IProgressMonitor monitor) {
49 // TODO Auto-generated method stub
50
51 }
52
53 @Override
54 public void doSaveAs() {
55 // TODO Auto-generated method stub
56
57 }
58
59 @Override
60 public boolean isSaveAsAllowed() {
61 // TODO Auto-generated method stub
62 return false;
63 }
64
65 @Override
66 public void init(IEditorSite site, IEditorInput input) throws PartInitException {
67
68 if (!(input instanceof IEditorInput))
69 throw new PartInitException(
70 "Invalid Input: Must be IFileEditorInput");
71
72 if (input.getAdapter(TaxonName.class) != null) {
73 taxonname = (TaxonName) input.getAdapter(TaxonName.class);
74 // System.out.println(taxonname.getCreatedWho());
75 // taxonname.addCdmEventListener(this);
76 } else {
77
78 taxonname = null;
79 }
80
81
82 setSite(site);
83 setInput(input);
84 }
85
86 }