<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div>Sorry - I wrote this reply before realizing that you were asking about an "editor", not just incorporating Drools into an RCP. I am posting this in case other are having the more mundane problem of making a RCP execute Drools rules.</div><div><br class="webkit-block-placeholder"></div><div>- Mike</div><div><br class="webkit-block-placeholder"></div><div>I have been trying to do this for a while, and have managed to create an RCP that does work. I know at least one other person has responded on this list as having accomplished it. His response indicated that he created a separate plugin for all the Drools components, and referred to it from his main plugin. He also indicated that the objects needed for the DRL file had to be in the same plugin as the Drools engine components.</div><div><br class="webkit-block-placeholder"></div><div>This has not been my experience. I created a plugin that contains the Drools components and the dependent jars in the /lib folder of the Drools distribution. That plugin's Manifest.mf file must be edited to add the line:</div><div><br class="webkit-block-placeholder"></div><div>Eclipse-BuddyPolicy: registered</div><div><br class="webkit-block-placeholder"></div><div>to the end because this will allow the plugin to access any other plugins that want to be accessed by the Drools plugin. So suppose you name your plugin MinimalDrools; the last line of the Manifest.mf shows that it is registered as a Eclipse buddy.</div><div><br class="webkit-block-placeholder"></div><div>Now export the plugin in a deployable format, and then drag the new plugin into the Eclipse plugin folder and restart Eclipse.</div><div><br class="webkit-block-placeholder"></div><div>Now your project plugin needs to depend on this newly added plugin. In addition, in your project plugin Manifest.mf, you must add the reciprocal part of the buddy registration:</div><div><br class="webkit-block-placeholder"></div><div>Eclipse-RegisterBuddy: MinimalDrools</div><div><br class="webkit-block-placeholder"></div><div>With this structure, I added a rules directory in the root of the plugin, and in my application code:</div><div><br class="webkit-block-placeholder"></div><div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">        </span><span style="color: #7f0055">private</span> <span style="color: #7f0055">void</span> fireDroolsRulesEngine() <span style="color: #7f0055">throws</span> Exception {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>GlucoseDecisionState decisionState = <span style="color: #7f0055">new</span> GlucoseDecisionState();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>Reader source;</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span><span style="color: #7f0055">final</span> PackageBuilder builder = <span style="color: #7f0055">new</span> PackageBuilder();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>source = <span style="color: #7f0055">new</span> InputStreamReader(FileLocator.toFileURL(</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                                </span>GlucosePlugin.getDefault().getBundle().getEntry(</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(42, 0, 255); "><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">                                                </span></span>"rules/GlucoseDroolRules00.drl"<span style="color: #000000">)).openStream());</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>builder.addPackageFromDrl(source);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span><span style="color: #7f0055">if</span> (builder.hasErrors()) {</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                        </span>System.<span style="color: #0000c0">out</span>.println(builder.getErrors().toString());</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>}</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(63, 127, 95); "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>Package pkg = builder.getPackage();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>RuleBase ruleBase = RuleBaseFactory.newRuleBase();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>ruleBase.addPackage(pkg);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>StatefulSession session = ruleBase.newStatefulSession();</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; min-height: 15.0px"><span class="Apple-tab-span" style="white-space:pre">                </span><br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(63, 127, 95); "><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">                </span></span>// setup the debug listeners</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>session.addEventListener( <span style="color: #7f0055">new</span> DebugAgendaEventListener() );</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>session.addEventListener( <span style="color: #7f0055">new</span> DebugWorkingMemoryEventListener() );</div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; min-height: 15.0px"><span class="Apple-tab-span" style="white-space:pre">                </span> <br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; color: rgb(63, 127, 95); "><span style="color: #000000"><span class="Apple-tab-span" style="white-space:pre">                </span></span>// setup the audit logging</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span><span style="color: #7f0055">final</span> WorkingMemoryFileLogger glucoseLogger = <span style="color: #7f0055">new</span> WorkingMemoryFileLogger( session );</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>glucoseLogger.setFileName( <span style="color: #2a00ff">"glucoseLogFile"</span> ); </div><p style="margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Monaco; min-height: 15.0px"><span class="Apple-tab-span" style="white-space:pre">                </span><br class="webkit-block-placeholder"></p><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>session.insert(<span style="color: #0000c0">decision</span>,<span style="color: #7f0055">true</span>); </div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>session.insert(decisionState,<span style="color: #7f0055">true</span>);</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>session.fireAllRules();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>glucoseLogger.writeToDisk();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">                </span>session.dispose();</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><span class="Apple-tab-span" style="white-space:pre">        </span>}</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><br class="webkit-block-placeholder"></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="2"><span class="Apple-style-span" style="font-size: 10px;">This works. It is necessary to add the dependency of MinimalDrools to you feature, etc. if you are exporting a complete application.</span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="2"><span class="Apple-style-span" style="font-size: 10px;"><br class="webkit-block-placeholder"></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="2"><span class="Apple-style-span" style="font-size: 10px;">This being said, I cannot successfully run JUnit tests on the Drools part of my RCP. I can unit test everything else, including things like Hibernate, my database connections, etc. But the MinimalDrools plugin does not satisfy some aspect of the Eclipse JUnit setup. The Drools compiler does initialize, but something prevents the package from instantiating (several previous posts on this that remain unresolved).</span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="2"><span class="Apple-style-span" style="font-size: 10px;"><br class="webkit-block-placeholder"></span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><font class="Apple-style-span" face="Helvetica" size="2"><span class="Apple-style-span" style="font-size: 10px;">Good luck.</span></font></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><br class="webkit-block-placeholder"></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; font: normal normal normal 11px/normal Monaco; "><br class="webkit-block-placeholder"></div></div><div><br class="webkit-block-placeholder"></div><div><br class="webkit-block-placeholder"></div><br><div><blockquote type="cite"><br>Date: Sat, 08 Dec 2007 19:04:52 +0100<br>From: Michael Sizaki <<a href="mailto:Sizaki@gmx.de">Sizaki@gmx.de</a>><br>Subject: [rules-users] Drools and eclipse RCP<br>To: <a href="mailto:rules-users@lists.jboss.org">rules-users@lists.jboss.org</a><br>Message-ID: <<a href="mailto:475ADCC4.2080305@gmx.de">475ADCC4.2080305@gmx.de</a>><br>Content-Type: text/plain; charset=ISO-8859-1; format=flowed<br><br>Hi,<br><br>is it possible to use the drools editor etc in an eclipse RCP<br>application? At the moment, org.drools.eclipse plugin<br>depends on debug and jdt and other eclipse IDE related<br>plugins.....<br><br>I would want a simple way for users to enter rules into<br>my RCP application.<br><br>Michael<br></blockquote></div><br></body></html>