Eclipse Shift + Ctrl + O stops working (Android 4.0.3)

Using Eclipse Shift + Ctrl + O to organize the import works fine until it stops working.

For some reason, it now removes my necessary imports and does not allow classes. Example below: Button, onClick, Toast are not allowed due to pressing Shift-Ctrl-O, it cleared the necessary file.

It worked before, and I donโ€™t know what I did to make it no longer work. Any help would be greatly appreciated. I cleaned up the project, restarted eclipse ... to no avail.

final Button button=(Button) findViewById(R.id.button); button.setOnClickListener(new OnClickListener() { public void onClick(View v) { //Perform action on clicks Toast.makeText(HelloFormStuffActivity.this, "Beep Bop", Toast.LENGTH_SHORT).show(); } }); 

Thank you very well in advance.

+4
source share
2 answers

I / had the same problem. The best I could understand was that the eclipse should have a โ€œsourceโ€ element on the main toolbar, which has options such as format and โ€œOrganize Importโ€. When you click on a project in the "Package Explorer", the "source" menu item appears between the "refactor" and the "launch".

+1
source

This happened when I created a file without the .java extension and renamed it to Refactor. Until I noticed that there was no syntax highlighting, I realized that I was still opening it in a text editor, so I closed it and opened it again, and Ctrl + Shift + O started working again.

+1
source

Source: https://habr.com/ru/post/1393856/


All Articles