Bugzilla – Bug 99
Automatic import statements
Last modified: 2009-03-23 08:59:15
You need to log in before you can comment on or make changes to this bug.
Hi, please add the possibility to import the necessary import statements automatically. For example javafx.stage.Stage { title : "My first JavaFX program" scene: javafx.scene.Scene { width: 200 height: 200 content: [ Text { } ] } It would be nice to have the possibility to right mouse click -> Source -> Organize Imports like in standard Java code. Best regards, Lars
+1
Created an attachment (id=26) [details] Screen shots that show the quick fix in action Not entirely the solution that was asked for, but I have a patch that implements a "quick fix" that adds import statements for unknown classes. I haven't had time to polish/fully test it yet, and I'm sure it can be improved upon, but maybe you can use it to jump start your efforts?
Applied the Quick Fix patch. Will this work for you instead of the Organize Imports feature?
Hi, sorry that it took me so long to reply, I wasn't sure that you were addressing me (I'm still not... ;-)). The quick fix looks very good and is a valid workaround for my reported bug. Thank you, Lars
Hi, I tried the quick fix solution on my mac installation and it does not work. The button is disabled. Any ideas when the organize imports will be operational or how I enable the quick fix? Thanks!
What Java FX code are you using? The Quick Fix is not available for every type of error, so without some code it's hard to comment on this issue.
Created an attachment (id=45) [details] screendump that show the code and errors I simply follow the example on the previous screen shots and the quick fix is disabled. I entered a separate bug for the error icons on the numbers on the editor pane. It also appears that the scripts are not automatically saved when one clicks on the run button. Is this a known bug?
(In reply to comment #7) > Created an attachment (id=45) [details] [details] > screendump that show the code and errors > > I simply follow the example on the previous screen shots and the quick fix is > disabled. That is the expected behavior, since that error has nothing to do with missing imports and thus cannot be resolved by adding import statements. > It also appears that the scripts are not automatically saved when one clicks on > the run button. Is this a known bug? This is an Eclipse preference setting. See Window|Preferences, the first option under the Run/Debug|Launching heading.
Sorry... How can this be 'expected behavior'? The first screen shot of the quick fix in action posted by sinnema313 clearly shows the same error I have with an enabled option for a quick fix. On my configuration it is disabled. In my view this is unexpected behavior. For the sake of clarity on the issue I am referring to the error 'cannot find symbol: class Scene, Font, etc...'. The screen dump shows also other errors, which are ignored by the compiler. I posted a separate bug for these error signs. Thanks on the tip on the automatic save before run.
I applied the tip for the save before run on my mac configuration. No such luck :( Shall I report a separate bug?
(In reply to comment #10) > I applied the tip for the save before run on my mac configuration. No such luck > :( Shall I report a separate bug? Not on the JavaFX plug-in, as it has nothing to do with it AFAIK. This functionality is part of standard Eclipse.
(In reply to comment #9) > Sorry... How can this be 'expected behavior'? The first screen shot of the > quick fix in action posted by sinnema313 clearly shows the same error I have > with an enabled option for a quick fix. My bad, I confused this with the errors on the width and height. > On my configuration it is disabled. I don't have a Mac, so I can't try this. On my GNU/Linux box it works. Can someone from Sun or otherwise try this on a Mac? Also what version of the JavaFX SDK are you using?
(In reply to comment #12) > Also what version of the JavaFX SDK are you using? I am using the latest SDK which comes with the Mac netbeans image. Eclipse runs under java 1.5 while my java default is 1.6. This is the common set up for 64-bit architectures. I am not quite sure if it is a platform problem. I'll make a clean install and try again. It might be a configuration mismatch with my other plug ins.