我正在编写一个小插件,将Eclipse文本编辑器的插入符号位置移到所选块的另一端。问题是我找不到一个很好的方法来发现选择是从左到右还是从右到左。似乎打破了抽象,因为我必须知道编辑器是如何实现的。另一个缺点是,您必须在文本查看器上使用widgetOffset2ModelOffset方法来调整位置。我不能从我的ITextEditor或ISelectionProvider或其他地方得到插入符号的位置吗?这是我的代码:
public class SwapCur
org.eclipse.jface.text.IDocument;import org.eclipse.jface.text.ITextViewerstatic final String PREFERENCES = ".hyper";
public IHyperlink[] detectHyperlinks(ITextViewer我的目标是打开我在编辑过的dsl语法中点击过的</