Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] How to parse the editor contents to get the required information using CDT?

>  Pls, Can anybody give any example How to parse the editor contents to get
> the information like wherther the current selected text is Declaration or
> Field or Class or Constructor etc. using CDT?

Not sure how far you got, but basically you have to get hold of an
IWorkingCopy of the editor input, using that you can request the CElement
corresponding to a string or offset, see ITranslationUnit.getElement()/
getElementOffset(). As an example you might have a look at the
getHoverInfo() method of CSourceHover.java (in the org.eclipse.cdt.ui
plugin), or check the CEditor class itselve.

Regards,
  Wieant


P.S. would appreciate if you do not post the same message to multiple
lists.


Back to the top