| 
| View not being drawn/shown/displayed [message #213901] | Tue, 11 April 2006 14:07 |  | 
| Eclipse User  |  |  |  |  | Originally posted by: ben.vitale.precipia.com 
 I've built a GEF-based editor with an EMF-based model to support it.
 The editor is being displayed inside an RCP application perspective.
 When I launch the editor, I can see the palette, but there is nothing
 displayed on my editor canvas.  I'm expecting to see two node figures,
 because I've hacked my editor input to contain a sample model.
 
 I've compared my code to the Shapes example, and it seems that I have
 all the right hooks in place.  Below are the methods that I've been
 focusing on as part of my troubleshooting.  Can anyone point me to other
 places that I should be checking for missing pieces?
 
 From ScenarioEditor.java:
 
 protected void setInput(IEditorInput input)
 {
 super.setInput(input);
 ScenarioEditorInput scenarioInput =
 ((ScenarioEditorInput) input);
 // scenario is set to a sample model instance
 scenario = scenarioInput.getScenario();
 setPartName(scenarioInput.getName());
 }
 
 public void createPartControl(Composite parent)
 {
 SashForm sashForm = new SashForm(parent, SWT.HORIZONTAL);
 sashForm.setBackground(parent.getBackground());
 paletteViewer = createPaletteViewer(sashForm);
 graphicalViewer = createGraphicalViewer(sashForm);
 sashForm.setWeights(new int[] { 30, 70 });
 }
 
 private GraphicalViewer createGraphicalViewer(Composite parent)
 {
 // create graphical graphicalViewer
 GraphicalViewer viewer = new ScrollingGraphicalViewer();
 viewer.createControl(parent);
 
 // configure the graphicalViewer
 viewer.getControl().setBackground(ColorConstants.white);
 viewer.setRootEditPart(new ScalableFreeformRootEditPart());
 viewer.setEditPartFactory(getEditPartFactory());
 
 // hook the graphicalViewer into the EditDomain
 getEditDomain().addViewer(viewer);
 
 getSite().setSelectionProvider(viewer);
 
 // initialize the graphicalViewer with input
 viewer.setContents(getContent());
 
 return viewer;
 }
 
 From ScenarioNodeEditPart.java:
 
 protected ScenarioNodeFigure getNodeFigure(){
 return (ScenarioNodeFigure) getFigure();
 }
 
 protected void refreshVisuals() {
 getNodeFigure().setName( getScenarioNode().getName() );
 getNodeFigure().setLocation(
 getScenarioNode().getLocation());
 getNodeFigure().setSize( getScenarioNode().getSize());
 }
 
 From ScenarioNodeFigure.java:
 
 public class ScenarioNodeFigure
 extends Ellipse
 implements IScenarioNodeFigure
 
 .....
 
 public ScenarioNodeFigure() {
 
 // XYLayout lays out the components using the
 // layout constraints as defined by each component.
 layout = new XYLayout();
 setLayoutManager( layout );
 
 setBackgroundColor( ColorConstants.red );
 setOpaque(true);
 
 incomingConnectionAnchor = new EllipseAnchor(this);
 outgoingConnectionAnchor = new EllipseAnchor(this);
 label = new Label(" ");
 add(label);
 
 }
 
 
 Thanks much.
 
 Ben
 |  |  |  | 
Powered by 
FUDForum. Page generated in 0.02832 seconds