Javadoc を組み込む その 4

昨日、Javadoc を組み込めなかった原因が分かったので、今日は再挑戦。

LG3DProjectWizard#perfromFinish を次のようにしてみました。

                    IPreferenceStore store = WrpePlugin.getDefault().getPreferenceStore();
                    String home = store.getString(WrpePlugin.LG3D_PREF_HOME_KEY);
                    Path corePath = new Path(home + WrpePlugin.CORE_LIBRARY);
                    String javadocPath = "file:/" + home + WrpePlugin.CORE_JAVADOC;
                    try {
                        IClasspathEntry[] initialEntries = javaProject.getRawClasspath();
                        IClasspathEntry[] entries = new IClasspathEntry[initialEntries.length + 1];
                        System.arraycopy(initialEntries, 0, entries, 0, initialEntries.length);
                        
//                        entries[initialEntries.length] = JavaCore.newLibraryEntry(corePath, null, null);
                        IClasspathAttribute[] attributes = new IClasspathAttribute[] {
                                JavaCore.newClasspathAttribute(IClasspathAttribute.JAVADOC_LOCATION_ATTRIBUTE_NAME,
                                        javadocPath)
                            };
                            entries[initialEntries.length] = JavaCore.newLibraryEntry(corePath, null, null,
                                    new IAccessRule[0], attributes, false);

                        javaProject.setRawClasspath(entries, monitor);
                    } catch (JavaModelException ex) {
                        ex.printStackTrace();
                        throw new InvocationTargetException(ex);
                    }

これで、実行して LG3D のプロジェクトを作ってみると...

Javadoc Property

そして、Frame3D の Javadoc を表示させるとちゃんと表示することができたのでした ;-)

Javadoc