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.

Bug 26966

Summary: Fast Import (Alt Shift I) should trim selected text
Product: editor Reporter: sergionalin <sergionalin>
Component: -- Other --Assignee: issues@editor <issues>
Status: RESOLVED FIXED    
Severity: blocker CC: jkovar, mihmax
Priority: P3 Keywords: REGRESSION, SIMPLEFIX
Version: 3.x   
Hardware: All   
OS: Windows XP   
Issue Type: ENHANCEMENT Exception Reporter:
Attachments: Patch to be applied on main trunk
Patch to be applied on release341 branch
Better patch (no more null exceptions)
Proposed patch for trunk

Description sergionalin 2002-09-02 17:54:37 UTC
if you select, e.g.: "Remote Exception " with a space as the last char 
(which will always 
happen if you use word selection with crtl + right arrow)
and use the Fast Import function, it will 
not work.
If you remove the last space all works as expected.
I greatly appreciate the Fast 
Import function and think this small adjustment would improve its "ease of use".
Comment 1 _ mihmax 2002-11-21 10:11:20 UTC
Enchancment, will not be fixed in 3.4.1

just to let you know, see also:
http://www.netbeans.org/devhome/docs/releases/34/

Sincere, Maxym
Comment 2 _ mihmax 2002-11-21 17:57:39 UTC
Sorry, I didn't clarify myself:

This issue is considered as a candidate for 3.4.1, but it's not a
"MUST HAVE" bugfix (that's why I removed it blocking issue 28441).

Sorry
Comment 3 carcassi 2002-11-22 04:18:38 UTC
Created attachment 8017 [details]
Patch to be applied on main trunk
Comment 4 carcassi 2002-11-22 04:29:28 UTC
The patch I have attached is a diff from the main trunk. 
It basically modify just one file (JavaFastImport.java) 
trimming the text.

The patch is compatible with issue #25497, which is not 
marked as CANDIDATE_3.4.1. Integrating the fix without 
issue #25497 requires a slightly different patch. I remain 
available to provide this if needed and when needed. :-)
Comment 5 _ mihmax 2002-11-22 08:44:16 UTC
Yes, Gabriele, please make a patch without issue 25497 - I'm not sure
it can/may go into 3.4.1
Comment 6 carcassi 2002-11-22 15:39:50 UTC
I'll make a patch to the 3.4.1 trunk. There is one thing, 
though: there are two other issues (#26063 and #26430) 
that have been solved after issue #25497, and are 
3.4.1_CANDIDATE. If I make the patch to the 3.4.1 trunk, 
it means they have to make patches for those after mine 
since I don't see them integrate in 3.4.1. Is it ok? Or is 
it better that I wait for the integration of #26063 and 
#26430 (since this issue is not really a MUST_HAVE)?

(Ok, maybe I am being too cautious... It's the first time 
I contribute to such a big project. ;-) )
Comment 7 Miloslav Metelka 2002-11-22 16:47:18 UTC
If it does not matter that the #25497 was an enhancement I would
integrate them all. But IMHO Maxym should finally decide.
Comment 8 _ mihmax 2002-11-23 16:02:58 UTC
OK, so this enchancement is small enough to be OK even the bugfix
release (3.4.1 is that).

Please, post to nbreviewers about all the issues (2 or 3), I hope
noone objects these RFEs
Comment 9 _ mihmax 2002-11-23 16:09:52 UTC
2 Gabriele:
Thanks for the diff, _both_ fixes should be integrated into 3.4.1, so
there's no need in other .diff
Comment 10 _ mihmax 2002-11-23 16:24:00 UTC
2 Gabrielle again ;-)
Bugfixes for issue 26063 and issue 26430 are both to go into 3.4.1
Comment 11 Jaroslav Tulach 2002-12-03 09:54:05 UTC
Hi. This issue is marked as 3.4.1_CANDIDATE. It means that it should be
integrated into release341 one branch. The plan at
http://www.netbeans.org/devhome/docs/releases/34/index.html expected beta1 to be
produced on Dec01. That did not happen due to a lot of outstanding not
integrated candidates like this one. 

Would it be possible to spend few minutes by backporting this fix? Thank you in
advance.
Comment 12 _ mihmax 2002-12-06 06:24:38 UTC
2 Gabriele: #25497 is not going to 3.4.1, so please provide a
different patch.
The one you provided really ;-) doesn't work.
Comment 13 carcassi 2002-12-06 14:20:09 UTC
I will provide a patch to the release341 branch. When you 
say the patch didn't work, do you mean to the release341 
branch (which I know) or to the trunk (which should 
work)? :-)
Comment 14 _ mihmax 2002-12-06 14:44:02 UTC
in release341 ;-) of course
I haven't look at trunk since starting 3.4.1 initiative
Comment 15 carcassi 2002-12-08 17:05:44 UTC
Created attachment 8204 [details]
Patch to be applied on release341 branch
Comment 16 carcassi 2002-12-08 17:08:36 UTC
I attached the patch. Sorry it took so long, I needed some 
quiet time to figure out the extra binary stuff...
Comment 17 _ mihmax 2002-12-08 19:34:01 UTC
No problem it took long, Frinay night build - a possible 3.4.1 beta
wasn't done anyway ;-(

Thanks a lot

BTW: Since the patch is So Simple ;), I commit it right away:
Checking in
editor/libsrc/org/netbeans/editor/ext/java/JavaFastImport.java;
new revision: 1.7.24.2; previous revision: 1.7.24.1
done
Comment 18 _ mihmax 2002-12-08 20:36:53 UTC
Sorry folks, but Gabriele's patch is mailfunctioning, actually it
throughs NPE every time I'm between two spaces: " | " and press
Alt+Shift+I.

In this piece of code:
        exp = exp.trim();    
exp is null if we're not immediately after of before the identifier,
so trimming it gives us nothing.

Checking in
editor/libsrc/org/netbeans/editor/ext/java/JavaFastImport.java;
new revision: 1.7.24.3; previous revision: 1.7.24.2
Comment 19 _ mihmax 2002-12-08 20:41:32 UTC
2Gabriele: 
null is returned, I suppose, by
"Utilities.getSelectionOrIdentifier(target);" method, so the trimming
must be done somewhere in Utilities class, not in JavaFastImport class.

Sincere, Maxym
Comment 20 carcassi 2002-12-08 21:22:35 UTC
Hi Maxym,
I am sorry: I feel I am making you lose time over 
something very trivial.
I don't think the trim should be done in the Utility 
class, since the function has to return the selection, and 
the selection might contain spaces. I'll just check if 
null is returned, and don't trim.
I'll try to test the fix better before attaching it this 
time.
Comment 21 carcassi 2002-12-08 22:05:23 UTC
Created attachment 8210 [details]
Better patch (no more null exceptions)
Comment 22 _ mihmax 2002-12-09 17:41:19 UTC
Well, Gabriele,
the patch you provided is useless if (| being caret) you have the
following situation and press Alt+Shift+I:
"RemoteException | re;"

I this situation the "exp" is null, so trimming doesn't help much ;-)
I mean, what's the testcase where this trimming DOES help? I saw none.

Sincer, Max
Comment 23 carcassi 2002-12-09 23:21:14 UTC
Maxym, the trim is useful when you have selected 
something, as the summary suggests. ;-) If you 
select "RemoteException ", without the patch you don't 
import anything, with it you do. I tend to select (that's 
why I didn't notice the problem with the patch), you seem 
not to, so you'll never notice the difference. :-) The 
behaviour without selection was intended to stay the same.

If you ask: why should I select "RemoteException " in the 
first place? It comes out when you use Ctrl+right to 
select a word. Yes, it _is_ something very very very 
tiny... ;-) but it gets annoying. And every little counts.

Hope it's clear now. :-)
Comment 24 _ mihmax 2002-12-10 16:02:36 UTC
OK, accepted.
Small feature, and now that we know all the BUGs ;-), it's ready to be
applyed.

Checking in
editor/libsrc/org/netbeans/editor/ext/java/JavaFastImport.java;
new revision: 1.7.24.4; previous revision: 1.7.24.3
done
Comment 25 _ mihmax 2002-12-10 16:18:39 UTC
Editor guys!
please commit to trunk

Thanks
Comment 26 carcassi 2002-12-10 17:04:54 UTC
Wait before integrating to trunk! :-)
Due to issue #25497, I have to provide a different patch.
Comment 27 carcassi 2003-01-01 17:33:56 UTC
Created attachment 8412 [details]
Proposed patch for trunk
Comment 28 carcassi 2003-01-01 17:36:46 UTC
Sorry I took so long. The fix is compatible with other 
issues that wheren't included in 3.4.1, in particular 
#25497 and #26761.
Comment 29 carcassi 2003-02-13 22:58:32 UTC
The patch doesn't seem to have been committed to the 
trunk. And I actually noticed that the file it is patching 
has changed... What happens now? :-)
Comment 30 scaswell 2003-06-27 13:07:22 UTC
This feature was included in 3.4.1 but has disappeared in the released
3.5. Can it please be reinstated?
Comment 31 carcassi 2003-06-27 14:09:48 UTC
Well, I would be willing to provide another patch. Question 
is: will this time somebody have a look at it and integrate 
it? :-(
Comment 32 Martin Roskanin 2003-06-27 16:25:59 UTC
Gabriele, thank you for the patch. I have added you to NetBeans credit
file in core/release/CREDITS.html
I have used your carcassi@netbeans.org email, if you would like to
change it, please let me know.

the bug has been fixed in [maintrunk]
/cvs/editor/libsrc/org/netbeans/editor/ext/java/JavaFastImport.java,v
 <--  JavaFastImport.java
new revision: 1.14; previous revision: 1.13

also implemented in [prj40_prototype]
/cvs/java/editor/libsrc/org/netbeans/editor/ext/java/Attic/JavaFastImport.java,v
 <--  JavaFastImport.java
new revision: 1.1.2.1.2.1.2.3; previous revision: 1.1.2.1.2.1.2.2

Thanks again,
Mato

PS: we are sorry for omitting this issue for a long time ;-)
Comment 33 Martin Roskanin 2003-07-01 15:44:09 UTC
*** Issue 34707 has been marked as a duplicate of this issue. ***
Comment 34 Martin Roskanin 2003-07-01 15:51:19 UTC
CCing our sustainer...
Comment 35 _ mihmax 2003-07-02 11:55:26 UTC
Martin, I suppose you marked it a DEFECT by mistake, or do I miss
anything?
Comment 36 carcassi 2003-07-08 17:08:42 UTC
BTW, since this is a trivial patch, and was present in 
3.4.1 and not in 3.5, shouldn't we mark it both as 
SIMPLEFIX and REGRESSION? :-)
Comment 37 Miloslav Metelka 2003-07-15 15:55:24 UTC
OK, I've added both requested keywords. It's a regression against
3.4.1, so we should include the fix in the next update of 3.5.