Skip to main content



      Home
Home » Modeling » GMF (Graphical Modeling Framework) » Diagram Canvas BackgroundColor
Diagram Canvas BackgroundColor [message #215234] Wed, 14 January 2009 13:10 Go to next message
Eclipse UserFriend
Dear community,


I am trying to set the background of the editor canvas to some user
spedific function.
I can do this via the DiagramEditPart's methods setOpaque and set
BackgroundColor.

However the grid is only visible when set to "infront" and then really
in front of every other diagram element.

Whats the steps to get the grid shown but as the lowest layer, just like
when the DiagramEditPart is not set to opaque.

TIA & regards
Thomas
Re: Diagram Canvas BackgroundColor [solved] [message #222921 is a reply to message #215234] Fri, 27 March 2009 04:12 Go to previous message
Eclipse UserFriend
I managed to set the background color without any drawbacks of the
GMF/GEF-layers by settings the GrahpicalViewer's Control background to
the color i desire.

I added the following method
/**
* dynamic template content
* @author Thomas Beyer
* @generated
*/
protected void createGraphicalViewer(Composite parent) {
super.createGraphicalViewer(parent);
org.eclipse.swt.graphics.RGB rgb = PreferenceConverter.getColor(
HmiDiagramEditorPlugin.getInstance().getPreferenceStore(),
HMIUIMessages.Id_Pref_CanvasBackground);
if (!rgb.equals(ColorConstants.white.getRGB())) {
getGraphicalViewer().getControl().setBackground(
new Color(null, rgb));
}
}

to the generated XXXDiagramEditor and it does the trick.

Regards Thomas

Am 14.01.2009 19:10, schrieb Thomas Beyer:
> Dear community,
>
>
> I am trying to set the background of the editor canvas to some user
> spedific function.
> I can do this via the DiagramEditPart's methods setOpaque and set
> BackgroundColor.
>
> However the grid is only visible when set to "infront" and then really
> in front of every other diagram element.
>
> Whats the steps to get the grid shown but as the lowest layer, just like
> when the DiagramEditPart is not set to opaque.
>
> TIA & regards
> Thomas
Previous Topic:WrapTextCellEditor problem
Next Topic:Making a border invisible
Goto Forum:
  


Current Time: Tue Jul 01 13:08:25 EDT 2025

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

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

Back to the top