jrhenderson1988 / jsyntaxpane

Automatically exported from code.google.com/p/jsyntaxpane
0 stars 0 forks source link

need examples for intellisense/content assisst #139

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I can't quite figure out how to use those completion actions. how do i
setup one, how do i mount it to listen to CTRL+SPACE etc.

if there's a mailing list or a forum setup for discussions, I should use
that...sorry.

thanks

Original issue reported on code.google.com by razvanc99@gmail.com on 9 Mar 2010 at 7:40

GoogleCodeExporter commented 9 years ago
ok... got it, but I had to read quite a bit of code, we should still create a 
sample.

here's the code, in scala (sorry):

------- 1. make your action classes, that do your stuff:
class F9RunCompletionAction extends DefaultSyntaxAction ("RAZIE_F9ACTION") {
  override def actionPerformed(target:JTextComponent , sDoc:SyntaxDocument , dot:Int
, e:ActionEvent ) {
    SPRaz.sp.runline
    }
}

---------- 2. register them, before you create the panel:
     DefaultSyntaxKit.getConfig (classOf[DefaultSyntaxKit]).put
("Action.RAZIE_F9ACTION","razie.draw.swing.F9RunCompletionAction,F9");

-------- 3. when setting up the pane (copy from the main test clas) add the 
actions:

            defaultSyntaxKit.addActions(jEdtTest);

...the surrounding code here is:

         EditorKit kit = jEdtTest.getEditorKit();
         if (kit instanceof DefaultSyntaxKit) {
            DefaultSyntaxKit defaultSyntaxKit = (DefaultSyntaxKit) kit;
            defaultSyntaxKit.addToolBarActions(jEdtTest, jToolBar1);

            defaultSyntaxKit.addActions(jEdtTest);
         }

cheers

Original comment by razvanc99@gmail.com on 9 Mar 2010 at 9:23