Revision 6803fca4
Added by Patrick Plitzner over 4 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/CharacterTransfer.java | ||
---|---|---|
23 | 23 |
import org.eclipse.swt.dnd.TransferData; |
24 | 24 |
|
25 | 25 |
import eu.etaxonomy.cdm.api.service.IFeatureNodeService; |
26 |
import eu.etaxonomy.cdm.model.common.Language; |
|
26 | 27 |
import eu.etaxonomy.cdm.model.description.Character; |
27 | 28 |
import eu.etaxonomy.cdm.model.term.DefinedTerm; |
28 | 29 |
import eu.etaxonomy.cdm.model.term.Representation; |
... | ... | |
103 | 104 |
IFeatureNodeService featureNodeService = CdmStore.getService(IFeatureNodeService.class); |
104 | 105 |
TermNode<DefinedTerm> structure = featureNodeService.load(UUID.fromString(split[0])); |
105 | 106 |
TermNode<DefinedTerm> property = featureNodeService.load(UUID.fromString(split[1])); |
106 |
Representation structureRepresentation = structure.getTerm().getRepresentation(PreferencesUtil.getGlobalLanguage()); |
|
107 |
Representation propertyRepresentation = property.getTerm().getRepresentation(PreferencesUtil.getGlobalLanguage()); |
|
108 |
String label = null; |
|
109 |
String abbrevLabel = null; |
|
110 |
if(structureRepresentation.getLabel()!=null && propertyRepresentation.getLabel()!=null){ |
|
111 |
label = structureRepresentation.getLabel()+" "+propertyRepresentation.getLabel(); |
|
112 |
} |
|
113 |
if(structureRepresentation.getAbbreviatedLabel()!=null && propertyRepresentation.getAbbreviatedLabel()!=null){ |
|
114 |
abbrevLabel = structureRepresentation.getAbbreviatedLabel()+" "+propertyRepresentation.getAbbreviatedLabel(); |
|
115 |
} |
|
116 |
characters.add(Character.NewInstance(structure, property, null, label, abbrevLabel)); |
|
107 |
characters.add(createCharacter(structure, property)); |
|
117 | 108 |
} |
118 | 109 |
}catch(EOFException e){ |
119 | 110 |
return characters.toArray(); |
... | ... | |
125 | 116 |
return null; |
126 | 117 |
} |
127 | 118 |
|
119 |
public static Character createCharacter(TermNode<DefinedTerm> structureNode, |
|
120 |
TermNode<DefinedTerm> propertyNode) { |
|
121 |
Representation structureRepresentation = structureNode.getTerm().getRepresentation(PreferencesUtil.getGlobalLanguage()); |
|
122 |
if(structureRepresentation==null){ |
|
123 |
structureRepresentation = structureNode.getTerm().getRepresentation(Language.DEFAULT()); |
|
124 |
} |
|
125 |
Representation propertyRepresentation = propertyNode.getTerm().getRepresentation(PreferencesUtil.getGlobalLanguage()); |
|
126 |
if(propertyRepresentation==null){ |
|
127 |
propertyRepresentation = propertyNode.getTerm().getRepresentation(Language.DEFAULT()); |
|
128 |
} |
|
129 |
String label = null; |
|
130 |
String abbrevLabel = null; |
|
131 |
if(structureRepresentation!=null && propertyRepresentation!=null){ |
|
132 |
if(structureRepresentation.getLabel()!=null && propertyRepresentation.getLabel()!=null){ |
|
133 |
label = structureRepresentation.getLabel()+" "+propertyRepresentation.getLabel(); |
|
134 |
} |
|
135 |
if(structureRepresentation.getAbbreviatedLabel()!=null && propertyRepresentation.getAbbreviatedLabel()!=null){ |
|
136 |
abbrevLabel = structureRepresentation.getAbbreviatedLabel()+" "+propertyRepresentation.getAbbreviatedLabel(); |
|
137 |
} |
|
138 |
} |
|
139 |
if(label!=null){ |
|
140 |
//default label |
|
141 |
label = structureNode.getTerm().getLabel()+" "+propertyNode.getTerm().getLabel(); |
|
142 |
} |
|
143 |
//create new Character |
|
144 |
Character character = Character.NewInstance(structureNode, propertyNode, null, label, abbrevLabel); |
|
145 |
return character; |
|
146 |
} |
|
147 |
|
|
128 | 148 |
} |
Also available in: Unified diff
fix #8755 Show all structure/property trees in CharacterEditor