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

(-)editor/libsrc/org/netbeans/editor/ext/java/JavaFastImport.java (+18 lines)
Lines 70-75 Link Here
70
        exp = Utilities.getSelectionOrIdentifier(target);
70
        exp = Utilities.getSelectionOrIdentifier(target);
71
        block = Utilities.getSelectionOrIdentifierBlock (target);
71
        block = Utilities.getSelectionOrIdentifierBlock (target);
72
        packageImport = getPackageImportSetting();
72
        packageImport = getPackageImportSetting();
73
        
74
        // Bugfix for #26966
75
        if (exp != null) {
76
            // Eliminating extra spaces
77
            String untrimmedExp = exp;
78
            exp = exp.trim();
79
        
80
            // Recalculating block beginning and ending
81
            int nLeadingSpaces = untrimmedExp.indexOf(exp);
82
            int nTrailingSpaces = untrimmedExp.length() - exp.length() - nLeadingSpaces;
83
            block[0] += nLeadingSpaces;
84
            block[1] -= nTrailingSpaces;
85
        }
86
73
    }
87
    }
74
    
88
    
75
    private boolean getPackageImportSetting(){
89
    private boolean getPackageImportSetting(){
Lines 271-279 Link Here
271
                if (item instanceof JCClass){
285
                if (item instanceof JCClass){
272
                    // bugfix of #26761
286
                    // bugfix of #26761
273
                    doc.insertString (block[0], ((JCClass)item).getFullName(), null);
287
                    doc.insertString (block[0], ((JCClass)item).getFullName(), null);
288
                    // sets the caret after the name (necessary when starting from a trimmed selection)
289
                    target.getCaret().setDot(block[0] + ((JCClass)item).getFullName().length());
274
                }else{
290
                }else{
275
                    doc.insertString (block[0], item.toString (), null);
291
                    doc.insertString (block[0], item.toString (), null);
292
                    target.getCaret().setDot(block[0] + item.toString().length());
276
                }
293
                }
294
                
277
            } catch (javax.swing.text.BadLocationException ex) {
295
            } catch (javax.swing.text.BadLocationException ex) {
278
                throw new IllegalStateException ();
296
                throw new IllegalStateException ();
279
            }
297
            }

Return to bug 26966