Revision 324d38f7
Added by Alex Theys about 12 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/uses/UsesLabelProvider.java | ||
---|---|---|
1 | 1 |
package eu.etaxonomy.taxeditor.editor.view.uses; |
2 | 2 |
|
3 |
import java.util.Arrays; |
|
4 |
import java.util.List; |
|
5 |
import java.util.Map; |
|
6 | 3 |
|
7 |
import javax.swing.text.html.HTMLDocument.HTMLReader.IsindexAction; |
|
8 | 4 |
|
9 | 5 |
import org.eclipse.jface.viewers.ColumnLabelProvider; |
10 | 6 |
import org.eclipse.jface.viewers.DelegatingStyledCellLabelProvider.IStyledLabelProvider; |
... | ... | |
12 | 8 |
|
13 | 9 |
import eu.etaxonomy.cdm.api.service.DefaultCategoricalDescriptionBuilder; |
14 | 10 |
import eu.etaxonomy.cdm.api.service.DescriptionBuilder; |
15 |
import eu.etaxonomy.cdm.model.common.Language; |
|
16 |
import eu.etaxonomy.cdm.model.common.LanguageString; |
|
17 | 11 |
import eu.etaxonomy.cdm.model.description.CategoricalData; |
18 | 12 |
import eu.etaxonomy.cdm.model.description.DescriptionBase; |
19 |
import eu.etaxonomy.cdm.model.description.DescriptionElementBase; |
|
20 | 13 |
import eu.etaxonomy.cdm.model.description.Modifier; |
21 |
import eu.etaxonomy.cdm.model.description.State; |
|
22 | 14 |
import eu.etaxonomy.cdm.model.description.StateData; |
23 |
import eu.etaxonomy.cdm.model.description.TextData; |
|
24 | 15 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
25 | 16 |
|
17 |
/** |
|
18 |
* The context manager mediates context start/stop and workbench shutdowns to all registered listeners. |
|
19 |
* |
|
20 |
* @author a.theys |
|
21 |
* @created mar 13, 2012 |
|
22 |
* @version 1.0 |
|
23 |
*/ |
|
26 | 24 |
public class UsesLabelProvider extends ColumnLabelProvider implements |
27 | 25 |
IStyledLabelProvider { |
28 | 26 |
|
29 |
private static DescriptionBuilder<CategoricalData> categoricalDescriptionBuilder = new DefaultCategoricalDescriptionBuilder(); |
|
30 | 27 |
public String getText(Object element) { |
31 | 28 |
String text = ""; |
32 |
/* |
|
33 |
* return DescriptionHelper.getLabel(element); |
|
34 |
* |
|
35 |
* for (Marker marker : element.getMarkers()) { if |
|
36 |
* (marker.getMarkerType().getTitleCache().equals("use")) { return |
|
37 |
* "Use: " + text; } } |
|
38 |
*/ |
|
29 |
|
|
39 | 30 |
if (element instanceof DescriptionBase) { |
40 | 31 |
text = ((DescriptionBase) element).getTitleCache(); |
41 | 32 |
if (text == null || text.length() == 0) { |
... | ... | |
46 | 37 |
} |
47 | 38 |
} |
48 | 39 |
else if (element instanceof CategoricalData) { |
49 |
//String text = ""; |
|
50 |
//TextData textData = categoricalDescriptionBuilder.build((CategoricalData) element, getLanguageList()); |
|
51 | 40 |
if (!((CategoricalData) element).getStates().isEmpty()) { |
52 | 41 |
for (StateData statedata : ((CategoricalData) element).getStates()) { |
53 | 42 |
if(statedata.getState() != null && statedata.getModifyingText().get(CdmStore.getDefaultLanguage()) !=null && statedata.getModifyingText().get(CdmStore.getDefaultLanguage()).getText().equals("Use Category")) { |
... | ... | |
126 | 115 |
StyledString.QUALIFIER_STYLER); |
127 | 116 |
} |
128 | 117 |
|
129 |
private static List<Language> getLanguageList(){ |
|
130 |
return Arrays.asList(new Language[]{CdmStore.getDefaultLanguage()}); |
|
131 |
} |
|
118 |
|
|
132 | 119 |
|
133 | 120 |
} |
Also available in: Unified diff
AT: committing latest changes to the Tax Editor after a first round of Code review