11

I am writing a code completion plugin for a PHP library in Java / Netbeans Platform. I need to find a way to obtain a reference to one of the PHP modules so I can interpret part of the source, anyone experience with this kind of problem?

  • How do I obtain a reference to the PHP module (for code completion plugin module)
  • What is the recommended approach to integrate a code completer with PHP module on the NetBeans platform?

Cheers and thanks in advance Gabor

Gabor de Mooij
  • 2,997
  • 17
  • 22

2 Answers2

1

You would use the org.netbeans.modules.php.api and some other core stuff and implement a new CompletionProvider. (MyCompleter implements CompletionProvider)

import org.netbeans.modules.php.api.phpmodule.PhpModule;
import org.netbeans.modules.php.api.util.UiUtils;
import org.netbeans.modules.php.api.executable.PhpInterpreter;

and maybe Tokenizer and Completion could be usefull

Tokenizer

import org.netbeans.api.lexer.Token;
import org.netbeans.api.lexer.TokenSequence;

Completion

import org.netbeans.spi.editor.completion.CompletionProvider;
import org.netbeans.spi.editor.completion.CompletionResultSet;
import org.netbeans.spi.editor.completion.CompletionTask;
import org.netbeans.spi.editor.completion.support.AsyncCompletionQuery;
import org.netbeans.spi.editor.completion.support.AsyncCompletionTask;
Jens A. Koch
  • 39,862
  • 13
  • 113
  • 141
0

In Netbeans, PHP support is initially chosen in the version you decide to download. However, you can add PHP support like you describe after the fact through Netbean's plugin functionality. Just go to Tools>Plugins and click on the Available Plugins tab at the top. There you will see a host of PHP related plugins, from Manual references to Framework specific helpers that you can install. You can also install individual plugins downloaded from here manually through another tab in the same menu interface.

See here to look at the table for download options... Notice the far right, with all the dots, that's All. Only way to start out with Java + PHP support is install support for all other languages too. A little hefty if you have focused development needs, which is probably why you skipped this.

Hope this helps!

Netbeans Downloads

Berti
  • 76
  • 5