コード例 #1
0
 /**
  * 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;
 }
コード例 #2
0
 /**
  * Method getPosition. Get position for generic workspace files
  *
  * @param aSelectedElement IFile
  * @return TextPosition
  * @throws CoreException
  */
 public static R4EUITextPosition getPosition(IFile aSelectedElement)
     throws CoreException { // $codepro.audit.disable overloadedMethods
   if (null == aSelectedElement) {
     return null;
   }
   final R4EUITextPosition position =
       new R4EUITextPosition(
           R4EUIConstants.NO_OFFSET, R4EUIConstants.INVALID_VALUE, aSelectedElement);
   position.setName(aSelectedElement.getName());
   return position;
 }
コード例 #3
0
 /**
  * Method getPosition. Get position for workspace java source files
  *
  * @param aSelectedElement ISourceReference
  * @param aFile IFile
  * @return TextPosition
  * @throws CoreException
  */
 public static R4EUITextPosition getPosition(ISourceReference aSelectedElement, IFile aFile)
     throws CoreException {
   int offset = 0;
   int length = 0;
   String name = "";
   if (null != aSelectedElement) {
     final ISourceRange sourceRange = aSelectedElement.getSourceRange();
     if (null != sourceRange) {
       offset = sourceRange.getOffset();
       length = sourceRange.getLength();
     }
     name = ((IJavaElement) aSelectedElement).getElementName();
   }
   final R4EUITextPosition position = new R4EUITextPosition(offset, length, aFile);
   position.setName(name);
   return position;
 }