本文整理了Java中org.eclipse.ui.ide.IDE.openEditor()
方法的一些代码示例,展示了IDE.openEditor()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IDE.openEditor()
方法的具体详情如下:
包路径:org.eclipse.ui.ide.IDE
类名称:IDE
方法名:openEditor
[英]Opens an editor on the given IFileStore object.
Unlike the other openEditor
methods, this one can be used to open files that reside outside the workspace resource set.
If the page already has an editor open on the target object then that editor is brought to front; otherwise, a new editor is opened.
[中]打开给定IFileStore对象上的编辑器。
与其他openEditor
方法不同,此方法可用于打开驻留在工作区资源集之外的文件。
如果页面已经在目标对象上打开了一个编辑器,那么该编辑器将被置于前面;否则,将打开一个新编辑器。
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
@Override
public void run() {
try {
IDE.openEditor(activePage, resource, true);
} catch (PartInitException e) {
JavaPlugin.log(e);
}
}
});
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
@Override
public void run() {
try {
IDE.openEditor(activePage, file, true);
} catch (PartInitException e) {
JavaPlugin.log(e);
}
}
});
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
@Override
public void run() {
try {
IDE.openEditor(activePage, resource, true);
} catch (PartInitException e) {
JavaPlugin.log(e);
}
}
});
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
public void run() {
try {
IDE.openEditor(activePage, resource, true);
} catch (PartInitException e) {
JavaPlugin.log(e);
}
}
});
代码示例来源:origin: org.eclipse.xtext/ui
public void run() {
final IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
try {
IDE.openEditor(page, file, true);
} catch (final PartInitException e) {
logger.error(e.getMessage(), e);
}
}
});
代码示例来源:origin: infinitest/infinitest
protected void jumpToMarker(IMarker marker) throws CoreException {
// RISK Untested
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IDE.openEditor(page, marker);
}
代码示例来源:origin: cbeust/testng-eclipse
public void run() {
IWorkbenchPage page =
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
try {
IDE.openEditor(page, javaFile, true);
} catch (PartInitException e) {
}
}
});
代码示例来源:origin: net.officefloor.eclipse/net.officefloor.ui
public void run() {
IWorkbenchPage page = PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getActivePage();
try {
IDE.openEditor(page, file, true);
} catch (PartInitException e) {
}
}
});
代码示例来源:origin: org.eclipse.platform/org.eclipse.team.ui
private static IEditorPart openInEditor(IFile file, boolean activate) throws PartInitException {
if (file == null)
throwPartInitException(TeamUIMessages.SynchronizeView_fileMustNotBeNull);
IWorkbenchPage p = TeamUIPlugin.getActivePage();
if (p == null)
throwPartInitException(TeamUIMessages.SynchronizeView_noActiveWorkbenchPage);
IEditorPart editorPart = IDE.openEditor(p, file, activate);
return editorPart;
}
代码示例来源:origin: RepreZen/KaiZen-OpenAPI-Editor
protected static IEditorPart openEditor(IFile file) {
final IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
try {
return IDE.openEditor(page, file);
} catch (PartInitException e) {
return null;
}
}
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.m2e.core.ui
public void run() {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
try {
IDE.openEditor(page, file, true);
} catch(PartInitException e) {
}
}
});
代码示例来源:origin: RepreZen/KaiZen-OpenAPI-Editor
public void run() {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
try {
IDE.openEditor(page, file, editorId);
} catch (PartInitException e) {
}
}
});
代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui
public static void openImage(String value, String definingPluginId) {
IResource resource = getImageResource(value, definingPluginId);
try {
if (resource != null && resource instanceof IFile)
IDE.openEditor(PDEPlugin.getActivePage(), (IFile) resource, true);
else
MessageDialog.openWarning(PDEPlugin.getActiveWorkbenchShell(), PDEUIMessages.AboutSection_open, PDEUIMessages.AboutSection_warning); //
} catch (PartInitException e) {
}
}
代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui
private static IEditorPart openInEditor(IFile file, boolean activate) throws PartInitException {
if (file == null)
throwPartInitException(JavaEditorMessages.EditorUtility_file_must_not_be_null);
IWorkbenchPage p= JavaPlugin.getActivePage();
if (p == null)
throwPartInitException(JavaEditorMessages.EditorUtility_no_active_WorkbenchPage);
IEditorPart editorPart= IDE.openEditor(p, file, activate);
initializeHighlightRange(editorPart);
return editorPart;
}
代码示例来源:origin: org.eclipse.platform/org.eclipse.team.ui
public static IEditorPart openEditor(IWorkbenchPage page, IFileRevision revision, IProgressMonitor monitor) throws CoreException {
IStorage file = revision.getStorage(monitor);
if (file instanceof IFile) {
//if this is the current workspace file, open it
return IDE.openEditor(page, (IFile)file, OpenStrategy.activateOnOpen());
} else {
FileRevisionEditorInput fileRevEditorInput = FileRevisionEditorInput.createEditorInputFor(revision, monitor);
IEditorPart part = openEditor(page, fileRevEditorInput);
return part;
}
}
代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui
private static IEditorPart openInEditor(IFile file, boolean activate) throws PartInitException {
if (file == null)
throwPartInitException(JavaEditorMessages.EditorUtility_file_must_not_be_null);
IWorkbenchPage p= JavaPlugin.getActivePage();
if (p == null)
throwPartInitException(JavaEditorMessages.EditorUtility_no_active_WorkbenchPage);
IEditorPart editorPart= IDE.openEditor(p, file, activate);
initializeHighlightRange(editorPart);
return editorPart;
}
代码示例来源:origin: org.eclipse/org.eclipse.jdt.ui
private static IEditorPart openInEditor(IFile file, boolean activate) throws PartInitException {
if (file == null)
throwPartInitException(JavaEditorMessages.EditorUtility_file_must_not_be_null);
IWorkbenchPage p= JavaPlugin.getActivePage();
if (p == null)
throwPartInitException(JavaEditorMessages.EditorUtility_no_active_WorkbenchPage);
IEditorPart editorPart= IDE.openEditor(p, file, activate);
initializeHighlightRange(editorPart);
return editorPart;
}
代码示例来源:origin: org.eclipse/org.eclipse.wst.common.ui
protected void showMatch(Match match, int offset, int length, boolean activate) throws PartInitException {
IFile file= (IFile) match.getElement();
IWorkbenchPage wbPage= UIPlugin.getActivePage();
IEditorPart editor= IDE.openEditor(wbPage, (IFile) match.getElement(), activate);
if (offset != 0 && length != 0) {
if (editor instanceof ITextEditor) {
ITextEditor textEditor= (ITextEditor) editor;
textEditor.selectAndReveal(offset, length);
} else if (editor != null) {
showWithMarker(editor, file, offset, length);
}
}
}
代码示例来源:origin: org.eclipse.mylyn.wikitext/ui
public void open() {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IWorkbenchPage activePage = window.getActivePage();
try {
IDE.openEditor(activePage, file);
} catch (PartInitException e) {
WikiTextUiPlugin.getDefault().log(e);
MessageDialog.openError(window.getShell(), Messages.MarkupHyperlinkDetector_unexpectedError,
NLS.bind(Messages.MarkupHyperlinkDetector_openException, file.getName(), e.getMessage()));
}
}
}
代码示例来源:origin: org.eclipse.xtext/ui
protected IEditorPart openDefaultEditor(IStorage storage, URI uri) throws PartInitException {
XtextReadonlyEditorInput editorInput = new XtextReadonlyEditorInput(storage);
IWorkbenchPage page = getWorkbench().getActiveWorkbenchWindow().getActivePage();
return IDE.openEditor(page, editorInput, PlatformUI.getWorkbench().getEditorRegistry().getDefaultEditor(
uri.lastSegment()).getId());
}
内容来源于网络,如有侵权,请联系作者删除!