Revision cedc4ff1
Added by Katja Luther about 6 years ago
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/NavigationUtil.java | ||
---|---|---|
34 | 34 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
35 | 35 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
36 | 36 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
37 |
import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto; |
|
37 | 38 |
import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache; |
38 | 39 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
39 | 40 |
import eu.etaxonomy.taxeditor.editor.e4.TaxonEditorInputE4; |
... | ... | |
65 | 66 |
public static void openEditor(UuidAndTitleCache uuidAndTitleCache, Shell shell, EModelService modelService, EPartService partService, MApplication application){ |
66 | 67 |
Class<?> type = uuidAndTitleCache.getType(); |
67 | 68 |
ICdmBase cdmBase = null; |
68 |
if(type.equals(Classification.class)){ |
|
69 |
if(uuidAndTitleCache instanceof TaxonNodeDto){ |
|
70 |
EditorUtil.openTaxonNodeE4(uuidAndTitleCache.getUuid(), modelService, partService, application); |
|
71 |
return; |
|
72 |
} |
|
73 |
else if(type.equals(Classification.class)){ |
|
69 | 74 |
cdmBase = CdmStore.getService(IClassificationService.class).load(uuidAndTitleCache.getUuid()); |
70 | 75 |
} |
71 | 76 |
else if(type.equals(TaxonNode.class)){ |
... | ... | |
154 | 159 |
* @param taxonNode a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object. |
155 | 160 |
* @return a boolean. |
156 | 161 |
*/ |
157 |
public static boolean isDirty(TaxonNode taxonNode, EPartService partService){ |
|
162 |
public static boolean isDirty(TaxonNodeDto taxonNode, EPartService partService){
|
|
158 | 163 |
|
159 | 164 |
Collection<MPart> dirtyParts = partService.getDirtyParts(); |
160 | 165 |
for (MPart part : dirtyParts) { |
161 | 166 |
if(part.getObject() instanceof TaxonNameEditorE4){ |
162 | 167 |
TaxonEditorInputE4 input = ((TaxonNameEditorE4) part.getObject()).getEditorInput(); |
163 |
if(input.getTaxonNode().equals(taxonNode)){
|
|
168 |
if(input.getTaxonNode().getUuid().equals(taxonNode.getUuid())){
|
|
164 | 169 |
return true; |
165 | 170 |
} |
166 | 171 |
} |
... | ... | |
168 | 173 |
return false; |
169 | 174 |
} |
170 | 175 |
|
176 |
/** |
|
177 |
* Whether a taxonNode has unsaved changes. |
|
178 |
* |
|
179 |
* @param taxonNode a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object. |
|
180 |
* @return a boolean. |
|
181 |
*/ |
|
182 |
public static boolean isDirty(TaxonNode taxonNode, EPartService partService){ |
|
183 |
|
|
184 |
Collection<MPart> dirtyParts = partService.getDirtyParts(); |
|
185 |
for (MPart part : dirtyParts) { |
|
186 |
if(part.getObject() instanceof TaxonNameEditorE4){ |
|
187 |
TaxonEditorInputE4 input = ((TaxonNameEditorE4) part.getObject()).getEditorInput(); |
|
188 |
if(input.getTaxonNode().equals(taxonNode)){ |
|
189 |
return true; |
|
190 |
} |
|
191 |
} |
|
192 |
} |
|
193 |
return false; |
|
194 |
} |
|
195 |
|
|
171 | 196 |
/** |
172 | 197 |
* <p>openSearch</p> |
173 | 198 |
* |
Also available in: Unified diff
ref #2380: implement usage of Dto for taxon navigator