4

I read that Jboss Drools Autocomplete for Eclipse is disabled.

My objective now, is to use Java Autocomplete for .drl files (I'm developing my drl rules with dialect "java").

Does anyone knows how I can use Java Autocomplete in Eclipse for my .drl files?

Thank you in Advance, Oriol

user1592470
  • 401
  • 2
  • 8
  • 21
  • You can't: a .drl file is not a Java file. Only a portion of it uses Java syntax, which can once again not be understood by the IDE without special-case knowledge of the .drl context. – Marko Topolnik Jul 01 '13 at 09:13
  • I know, but it doesnt matters if Java Autocomplete show me errors for the other components of the .drl file. I want the Java Autocomplete only to check the Java part. – user1592470 Jul 01 '13 at 09:22
  • Autocomplete works by understanding your code. You can't expect to type arbitrary text, which happens to contain a snippet of Java, and have Autocomplete work. At least you as a programmer should have an understanding of such issues. – Marko Topolnik Jul 01 '13 at 09:24
  • I'm sorry but I don't agree with you. It doesn't mind for me if autocomplete doesn't understand a part of my code, I only want it for developing my short snippet of Java. And I think it's possible to do it, I'll check for a solution and post it here if I finally find it. – user1592470 Jul 01 '13 at 09:53
  • Do you have any background in source code parsing? If you do, it should be obvious to you that generic Java Autocomplete can't automagically realize where your Java snippet starts. Not to mention the Drools-specific global variables defined in the `then` clause, the type declarations implied by the `when` block, etc. – Marko Topolnik Jul 01 '13 at 10:01

1 Answers1

3

You can get this happening by going to Preferences -> General -> Content types and adding *.drl as a sub-type of Java source.

This will get Java content assist working in .drl files, but it will unfortunately do a whole lot more. It will send your drl files to the Java compiler and it will show error markers for malformed Java code (and drl files contain lots of that).

You can turn off lots of this through various preferences:

  1. add *.drl files to the exclusion filters of your classpath or place them outside of the classpath altogether.
  2. Go to Preferences -> Java -> Editor and disable "Report problems as you type". No error markers in drl file. But, this will also affect your java files.

So, there is no complete solution here, but you can get some of what you want.

Andrew Eisenberg
  • 28,387
  • 9
  • 92
  • 148