Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » No figure drawn for EditPart
No figure drawn for EditPart [message #217369] Sat, 03 June 2006 06:47
Eclipse UserFriend
Originally posted by:


I am a newbie and needed help while creating a basic GEF editor.

I want to create a new editor for java files. The custom editor is opened
with the palette, but there is no Figure drawn. I have copied the
important parts of the code below.

CodeBrowserEditor where the model is an ICompilationUnit

protected void setInput(IEditorInput input) {
IFile file = ((IFileEditorInput) input).getFile();
compilationUnit = JavaCore.createCompilationUnitFrom(file);

protected void initializeGraphicalViewer() {
GraphicalViewer viewer = getGraphicalViewer();
viewer.setContents(compilationUnit); // set the contents of this editor

protected void configureGraphicalViewer() {

GraphicalViewer viewer = getGraphicalViewer();
viewer.setEditPartFactory(new CompilationUnitEditPartFactory());
viewer.setRootEditPart(new ScalableFreeformRootEditPart());


public EditPart createEditPart(EditPart context, Object model) {
if (model instanceof ICompilationUnit) {
EditPart editPart = new CompilationUnitEditPart();
return editPart;


protected IFigure createFigure() {
IFigure layer = new FreeformLayer();
layer.setBorder(new MarginBorder(3));
layer.setLayoutManager(new FreeformLayout());

IFigure rectangle = new RectangleFigure();
rectangle.setOpaque(true); // non-transparent figure

return layer;

protected void createEditPolicies() {

protected void refreshVisuals() {

createFigure in CompilationUnitEditPart is called, but nothing is drawn.

Thanks for your help

Previous Topic:Any good GEF book?
Next Topic:Any ConnectionAnchor layout & Connection Line layout articles?
Goto Forum:

Current Time: Wed Dec 07 00:18:27 GMT 2022

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

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

Back to the top