This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.
In an application based on the netbeans platform I use: JEditorPane editorPane = new JEditorPane(); ExtEditorUI extEditorUI = ExtUtilities.getExtEditorUI(editorPane); JComponent editorComponent = extEditorUI.getExtComponent(); With the platform delivered with Netbeans 6.1 this code worked without problems. With the platform delivered with Netbeans 6.5 (m1 and beta) the call ExtUtilities.getExtEditorUI(editorPane) throws the following ClassCastException: java.lang.ClassCastException: org.netbeans.modules.languages.dataobject.LanguagesEditorKit$2 cannot be cast to org.netbeans.editor.ext.ExtEditorUI at org.netbeans.editor.ext.ExtUtilities.getExtEditorUI(ExtUtilities.java:63) Since I have not found a workaround I have set P1 priority. Best regards, Martin
I'm looking into this. Generally, ExtUtilities as well as ExtEditorUI has been deprecated and moved to editor.deprecated.pre61completion module. You should not be using them anymore. Instead use Utilities.getEditorUI(editorPane).getExtComponent().
I fixed ExtUtilities to prevent CCE, but as I said before, you should use EditorUI instead. http://hg.netbeans.org/main/rev/bd32860b2cc6
Thanks for your fast reply, I just switched to Utilities.getEditorUI(editorPane).getExtComponent() and it worked as before. Thank you. Btw. how do I find out how to replace deprecated code? There is another small problem with the editor returned by the call above. Line numbers (when switched on) are truncated as shown in the image I attach in a minute. I use a TopComponent as follows: public class MyEditor extends TopComponent { public MyEditor () { setLayout(new BorderLayout()); Lookup lookup = MimeLookup.getLookup(MimePath.get("text/x-mylanguage")); EditorKit editorKit = lookup.lookup(EditorKit.class); JEditorPane editorPane = new JEditorPane(); editorPane.setEditorKit(editorKit); EditorUI editorUI = Utilities.getEditorUI(editorPane); JComponent editorComponent = editorUI.getExtComponent(); JToolBar toolBar = editorUI.getToolBarComponent(); add(toolBar, BorderLayout.NORTH); add(editorComponent, BorderLayout.CENTER); } } Thanks again for looking into this.
Created attachment 67940 [details] Image showing the truncated line numbers
> how do I find out how to replace deprecated code? Well, I don't think there is a single common place to go and check, but in general changes are always announced on apireviews@netbeans.org and nbdev@netbeans.org. It's also good idea to look in the IDE's log file and search for any warnings. They usually mention an issue number, which you can then look up in the IssueZilla and learn more about the problem. The issue report may include links to transition guides, how-tos, etc. In this particular case the description is in a wiki page at http://wiki.netbeans.org/EditorSettingsUpgrade. Please read through it and see if and how much of your application is affected by these changes. I suspect that you get quite a lot of warnings when starting up your application and that they complain about injecting module dependencies and using deprecated modules, etc. We try to do changes as much backward compatible as possible, but as a rule of thumb you should always try to fix all the warnings that the platform gives you. If you have questions about some warning please ask on nbdev. > Line numbers (when switched on) are truncated I suspect that the line numbers component for some reason does not update its width. When exactly are you loading text to the JEditorPane's document? And how do you do it? Maybe we could just discuss this offline. Do you want to send me an email to vstejskal@netbeans.org? Thanks
Integrated into 'main-golden', available in build *200808201401* on http://bits.netbeans.org/dev/nightly/ Changeset: http://hg.netbeans.org/main/rev/bd32860b2cc6 User: Vita Stejskal <vstejskal@netbeans.org> Log: #144541: preventing class cast exception
Integrated into 'main-golden', available in build *200808220201* on http://bits.netbeans.org/dev/nightly/ Changeset: http://hg.netbeans.org/main/rev/24ef74f72b95 User: Vita Stejskal <vstejskal@netbeans.org> Log: #144541: GlyphGutter should survive document change in the associated component