Revision a3de3443
Added by Katja Luther about 10 years ago
.gitattributes | ||
---|---|---|
884 | 884 |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonLinkHelper.java -text |
885 | 885 |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigator.java -text |
886 | 886 |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigatorDataChangeBehavior.java -text |
887 |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNodeComparator.java -text |
|
887 | 888 |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNodeContentProvider.java -text |
888 | 889 |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNodeLabelProvider.java -text |
889 | 890 |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNodePropertyTester.java -text |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigator.java | ||
---|---|---|
22 | 22 |
import org.eclipse.core.runtime.IProgressMonitor; |
23 | 23 |
import org.eclipse.jface.viewers.DoubleClickEvent; |
24 | 24 |
import org.eclipse.jface.viewers.TreePath; |
25 |
import org.eclipse.jface.viewers.ViewerComparator; |
|
25 | 26 |
import org.eclipse.ui.IMemento; |
26 | 27 |
import org.eclipse.ui.IViewSite; |
27 | 28 |
import org.eclipse.ui.PartInitException; |
... | ... | |
31 | 32 |
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled; |
32 | 33 |
import eu.etaxonomy.cdm.api.service.IClassificationService; |
33 | 34 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
35 |
import eu.etaxonomy.cdm.model.taxon.TaxonComparatorSearch; |
|
34 | 36 |
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap; |
35 | 37 |
import eu.etaxonomy.taxeditor.model.DataChangeBridge; |
36 | 38 |
import eu.etaxonomy.taxeditor.model.IDataChangeBehavior; |
... | ... | |
74 | 76 |
/** {@inheritDoc} */ |
75 | 77 |
@Override |
76 | 78 |
protected IAdaptable getInitialInput() { |
79 |
TaxonComparatorSearch comparator = new TaxonComparatorSearch(); |
|
80 |
TaxonNodeComparator viewerComparator = new TaxonNodeComparator(comparator); |
|
81 |
this.getCommonViewer().setComparator(viewerComparator); |
|
77 | 82 |
if (CdmStore.isActive()) { |
78 | 83 |
// TODO when closing and reopening the taxon navigator |
79 | 84 |
// we do not preserve state. Closing the view, in contrary to |
... | ... | |
90 | 95 |
public void init(IViewSite site) throws PartInitException { |
91 | 96 |
super.init(site); |
92 | 97 |
init(); |
98 |
|
|
93 | 99 |
} |
94 | 100 |
|
95 | 101 |
/** |
... | ... | |
103 | 109 |
conversation.registerForDataStoreChanges(TaxonNavigator.this); |
104 | 110 |
} |
105 | 111 |
CdmStore.getLoginManager().addObserver(this); |
112 |
|
|
113 |
|
|
114 |
|
|
106 | 115 |
} |
107 | 116 |
|
108 | 117 |
/** |
... | ... | |
192 | 201 |
* @return |
193 | 202 |
*/ |
194 | 203 |
private TreePath createTreePathFromString(String string) { |
195 |
|
|
204 |
|
|
205 |
|
|
196 | 206 |
List<CdmBase> pathList = new ArrayList<CdmBase>(); |
197 | 207 |
|
198 | 208 |
if (string.length() == 0) { |
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNodeComparator.java | ||
---|---|---|
1 |
package eu.etaxonomy.taxeditor.navigation.navigator; |
|
2 |
|
|
3 |
import java.util.Arrays; |
|
4 |
|
|
5 |
|
|
6 |
import org.eclipse.jface.viewers.Viewer; |
|
7 |
import org.eclipse.jface.viewers.ViewerComparator; |
|
8 |
|
|
9 |
|
|
10 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
|
11 |
import eu.etaxonomy.cdm.model.taxon.TaxonComparatorSearch; |
|
12 |
import eu.etaxonomy.cdm.model.taxon.TaxonNode; |
|
13 |
|
|
14 |
public class TaxonNodeComparator extends ViewerComparator{ |
|
15 |
|
|
16 |
|
|
17 |
public TaxonNodeComparator(TaxonComparatorSearch comparator) { |
|
18 |
super(comparator); |
|
19 |
} |
|
20 |
|
|
21 |
@Override |
|
22 |
public void sort(final Viewer viewer, Object[] elements) { |
|
23 |
|
|
24 |
TaxonBase[] nodesArray = new TaxonBase[elements.length]; |
|
25 |
if (elements.length>1){ |
|
26 |
for(int i=0; i<elements.length; i++){ |
|
27 |
nodesArray[i] = ((TaxonNode)elements[i]).getTaxon(); |
|
28 |
} |
|
29 |
Arrays.sort(nodesArray, this.getComparator()); |
|
30 |
} |
|
31 |
} |
|
32 |
} |
Also available in: Unified diff
#4114 sort order in taxon navigator