CGLib, NetBeans Modules and class loaders

My first try at using CGLib from a Netbeans RCP ended up in a ClassNotFoundException for net.sf.cglib.proxy.Factory I had two modules, MainModule and cglib and MainModule was depending on cglib. And the following snippet was raising the ClassNotFoundException. Enhancer enhancer = new Enhancer(); enhancer.setSuperclass(Graph.class); enhancer.setCallback(NoOp.INSTANCE); Graph g = (Graph) enhancer.create(new Class[]{FrameListener.class,InterpreterAbstraction.class},new Object[]{fl,ia}) ; As I later found out from Enhancer documentation and DevFaqClassLoaders it seems that Enhancer it taking the System class loader instead of taking the Module classloader. I explicitly set the classloader used by the Enhancer via the setClassLoader method and now it seems to work. ...

August 6, 2009

GraphBrowser

I decided to start a small project trying to port the GUESS framework into Netbeans RCP. The plan is to replace the GUESS own graphical library with Netbeans Visual Library stuff and replace the GUESS Python like interpreter with something more along the lines of JSR 223 Scripting for the Java Platform. For the moment I created the project at kenai.

July 18, 2009

Disable splash screen on your Netbeans Application

Just add run.args.extra=--nosplash to the project.properties file

November 19, 2008

Netbeans Paint Application

My first try with the Netbeans Paint Application tutorial didn’t work as expected. For some reason I got this stack trace when I tried to run it: java.lang.IllegalStateException: Module was supposed to be OK: StandardModule:org.netbeans.modules.projectuiapi jarFile: C:\Program Files\NetBeans 6.0\ide8\modules\org-netbeans-modules-projectuiapi.jar at org.netbeans.ModuleManager.maybeAddToEnableList(ModuleManager.java:1087) at org.netbeans.ModuleManager.maybeAddToEnableList(ModuleManager.java:1104) at org.netbeans.ModuleManager.maybeAddToEnableList(ModuleManager.java:1104) at org.netbeans.ModuleManager.simulateEnable(ModuleManager.java:1048) at org.netbeans.core.startup.ModuleList.installNew(ModuleList.java:379) at org.netbeans.core.startup.ModuleList.trigger(ModuleList.java:341) at org.netbeans.core.startup.ModuleSystem.restore(ModuleSystem.java:275) at org.netbeans.core.startup.Main.getModuleSystem(Main.java:171) at org.netbeans.core.startup.Main.start(Main.java:322) [catch] at org.netbeans.core.startup.TopThreadGroup.run(TopThreadGroup.java:110) at java.lang.Thread.run(Thread.java:619) I managed to solve it although I don’t really know the cause. ...

February 21, 2008

Eclipse Preference Page Extension Wizard troubleshooting

Today I tried to add a Preference Page to an RCP application that I’m working on with no luck. After executing the Extension -> Add -> Extension Wizards -> Preference Page I end up with 3 new classes. But 2 of then have compilation errors, they refer to an unexisting PreferenceClass. After googling a bit I found this message in a mailing list describing the same exact problem: >Hello, I ’ve added preference page in my application using plugin.xml extensions template. Then, in a new package, Eclipse created 3 classes (Template preferences page extending FieldEditorPreferencePage, a preference constants class and a preference initializer class). The template preferences page uses a PreferenceClass which doesn’t already exists… I suppose this class has to initialize the preference store, in the preference template class constructor, unsing the plugin instance of the product : “setPreferenceStore(PreferenceClass.getDefault().getPreferenceStore());” I’ve tried to extend the AbstractUIPlugin (I’ve read in differents articles from eclipse.org) to catch the plugin instance when it is created, but without succes (when to catch this single instance during startup of eclispe core runtime ?). Then I’ve found the existance of the WorkBenchPlugin class which holds this static instance, I used it, discarding PreferenceClass , but Eclispe tells me that the use of this class is discouraged. Why ? How is it possible to store the plugin instance at startup ? Thanks a lot for your help, frank ...

June 29, 2007

New views don't show up when using Eclipse RCP setSaveAndRestore

If you add a new view to an Eclipse RCP and when launch it the new view is not there you probably hit the problem described in this CT Arrington’s Weblog post. The IWorkbenchConfigurer.setSaveAndRestore(true) called from your WorkbenchAdvisor can be the source of the problem. The Eclipse RCP platform is trying to restore the perspective from the serialized version stored on disk so it fails to load you new changes. You have several solutions [from the CT Arrington’s Weblog post]. ...

April 23, 2007