Set default (initialization) color for a figure [message #189230] |
Fri, 23 May 2008 17:40 |
Eclipse User |
|
|
|
Originally posted by: mehrdad.saadatmand.gmail.com
Hi,
I want to give my figures a default backgroud color, while letting the user
change it if they want. In what class should I set the backgroundcolor, so
that it is only set on figure creation and does not overwrite user set
colors?
Thanks,
Mehrdad
|
|
|
|
|
Re: Set default (initialization) color for a figure [message #189602 is a reply to message #189594] |
Tue, 27 May 2008 23:29 |
Eclipse User |
|
|
|
Originally posted by: mehrdad.saadatmand.gmail.com
Thanks, Actually Alex's solution was exactly what I needed. Having it in the
graphical definition, disables user from changing it to their own desired
color.
@Override protected void initializeFromPreferences(View view)
{
super.initializeFromPreferences(view);
IPreferenceStore store = (IPreferenceStore)
getPreferencesHint().getPreferenceStore();
int fillcol= store.getDefaultInt("CompBackColor");
FillStyle fillstl = (FillStyle)
view.getStyle(NotationPackage.Literals.FILL_STYLE);
fillstl.setFillColor(fillcol);
}
If I add this code to the decorateView method, it also works fine as far as
initlization is needed. I'm curious to know what the difference between
having it here in initializeFromPreferences and putting it in decorateView
method is, conceptually.
"Stefan" <ste-re@gmx.de> wrote in message
news:g1i1ae$98c$1@build.eclipse.org...
>I think it should also be possible when you set a background color in the
>graphical definition for your node
|
|
|
Powered by
FUDForum. Page generated in 0.02590 seconds