01: /*
02: * Sun Public License Notice
03: *
04: * The contents of this file are subject to the Sun Public License
05: * Version 1.0 (the "License"). You may not use this file except in
06: * compliance with the License. A copy of the License is available at
07: * http://www.sun.com/
08: *
09: * The Original Code is NetBeans. The Initial Developer of the Original
10: * Code is Sun Microsystems, Inc. Portions Copyright 1997-2000 Sun
11: * Microsystems, Inc. All Rights Reserved.
12: */
13:
14: package org.netbeans.editor.ext;
15:
16: import javax.swing.plaf.TextUI;
17: import javax.swing.text.JTextComponent;
18:
19: import org.netbeans.editor.BaseTextUI;
20:
21: /**
22: * Extended kit offering advanced functionality
23: *
24: * @author Miloslav Metelka
25: * @version 1.00
26: */
27: public class ExtUtilities {
28:
29: private ExtUtilities() {
30: }
31:
32: public static ExtEditorUI getExtEditorUI(JTextComponent target) {
33: TextUI ui = target.getUI();
34: return (ui instanceof BaseTextUI) ? (ExtEditorUI) ((BaseTextUI) ui)
35: .getEditorUI()
36: : null;
37: }
38:
39: public static Completion getCompletion(JTextComponent target) {
40: ExtEditorUI extEditorUI = getExtEditorUI(target);
41: if (extEditorUI != null) {
42: return extEditorUI.getCompletion();
43: }
44: return null;
45: }
46:
47: }
|