本文整理汇总了Java中com.intellij.codeInsight.editorActions.ExtendWordSelectionHandlerBase类的典型用法代码示例。如果您正苦于以下问题:Java ExtendWordSelectionHandlerBase类的具体用法?Java ExtendWordSelectionHandlerBase怎么用?Java ExtendWordSelectionHandlerBase使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExtendWordSelectionHandlerBase类属于com.intellij.codeInsight.editorActions包,在下文中一共展示了ExtendWordSelectionHandlerBase类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: select
import com.intellij.codeInsight.editorActions.ExtendWordSelectionHandlerBase; //导入依赖的package包/类
@Override
public List<TextRange> select(PsiElement e, CharSequence editorText, int cursorOffset, Editor editor) {
final GrDocCommentOwner owner;
final GrDocComment doc;
if (e instanceof GrDocComment) {
doc = (GrDocComment)e;
owner = GrDocCommentUtil.findDocOwner(doc);
}
else {
owner = (GrDocCommentOwner)e;
doc = GrDocCommentUtil.findDocComment(owner);
}
if (doc == null || owner == null) return Collections.emptyList();
final TextRange range = new TextRange(doc.getTextRange().getStartOffset(), owner.getTextRange().getEndOffset());
return ExtendWordSelectionHandlerBase.expandToWholeLine(editorText, range, true);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:GroovyMembersWithDocSelectioner.java
示例2: select
import com.intellij.codeInsight.editorActions.ExtendWordSelectionHandlerBase; //导入依赖的package包/类
@Override
public List<TextRange> select(PsiElement e, CharSequence editorText, int cursorOffset, Editor editor) {
final TextRange originalRange = e.getTextRange();
LOG.assertTrue(originalRange.getEndOffset() <= editorText.length(), getClass() + "; " + e);
List<TextRange> ranges;
if (isSeparateStatement(e)) {
ranges = ExtendWordSelectionHandlerBase.expandToWholeLine(editorText, originalRange, true);
if (ranges.size() == 1 && ranges.contains(originalRange)) {
ranges = ExtendWordSelectionHandlerBase.expandToWholeLine(editorText, originalRange, false);
}
}
else {
ranges = new ArrayList<TextRange>();
ranges.add(e.getTextRange());
}
SelectWordUtil.addWordSelection(editor.getSettings().isCamelWords(), editorText, cursorOffset, ranges);
return ranges;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:22,代码来源:GroovyWordSelectionHandler.java
示例3: select
import com.intellij.codeInsight.editorActions.ExtendWordSelectionHandlerBase; //导入依赖的package包/类
@Override
public List<TextRange> select(PsiElement e, CharSequence editorText, int cursorOffset, Editor editor) {
TextRange originalRange;
PsiElement first;
PsiElement last;
if (e instanceof GrStatement) {
first = e;
PsiElement next = e.getNextSibling();
next = skipWhitespacesForward(next);
if (next != null && next.getNode().getElementType() == GroovyTokenTypes.mSEMI) {
originalRange = new TextRange(e.getTextRange().getStartOffset(), next.getTextRange().getEndOffset());
last = next;
}
else {
originalRange = e.getTextRange();
last = e;
}
}
else {
last = e;
PsiElement prev = e.getPrevSibling();
prev = skipWhitespaceBack(prev);
if (prev instanceof GrStatement) {
originalRange = new TextRange(prev.getTextRange().getStartOffset(), e.getTextRange().getEndOffset());
first = prev;
}
else {
originalRange = e.getTextRange();
first = e;
}
}
final List<TextRange> ranges = ExtendWordSelectionHandlerBase.expandToWholeLine(editorText, originalRange);
final TextRange blockRange = inferBlockRange(first, last);
if (!blockRange.equals(originalRange)) {
ranges.addAll(ExtendWordSelectionHandlerBase.expandToWholeLine(editorText, blockRange, true));
}
return ranges;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:47,代码来源:GroovyStatementSelectioner.java
注:本文中的com.intellij.codeInsight.editorActions.ExtendWordSelectionHandlerBase类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论