Project

General

Profile

Revision e6f55e01

IDe6f55e01d40900f8067ccfd700df36695d99b356
Parent 5f8f8bc1
Child 5eee5e77

Added by Katja Luther over 2 years ago

adapt taxonnodeselection dialog to possibility to search for classifications

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/e4/handler/ChangeSynonymToAcceptedTaxonHandlerE4.java
88 88
		Taxon taxon = input.getTaxon();
89 89

  
90 90
		TaxonNode newParentNode = TaxonNodeSelectionDialog.select(shell,// editor.getConversationHolder(),
91
		        Messages.ChangeSynonymToAcceptedTaxonHandler_SELECT_PARENT, null, null, input.getTaxonNode().getClassification().getUuid());
91
		        Messages.ChangeSynonymToAcceptedTaxonHandler_SELECT_PARENT, null, null, input.getTaxonNode().getClassification().getUuid(), true);
92 92

  
93 93

  
94 94
		if(newParentNode != null){
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/ui/dialog/selection/TaxonNodeSelectionDialog.java
10 10

  
11 11
import org.eclipse.jface.viewers.ILabelProvider;
12 12
import org.eclipse.swt.SWT;
13
import org.eclipse.swt.events.SelectionAdapter;
13 14
import org.eclipse.swt.events.SelectionEvent;
14 15
import org.eclipse.swt.events.SelectionListener;
15 16
import org.eclipse.swt.layout.GridData;
......
35 36
public class TaxonNodeSelectionDialog extends AbstractFilteredCdmResourceSelectionDialog<TaxonNode> implements SelectionListener{
36 37

  
37 38
	public static TaxonNode select(Shell shell, //ConversationHolder conversation,
38
	        String title, List<UUID> excludeTaxa, TaxonNode node, UUID classificationUUID) {
39
	        String title, List<UUID> excludeTaxa, TaxonNode node, UUID classificationUUID, boolean allowSelectClassification) {
39 40
		TaxonNodeSelectionDialog dialog = new TaxonNodeSelectionDialog(shell,
40 41
				//conversation,
41 42
				title,
42 43
				excludeTaxa,
43 44
				false,
44 45
				node,
45
				classificationUUID);
46
				classificationUUID, allowSelectClassification);
46 47
		return getSelectionFromDialog(dialog);
47 48
	}
49
	public static TaxonNode select(Shell shell, //ConversationHolder conversation,
50
            String title, List<UUID> excludeTaxa, TaxonNode node, UUID classificationUUID) {
51
        TaxonNodeSelectionDialog dialog = new TaxonNodeSelectionDialog(shell,
52
                //conversation,
53
                title,
54
                excludeTaxa,
55
                false,
56
                node,
57
                classificationUUID);
58
        return getSelectionFromDialog(dialog);
59
    }
48 60

  
49 61
	public static UuidAndTitleCache<TaxonNode> selectUuidAndTitleCache(Shell shell, //ConversationHolder conversation,
50 62
            String title, List<UUID> excludeTaxa, TaxonNode node, UUID classificationUUID) {
......
54 66
                excludeTaxa,
55 67
                false,
56 68
                node,
57
                classificationUUID);
69
                classificationUUID, false);
58 70
        return getUuidAndTitleCacheSelectionFromDialog(dialog);
59 71
    }
60 72

  
......
65 77
	private Classification selectedClassification;
66 78
	private UUID selectedUuid;
67 79
	private final List<UUID> excludeTaxa;
80
	private boolean allowClassificationSelection = false;
68 81

  
69 82
	protected TaxonNodeSelectionDialog(Shell shell, //ConversationHolder conversation,
70
	        String title, List<UUID> excludeTaxa, boolean multi, TaxonNode node, UUID classificationUUID) {
83
	        String title, List<UUID> excludeTaxa, boolean multi, TaxonNode node, UUID classificationUUID, boolean allowSelectClassification) {
71 84
		super(shell, //conversation,
72 85
		        title, multi, TaxonNodeSelectionDialog.class.getCanonicalName(), node);
73 86

  
......
81 94
        }
82 95

  
83 96
		fillClassifications();
97
		this.allowClassificationSelection = allowSelectClassification;
84 98

  
85 99
		createClassificationSelectionCombo(shell);
86 100
	}
101
	protected TaxonNodeSelectionDialog(Shell shell, //ConversationHolder conversation,
102
            String title, List<UUID> excludeTaxa, boolean multi, TaxonNode node, UUID classificationUUID) {
103
	    this(shell, title, excludeTaxa, multi, node, classificationUUID, false);
104
	}
87 105

  
88 106
	/** {@inheritDoc} */
89 107
	@Override
......
138 156
		return "";
139 157
	}
140 158

  
159
	@Override
160
    protected SelectionListener getNewWizardButtonSelectionListener(){
161
        return new SelectionAdapter() {
162

  
163
            @Override
164
            public void widgetSelected(SelectionEvent e) {
165
                Classification tree = selectedClassification;
166
                setPattern(tree.getRootNode());
167

  
168
            }
169
        };
170
    }
171

  
172

  
141 173
	/** {@inheritDoc} */
142 174
	@Override
143 175
	protected TaxonNode getPersistentObject(UUID uuid) {
......
147 179
	/** {@inheritDoc} */
148 180
	@Override
149 181
	protected void callService(String pattern) {
150
	    model = CdmStore.getService(IClassificationService.class).getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(selectedUuid, limitOfInitialElements, pattern);
182
	    model = CdmStore.getService(IClassificationService.class).getTaxonNodeUuidAndTitleCacheOfAcceptedTaxaByClassification(selectedUuid, limitOfInitialElements, pattern, allowClassificationSelection);
151 183
	}
152 184
	@Override
153 185
	protected void sort() {

Also available in: Unified diff

Add picture from clipboard (Maximum size: 40 MB)