Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
415 views
in Technique[技术] by (71.8m points)

java - Eclipse Organize Imports Shortcut (Ctrl+Shift+O) is not working

Eclipse used to import missing packages when I press Ctrl+Shift+O.

The shortcut key has stopped working when used in Java files but the same shortcut is working in Python files (importing missing packages).

Any thoughts on how to fix the issue.

Below are couple of snapshots for your reference.

Keys Binding

Organize Imports in Source

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The Java Organize Import command is overwritten by another Ctrl+Shift+O command: in Window > Preferences: General > Keys the Java Organize Import command (where When is In Windows) is bound to Ctrl+Shift+O, but in the main and right-click menu Source > Organize Imports the command is displayed without the shortcut.

There are two solutions for this problem:

  • Change or remove the shortcut of the command that overwrites the Java Organize Import command:

    1. Find the command: In the Java editor press Ctrl+Shift+L and see which command is bound to Ctrl+Shift+O. Probably, it is the Beans Quick Outline command.
    2. In Window > Preferences: General > Keys change or remove the binding for the found command.
  • Restricts the scope of the shortcut of Java Organize Import to the Java editor:

    1. In Window > Preferences: General > Keys select the Java Organize Import command and change When from In Windows to Editing Java Source. This solution restricts Ctrl+Shift+O to the Java editor and disables the shortcut in the Package/Project Explorer.

See also: Spring IDE issue #160: organize imports is not working


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...