comparison org.eclipse.jface/src/org/eclipse/jface/viewers/ViewerSorter.d @ 12:bc29606a740c

Added dwt-addons in original directory structure of eclipse.org
author Frank Benoit <benoit@tionex.de>
date Sat, 14 Mar 2009 18:23:29 +0100
parents
children
comparison
equal deleted inserted replaced
11:43904fec5dca 12:bc29606a740c
1 /*******************************************************************************
2 * Copyright (c) 2000, 2006 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 * Port to the D programming language:
11 * Frank Benoit <benoit@tionex.de>
12 *******************************************************************************/
13 module org.eclipse.jface.viewers.ViewerSorter;
14
15 import org.eclipse.jface.viewers.ViewerComparator;
16
17 import java.lang.all;
18 import java.text.Collator;
19
20 /**
21 * A viewer sorter is used by a {@link StructuredViewer} to reorder the elements
22 * provided by its content provider.
23 * <p>
24 * The default <code>compare</code> method compares elements using two steps.
25 * The first step uses the values returned from <code>category</code>.
26 * By default, all elements are in the same category.
27 * The second level is based on a case insensitive compare of the strings obtained
28 * from the content viewer's label provider via <code>ILabelProvider.getText</code>.
29 * </p>
30 * <p>
31 * Subclasses may implement the <code>isSorterProperty</code> method;
32 * they may reimplement the <code>category</code> method to provide
33 * categorization; and they may override the <code>compare</code> methods
34 * to provide a totally different way of sorting elements.
35 * </p>
36 * <p>
37 * It is recommended to use <code>ViewerComparator</code> instead.
38 * </p>
39 * @see IStructuredContentProvider
40 * @see StructuredViewer
41 */
42 public class ViewerSorter : ViewerComparator {
43 /**
44 * The collator used to sort strings.
45 *
46 * @deprecated as of 3.3 Use {@link ViewerComparator#getComparator()}
47 */
48 protected Collator collator;
49
50 /**
51 * Creates a new viewer sorter, which uses the default collator
52 * to sort strings.
53 */
54 public this() {
55 this(Collator.getInstance());
56 }
57
58 /**
59 * Creates a new viewer sorter, which uses the given collator
60 * to sort strings.
61 *
62 * @param collator the collator to use to sort strings
63 */
64 public this(Collator collator) {
65 super(collator);
66 this.collator = collator;
67 }
68
69 /**
70 * Returns the collator used to sort strings.
71 *
72 * @return the collator used to sort strings
73 * @deprecated as of 3.3 Use {@link ViewerComparator#getComparator()}
74 */
75 public Collator getCollator() {
76 return collator;
77 }
78
79 }