Programmatically folding of methods [message #932779] |
Thu, 04 October 2012 12:20 |
Søren Skrædder Messages: 1 Registered: October 2012 |
Junior Member |
|
|
Hi,
I'm desperately trying to programmatically collapse and expand methods in a JDT-Editor.
I read the documentation about the fundamental basics of folding, but I assume it's probably outdated. (http://www.eclipse.org/articles/Article-Folding-in-Eclipse-Text-Editors/folding.html)
My first approach didn't work:
IJavaFoldingStructureProviderExtension extension = JavaPlugin.getDefault().getFoldingStructureProviderRegistry().getCurrentFoldingProvider();
ICompilationUnit c = ...; // c is actually a class
try {
IJavaElement[] elements = c.getAllTypes()[0].getMethods();
extension.collapseElements(elements);
} catch (JavaModelException e) {
e.printStackTrace();
}
While running the debugger, I found out that the "elements"-array contains all methods, so the call to collapse didn't work.
Has anyone ever done something similar or can give me any hints/examples?
Thanks,
Søren
|
|
|
Powered by
FUDForum. Page generated in 0.03396 seconds