Revision 56b382bd
Added by Niels Hoffmann almost 14 years ago
taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/newWizards/NewTaxonNodeWizard.java | ||
---|---|---|
10 | 10 |
import org.eclipse.jface.wizard.Wizard; |
11 | 11 |
import org.eclipse.ui.INewWizard; |
12 | 12 |
import org.eclipse.ui.IWorkbench; |
13 |
import org.eclipse.ui.PartInitException; |
|
14 | 13 |
|
15 | 14 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
16 | 15 |
import eu.etaxonomy.cdm.model.taxon.ITreeNode; |
... | ... | |
38 | 37 |
private boolean openEmptyEditor = false; |
39 | 38 |
|
40 | 39 |
public NewTaxonNodeWizard() { |
41 |
this.setWindowTitle("New Taxon Node"); |
|
40 |
this.setWindowTitle("New Taxon"); |
|
41 |
selection = getNavigatorSelection(); |
|
42 | 42 |
} |
43 | 43 |
|
44 |
|
|
45 |
|
|
46 | 44 |
/** |
47 |
* @param selection |
|
45 |
* Retrieve the current selection from taxon navigator |
|
46 |
* |
|
47 |
* @return |
|
48 | 48 |
*/ |
49 |
public NewTaxonNodeWizard(StructuredSelection selection) { |
|
50 |
this(); |
|
51 |
this.selection = selection; |
|
49 |
private IStructuredSelection getNavigatorSelection() { |
|
50 |
StructuredSelection selection = null; |
|
51 |
TaxonNavigator navigator = NavigationUtil.getNavigator(false); |
|
52 |
|
|
53 |
if(navigator != null){ |
|
54 |
selection = (StructuredSelection) navigator.getCommonViewer().getSelection(); |
|
55 |
} |
|
56 |
|
|
57 |
return selection; |
|
52 | 58 |
} |
53 | 59 |
|
54 | 60 |
|
... | ... | |
56 | 62 |
@Override |
57 | 63 |
public boolean performFinish() { |
58 | 64 |
TaxonNavigator taxonNavigator; |
59 |
try { |
|
60 |
taxonNavigator = (TaxonNavigator) NavigationUtil.getView(TaxonNavigator.ID); |
|
61 |
} catch (PartInitException e) { |
|
62 |
logger.error(e); |
|
63 |
throw new RuntimeException(e); |
|
64 |
} |
|
65 |
taxonNavigator = (TaxonNavigator) NavigationUtil.showView(TaxonNavigator.ID); |
|
65 | 66 |
|
66 | 67 |
if(page.getTaxonName() == null || page.getTaxonName().getFullTitleCache().length() == 0){ |
67 | 68 |
openEmptyEditor = true; |
68 | 69 |
}else{ |
69 |
AbstractOperation operation = new CreateTaxonNodeOperation("Create Taxon Node",
|
|
70 |
AbstractOperation operation = new CreateTaxonNodeOperation("Create Taxon", |
|
70 | 71 |
NavigationUtil.getUndoContext(), page.getParentNode(), page.getTaxonName(), this, taxonNavigator); |
71 | 72 |
NavigationUtil.executeOperation(operation); |
72 | 73 |
|
Also available in: Unified diff