56 |
56 |
import eu.etaxonomy.cdm.api.service.IFeatureNodeService;
|
57 |
57 |
import eu.etaxonomy.cdm.api.service.IFeatureTreeService;
|
58 |
58 |
import eu.etaxonomy.cdm.api.service.ITermService;
|
|
59 |
import eu.etaxonomy.cdm.model.common.Representation;
|
59 |
60 |
import eu.etaxonomy.cdm.model.description.Character;
|
60 |
61 |
import eu.etaxonomy.cdm.model.description.FeatureNode;
|
61 |
62 |
import eu.etaxonomy.cdm.model.description.FeatureTree;
|
... | ... | |
72 |
73 |
import eu.etaxonomy.taxeditor.model.IPartContentHasDetails;
|
73 |
74 |
import eu.etaxonomy.taxeditor.model.IPartContentHasSupplementalData;
|
74 |
75 |
import eu.etaxonomy.taxeditor.model.MessagingUtils;
|
|
76 |
import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
|
75 |
77 |
import eu.etaxonomy.taxeditor.session.ICdmEntitySession;
|
76 |
78 |
import eu.etaxonomy.taxeditor.store.CdmStore;
|
77 |
79 |
import eu.etaxonomy.taxeditor.ui.dialog.selection.FeatureTreeSelectionDialog;
|
... | ... | |
218 |
220 |
|
219 |
221 |
private void init(){
|
220 |
222 |
btnAddCharacter.addSelectionListener(new SelectionAdapter() {
|
221 |
|
/**
|
222 |
|
* {@inheritDoc}
|
223 |
|
*/
|
224 |
223 |
@Override
|
225 |
224 |
public void widgetSelected(SelectionEvent e) {
|
226 |
225 |
ISelection structureTreeSelection = structuresTreeEditorComposite.getViewer().getSelection();
|
... | ... | |
234 |
233 |
for (Character character : characters) {
|
235 |
234 |
//add new Character to feature tree
|
236 |
235 |
FeatureNode parent = ((FeatureTree) characterTreeEditorComposite.getViewer().getInput()).getRoot();
|
237 |
|
CdmStore.getService(IFeatureNodeService.class).addChildFeatureNode(parent.getUuid(), character.getUuid());
|
|
236 |
CdmStore.getService(IFeatureNodeService.class).createChildFeatureNode(parent, character);
|
238 |
237 |
}
|
239 |
|
|
240 |
|
setDirty();
|
241 |
238 |
characterTreeEditorComposite.getViewer().refresh();
|
242 |
239 |
}
|
243 |
240 |
});
|
... | ... | |
254 |
251 |
Iterator<FeatureNode> propertiesIterator = propertyTreeSelection.iterator();
|
255 |
252 |
while(propertiesIterator.hasNext()){
|
256 |
253 |
FeatureNode propertyNode = propertiesIterator.next();
|
|
254 |
Representation structureRepresentation = structureNode.getFeature().getRepresentation(PreferencesUtil.getGlobalLanguage());
|
|
255 |
Representation propertyRepresentation = propertyNode.getFeature().getRepresentation(PreferencesUtil.getGlobalLanguage());
|
|
256 |
String label = null;
|
|
257 |
String abbrevLabel = null;
|
|
258 |
if(structureRepresentation.getLabel()!=null && propertyRepresentation.getLabel()!=null){
|
|
259 |
label = structureRepresentation.getLabel()+" "+propertyRepresentation.getLabel();
|
|
260 |
}
|
|
261 |
if(structureRepresentation.getAbbreviatedLabel()!=null && propertyRepresentation.getAbbreviatedLabel()!=null){
|
|
262 |
abbrevLabel = structureRepresentation.getAbbreviatedLabel()+" "+propertyRepresentation.getAbbreviatedLabel();
|
|
263 |
}
|
257 |
264 |
//create new Character
|
258 |
|
Character character = Character.NewInstance(structureNode, propertyNode);
|
|
265 |
Character character = Character.NewInstance(structureNode, propertyNode, null, label, abbrevLabel);
|
259 |
266 |
characters.add(character);
|
260 |
267 |
}
|
261 |
268 |
}
|
ref #7923 Set character representation during creation