While those two examples were immensely helpful, I am still trying to figure out how to use the org.eclipse.php.internal.core.format package.

For example, I'm a bit confused as to how the class PhpFormatter actually works (or rather, how it is intended to be used, the documentation is a little sparse). Its constructor requires a start and length parameter, which - I assume - is so one can selectively format parts of a document. The format() function then requires an org.w3c.dom.Node, which is presumably the root of the AST? Why is it then, that it does not accept org.eclipse.php.internal.core.ast.nodes.ASTNode? Do I need to convert the AST to DOM? Or am I missing something entirely here?

Also, what's the point of implementing the strategy pattern when all indentation strategies are hard-coded into private final members?

Basically all I want to do is read a PHP file, fiddle with the AST and then pretty-print it back out. Is PhpFormatter the wrong way to go here?

regards
raph
_______________________________________________
pdt-dev mailing list
pdt-dev@eclipse.org
https://dev.eclipse.org/mailman/listinfo/pdt-dev

Reply via email to