KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > ui > text > java > AlphabeticSorter


1 /*******************************************************************************
2  * Copyright (c) 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  *******************************************************************************/

11 package org.eclipse.jdt.internal.ui.text.java;
12
13 import org.eclipse.jface.text.contentassist.ICompletionProposal;
14
15 import org.eclipse.jdt.ui.text.java.AbstractProposalSorter;
16 import org.eclipse.jdt.ui.text.java.CompletionProposalComparator;
17
18 /**
19  * A alphabetic proposal based sorter.
20  *
21  * @since 3.2
22  */

23 public final class AlphabeticSorter extends AbstractProposalSorter {
24
25     private final CompletionProposalComparator fComparator= new CompletionProposalComparator();
26     
27     public AlphabeticSorter() {
28         fComparator.setOrderAlphabetically(true);
29     }
30
31     /*
32      * @see org.eclipse.jdt.ui.text.java.AbstractProposalSorter#compare(org.eclipse.jface.text.contentassist.ICompletionProposal, org.eclipse.jface.text.contentassist.ICompletionProposal)
33      */

34     public int compare(ICompletionProposal p1, ICompletionProposal p2) {
35         return fComparator.compare(p1, p2);
36     }
37
38 }
39
Popular Tags