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: rahulrevo.gmail.com

Hi,

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) {
super.setInput(input);
IFile file = ((IFileEditorInput) input).getFile();
compilationUnit = JavaCore.createCompilationUnitFrom(file);
setPartName(compilationUnit.getElementName());
}

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

protected void configureGraphicalViewer() {
super.configureGraphicalViewer();

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


CompilationUnitEditPartFactory

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



CompilationUnitEditPart

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
rectangle.setBackgroundColor(ColorConstants.green);
layer.add(rectangle);

return layer;
}

protected void createEditPolicies() {
}

protected void refreshVisuals() {
}


createFigure in CompilationUnitEditPart is called, but nothing is drawn.

Thanks for your help

Rahul
Previous Topic:How to disable an GEF editor
Next Topic:Zoom cuts String-Labels in simple Rectangle
Goto Forum:
  


Current Time: Mon Jan 20 06:09:36 GMT 2025

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

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

Back to the top