Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Programmatically folding of methods
Programmatically folding of methods [message #932779] Thu, 04 October 2012 12:20
Søren Skrædder is currently offline 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
Previous Topic:Migrating LTK/JDT related plugins from Eclipse 3.3 to 3.8
Next Topic:issue - print messages in eclipse console
Goto Forum:
  


Current Time: Wed Oct 22 04:47:48 GMT 2014

Powered by FUDForum. Page generated in 0.09195 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software