PageRenderTime 45ms CodeModel.GetById 43ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/bundles/plugins-trunk/SideKick/macros/JumpToEndOfFunction.bsh

#
Unknown | 23 lines | 20 code | 3 blank | 0 comment | 0 complexity | 67db104c7c191466a19da2104a891e51 MD5 | raw file
 1void JumpToEndOfFunction(JEditTextArea textArea)
 2{
 3	int position = textArea.getCaretPosition();
 4	// Select the current asset
 5	sidekick.SideKickActions.selectAsset(view);
 6	// Search for the first occurrence of '{'
 7	Selection[] selection = textArea.getSelection();
 8	String s = null;
 9	if (selection == null || selection.length == 0) {
10		return;
11	}
12	int start = selection[0].getStart();
13	s = textArea.getSelectedText(selection[0]);
14	for (int i = s.length() - 1; i >= 0; i--) {
15		if (s.charAt(i) == '}') {
16			textArea.setCaretPosition(start + i);
17			return;
18		}
19	}
20}
21
22
23