When writing Java code in the Eclipse IDE, press Control + Space to open the content support window.
For example, the content support window for System. will display all available fields and methods for the System class.
I need to access the โdata modelโ for the content support window using code.
Using the example above, this is: the name of the System class is given, how can I get all the available fields and methods?
I spent some time on the source code of these three classes on grepcode.com:
org.eclipse.jdt.ui.text.java.JavaContentAssistInvocationContext org.eclipse.jdt.internal.ui.text.java.JavaCompletionProposalComputer org.eclipse.jdt.ui.text.java.CompletionProposalCollector
It seems like an instance of ICompilationUnit used to provide field names and methods.
Then I do not understand how to generate an instance of ICompilationUnit for a class in the jre system library or a third-party library? Or, if I did not read the code correctly, then how does the program name the names of fields and methods? (I donโt need to worry about things bias and UI, only part of the โdata modelโ).
source share