Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » CompilationUnitEditor in Property Sheet
CompilationUnitEditor in Property Sheet [message #1085934] Tue, 13 August 2013 15:03
Nick Collier is currently offline Nick CollierFriend
Messages: 20
Registered: July 2009
Junior Member
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
Previous Topic:Editor Save Action don't persist
Next Topic:Problem while commiting the files to cvs
Goto Forum:
  


Current Time: Sun May 12 15:14:16 GMT 2024

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

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

Back to the top