如何在 Eclipse 3.5.2 中缩进选定的文本块?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2870686/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
How can I indent a selected block of text in Eclipse 3.5.2?
提问by cdonner
I use TAB and Shift-Tab in Visual Studio to indent an entire selection. This does nothing in Eclipse, and I can't seem to find another way to do it.
我在 Visual Studio 中使用 TAB 和 Shift-Tab 来缩进整个选择。这在 Eclipse 中没有任何作用,我似乎找不到另一种方法来做到这一点。
Update: I wasn't really paying all that much attention to this initially and did not ask the question correctly. I now realized that it is in XML files where TAB still does not indent a selection. I did not find a setting for this in the properties, so I assume it is not possible.
更新:我最初并没有真正关注这个问题,也没有正确提出这个问题。我现在意识到它在 XML 文件中,TAB 仍然没有缩进选择。我没有在属性中找到这个设置,所以我认为这是不可能的。
回答by Joshua McKinnon
Taband Shift+Tabare the normal ways to do this in Eclipse, just like in Visual Studio.
Tab和Shift+Tab是在 Eclipse 中执行此操作的常规方法,就像在 Visual Studio 中一样。
In addition to the keyboard shortcuts, you can also do this from the Source menu. Source -> Shift Left, and Source -> Shift Right.
除了键盘快捷键,您还可以从“源”菜单执行此操作。源 -> 左移,和源 -> 右移。
Have you checked to make sure tab/shift tabbing is working as you expect in other applications? Is there a stuck key on your keyboard preventing the shortcuts from working? Could another application be stealing the keyboard shortcuts? (as odd as that sounds...)
您是否检查过以确保制表符/移位制表符在其他应用程序中按您的预期工作?键盘上是否有一个卡住的键阻止快捷方式工作?其他应用程序可能会窃取键盘快捷键吗?(听起来很奇怪……)
Also, try restarting Eclipse.
另外,尝试重新启动 Eclipse。
回答by justGuest
ctrl + i ---> it is for making accurate indentation to a block of source code.
ctrl + i ---> 用于对源代码块进行准确缩进。
回答by Alb
Go to Window Menu -> Preferences -> Java -> Editor -> Typing and make sure the `'Tab key adjusts the indentation of the current line' checkbox is ticked.
转到窗口菜单 -> 首选项 -> Java -> 编辑器 -> 输入并确保勾选“Tab 键调整当前行的缩进”复选框。