Project

General

Profile

« Previous | Next » 

Revision c158c2cf

Added by Cherian Mathew over 10 years ago

SpecimenOrObservationTypeSelectionDialog : new dialog which allows user to choose from known SpecimenOrObservationTypes
AbstractFilteredCdmResourceSelectionDialog: added check to make sure that wizard does return a non-null entity

View differences:

.gitattributes
1258 1258
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/PolytomousKeySelectionDialog.java -text
1259 1259
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/ReferenceSelectionDialog.java -text
1260 1260
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/SelectionDialogFactory.java -text
1261
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/SpecimenOrObservationTypeSelectionDialog.java -text
1261 1262
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/TaxonBaseSelectionDialog.java -text
1262 1263
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/TaxonNodeSelectionDialog.java -text
1263 1264
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/TeamSelectionDialog.java -text
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/AbstractFilteredCdmResourceSelectionDialog.java
461 461
			 */
462 462
			@Override
463 463
			public void widgetSelected(SelectionEvent e) {
464
				
464

  
465 465
				AbstractNewEntityWizard wizard = getNewEntityWizard(e.text);
466

  
466 467
				wizard.init(null, null);
467
				WizardDialog dialog = new WizardDialog(getShell(), wizard);
468
				int status = dialog.open();
469
				
470
				if (status == IStatus.OK) {
471
					
472
					T entity = (T) wizard.getEntity();
473
					
474
//					addObjectToModel(teamOrPerson);
475
					refresh();
476
					setPattern(entity);
477
					getConversationHolder().bind();
468
				if(wizard.getEntity() != null) {
469
					WizardDialog dialog = new WizardDialog(getShell(), wizard);
470
					int status = dialog.open();
471

  
472
					if (status == IStatus.OK) {
473

  
474
						T entity = (T) wizard.getEntity();
475
						refresh();
476
						setPattern(entity);
477
						getConversationHolder().bind();
478
					}
478 479
				}
479 480
			}
480 481
		};
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/SpecimenOrObservationTypeSelectionDialog.java
1
//$Id$
2

  
3
package eu.etaxonomy.taxeditor.ui.dialog.selection;
4

  
5
import java.util.ArrayList;
6
import java.util.EnumSet;
7

  
8
import org.eclipse.swt.widgets.Shell;
9

  
10
import eu.etaxonomy.cdm.api.conversation.ConversationHolder;
11
import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationType;
12
import eu.etaxonomy.taxeditor.newWizard.AbstractNewEntityWizard;
13

  
14
/**
15
* <p>OriginalSourceTypeSelectionDialog class.</p>
16
*
17
* @author c.mathew
18
* @created 18.07.2013
19
* @version 1.0
20
*/
21
public class SpecimenOrObservationTypeSelectionDialog extends
22
		AbstractFilteredCdmEnumSelectionDialog<SpecimenOrObservationType> {
23

  
24
	/**
25
	 * <p>select</p>
26
	 *
27
	 * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
28
	 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
29
	 * @return a {@link eu.etaxonomy.cdm.model.common.OriginalSourceType} object.
30
	 */
31
	public static SpecimenOrObservationType select(Shell shell, ConversationHolder conversation){
32
		SpecimenOrObservationTypeSelectionDialog dialog = 
33
				new SpecimenOrObservationTypeSelectionDialog(shell, 
34
						conversation,
35
						"Choose Specimen / Observation Type", 
36
						false, 
37
						SpecimenOrObservationTypeSelectionDialog.class.getCanonicalName());
38
		return getSelectionFromDialog(dialog);
39
	}
40
	
41
	/**
42
	 * <p>Constructor for FilteredDerivedUnitSelectionDialog.</p>
43
	 *
44
	 * @param shell a {@link org.eclipse.swt.widgets.Shell} object.
45
	 * @param conversation a {@link eu.etaxonomy.cdm.api.conversation.ConversationHolder} object.
46
	 * @param title a {@link java.lang.String} object.
47
	 * @param multi a boolean.
48
	 * @param settings a {@link java.lang.String} object.
49
	 */
50
	protected SpecimenOrObservationTypeSelectionDialog(Shell shell, 
51
			ConversationHolder conversation, 
52
			String title,
53
			boolean multi, 
54
			String settings) {
55
		super(shell, conversation, title, multi, settings, SpecimenOrObservationType.Unknown);
56
	}
57

  
58

  
59
	/** {@inheritDoc} */
60
	@Override
61
	protected void initModel() {
62
		model = new ArrayList<SpecimenOrObservationType>();
63
		model.addAll(EnumSet.allOf(SpecimenOrObservationType.class));		
64
	}
65

  
66
	/** {@inheritDoc} */
67
	@Override
68
	protected AbstractNewEntityWizard getNewEntityWizard(String parameter) {
69
		return null;
70
	}
71

  
72
	/** {@inheritDoc} */
73
	@Override
74
	protected String getNewWizardLinkText() {
75
		return null;
76
	}
77
}

Also available in: Unified diff