org.eclipse.ui.ide.IDE#gotoMarker ( )源码实例Demo

下面列出了org.eclipse.ui.ide.IDE#gotoMarker ( ) 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: tracecompass   文件: DsfGdbAdaptor.java
private static void gotoRank(IEditorPart editor, int rank) {
    IEditorInput editorInput = editor.getEditorInput();
    if (editorInput instanceof IFileEditorInput) {
        IFile file = ((IFileEditorInput) editorInput).getFile();
        try {
            final IMarker marker = file.createMarker(IMarker.MARKER);
            marker.setAttribute(IMarker.LOCATION, (Integer) rank);
            IDE.gotoMarker(editor, marker);
            marker.delete();
        } catch (CoreException e) {
            GdbTraceCorePlugin.logError(e.getMessage(), e);
        }
    }
}
 
private void showWithMarker(IEditorPart editor, IFile file, int offset, int length) throws PartInitException {
	try {
		IMarker marker= file.createMarker(NewSearchUI.SEARCH_MARKER);
		HashMap<String, Integer> attributes= new HashMap<String, Integer>(4);
		attributes.put(IMarker.CHAR_START, new Integer(offset));
		attributes.put(IMarker.CHAR_END, new Integer(offset + length));
		marker.setAttributes(attributes);
		IDE.gotoMarker(editor, marker);
		marker.delete();
	} catch (CoreException e) {
		throw new PartInitException(SearchMessages.JavaSearchResultPage_error_marker, e);
	}
}
 
public void gotoMarker(IMarker marker) {
	setActivePage(0);
	IDE.gotoMarker(getEditor(0), marker);
}