[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Newsgroup Home]
|
[news.eclipse.platform] How to access an editor's SourceViewer and AnnotationModel
|
Hey,
I want to take the active editor and search through it and verify that
each class has a certain set of comments of the form:
/*!
\brief <brief overview of the class>
\usage <normal case usage examples>
\extending <any kind words on deriving from the class>
*/
And each function has a set of comments of the form:
/*!
\brief <brief overview of the function>
\pre <description of any pre-conditions>
\post <description of any post-conditions>
\param <parameter name> <parameter description (one line per)>
\return <return value description>
\exception <exception type> <why it could be thrown (one line per)>
*/
If there is an easy way to do this, I'm all ears. However, I am trying to
get the active editor and get at its SourceViewer in order to get at its
AnnotationModel and then look for AnnotationMarkers indicating classes and
functions then searching around them for said comments and adding if
necessary. Unfortunately I can't seem to get at the SourceViewer or
AnnotationModel. Here is what I tried:
TextEditor activeEd =
(TextEditor)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
TextFileDocumentProvider tfdp =
(TextFileDocumentProvider)activeEd.getDocumentProvider();
Document doc = (Document)tfdp.getDocument(Object obj);
AnnotationModel am = (AnnotationModel)tfdp.getAnnotationModel(Object obj);
The problem I have is I don't know what Object it wants and the
documentation is not helpful in this area.
Any help is appreciated, and if there's an easier way, again, I'd love to
hear it.
Thanks!
Kevin