Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 271592

Summary: [quick fix] multi quick fix does not work when proposal list has focus
Product: [Eclipse Project] JDT Reporter: Frederic Fusier <frederic_fusier>
Component: UIAssignee: JDT-UI-Inbox <jdt-ui-inbox>
Status: CLOSED WONTFIX QA Contact:
Severity: normal    
Priority: P3 CC: daniel_megert, markus.kell.r
Version: 3.5   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard: stalebug
Bug Depends on: 272284    
Bug Blocks:    
Attachments:
Description Flags
Screenshot - works for me none

Description Frederic Fusier CLA 2009-04-08 05:45:16 EDT
Using I20090401-1325 build.

I would expected that the quick-fix for Non-externalized strings could be applied on several lines.

It's possible to get lot of warning on non-externalized string when inserting a multi lines text using the 'Escape text when pasting into a string literal' Typing preferences...

E.g.

I have this simple code:
class X {
    String test = "";
}
and I want to insert following text inside the empty string literal:
This is a good example
illustrating
that the quick-fix
for non-externalized stings
should be
multi-fixable

After the insert, you get:
class X {
    String test = "This is a good example\r\n" + 
    		"illustrating\r\n" + 
    		"that the quick-fix\r\n" + 
    		"for non-externalized stings\r\n" + 
    		"should be\r\n" + 
    		"multi-fixable\r\n" + 
    		""; //$NON-NLS-1$
}
but unfortunately, I get a warning on each new inserted line.

Then it will be very cool to have a way to fix all these warnings in one shot instead of applying it for each inserted line...
Comment 1 Frederic Fusier CLA 2009-04-08 05:46:51 EDT
Ooops, a little typo in my sample, you should read instead:

class X {
    String test = ""; //$NON-NLS-1$

}

Comment 2 Markus Keller CLA 2009-04-08 08:10:21 EDT
Wouldn't it be easier if you just disabled the NLS warning in test projects? I don't think multi-line strings are that common in NLS'd projects.

Multi-fixes are a bit dangerous because you don't have a preview and may accidentally "fix" places that should not be touched.
Comment 3 Markus Keller CLA 2009-04-08 08:43:01 EDT
Created attachment 131272 [details]
Screenshot - works for me

Oh, Dani told me that we already have this as multi-fix. And when I tried your example in HEAD, it even worked. How do you invoke quick fix? Can you reproduce in a new Java project?
Comment 4 Markus Keller CLA 2009-04-08 09:04:18 EDT
I guess I found it:

The Ctrl+Enter trick for multi quick fixes only works as long as the proposal table does not have focus. As soon as you press Tab or click into the list, it doesn't work any more:
- message line at bottom of popup is not updated
- Ctrl+Enter does nothing

Adjusted summary and turned this into a bug.
Comment 5 Frederic Fusier CLA 2009-04-08 09:14:39 EDT
(In reply to comment #4)
> I guess I found it:
> 
> The Ctrl+Enter trick for multi quick fixes only works as long as the proposal
> table does not have focus. As soon as you press Tab or click into the list, it
> doesn't work any more:
> - message line at bottom of popup is not updated
> - Ctrl+Enter does nothing
> 
> Adjusted summary and turned this into a bug.
> 
I never get the Ctrl+End message, whatever the selection is... hence cannot apply the multi-fix functionality... :-(

Do I miss a preference somewhere?
Comment 6 Frederic Fusier CLA 2009-04-08 09:19:42 EDT
(In reply to comment #5)
> I never get the Ctrl+End message, whatever the selection is... hence cannot
> apply the multi-fix functionality... :-(
> 
> Do I miss a preference somewhere?
> 
OK, I found it. I need to click first to Ctrl key, then on the down arrow to select the "Add missing '$NON-NLS$' tag" item and then the Ctrl+End message appears... :-)

Not so intuitive though...
Comment 7 Dani Megert CLA 2009-04-15 06:12:32 EDT
>- message line at bottom of popup is not updated
This happens because ICompletionListener.selectionChanged(...) is not fired when the proposal has focus (see bug 272284).

>- Ctrl+Enter does nothing
This is because
- widgetDefaultSelected is not triggered when 'Ctrl' is down (as opposed to other
  modifiers being down)
  ==> we need to use a different listener here
- SelectionEvent.stateMask is not set (bug 65679)
  ==> will automatically be solved when we use a different listener
Comment 8 Eclipse Genie CLA 2020-03-12 07:46:01 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. As such, we're closing this bug.

If you have further information on the current state of the bug, please add it and reopen this bug. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.