taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/handler/DeleteTaxonNodeHandler.java -text
taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/handler/EditTaxonHandler.java -text
taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/handler/MoveTaxonHandler.java -text
-taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/handler/NewTaxonomicTreeWizard.java -text
+taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/handler/NewTaxonNodeHandler.java -text
+taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/handler/NewTaxonomicTreeHandler.java -text
taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/handler/NewTaxonomicTreeWizardPage.java -text
taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/handler/QuickCreateChildTaxonHandler.java -text
taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/handler/RefreshTreeHandler.java -text
taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchBar.java -text
taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchResultLabelProvider.java -text
taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/search/SearchResultView.java -text
+taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/newWizards/NewTaxonNodeWizard.java -text
+taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/newWizards/NewTaxonNodeWizardPage.java -text
+taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/newWizards/NewTaxonomicTreeWizard.java -text
+taxeditor-navigation/src/main/java/eu/etaxonomy/taxeditor/newWizards/NewTaxonomicTreeWizardPage.java -text
taxeditor-navigation/src/main/java/log4j.properties -text
taxeditor-navigation/src/test/java/eu/etaxonomy/taxeditor/navigation/Application.java -text
taxeditor-navigation/src/test/java/eu/etaxonomy/taxeditor/navigation/ApplicationActionBarAdvisor.java -text
<extension
point="org.eclipse.ui.menus">
<menuContribution
- locationURI="popup:eu.etaxonomy.taxeditor.navigation.search.searchResultView">
- <command
- commandId="eu.etaxonomy.taxeditor.navigation.command.editTaxon"
- label="Edit"
- style="push">
- </command>
- </menuContribution>
- <menuContribution
- locationURI="toolbar:org.eclipse.ui.main.toolbar">
- <toolbar
- id="eu.etaxonomy.taxeditor.navigation.search.toolbar">
- <control
- class="eu.etaxonomy.taxeditor.navigation.search.SearchBar">
- </control>
- </toolbar>
- </menuContribution>
- <menuContribution
- locationURI="menu:org.eclipse.ui.main.menu.file?before=eu.etaxonomy.taxeditor.application.filemenu.separator">
+ locationURI="menu:org.eclipse.ui.main.menu.file">
<separator
- name="eu.etaxonomy.taxeditor.navigation.separator"
+ name="eu.etaxonomy.taxeditor.navigation.recentnames.separator"
visible="true">
</separator>
<dynamic
commandId="eu.etaxonomy.taxeditor.navigation.command.showTaxonomicTreeView"
label="Taxonomic Tree"
style="push">
- </command>
+ </command>
</menuContribution>
<menuContribution
- locationURI="popup:eu.etaxonomy.taxeditor.navigation.navigatorpopup">
+ locationURI="popup:eu.etaxonomy.taxeditor.navigation.search.searchResultView">
<command
- commandId="org.eclipse.ui.newWizard"
- label="New"
+ commandId="eu.etaxonomy.taxeditor.navigation.command.editTaxon"
+ label="Edit"
style="push">
</command>
+ </menuContribution>
+ <menuContribution
+ locationURI="popup:eu.etaxonomy.taxeditor.navigation.navigatorpopup">
+ <menu
+ id="eu.etaxonomy.navigation.menu.new"
+ label="New">
+ <command
+ commandId="eu.etaxonomy.taxeditor.navigation.newTaxonNode"
+ label="Taxon Node"
+ style="push">
+ </command>
+ <separator
+ name="eu.etaxonomy.navigation.menu.new.separator1"
+ visible="true">
+ </separator>
+ <command
+ commandId="eu.etaxonomy.taxeditor.navigation.newTaxonomicTree"
+ id="eu.etaxonomy.taxeditor.navigation.menu.nu.new.taxonomicTree"
+ label="Taxonomic Tree"
+ style="push">
+ </command>
+ </menu>
<separator
name="taxeditor-navigation.separator1"
visible="true">
<command
commandId="eu.etaxonomy.taxeditor.navigation.command.editTaxon"
label="Edit"
- style="push">
+ style="push">
+ <separator
+ name="taxeditor-navigation.separator4">
+ </separator>
<visibleWhen>
<reference
definitionId="isTaxonNode">
</command>
<command
commandId="eu.etaxonomy.taxeditor.navigation.command.moveTaxon"
- label="Move Taxon"
+ label="Move Taxon (with Subtree)"
style="push">
<visibleWhen>
<reference
style="push">
</command>
</menuContribution>
+ <menuContribution
+ locationURI="toolbar:org.eclipse.ui.main.toolbar">
+ <toolbar
+ id="eu.etaxonomy.taxeditor.navigation.search.toolbar">
+ <control
+ class="eu.etaxonomy.taxeditor.navigation.search.SearchBar">
+ </control>
+ </toolbar>
+ </menuContribution>
+ <menuContribution
+ locationURI="menu:eu.etaxonomy.navigation.menu.new">
+ <command
+ commandId="eu.etaxonomy.taxeditor.navigation.newTaxonNode"
+ label="Taxon Node"
+ style="push">
+ </command>
+ <separator
+ name="eu.etaxonomy.navigation.menu.new.separator1"
+ visible="true">
+ </separator>
+ <command
+ commandId="eu.etaxonomy.taxeditor.navigation.newTaxonomicTree"
+ id="eu.etaxonomy.taxeditor.navigation.menu.nu.new.taxonomicTree"
+ label="Taxonomic Tree"
+ style="push">
+ </command>
+ </menuContribution>
</extension>
<extension
point="org.eclipse.ui.commands">
name="Show Taxonomic Tree View">
</command>
</extension>
+ <extension
+ point="org.eclipse.ui.commands">
+ <command
+ defaultHandler="eu.etaxonomy.taxeditor.navigation.handler.NewTaxonNodeHandler"
+ id="eu.etaxonomy.taxeditor.navigation.newTaxonNode"
+ name="New Taxon Node">
+ </command>
+ <command
+ defaultHandler="eu.etaxonomy.taxeditor.navigation.handler.NewTaxonomicTreeHandler"
+ id="eu.etaxonomy.taxeditor.navigation.newTaxonomicTree"
+ name="New Taxonomic Tree">
+ </command>
+ </extension>
<extension
point="org.eclipse.ui.themes">
</primaryWizard-->
<wizard
category="eu.etaxonomy.taxeditor.new.category.cdm"
- class="eu.etaxonomy.taxeditor.navigation.handler.NewTaxonomicTreeWizard"
+ class="eu.etaxonomy.taxeditor.newWizards.NewTaxonomicTreeWizard"
+ hasPages="true"
icon="icons/tree_icon_small.jpg"
- id="taxeditor-navigation.wizard1"
+ id="eu.etaxonomy.taxeditor.new.taxonomicTree"
name="Taxonomic Tree">
</wizard>
+ <wizard
+ category="eu.etaxonomy.taxeditor.new.category.cdm"
+ class="eu.etaxonomy.taxeditor.newWizards.NewTaxonNodeWizard"
+ hasPages="true"
+ id="eu.etaxonomy.taxeditor.new.taxonNode"
+ name="Taxon Node">
+ </wizard>
</extension>
<extension
point="org.eclipse.core.expressions.definitions">
// do not show the current selection
List<UUID> excludeTaxa = new ArrayList<UUID>();
excludeTaxa.add(taxonNode.getTaxon().getUuid());
- parentTaxonNode = FilteredTaxonNodeSelectionDialog.selectTaxonNode(shell, "Choose new parent", excludeTaxa);
+ parentTaxonNode = FilteredTaxonNodeSelectionDialog.selectTaxonNode(shell, "Choose new parent", excludeTaxa, null);
if(parentTaxonNode != null){
--- /dev/null
+package eu.etaxonomy.taxeditor.navigation.handler;
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+
+import org.apache.log4j.Logger;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
+import eu.etaxonomy.taxeditor.newWizards.NewTaxonNodeWizard;
+
+/**
+ * @author n.hoffmann
+ * @created Sep 15, 2009
+ * @version 1.0
+ */
+public class NewTaxonNodeHandler extends AbstractHandler implements IHandler {
+ private static final Logger logger = Logger
+ .getLogger(NewTaxonNodeHandler.class);
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+
+ StructuredSelection selection = (StructuredSelection) HandlerUtil.getActiveMenuSelection(event);
+
+ NewTaxonNodeWizard wizard = new NewTaxonNodeWizard(selection);
+ WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), wizard);
+ int status = dialog.open();
+
+ if(status == Status.OK && wizard.openInEditor()){
+ NavigationUtil.openEditor(wizard.getTaxonNode());
+ // if name is empty
+// NavigationUtil.openEmpty(parentNodeUuid);
+ }
+
+ return null;
+ }
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.navigation.handler;
+
+import org.apache.log4j.Logger;
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.IHandler;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+import eu.etaxonomy.taxeditor.newWizards.NewTaxonNodeWizard;
+import eu.etaxonomy.taxeditor.newWizards.NewTaxonomicTreeWizard;
+
+/**
+ * @author n.hoffmann
+ * @created Sep 15, 2009
+ * @version 1.0
+ */
+public class NewTaxonomicTreeHandler extends AbstractHandler implements
+ IHandler {
+ private static final Logger logger = Logger
+ .getLogger(NewTaxonomicTreeHandler.class);
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+
+ WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), new NewTaxonomicTreeWizard());
+ dialog.open();
+
+ return null;
+ }
+}
import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
import eu.etaxonomy.taxeditor.operations.CreateTaxonNodeOperation;
import eu.etaxonomy.taxeditor.operations.IPostOperationEnabled;
-import eu.etaxonomy.taxeditor.parser.CdmParserUtil;
+import eu.etaxonomy.taxeditor.parser.ParserUtil;
import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
/**
//TaxonUtil.addChildTaxonBaseIsolated(parentTaxon.getUuid(), dialog.getValue());
- TaxonNameBase name = CdmParserUtil.parseReferencedName(dialog.getValue());
+ TaxonNameBase name = ParserUtil.parseReferencedName(dialog.getValue());
CreateTaxonNodeOperation operation;
try {
private static final Logger logger = Logger.getLogger(Root.class);\r
\r
public List<TaxonomicTree> getParentBeans() {\r
- List<TaxonomicTree> trees = CdmStore.getTaxonomicTrees();\r
+ List<TaxonomicTree> trees = CdmStore.getTaxonTreeService().list(null, null).getRecords();\r
return trees;\r
}\r
\r
if(string.length() == 0) return null; \r
\r
for (String uuid : string.split(" ")) {\r
- CdmBase cdmBaseObject = CdmStore.getTaxonService().getTaxonNodeByUuid(UUID.fromString(uuid));\r
+ CdmBase cdmBaseObject = CdmStore.getTaxonTreeService().getTaxonNodeByUuid(UUID.fromString(uuid));\r
if (cdmBaseObject == null) {\r
// is this a tree uuid?\r
- cdmBaseObject = CdmStore.getTaxonService().getTaxonomicTreeByUuid(UUID.fromString(uuid));\r
+ cdmBaseObject = CdmStore.getTaxonTreeService().getTaxonomicTreeByUuid(UUID.fromString(uuid));\r
\r
if(cdmBaseObject == null) return null;\r
}\r
*/\r
@Override\r
public void dispose() {\r
- conversation.commit();\r
- conversation.unregisterForDataStoreChanges(this);\r
- \r
super.dispose();\r
+ dataChangeBehavior = null;\r
+ if(conversation != null){\r
+ conversation.unregisterForDataStoreChanges(this);\r
+ }\r
}\r
\r
/* (non-Javadoc)\r
class ConfigurationSelectionListener extends SelectionAdapter{
- ITaxonServiceConfigurator configurator;
+ private ITaxonServiceConfigurator configurator;
/* (non-Javadoc)
* @see org.eclipse.swt.events.SelectionListener#widgetSelected(org.eclipse.swt.events.SelectionEvent)
SearchOption option = (SearchOption) e.widget.getData();
if(option == SearchOption.TAXON){
- getConfigurator().setDoTaxa(configurator.isDoTaxa() ? false : true);
+ getConfigurator().setDoTaxa(getConfigurator().isDoTaxa() ? false : true);
}
if(option == SearchOption.SYNONYM){
- getConfigurator().setDoSynonyms(configurator.isDoSynonyms() ? false : true);
+ getConfigurator().setDoSynonyms(getConfigurator().isDoSynonyms() ? false : true);
}
if(option == SearchOption.NAME){
- getConfigurator().setDoNamesWithoutTaxa(configurator.isDoNamesWithoutTaxa() ? false : true);
+ getConfigurator().setDoNamesWithoutTaxa(getConfigurator().isDoNamesWithoutTaxa() ? false : true);
}
if(option == SearchOption.COMMON_NAME){
- getConfigurator().setDoTaxaByCommonNames(configurator.isDoTaxaByCommonNames() ? false : true);
+ getConfigurator().setDoTaxaByCommonNames(getConfigurator().isDoTaxaByCommonNames() ? false : true);
}
saveConfigurator();
}
}
private void saveConfigurator(){
- PreferencesUtil.setSearchConfigurator(configurator);
+ PreferencesUtil.setSearchConfigurator(getConfigurator());
this.configurator = PreferencesUtil.getSearchConfigurator();
}
}
"eu.etaxonomy.taxeditor.navigation.search.searchResultView"; //$NON-NLS-1$\r
\r
private TableViewer resultViewer;\r
- \r
- private String queryString;\r
\r
private ConversationHolder conversation;\r
\r
--- /dev/null
+/**
+ *
+ */
+package eu.etaxonomy.taxeditor.newWizards;
+
+import org.apache.log4j.Logger;
+import org.eclipse.core.commands.operations.AbstractOperation;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+
+import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
+import eu.etaxonomy.taxeditor.operations.CreateTaxonNodeOperation;
+import eu.etaxonomy.taxeditor.operations.IPostOperationEnabled;
+
+/**
+ *
+ * @author n.hoffmann
+ * @created Sep 15, 2009
+ * @version 1.0
+ */
+public class NewTaxonNodeWizard extends Wizard implements INewWizard, IPostOperationEnabled {
+ private static final Logger logger = Logger.getLogger(NewTaxonNodeWizard.class);
+
+ private NewTaxonNodeWizardPage page;
+
+ private IStructuredSelection selection;
+
+ private IWorkbench workbench;
+
+ private TaxonNode generatedTaxonNode;
+
+ private boolean openEmptyEditor = false;
+
+ public NewTaxonNodeWizard() {
+ this.setWindowTitle("New Taxon Node");
+ }
+
+
+
+ /**
+ * @param selection
+ */
+ public NewTaxonNodeWizard(StructuredSelection selection) {
+ this();
+ this.selection = selection;
+ }
+
+
+
+ @Override
+ public boolean performFinish() {
+ if(page.getTaxonName() == null){
+ openEmptyEditor = true;
+ }else{
+ AbstractOperation operation = new CreateTaxonNodeOperation("Create Taxon Node",
+ NavigationUtil.getUndoContext(), page.getParentNode().getUuid(), page.getTaxonName(), this);
+ NavigationUtil.executeOperation(operation);
+
+ NavigationUtil.getNavigator().getCommonViewer().refresh();
+ }
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#addPages()
+ */
+ @Override
+ public void addPages() {
+ super.addPages();
+
+ page = new NewTaxonNodeWizardPage(selection);
+
+ addPage(page);
+ }
+
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.workbench = workbench;
+ this.selection = selection;
+ }
+
+ public boolean openInEditor(){
+ return page.openInEditor();
+ }
+
+ public boolean openEmpty(){
+ return openInEditor() && openEmptyEditor;
+ }
+
+ public TaxonNode getTaxonNode(){
+ return generatedTaxonNode;
+ }
+
+ /* (non-Javadoc)
+ * @see eu.etaxonomy.taxeditor.operations.IPostOperationEnabled#postOperation(eu.etaxonomy.cdm.model.common.CdmBase)
+ */
+ public boolean postOperation(CdmBase objectAffectedByOperation) {
+ generatedTaxonNode = (TaxonNode) objectAffectedByOperation;
+
+ return true;
+ }
+}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.newWizards;
+
+import org.apache.log4j.Logger;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.SelectionAdapter;
+import org.eclipse.swt.events.SelectionEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.swt.widgets.Text;
+
+import eu.etaxonomy.cdm.model.name.TaxonNameBase;
+import eu.etaxonomy.cdm.model.taxon.ITreeNode;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.cdm.model.taxon.TaxonomicTree;
+import eu.etaxonomy.taxeditor.dialogs.FilteredNameSelectionDialog;
+import eu.etaxonomy.taxeditor.dialogs.FilteredTaxonNodeSelectionDialog;
+import eu.etaxonomy.taxeditor.dialogs.FilteredTaxonSelectionDialog;
+import eu.etaxonomy.taxeditor.dialogs.FilteredTaxonomicTreeSelectionDialog;
+import eu.etaxonomy.taxeditor.editor.name.ParseHandler;
+import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
+
+/**
+ * @author n.hoffmann
+ * @created Sep 15, 2009
+ * @version 1.0
+ */
+public class NewTaxonNodeWizardPage extends WizardPage implements ModifyListener {
+
+ private static final Logger logger = Logger
+ .getLogger(NewTaxonNodeWizardPage.class);
+
+ private static final String BUTTON_TEXT_BROWSE = "Browse";
+
+ private TaxonomicTree taxonomicTree;
+
+ private ParseHandler parseHandler;
+
+ private TaxonNode parentTaxonNode;
+
+ private TaxonBase taxonBase;
+
+ private boolean reuseExistingTaxon = false;
+
+ private TaxonNameBase taxonName;
+
+ private boolean openInEditor = true;
+
+ private Button button_openInEditor;
+
+ private Text text_parentTaxonNode;
+
+ private Text text_reuseTaxon;
+
+ private Text text_taxonName;
+
+ private Text text_taxonomicTree;
+
+ private Button button_taxonName;
+
+ private Button button_reuseTaxon;
+
+ private Button button_toggleReuseTaxon;
+
+ /**
+ * @param pageName
+ */
+ protected NewTaxonNodeWizardPage(IStructuredSelection selection) {
+ super("New Taxon Node");
+
+ if(selection != null && selection.size() == 1){
+ if(selection.getFirstElement() instanceof ITreeNode){
+ ITreeNode parentNode = (ITreeNode) selection.getFirstElement();
+
+ if(parentNode instanceof TaxonNode){
+ parentTaxonNode = (TaxonNode) parentNode;
+ taxonomicTree = parentTaxonNode.getTaxonomicTree();
+ }else{
+ taxonomicTree = (TaxonomicTree) parentNode;
+ }
+ }
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NULL);
+
+ GridLayout layout = new GridLayout(3, false);
+ composite.setLayout(layout);
+
+ // taxonomic tree
+ Label label_taxonomicTree = new Label(composite, SWT.NULL);
+ label_taxonomicTree.setText("Taxonomic Tree");
+
+ text_taxonomicTree = new Text(composite, SWT.BORDER | SWT.SINGLE);
+ text_taxonomicTree.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
+ text_taxonomicTree.setEnabled(false);
+ text_taxonomicTree.setText(taxonomicTree != null ? taxonomicTree.getTitleCache() : "");
+
+ Button button_taxonomicTree = new Button(composite, SWT.PUSH);
+ button_taxonomicTree.setText(BUTTON_TEXT_BROWSE);
+ button_taxonomicTree.addSelectionListener(new TaxonomicTreeSelector());
+
+
+ // parental node
+ Label label_parentTaxonNode = new Label(composite, SWT.NULL);
+ label_parentTaxonNode.setText("Parent Taxon Node");
+
+ text_parentTaxonNode = new Text(composite, SWT.BORDER | SWT.SINGLE);
+ text_parentTaxonNode.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
+ text_parentTaxonNode.setEnabled(false);
+ text_parentTaxonNode.setText(parentTaxonNode != null ? parentTaxonNode.getTaxon().getName().getTitleCache() : "");
+
+ Button button_parentTaxonNode = new Button(composite, SWT.PUSH);
+ button_parentTaxonNode.setText(BUTTON_TEXT_BROWSE);
+ button_parentTaxonNode.addSelectionListener(new TaxonNodeSelector());
+
+ // existing taxon
+ Composite container_label_reuseTaxon = new Composite(composite, SWT.NULL);
+ container_label_reuseTaxon.setLayout(new GridLayout(2, false));
+
+ button_toggleReuseTaxon = new Button(container_label_reuseTaxon, SWT.CHECK);
+ button_toggleReuseTaxon.addSelectionListener(new ToggleReuseTaxonSelector());
+ button_toggleReuseTaxon.setSelection(reuseExistingTaxon);
+
+ Label label_reuseTaxon = new Label(container_label_reuseTaxon, SWT.NULL);
+ label_reuseTaxon.setText("Reuse Existing Taxon");
+ label_reuseTaxon.setEnabled(false);
+
+ text_reuseTaxon = new Text(composite, SWT.BORDER | SWT.SINGLE);
+ text_reuseTaxon.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
+ text_reuseTaxon.setEnabled(false);
+
+
+ button_reuseTaxon = new Button(composite, SWT.PUSH);
+ button_reuseTaxon.setText(BUTTON_TEXT_BROWSE);
+ button_reuseTaxon.addSelectionListener(new TaxonSelector());
+ button_reuseTaxon.setEnabled(false);
+
+ // name
+ Label label_taxonName = new Label(composite, SWT.NULL);
+ label_taxonName.setText("Taxon Name");
+
+ text_taxonName = new Text(composite, SWT.BORDER | SWT.SINGLE);
+ text_taxonName.addModifyListener(this);
+ text_taxonName.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, true));
+
+ button_taxonName = new Button(composite, SWT.PUSH);
+ button_taxonName.setText(BUTTON_TEXT_BROWSE);
+ button_taxonName.addSelectionListener(new TaxonNameSelector());
+
+ // open in editor
+ Composite container_openInEditor = new Composite(composite, SWT.NULL);
+ container_openInEditor.setLayout(new GridLayout(2, false));
+ button_openInEditor = new Button(container_openInEditor, SWT.CHECK);
+ button_openInEditor.addSelectionListener(new OpenInEditorSelector());
+ button_openInEditor.setSelection(openInEditor);
+
+ Label label_openInEditor = new Label(container_openInEditor, SWT.NULL);
+ label_openInEditor.setText("Open Taxon in Editor");
+
+ // initialize the parse handler
+ parseHandler = ParseHandler.NewInstance(text_taxonName, taxonName);
+
+ // set focus to name field
+ text_taxonName.setFocus();
+
+ setControl(composite);
+ }
+
+ /**
+ * @return the taxon
+ */
+ public TaxonBase getTaxon() {
+ return taxonBase;
+ }
+
+ /**
+ * @return the name
+ */
+ public TaxonNameBase getTaxonName() {
+ return taxonName;
+ }
+
+ /**
+ * @return
+ */
+ public ITreeNode getParentNode() {
+ return parentTaxonNode != null ? parentTaxonNode : taxonomicTree;
+ }
+
+ public boolean openInEditor(){
+ return openInEditor;
+ }
+
+
+ /*
+ * SELECTION ADAPTERS
+ */
+
+ private class TaxonomicTreeSelector extends SelectionAdapter{
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ super.widgetSelected(e);
+ taxonomicTree = FilteredTaxonomicTreeSelectionDialog.selectTaxonomicTree(NavigationUtil.getShell());
+ text_taxonomicTree.setText(taxonomicTree.getTitleCache());
+ }
+ }
+
+ private class TaxonNodeSelector extends SelectionAdapter{
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ super.widgetSelected(e);
+ parentTaxonNode = FilteredTaxonNodeSelectionDialog.selectTaxonNode(NavigationUtil.getShell(), "Select parent", null, null);
+ text_parentTaxonNode.setText(parentTaxonNode.getTaxon().getTitleCache());
+ }
+
+ }
+
+ private class TaxonSelector extends SelectionAdapter{
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ super.widgetSelected(e);
+ taxonBase = FilteredTaxonSelectionDialog.selectTaxon(NavigationUtil.getShell());
+ text_reuseTaxon.setText(taxonBase.getTitleCache());
+ }
+ }
+
+ private class TaxonNameSelector extends SelectionAdapter{
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ super.widgetSelected(e);
+ taxonName = FilteredNameSelectionDialog.selectName(NavigationUtil.getShell(), null);
+ text_taxonName.setText(taxonName.getTitleCache());
+ }
+ }
+
+ private class OpenInEditorSelector extends SelectionAdapter{
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ super.widgetSelected(e);
+ openInEditor = button_openInEditor.getSelection();
+ }
+ }
+
+ private class ToggleReuseTaxonSelector extends SelectionAdapter{
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
+ */
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ super.widgetSelected(e);
+
+ if(button_toggleReuseTaxon.getSelection()){
+ // enable reuse Taxon
+ text_reuseTaxon.setEnabled(true);
+ button_reuseTaxon.setEnabled(true);
+ // disable name
+ text_taxonName.setEnabled(false);
+ button_taxonName.setEnabled(false);
+ }else{
+ // disable reuse Taxon
+ text_reuseTaxon.setEnabled(false);
+ button_reuseTaxon.setEnabled(false);
+ // enable name
+ text_taxonName.setEnabled(true);
+ button_taxonName.setEnabled(true);
+ }
+
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
+ */
+ public void modifyText(ModifyEvent e) {
+ taxonName = parseHandler.parse();
+ }
+}
* See LICENSE.TXT at the top of this package for the full license terms.
*/
-package eu.etaxonomy.taxeditor.navigation.handler;
+package eu.etaxonomy.taxeditor.newWizards;
import org.apache.log4j.Logger;
-import org.eclipse.core.commands.common.NotDefinedException;
import org.eclipse.core.commands.operations.AbstractOperation;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.wizard.Wizard;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.IWorkbench;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
import eu.etaxonomy.taxeditor.operations.CreateTaxonomicTreeOperation;
* @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
*/
public void init(IWorkbench workbench, IStructuredSelection selection) {
- // TODO Auto-generated method stub
-
+
}
}
--- /dev/null
+// $Id$
+/**
+* Copyright (C) 2007 EDIT
+* European Distributed Institute of Taxonomy
+* http://www.e-taxonomy.eu
+*
+* The contents of this file are subject to the Mozilla Public License Version 1.1
+* See LICENSE.TXT at the top of this package for the full license terms.
+*/
+
+package eu.etaxonomy.taxeditor.newWizards;
+
+
+import java.util.UUID;
+
+import org.apache.log4j.Logger;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.events.ModifyEvent;
+import org.eclipse.swt.events.ModifyListener;
+import org.eclipse.swt.events.MouseAdapter;
+import org.eclipse.swt.events.MouseEvent;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Button;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Text;
+
+import eu.etaxonomy.cdm.model.reference.ReferenceBase;
+import eu.etaxonomy.taxeditor.dialogs.FilteredReferenceSelectionDialog;
+import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
+
+/**
+ * @author n.hoffmann
+ * @created 23.06.2009
+ * @version 1.0
+ */
+public class NewTaxonomicTreeWizardPage extends WizardPage implements ModifyListener {
+ private static final Logger logger = Logger
+ .getLogger(NewTaxonomicTreeWizardPage.class);
+
+ private Text text_treeLabel;
+
+ private Text text_reference;
+
+ private Button button_browseReference;
+
+ private UUID referenceUuid;
+
+ private Text text_microReference;
+
+ /**
+ * @param pageName
+ */
+ protected NewTaxonomicTreeWizardPage(String pageName) {
+ super(pageName);
+ this.setTitle("Taxonomic Tree");
+
+ this.setDescription("Create a new Taxonomic Tree.");
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+
+ setPageComplete(false);
+
+ Composite composite = new Composite(parent, SWT.NONE);
+ GridLayout gridLayout = new GridLayout();
+ gridLayout.numColumns = 3;
+ composite.setLayout(gridLayout);
+
+ CLabel label_treeLabel = new CLabel(composite, SWT.NULL);
+ label_treeLabel.setText("Label:");
+
+ text_treeLabel = new Text(composite, SWT.BORDER);
+ text_treeLabel.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
+ text_treeLabel.addModifyListener(this);
+
+ // FIXME this is a rudimentary implementation. Add missing fields.
+
+ CLabel label_reference = new CLabel(composite, SWT.NULL);
+ label_reference.setText("Reference:");
+
+ text_reference = new Text(composite, SWT.BORDER);
+ text_reference.setEnabled(false);
+ text_reference.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+
+ button_browseReference = new Button(composite, SWT.PUSH);
+ button_browseReference.setText("Browse...");
+ button_browseReference.addMouseListener(new MouseAdapter(){
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.MouseAdapter#mouseUp(org.eclipse.swt.events.MouseEvent)
+ */
+ @Override
+ public void mouseUp(MouseEvent e) {
+ // TODO Auto-generated method stub
+ super.mouseUp(e);
+ logger.warn("Open reference search dialog");
+
+ ReferenceBase reference = FilteredReferenceSelectionDialog.selectReference(NavigationUtil.getShell(), null);
+
+ referenceUuid = reference.getUuid();
+
+ text_reference.setText(reference.getTitleCache());
+ }
+
+ });
+
+ CLabel label_microReference = new CLabel(composite, SWT.NULL);
+ label_microReference.setText("Reference Detail");
+
+ text_microReference = new Text(composite, SWT.BORDER);
+ text_microReference.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false, 2, 1));
+
+ setControl(composite);
+ }
+
+ /**
+ * @return the text_treeLabel
+ */
+ public String getTreeLabel() {
+ return text_treeLabel.getText();
+ }
+
+ /**
+ * @return
+ */
+ public String getMicroReference() {
+ return text_microReference.getText();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.swt.events.ModifyListener#modifyText(org.eclipse.swt.events.ModifyEvent)
+ */
+ public void modifyText(ModifyEvent e) {
+ if(getTreeLabel().trim().length() > 0){
+ setPageComplete(true);
+ }
+ }
+
+ /**
+ * @return
+ */
+ public UUID getReferenceUuid() {
+ return referenceUuid;
+ }
+}