/** * Method getPosition. Get position for workspace C and C++ source files * * @param aSelectedElement org.eclipse.cdt.core.model.ISourceReference * @param aFile IFile * @return TextPosition * @throws CoreException */ public static R4EUITextPosition getPosition( org.eclipse.cdt.core.model.ISourceReference aSelectedElement, IFile aFile) // $codepro.audit.disable overloadedMethods throws CoreException { int startPos = 0; int length = 0; int startLine = 0; int endLine = 0; String name = ""; if (null != aSelectedElement) { final org.eclipse.cdt.core.model.ISourceRange sourceRange = aSelectedElement.getSourceRange(); if (null != sourceRange) { startPos = sourceRange.getStartPos(); length = sourceRange.getLength(); startLine = sourceRange.getStartLine(); endLine = sourceRange.getEndLine(); } name = ((org.eclipse.cdt.core.model.ICElement) aSelectedElement).getElementName(); } final R4EUITextPosition position = new R4EUITextPosition(startPos, length, aFile); position.setStartLine(startLine); position.setEndLine(endLine); position.setName(name); return position; }