ide/src/org/xnap/commons/gui/shortcut/EmacsKeyBindings.java
public void actionPerformed(ActionEvent event) {
			JTextComponent jtc = getTextComponent(event);

			if (jtc != null) {
				try {
					/* downcase code */
					int start = jtc.getCaretPosition();
					int end = getWordEnd(jtc, start);
					jtc.setSelectionStart(start);
					jtc.setSelectionEnd(end);
					String word = jtc.getText(start, end - start);
					jtc.replaceSelection(word.toLowerCase());

					/* actual capitalize code */
					int offs = Utilities.getWordStart(jtc, start);
					// get first letter
					String c = jtc.getText(offs, 1);
					// we're at the end of the previous word
					if (c.equals(" ")) {
						/*
						 * ugly java workaround to get the beginning of the
						 * word.
						 */
						offs = Utilities.getWordStart(jtc, ++offs);
						c = jtc.getText(offs, 1);
					}
					if (Character.isLetter(c.charAt(0))) {
						jtc.setSelectionStart(offs);
						jtc.setSelectionEnd(offs + 1);
						jtc.replaceSelection(c.toUpperCase());
					}
					end = Utilities.getWordEnd(jtc, offs);
					jtc.setCaretPosition(end);
				} catch (BadLocationException ble) {
					jtc.getToolkit().beep();
				}
			}
		}
/***
		 * At first the same code as in
		 * {@link EmacsKeyBindings.DowncaseWordAction} is performed, to ensure
		 * the word is in lower case, then the first letter is capialized.
		 */
At first the same code as in
EmacsKeyBindings.DowncaseWordAction is performed, to ensure
the word is in lower case, then the first letter is capialized.
At first the same code as in EmacsKeyBindings . DowncaseWordAction is performed to ensure the word is in lower case then the first letter is capialized .
public void actionPerformed(ActionEvent event) {
			JTextComponent jtc = getTextComponent(event);
			if (jtc != null) {
				try {
					/* downcase code */
					int start = jtc.getCaretPosition();
					int end = getWordEnd(jtc, start);
					jtc.setSelectionStart(start);
					jtc.setSelectionEnd(end);
					String word = jtc.getText(start, end - start);
					jtc.replaceSelection(word.toLowerCase());
					/* actual capitalize code */
					int offs = Utilities.getWordStart(jtc, start);
					String c = jtc.getText(offs, 1);
					if (c.equals(" ")) {
						/*
						 * ugly java workaround to get the beginning of the
						 * word.
						 */
						offs = Utilities.getWordStart(jtc, ++offs);
						c = jtc.getText(offs, 1);
					}
					if (Character.isLetter(c.charAt(0))) {
						jtc.setSelectionStart(offs);
						jtc.setSelectionEnd(offs + 1);
						jtc.replaceSelection(c.toUpperCase());
					}
					end = Utilities.getWordEnd(jtc, offs);
					jtc.setCaretPosition(end);
				} catch (BadLocationException ble) {
					jtc.getToolkit().beep();
				}
			}
		}
public void actionPerformed ( ActionEvent event ) { JTextComponent jtc = getTextComponent ( event ) ; if ( jtc != null ) { try { /* downcase code */ int start = jtc . getCaretPosition ( ) ; int end = getWordEnd ( jtc , start ) ; jtc . setSelectionStart ( start ) ; jtc . setSelectionEnd ( end ) ; String word = jtc . getText ( start , end - start ) ; jtc . replaceSelection ( word . toLowerCase ( ) ) ; /* actual capitalize code */ int offs = Utilities . getWordStart ( jtc , start ) ; String c = jtc . getText ( offs , 1 ) ; if ( c . equals ( " " ) ) { /*
						 * ugly java workaround to get the beginning of the
						 * word.
						 */ offs = Utilities . getWordStart ( jtc , ++ offs ) ; c = jtc . getText ( offs , 1 ) ; } if ( Character . isLetter ( c . charAt ( 0 ) ) ) { jtc . setSelectionStart ( offs ) ; jtc . setSelectionEnd ( offs + 1 ) ; jtc . replaceSelection ( c . toUpperCase ( ) ) ; } end = Utilities . getWordEnd ( jtc , offs ) ; jtc . setCaretPosition ( end ) ; } catch ( BadLocationException ble ) { jtc . getToolkit ( ) . beep ( ) ; } } }
At first the same code as in
 {@link EmacsKeyBindings.DowncaseWordAction} is performed, to ensure
 the word is in lower case, then the first letter is capialized.
At first the same code as in { @link EmacsKeyBindings . DowncaseWordAction } is performed to ensure the word is in lower case then the first letter is capialized .
// get first letter // we're at the end of the previous word