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

(-)a/junit/src/org/netbeans/modules/junit/ClassNameTextField.java (-6 / +5 lines)
Lines 165-171 Link Here
165
     * @return  status for the current text
165
     * @return  status for the current text
166
     */
166
     */
167
    int determineStatus() {
167
    int determineStatus() {
168
        //trim class name before validate issue :141166
169
        String text = getText().trim();
168
        String text = getText().trim();
170
        
169
        
171
        int status = STATUS_BEFORE_PART;
170
        int status = STATUS_BEFORE_PART;
Lines 218-229 Link Here
218
        switch (internalStatus) {
217
        switch (internalStatus) {
219
            case STATUS_VALID:
218
            case STATUS_VALID:
220
                externalStatus = (defaultText == null)
219
                externalStatus = (defaultText == null)
221
                                        || defaultText.equals(getText())
220
                                        || defaultText.equals(getText().trim())//trim class name before validate issue :141166
222
                                 ? STATUS_VALID
221
                                 ? STATUS_VALID
223
                                 : STATUS_VALID_NOT_DEFAULT;
222
                                 : STATUS_VALID_NOT_DEFAULT;
224
                break;
223
                break;
225
            case STATUS_BEFORE_PART:
224
            case STATUS_BEFORE_PART:
226
                externalStatus = (getText().length() == 0) ? STATUS_EMPTY
225
                externalStatus = (getText().trim().length() == 0) ? STATUS_EMPTY//trim class name before validate issue :141166
227
                                                           : STATUS_INVALID;
226
                                                           : STATUS_INVALID;
228
                break;
227
                break;
229
            case STATUS_INVALID:
228
            case STATUS_INVALID:
Lines 280-286 Link Here
280
         */
279
         */
281
        public TextListener() {
280
        public TextListener() {
282
            status = determineStatus();
281
            status = determineStatus();
283
             //trim class name before validate issue :141166
282
            //trim class name before validate issue :141166
284
            length = ClassNameTextField.this.getText().trim().length();
283
            length = ClassNameTextField.this.getText().trim().length();
285
        }
284
        }
286
285
Lines 306-312 Link Here
306
            int newStatus;
305
            int newStatus;
307
            boolean wasEmpty = (length == 0);
306
            boolean wasEmpty = (length == 0);
308
307
309
            if (documentEvent.getLength() != 1
308
            if (documentEvent.getDocument().getLength() != 1
310
                    || (documentEvent.getOffset() != length)) {
309
                    || (documentEvent.getOffset() != length)) {
311
                length += documentEvent.getLength();
310
                length += documentEvent.getLength();
312
                newStatus = determineStatus();
311
                newStatus = determineStatus();
Lines 366-372 Link Here
366
        public void removeUpdate(DocumentEvent documentEvent) {
365
        public void removeUpdate(DocumentEvent documentEvent) {
367
            int newStatus;
366
            int newStatus;
368
367
369
            if (documentEvent.getLength() != 1
368
            if (documentEvent.getDocument().getLength() != 1
370
                    || (documentEvent.getOffset() != (length - 1))) {
369
                    || (documentEvent.getOffset() != (length - 1))) {
371
                length -= documentEvent.getLength();
370
                length -= documentEvent.getLength();
372
                newStatus = determineStatus();
371
                newStatus = determineStatus();

Return to bug 141166