return section;
}
- public NonViralNameDetailSection createNonViralNameDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style){
- NonViralNameDetailSection section = new NonViralNameDetailSection(this, conversation, parentElement, selectionProvider, style);
+ public NonViralNameDetailSection createNonViralNameDetailSection(ConversationHolder conversation, ICdmFormElement parentElement, ISelectionProvider selectionProvider, boolean nameChoosable, int style){
+ NonViralNameDetailSection section = new NonViralNameDetailSection(this, conversation, parentElement, selectionProvider, nameChoosable, style);
addAndAdaptSection(parentElement, section);
return section;
}
implements ITaxonBaseDetailSection {
private TaxonBase taxonBase;
+ boolean nameChoosable = false;
/**
* <p>Constructor for NonViralNameDetailSection.</p>
* @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
* @param parentElement a {@link eu.etaxonomy.taxeditor.ui.element.ICdmFormElement} object.
* @param selectionProvider a {@link org.eclipse.jface.viewers.ISelectionProvider} object.
+ * @param nameChoosable if <code>true</code> adds a button to choose the displayed name
* @param style a int.
*/
public NonViralNameDetailSection(CdmFormFactory formFactory, ConversationHolder conversation,
- ICdmFormElement parentElement, ISelectionProvider selectionProvider, int style) {
+ ICdmFormElement parentElement, ISelectionProvider selectionProvider, boolean nameChoosable, int style) {
super(formFactory, conversation, parentElement, selectionProvider, style);
+ this.nameChoosable = nameChoosable;
}
@Override
protected Control createToolbar() {
- ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
-
- //choose name
- Action chooseNameAction = new Action("Choose Name", IAction.AS_PUSH_BUTTON){
- @Override
- public void run() {
- TaxonNameBase taxonName = NameSelectionDialog.select(getShell(), getConversationHolder(), null);
- if(taxonName!=null){
- if(taxonName.isInstanceOf(NonViralName.class)){
- CdmStore.getService(ITaxonNodeService.class).list(TaxonNode.class, null, null, null, null);
- NonViralName nonViralName = HibernateProxyHelper.deproxy(taxonName, NonViralName.class);
- taxonBase.setName(nonViralName);
- // taxonBase.getTitleCache();
- setEntity(nonViralName);
- firePropertyChangeEvent(NonViralNameDetailSection.this);
- }
- else{
- MessagingUtils.warningDialog("Invalid name", this, "The selected name can not be used for this taxon.");
- }
- }
- }
- };
- chooseNameAction.setToolTipText("Choose name for this taxon");
- chooseNameAction.setImageDescriptor(ImageResources.getImageDescriptor(ImageResources.BROWSE_ICON));
-
- toolBarManager.add(chooseNameAction);
+ ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
+
+ if(nameChoosable){
+ //choose name
+ Action chooseNameAction = new Action("Choose Name", IAction.AS_PUSH_BUTTON){
+ @Override
+ public void run() {
+ TaxonNameBase taxonName = NameSelectionDialog.select(getShell(), getConversationHolder(), null);
+ if(taxonName!=null){
+ if(taxonName.isInstanceOf(NonViralName.class)){
+ CdmStore.getService(ITaxonNodeService.class).list(TaxonNode.class, null, null, null, null);
+ NonViralName nonViralName = HibernateProxyHelper.deproxy(taxonName, NonViralName.class);
+ taxonBase.setName(nonViralName);
+ // taxonBase.getTitleCache();
+ setEntity(nonViralName);
+ firePropertyChangeEvent(NonViralNameDetailSection.this);
+ }
+ else{
+ MessagingUtils.warningDialog("Invalid name", this, "The selected name can not be used for this taxon.");
+ }
+ }
+ }
+ };
+ chooseNameAction.setToolTipText("Choose name for this taxon");
+ chooseNameAction.setImageDescriptor(ImageResources.getImageDescriptor(ImageResources.BROWSE_ICON));
+
+ toolBarManager.add(chooseNameAction);
+ }
//clone
if(getEntity() != null && checkForMultipleNameUsages(getEntity())){
ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
- NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(getConversationHolder(), parent, this,
- ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ NonViralNameDetailSection nonViralNameSection = formFactory
+ .createNonViralNameDetailSection(getConversationHolder(), parent, this, true,
+ ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,
private void createNameSections(RootElement parent) {
destroySections();
- NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(getConversationHolder(), parent, this,
- ExpandableComposite.TWISTIE | ExpandableComposite.EXPANDED);
+ NonViralNameDetailSection nonViralNameSection = formFactory.createNonViralNameDetailSection(
+ getConversationHolder(), parent, this, false, ExpandableComposite.TWISTIE
+ | ExpandableComposite.EXPANDED);
formFactory.createHorizontalSeparator(parent, SWT.BORDER);
NomenclaturalReferenceDetailSection referenceDetailSection = formFactory.createNomenclaturalReferenceDetailSection(getConversationHolder(), parent, this,