Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » GEF Displaying rulers
GEF Displaying rulers [message #788403] Wed, 01 February 2012 19:12 Go to next message
Leonid Ripeynih is currently offline Leonid RipeynihFriend
Messages: 150
Registered: February 2012
Senior Member
Hi there! My first post. I'm starting my editor in gef, and I came across the following problem: how to display rulers on my editor? I've read API documentation about Ruler Composite and Ruler Provider and it seem's pretty easy to implement all the logics that have to me done. But i can't simply display the rullers, they won't show. I don't understand, should an empty Ruler Composite dispay a 'basic' empty ruler? Here is my code:

public class VisualEditor extends GraphicalEditorWithFlyoutPalette {

	RulerComposite rulerComp;
	
	public VisualEditor() {
		setEditDomain(new DefaultEditDomain(this));
	}

	@Override
	protected void initializeGraphicalViewer() {
		super.initializeGraphicalViewer();
		getGraphicalViewer().setContents(ContentHelper.getDummyRoot());
	}
	
	@Override
	protected void configureGraphicalViewer() {
		super.configureGraphicalViewer();
		getGraphicalViewer().setEditPartFactory(new VisualEditPartFactory());
		getGraphicalViewer().setProperty(RulerProvider.PROPERTY_RULER_VISIBILITY, true);

	}

	@Override
	protected PaletteRoot getPaletteRoot() {
		return new VisualEditorPalette();
	}

	@Override
	public void doSave(IProgressMonitor monitor) {
		// TODO Auto-generated method stub

	}

	protected void createGraphicalViewer(Composite parent) {
		rulerComp = new RulerComposite(parent, SWT.NONE);
		super.createGraphicalViewer(rulerComp);
		rulerComp.setGraphicalViewer((ScrollingGraphicalViewer) getGraphicalViewer());

		
	}

	protected Control getGraphicalControl() {
		return rulerComp;
	}
}

[Updated on: Wed, 01 February 2012 19:29]

Report message to a moderator

Re: GEF Displaying rulers [message #798448 is a reply to message #788403] Tue, 14 February 2012 18:01 Go to previous message
Jan Krakora is currently offline Jan KrakoraFriend
Messages: 477
Registered: December 2009
Location: Prague
Senior Member
Hi Dark Diver,

looking at the Logic example, I thing you should provide a ruler provider:

LogicRuler ruler = getLogicDiagram().getRuler(PositionConstants.WEST);
RulerProvider provider = null;
if (ruler != null) {
	provider = new LogicRulerProvider(ruler);
}
getGraphicalViewer().setProperty(RulerProvider.PROPERTY_VERTICAL_RULER, provider);
		
ruler = getLogicDiagram().getRuler(PositionConstants.NORTH);
provider = null;
if (ruler != null) {
	provider = new LogicRulerProvider(ruler);
}
getGraphicalViewer().setProperty(RulerProvider.PROPERTY_HORIZONTAL_RULER, provider);

[Updated on: Tue, 14 February 2012 18:02]

Report message to a moderator

Previous Topic:Disable connection feedback
Next Topic:GEF Layer examples
Goto Forum:
  


Current Time: Tue Mar 19 06:35:12 GMT 2024

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

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

Back to the top