本文整理汇总了Java中org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.revealInEditor方法的典型用法代码示例。如果您正苦于以下问题:Java EditorUtility.revealInEditor方法的具体用法?Java EditorUtility.revealInEditor怎么用?Java EditorUtility.revealInEditor使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.ui.javaeditor.EditorUtility
的用法示例。
在下文中一共展示了EditorUtility.revealInEditor方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility; //导入方法依赖的package包/类
@Override
public void run(IStructuredSelection selection) {
IMember[] members= getSelectedMembers(selection);
if (members == null || members.length == 0) {
return;
}
try {
ICompilationUnit cu= members[0].getCompilationUnit();
if (!ActionUtil.isEditable(getShell(), cu)) {
return;
}
// open the editor, forces the creation of a working copy
IEditorPart editor= JavaUI.openInEditor(cu);
if (ElementValidator.check(members, getShell(), getDialogTitle(), false))
run(members);
JavaModelUtil.reconcile(cu);
EditorUtility.revealInEditor(editor, members[0]);
} catch (CoreException e) {
ExceptionHandler.handle(e, getShell(), getDialogTitle(), ActionMessages.AddJavaDocStubsAction_error_actionFailed);
}
}
示例2: open
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility; //导入方法依赖的package包/类
private void open(KeyReference keyReference) {
if (keyReference == null)
return;
try {
IEditorPart part= keyReference.element != null ? EditorUtility.openInEditor(keyReference.element, true) : EditorUtility.openInEditor(keyReference.resource, true);
if (part != null)
EditorUtility.revealInEditor(part, keyReference.offset, keyReference.length);
} catch (PartInitException x) {
String message= null;
IWorkbenchAdapter wbAdapter= (IWorkbenchAdapter)((IAdaptable)keyReference).getAdapter(IWorkbenchAdapter.class);
if (wbAdapter != null)
message= Messages.format(PropertiesFileEditorMessages.OpenAction_error_messageArgs,
new String[] { wbAdapter.getLabel(keyReference), x.getLocalizedMessage() } );
if (message == null)
message= Messages.format(PropertiesFileEditorMessages.OpenAction_error_message, x.getLocalizedMessage());
MessageDialog.openError(fShell,
PropertiesFileEditorMessages.OpenAction_error_messageProblems,
message);
}
}
示例3: revealElementInEditor
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility; //导入方法依赖的package包/类
private void revealElementInEditor(Object elem, StructuredViewer originViewer) {
// only allow revealing when the type hierarchy is the active page
// no revealing after selection events due to model changes
if (getSite().getPage().getActivePart() != this) {
return;
}
if (fSelectionProviderMediator.getViewerInFocus() != originViewer) {
return;
}
IEditorPart editorPart= EditorUtility.isOpenInEditor(elem);
if (editorPart != null && (elem instanceof IJavaElement)) {
getSite().getPage().removePartListener(fPartListener);
getSite().getPage().bringToTop(editorPart);
EditorUtility.revealInEditor(editorPart, (IJavaElement) elem);
getSite().getPage().addPartListener(fPartListener);
}
}
示例4: open
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility; //导入方法依赖的package包/类
private void open(KeyReference keyReference) {
if (keyReference == null)
return;
try {
IEditorPart part= EditorUtility.openInEditor(keyReference.storage, true);
if (part != null)
EditorUtility.revealInEditor(part, keyReference.offset, keyReference.length);
} catch (PartInitException x) {
String message= null;
IWorkbenchAdapter wbAdapter= (IWorkbenchAdapter)((IAdaptable)keyReference).getAdapter(IWorkbenchAdapter.class);
if (wbAdapter != null)
message= Messages.format(PropertiesFileEditorMessages.OpenAction_error_messageArgs,
new String[] { wbAdapter.getLabel(keyReference), x.getLocalizedMessage() } );
if (message == null)
message= Messages.format(PropertiesFileEditorMessages.OpenAction_error_message, x.getLocalizedMessage());
MessageDialog.openError(fShell,
PropertiesFileEditorMessages.OpenAction_error_messageProblems,
message);
}
}
示例5: linkToEditor
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility; //导入方法依赖的package包/类
/**
* Links to editor (if option enabled)
* @param selection the selection
*/
private void linkToEditor(ISelection selection) {
Object obj= SelectionUtil.getSingleElement(selection);
if (obj != null) {
IEditorPart part= EditorUtility.isOpenInEditor(obj);
if (part != null) {
IWorkbenchPage page= getSite().getPage();
page.bringToTop(part);
if (obj instanceof IJavaElement)
EditorUtility.revealInEditor(part, (IJavaElement)obj);
}
}
}
示例6: openElement
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility; //导入方法依赖的package包/类
public IEditorPart openElement(Object element) throws PartInitException {
IWorkbenchPage wbPage= JavaPlugin.getActivePage();
IEditorPart editor;
if (NewSearchUI.reuseEditor())
editor= showWithReuse(element, wbPage);
else
editor= showWithoutReuse(element);
if (element instanceof IJavaElement)
EditorUtility.revealInEditor(editor, (IJavaElement) element);
return editor;
}
示例7: gotoSelectedElement
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility; //导入方法依赖的package包/类
private void gotoSelectedElement() {
Object selectedElement= getSelectedElement();
if (selectedElement != null) {
try {
dispose();
IEditorPart part= EditorUtility.openInEditor(selectedElement, true);
if (part != null && selectedElement instanceof IJavaElement)
EditorUtility.revealInEditor(part, (IJavaElement) selectedElement);
} catch (CoreException ex) {
JavaPlugin.log(ex);
}
}
}
示例8: activateEditor
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility; //导入方法依赖的package包/类
public void activateEditor(IWorkbenchPage page, IStructuredSelection selection) {
if (selection == null || selection.isEmpty())
return;
Object element= selection.getFirstElement();
IEditorPart part= EditorUtility.isOpenInEditor(element);
if (part != null) {
page.bringToTop(part);
if (element instanceof IJavaElement)
EditorUtility.revealInEditor(part, (IJavaElement) element);
}
}
示例9: linkToEditor
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility; //导入方法依赖的package包/类
/**
* Links to editor (if option enabled)
* @param selection the selection
*/
private void linkToEditor(ISelection selection) {
Object obj= SelectionUtil.getSingleElement(selection);
if (obj != null) {
IEditorPart part= EditorUtility.isOpenInEditor(obj);
if (part != null) {
IWorkbenchPage page= getSite().getPage();
page.bringToTop(part);
if (obj instanceof IJavaElement)
EditorUtility.revealInEditor(part, (IJavaElement) obj);
}
}
}
示例10: openInEditor
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility; //导入方法依赖的package包/类
/**
* Opens an editor on the given Java element in the active page. Valid elements are all Java elements that are {@link ISourceReference}.
* For elements inside a compilation unit or class file, the parent is opened in the editor is opened.
* If there already is an open Java editor for the given element, it is returned.
*
* @param element the input element; either a compilation unit
* (<code>ICompilationUnit</code>) or a class file (<code>IClassFile</code>) or source references inside.
* @param activate if set, the editor will be activated.
* @param reveal if set, the element will be revealed.
* @return returns the editor part of the opened editor or <code>null</code> if the element is not a {@link ISourceReference} or the
* file was opened in an external editor.
* @exception PartInitException if the editor could not be initialized or no workbench page is active
* @exception JavaModelException if this element does not exist or if an exception occurs while accessing its underlying resource
* @since 3.3
*/
public static IEditorPart openInEditor(IJavaElement element, boolean activate, boolean reveal) throws JavaModelException, PartInitException {
if (!(element instanceof ISourceReference)) {
return null;
}
IEditorPart part= EditorUtility.openInEditor(element, activate);
if (reveal && part != null) {
EditorUtility.revealInEditor(part, element);
}
return part;
}
示例11: revealInEditor
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility; //导入方法依赖的package包/类
/**
* Reveals the given java element in the given editor. If the element is not an instance
* of <code>ISourceReference</code> this method result in a NOP. If it is a source
* reference no checking is done if the editor displays a compilation unit or class file that
* contains the source reference element. The editor simply reveals the source range
* denoted by the given element.
*
* @param part the editor displaying a compilation unit or class file
* @param element the element to be revealed
*
* @since 2.0
*/
public static void revealInEditor(IEditorPart part, IJavaElement element) {
EditorUtility.revealInEditor(part, element);
}