KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > ui > text > spelling > ChangeCaseProposal


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 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
12 package org.eclipse.jdt.internal.ui.text.spelling;
13
14 import java.util.Locale JavaDoc;
15
16 import org.eclipse.jdt.ui.text.java.IInvocationContext;
17
18 import org.eclipse.jdt.internal.ui.JavaUIMessages;
19
20 /**
21  * Proposal to change the letter case of a word.
22  *
23  * @since 3.0
24  */

25 public class ChangeCaseProposal extends WordCorrectionProposal {
26
27     /**
28      * Creates a new change case proposal.
29      *
30      * @param arguments
31      * The problem arguments associated with the spelling problem
32      * @param offset
33      * The offset in the document where to apply the proposal
34      * @param length
35      * The lenght in the document to apply the proposal
36      * @param context
37      * The invocation context for this proposal
38      * @param locale
39      * The locale to use for the case change
40      */

41     public ChangeCaseProposal(final String JavaDoc[] arguments, final int offset, final int length, final IInvocationContext context, final Locale JavaDoc locale) {
42         super(Character.isLowerCase(arguments[0].charAt(0)) ? Character.toUpperCase(arguments[0].charAt(0)) + arguments[0].substring(1) : arguments[0], arguments, offset, length, context, Integer.MAX_VALUE);
43     }
44
45     /*
46      * @see org.eclipse.jface.text.contentassist.ICompletionProposal#getDisplayString()
47      */

48     public String JavaDoc getDisplayString() {
49         return JavaUIMessages.Spelling_case_label;
50     }
51 }
52
Popular Tags