// IFile
if(resource instanceof IFile){
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
try {
IEditorPart editor = IDE.openEditor(page, (IFile)resource, true);
IGotoMarker gotoMarker = (IGotoMarker)editor.getAdapter(IGotoMarker.class);
if(gotoMarker!=null){
IMarker marker= ((IFile)resource).createMarker(IMarker.TEXT);
marker.setAttribute(IMarker.CHAR_START, beginOffset);
marker.setAttribute(IMarker.CHAR_END, beginOffset);
gotoMarker.gotoMarker(marker);
}
} catch (Exception ex) {
HTMLPlugin.logException(ex);
}
}