Community
Participate
Working Groups
when applying the quick assist on the several parts of a String only the last one is applyied e.g if I want to have "eclipse "+"is "+"very "+"cool " from "eclipse is very cool" with the help of the quick assist, I only get the last result and the previous extraction dissapears.
Can you give steps? I couldn't reproduce this. The only thing I found is that the quick assist is not offered on the second string literal
input String is "eclipse is very cool" select >>cool<< -> "eclipse is very " + "cool" // as expected select >>very << -> "eclipse is " + "very " + "cool" // still.. now select >>is << -> "eclipse " + "is " + "very cool" // ?? then select >>eclipse<< -> "eclipse" + " is very cool" //??
Konstantin, if you're interested...
Interesting problem. As I can see in JDT Core source, expression "a" + "b" + "c" is _single_ StringLiteral object! So, when we ask for covering node, we receive full string value and really generate only up to 3 string parts. I don't think that we can do anything rational with this. In reallity this quick fix can not be applyed at all to strings that consist of several parts, because we can not map selection in source to position in escaped string. For example here: "1" + "2{start select}3{end select}" selection in source is 8 (relative from beginning of StringLiteral), but in espaced string - only 3, but we can not know this. I will add to quick assist check that string consists of single part, see patch in attachment. As workaround I suggest you extract pieces of string into separate variables. In reallity this is why I need this quick assist - I write first rough text, that should be parametrized, then pick out parts of string and place them in parameters. You may be also noticed that picked out part string is selected, so you need just press hot key for "Extract local variable".
Created attachment 17141 [details] Fix for getPickOutStringProposals
This is a bug in the AST. I filed bug 82830. Didn't release the patch, jdt.core should fix this *** This bug has been marked as a duplicate of 82830 ***