“Open Type” command does not respond in Eclipse wo

2019-03-14 22:45发布

问题:

In Eclipse, you can use Ctrl + Shift + T to search for a type. Unfortunately, Eclipse does not respond to this hotkey in one of my workspaces.

I am running IBM AST 6.1, which is built on Eclipse 3.2.1 (see http://publib.boulder.ibm.com/infocenter/wasinfo/v6r1/index.jsp?topic=/com.ibm.websphere.express.doc/info/exp/ae/tins_ast_roadmap.html).

When I go to Window -> Preferences -> General -> Keys, it shows the Open Type command is set to the Key Sequence Ctrl+Shift+T "When" "In Windows". Is this correct?

I can use Ctrl+Shift+R to search for a resource in this same Workspace, using the same Ctrl and Shift keys (i.e. the keys are working). I can also use Ctrl+Shift+T on other workspaces with the same Eclipse installation.

How can I enable Ctrl+Shift+T? What other info do we need to troubleshoot?

回答1:

Do you have the right perspective opened? "Open Type" does work in the Java, JavaEE ... perspectives, but not in the "Synchronize" perspective (for example).

To enable it for the "Synchronize" perspective in eclipse Mars(4.5) go to Window > Perspective > Customize Perspective... and in the "Action Set Availability" tab check the "Java Navigation" action set.



回答2:

I was already in the right perspective so that was not the cause of my issue. However, closing and re-opening the project fixed the problem for me.



回答3:

Try to delete all Eclipse indexed names in the following way:

  1. Go to folder workspace/.metadata/.plugins/org.eclipse.jdt.core
  2. Remove all *.index files and savedIndexNames.txt
  3. Restart Eclipse

The recommendations were provided by Mike Schrag and the whole trace can be found here.



回答4:

The same problem was resolved for me in a slightly different way... I first checked that I followed the accepted answer, confirmed that the Open Type command was mapped correctly and relevant to the perspective I was in.

But... it was still not functioning, apparently because focus was in a javascript file. Clicking out and assigning focus back to the package explorer tab allowed Open Type to work.



回答5:

you need to make sure that the eclipse window is active in your OS.



回答6:

For people who need to switch focus from JavaScripts every now and then. 1.Go to Window -> Preferences -> General ->Keys .

2.Search for Open type from list .

3.In Description : ensure it's Open a type in a Java editor

In Binding : ctrl + shift + T

when : In Windows 4.Apply.

P.S : IF any duplicates of Open Type please unbind it or restore defaults.



回答7:

Although, this is a very old post. But it might be someone get this problem in future.

The above mentioned posts can help in most of the scenarios. But sometimes, even you select the Java/J2EE perspective, but the selected project is not a nature of java/j2ee. And in that case, the Open Type will open but will not search anything. And to fix that you have to make sure, the selected project has the following code in .project file:

<natures>
    <nature>org.eclipse.jdt.core.javanature</nature>
</natures>