GitHub user priyanahata edited a discussion: What is the secret to make
EditorUI extComp show code folds and errors
I am only getting line numbers and version control markers but no code folds or
error markers on the glyphgutter. When i log i see the code folds bar in the
westsidebar but is not showing, neither do the errors
```
String mime = resource.getMimeType();
if (resource.getHandle() instanceof NbHandle nbh) {
FileObject fo = nbh.getFileObject();
if (fo != null) {
mime = fo.getMIMEType();
}
}
// 2. High-Fidelity Pane Setup
this.editor = new JEditorPane();
editor.setContentType(mime);
editor.setOpaque(true);
editor.setEditable(false);
// 3. Document Identity Binding
Document doc = editor.getDocument();
doc.putProperty("mimeType", mime);
if (resource.getHandle() instanceof NbHandle nbh) {
FileObject fo = nbh.getFileObject();
if (fo != null) {
try {
DataObject dobj = DataObject.find(fo);
doc.putProperty(Document.StreamDescriptionProperty,
dobj);
} catch (Exception ex) {
log.warn("Failed to find DataObject for: {}",
resource.getName());
}
}
}
// 4. Early Parser Activation
Source.create(doc);
// 5. TOTAL ADOPTION: Request the official NetBeans frame
EditorUI eui = Utilities.getEditorUI(editor);
if (eui != null) {
if (eui instanceof NbEditorUI neui) {
}
eui.updateTextMargin();
JComponent extComp = eui.getExtComponent();
// Adopt the official IDE scroller for scroll behavior
management
this.mainScroller = SwingUtils.findComponent(extComp,
JScrollPane.class);
getWrapper().removeAll();
getWrapper().add(extComp, BorderLayout.CENTER);
} else {
log.warn("EditorUI missing for: {}. Falling back to basic
scroller.", resource.getName());
this.mainScroller = new JScrollPane(editor);
getWrapper().removeAll();
getWrapper().add(mainScroller, BorderLayout.CENTER);
}
```
GitHub link: https://github.com/apache/netbeans/discussions/9259
----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists