Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » C / C++ IDE (CDT) » How to embed Eclipse CDT CSourceViewer inside SWT composite
How to embed Eclipse CDT CSourceViewer inside SWT composite [message #1724083] Sat, 20 February 2016 20:56
Fritz Müller is currently offline Fritz MüllerFriend
Messages: 1
Registered: February 2016
Junior Member
I have set up a multi-page editor plugin in Eclipse and would like to embed the CSourceViewer from Eclipse CDT into a page that also has a couple other elements, like buttons etc. What is the easiest way to do that? I tried something like the following, but this resulted in null pointer exceptions as soon as I try to type something inside the source viewer.
    CTextTools textTools= CUIPlugin.getDefault().getTextTools();
    IPreferenceStore store = CUIPlugin.getDefault().getCombinedPreferenceStore();
    CSourceViewer viewer = new CSourceViewer(composite, null, null, false, SWT.MULTI|SWT.V_SCROLL|SWT.H_SCROLL| SWT.FULL_SELECTION, CUIPlugin.getDefault().getPreferenceStore());
    viewer.configure(new CSourceViewerConfiguration(textTools.getColorManager(), store, null, textTools.getDocumentPartitioning()));
    gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    gd.heightHint = 200;
    gd.widthHint = 300;
    viewer.getControl().setLayoutData(gd);

It works with a normal source viewer. But the CDT CSourceViewer would be really nice to get syntax highlighting etc.
Previous Topic:Memory Monitor/Browser do not update address
Next Topic:Eclipse and Assimp, launch failed. Binary not found
Goto Forum:
  


Current Time: Sat Sep 21 17:18:20 GMT 2024

Powered by FUDForum. Page generated in 0.03255 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top