本文整理汇总了Java中org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.selectAndReveal方法的典型用法代码示例。如果您正苦于以下问题:Java JavaEditor.selectAndReveal方法的具体用法?Java JavaEditor.selectAndReveal怎么用?Java JavaEditor.selectAndReveal使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.ui.javaeditor.JavaEditor
的用法示例。
在下文中一共展示了JavaEditor.selectAndReveal方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doChooseImports
import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor; //导入方法依赖的package包/类
private TypeNameMatch[] doChooseImports(TypeNameMatch[][] openChoices, final ISourceRange[] ranges, final JavaEditor editor) {
// remember selection
ISelection sel= editor.getSelectionProvider().getSelection();
TypeNameMatch[] result= null;
ILabelProvider labelProvider= new TypeNameMatchLabelProvider(TypeNameMatchLabelProvider.SHOW_FULLYQUALIFIED);
MultiElementListSelectionDialog dialog= new MultiElementListSelectionDialog(getShell(), labelProvider) {
@Override
protected void handleSelectionChanged() {
super.handleSelectionChanged();
// show choices in editor
doListSelectionChanged(getCurrentPage(), ranges, editor);
}
};
fIsQueryShowing= true;
dialog.setTitle(ActionMessages.OrganizeImportsAction_selectiondialog_title);
dialog.setMessage(ActionMessages.OrganizeImportsAction_selectiondialog_message);
dialog.setElements(openChoices);
dialog.setComparator(ORGANIZE_IMPORT_COMPARATOR);
if (dialog.open() == Window.OK) {
Object[] res= dialog.getResult();
result= new TypeNameMatch[res.length];
for (int i= 0; i < res.length; i++) {
Object[] array= (Object[]) res[i];
if (array.length > 0) {
result[i]= (TypeNameMatch) array[0];
QualifiedTypeNameHistory.remember(result[i].getFullyQualifiedName());
}
}
}
// restore selection
if (sel instanceof ITextSelection) {
ITextSelection textSelection= (ITextSelection) sel;
editor.selectAndReveal(textSelection.getOffset(), textSelection.getLength());
}
fIsQueryShowing= false;
return result;
}
示例2: doListSelectionChanged
import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor; //导入方法依赖的package包/类
private void doListSelectionChanged(int page, ISourceRange[] ranges, JavaEditor editor) {
if (ranges != null && page >= 0 && page < ranges.length) {
ISourceRange range= ranges[page];
editor.selectAndReveal(range.getOffset(), range.getLength());
}
}