是否有一个Eclipse命令用括号将当前选择内容括起来? [英] Is there an Eclipse command to surround the current selection with parentheses?

查看:157
本文介绍了是否有一个Eclipse命令用括号将当前选择内容括起来?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有一个Eclipse命令用括号将当前选择内容括起来?

Is there an Eclipse command to surround the current selection with parentheses?

创建模板是一个不错的解决方法;它不能与环绕"功能一起使用,因为我想用括号括住表达式,而不是整行,并且需要${word_selection}而不是${line_selection}.

Creating a template is a decent workaround; it doesn't work with the "Surround With" functionality, because I want to parenthesize an expression, not an entire line, and that requires ${word_selection} rather than ${line_selection}.

是否可以将键盘快捷键绑定到此特定模板? Ctrl -空间 Ctrl -空间 /p>

Is there a way that I can bind a keyboard shortcut to this particular template? Ctrl-space Ctrl-space arrow arrow arrow isn't as slick as I'd hoped for.

推荐答案

也许不是正确的答案,但至少是一种解决方法:

Maybe not the correct answer, but at least a workaround:

  1. 使用以下名称定义名称为括号"(或"pa")的Java模板:

  1. define a Java template with the name "parenthesis" (or "pa") with the following :

($ {word_selection})$ {cursor}

(${word_selection})${cursor}

选择单词后, ctrl -空格 + p +使用箭头键选择模板

once the word is selected, ctrl-space + p + use the arrow keys to select the template

我使用此技术在JDK 1.4.2中对主要类型进行装箱,它节省了大量键入内容.

I used this technique for boxing primary types in JDK 1.4.2 and it saves quite a lot of typing.

这篇关于是否有一个Eclipse命令用括号将当前选择内容括起来?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆