Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » automatocally Grid in Background
automatocally Grid in Background [message #804419] Wed, 22 February 2012 10:53 Go to next message
Eclipse UserFriend
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 13:16 Go to previous messageGo to next message
Eclipse UserFriend
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 03:29 Go to previous message
Eclipse UserFriend
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 Jul 10 00:47:00 EDT 2025

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

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

Back to the top