Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » automatocally Grid in Background
automatocally Grid in Background [message #804419] Wed, 22 February 2012 15:53 Go to next message
Sascha Schubert is currently offline Sascha SchubertFriend
Messages: 6
Registered: February 2012
Junior Member
Hello everyone

I programming a small editor and have little problem.

I found out to show the grid layout in the background of my editor by this overlays my figures. I searched for a solution in the internet but cant find a good one. To get the grid automatically in the background i wrote my own custum preferences class but theres no option to set gridInFront to false.

I hope someone can help me finding a good solution.

THX Sascha
Re: automatocally Grid in Background [message #804516 is a reply to message #804419] Wed, 22 February 2012 18:16 Go to previous messageGo to next message
Michael Golubev is currently offline Michael GolubevFriend
Messages: 383
Registered: July 2009
Senior Member
Hello,

I have added the followng code into the TaiPan sample, TaiPanDiagramEditor#configureGraphicalViewer():

protected void configureGraphicalViewer() {
	super.configureGraphicalViewer();
	DiagramEditorContextMenuProvider provider = new DiagramEditorContextMenuProvider(this, getDiagramGraphicalViewer());
	getDiagramGraphicalViewer().setContextMenu(provider);
	getSite().registerContextMenu(ActionIds.DIAGRAM_EDITOR_CONTEXT_MENU, provider, getDiagramGraphicalViewer());
	
	//ADDED START
	DiagramRootEditPart root = (DiagramRootEditPart) getDiagramGraphicalViewer().getRootEditPart();
	Layer printableLayers = (Layer)root.getLayer(LayerConstants.PRINTABLE_LAYERS);
	Layer gridLayer = (Layer)root.getLayer(LayerConstants.GRID_LAYER);
	if (printableLayers != null && gridLayer != null){
		LayeredPane paneForPrintable = (LayeredPane)printableLayers.getParent();
		LayeredPane paneForGrid = (LayeredPane)gridLayer.getParent();
		if (paneForGrid == paneForPrintable) {
			paneForGrid.removeLayer(LayerConstants.GRID_LAYER);
			paneForGrid.addLayerBefore(gridLayer, LayerConstants.GRID_LAYER, LayerConstants.PRINTABLE_LAYERS);
		}
	}
	//ADDED END
}


Looks hackish, so any better solution would be appreciated, but at least to first look it works -- see attached screenshot

index.php/fa/7256/0/

Re: automatocally Grid in Background [message #805006 is a reply to message #804516] Thu, 23 February 2012 08:29 Go to previous message
Sascha Schubert is currently offline Sascha SchubertFriend
Messages: 6
Registered: February 2012
Junior Member
thanks alot works fine for me Smile
Previous Topic:firing commands when dragging a connection
Next Topic:Use GMF outside Eclipse in standalone application
Goto Forum:
  


Current Time: Thu Apr 25 15:13:56 GMT 2024

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

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

Back to the top