This is a discussion on Figuring Out the Classpath for NetBeans RCP Applications in IntelliJ IDEA - Solaris Rss ; The biggest challenge in the IntelliJ IDEA plugin for NetBeans RCP development is... getting the classpath right. And providing tools for IntelliJ IDEA for users of the plugin to modify the classpath specifically for the NetBeans Platform. Here's the first ...
The biggest challenge in the IntelliJ IDEA plugin for NetBeans RCP development is... getting the classpath right. And providing tools for IntelliJ IDEA for users of the plugin to modify the classpath specifically for the NetBeans Platform.
Here's the first stage—making the JARs in the NetBeans Platform available to IntelliJ IDEA so that the user can add them as a dependency to their project. The result of the code that follows is that the folder containing the modules is registered as a JAR directory in the Libraries tab of the Project Structure dialog:
Here's the code: //Path specified in New Project wizard by user: String netBeansPlatformPath = facetEditor.getPath(); //The above as a VirtualFile: VirtualFile path = LocalFileSystem.getInstance().findFileByPath(netBe ansPlatformPath); //Get the library registry: LibraryTablesRegistrar libTablesRegistrar = LibraryTablesRegistrar.getInstance(); //Get the table of project libraries (pass empty parameter if you want global libraries instead): LibraryTable libraryTable = libTablesRegistrar.getLibraryTable(module.getProje ct()); //Get the model of the library table: LibraryTable.ModifiableModel libTableModel = libraryTable.getModifiableModel(); //Create a library in the model: Library netBeansLibrary = libTableModel.createLibrary("NetBeans RCP"); //Get the model of the library: Library.ModifiableModel libraryModel = netBeansLibrary.getModifiableModel(); //Create a string pointing to the NetBeans Platform modules: String url = VfsUtil.getUrlForLibraryRoot(new File(netBeansPlatformPath + "/platform/modules")); //Add a JAR directory to the library model: libraryModel.addJarDirectory(url, false); //Commit the library model: libraryModel.commit(); //Commit the library table model: libTableModel.commit();
Now the same dialog above can be used to set the library (containing all the JARs) as a dependency of the project or module, as shown here:
Next steps involve figuring out how to automatically attach the new library as a dependency of the project. But more important is figuring out how to, ultimately, register module dependencies in the manifest file of the modules within the application, in so far as those modules are dependent on those dependencies. That's handled automatically by NetBeans IDE and is the main feature that I don't know how to implement, yet, in IntelliJ IDEA.
Read More about [Figuring Out the Classpath for NetBeans RCP Applications in IntelliJ IDEA...