Hi,
I've got a working eclipse plugin that displays a statechart like diagram. The user can click on the various elements in the diagram and edit the properties for that element. One of those properties is a string that becomes the body of a method in some generated source code. All of that works at the moment.
What I want to do is replace the simple Text widget in the property sheet for the diagram elements with something that will provide syntax highlighting, code completion etc. To that end I'm trying to embed a CompilationUnitEditor in the property sheet, but I don't think I'm setting it up correctly or opening it correctly. Here's the code for the editor so far:
public class CodeEditor extends CompilationUnitEditor {
public CodeEditor() {
JavaTextTools textTools = JavaPlugin.getDefault().getJavaTextTools();
JavaSourceViewerConfiguration config = new JavaSourceViewerConfiguration(textTools.getColorManager(),
JavaPlugin.getDefault().getCombinedPreferenceStore(),
this, IJavaPartitions.JAVA_PARTITIONING);
setSourceViewerConfiguration(config);
setPreferenceStore(JavaPlugin.getDefault().getCombinedPreferenceStore());
}
}
And here's the code that attempts to embed it in the property sheet.
CodeEditor editor = new CodeEditor();
editor.createPartControl(composite);
This throws NullPointerExceptions when it tries to get the site. I suspect there's much more to opening an editor, but I'm not sure how to proceed. Any suggestions appreciated.
thanks,
Nick