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 212412
Collapse All | Expand All

(-)a/java.editor/src/org/netbeans/modules/editor/java/Utilities.java (+37 lines)
Lines 166-171 Link Here
166
            return false;
166
            return false;
167
        if (prefix == null || prefix.length() == 0)
167
        if (prefix == null || prefix.length() == 0)
168
            return true;
168
            return true;
169
        
170
        // sub word completion
171
        {
172
            // example:
173
            // 'out' produces '.*?[o|O].*?[u|U].*?[t|T].*?'
174
            // org.openide.util.Utilities.acoh -> actionsForPath
175
            // java.lang.System.out -> setOut
176
            // argex -> IllegalArgumentException
177
            // java.util.Collections.que -> asLifoQueue
178
            // java.lang.System.sin -> setIn, getSecurityManager, setSecurityManager
179
            
180
            // check whether user input matches the regex
181
            StringBuilder sb = new StringBuilder(3+8*prefix.length());
182
            sb.append(".*?");
183
            for (int i = 0; i < prefix.length(); i++) {
184
                char charAt = prefix.charAt(i);
185
                if (Character.isLowerCase(charAt)) {
186
                    sb.append("[");
187
                    sb.append(charAt);
188
                    sb.append("|");
189
                    sb.append(Character.toUpperCase(charAt));
190
                    sb.append("]");
191
                } else {
192
                    //keep uppercase characters as beacons
193
                    // for example: java.lang.System.sIn -> setIn
194
                    sb.append(charAt);
195
                }
196
                sb.append(".*?");
197
            }
198
            
199
             System.out.println(sb);
200
            // FIXME regex matches are expensive
201
            if (Pattern.compile(sb.toString()).matcher(theString).matches()) {
202
                return true;
203
            };
204
        }
205
        
169
        return isCaseSensitive() ? theString.startsWith(prefix) :
206
        return isCaseSensitive() ? theString.startsWith(prefix) :
170
            theString.toLowerCase(Locale.ENGLISH).startsWith(prefix.toLowerCase(Locale.ENGLISH));
207
            theString.toLowerCase(Locale.ENGLISH).startsWith(prefix.toLowerCase(Locale.ENGLISH));
171
    }
208
    }

Return to bug 212412