This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 160042
Collapse All | Expand All

(-)java.editor/src/org/netbeans/modules/editor/java/JavaCodeTemplateProcessor.java (+22 lines)
Lines 91-96 Link Here
91
    public static final String UNCAUGHT_EXCEPTION_TYPE = "uncaughtExceptionType"; //NOI18N
91
    public static final String UNCAUGHT_EXCEPTION_TYPE = "uncaughtExceptionType"; //NOI18N
92
    public static final String UNCAUGHT_EXCEPTION_CATCH_STATEMENTS = "uncaughtExceptionCatchStatements"; //NOI18N
92
    public static final String UNCAUGHT_EXCEPTION_CATCH_STATEMENTS = "uncaughtExceptionCatchStatements"; //NOI18N
93
    public static final String CURRENT_CLASS_NAME = "currClassName"; //NOI18N
93
    public static final String CURRENT_CLASS_NAME = "currClassName"; //NOI18N
94
    public static final String CURRENT_METHOD_NAME = "currMethodName"; //NOI18N
94
95
95
    private static final String TRUE = "true"; //NOI18N
96
    private static final String TRUE = "true"; //NOI18N
96
    private static final String NULL = "null"; //NOI18N
97
    private static final String NULL = "null"; //NOI18N
Lines 131-136 Link Here
131
                        || CAST.equals(hint)
132
                        || CAST.equals(hint)
132
                        || NEW_VAR_NAME.equals(hint)
133
                        || NEW_VAR_NAME.equals(hint)
133
                        || CURRENT_CLASS_NAME.equals(hint)
134
                        || CURRENT_CLASS_NAME.equals(hint)
135
                        || CURRENT_METHOD_NAME.equals(hint)
134
                        || ITERABLE_ELEMENT_TYPE.equals(hint)
136
                        || ITERABLE_ELEMENT_TYPE.equals(hint)
135
                        || UNCAUGHT_EXCEPTION_TYPE.equals(hint)) {
137
                        || UNCAUGHT_EXCEPTION_TYPE.equals(hint)) {
136
                    initParsing();
138
                    initParsing();
Lines 511-516 Link Here
511
            } else if (CURRENT_CLASS_NAME.equals(entry.getKey())) {
513
            } else if (CURRENT_CLASS_NAME.equals(entry.getKey())) {
512
                param2hints.put(param, CURRENT_CLASS_NAME);
514
                param2hints.put(param, CURRENT_CLASS_NAME);
513
                return owningClassName();
515
                return owningClassName();
516
            } else if (CURRENT_METHOD_NAME.equals(entry.getKey())) {
517
                param2hints.put(param, CURRENT_METHOD_NAME);
518
                return owningMethodName();
514
            } else if (NAMED.equals(entry.getKey())) {
519
            } else if (NAMED.equals(entry.getKey())) {
515
                name = param.getName();
520
                name = param.getName();
516
            } else if (UNCAUGHT_EXCEPTION_TYPE.equals(entry.getKey())) {
521
            } else if (UNCAUGHT_EXCEPTION_TYPE.equals(entry.getKey())) {
Lines 893-898 Link Here
893
        }
898
        }
894
        return null;
899
        return null;
895
    }
900
    }
901
    private String owningMethodName() {
902
        try {
903
            if (cInfo != null) {
904
                TreePath path = treePath;
905
                while ((path = Utilities.getPathElementOfKind (Tree.Kind.METHOD, path)) != null) {
906
                    MethodTree tree = (MethodTree) path.getLeaf();
907
                    String result = tree.getName().toString();
908
                    if (result.length() > 0)
909
                        return result;
910
                    path = path.getParentPath();
911
                }
912
                return null;
913
            }
914
        } catch (Exception e) {
915
        }
916
        return null;
917
    }
896
    
918
    
897
    private TypeMirror uncaughtExceptionType(int caretOffset) {
919
    private TypeMirror uncaughtExceptionType(int caretOffset) {
898
        try {
920
        try {

Return to bug 160042