Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 337590

Summary: Color customization impossible
Product: [Modeling] GMF-Runtime Reporter: Nathalie Lepine <nathalie.lepine>
Component: GeneralAssignee: Project Inbox <gmf-runtime-inbox>
Status: CLOSED NOT_ECLIPSE QA Contact:
Severity: critical    
Priority: P3 CC: apupier, maxime.porhel
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
use ColorSelector and another event
apupier: review+
use a filter instead of a listener apupier: iplog+

Description Nathalie Lepine CLA 2011-02-18 12:02:16 EST
When i want to customize the diagram elements colors (font color, line color or fill color) with the contextual menu "More colors", i choose the color and when ok is pressed, i have got this exception :

Unhandled event loop exception

java.lang.NullPointerException
at org.eclipse.gmf.runtime.common.ui.action.AbstractContributionItem.getActionManager(AbstractContributionItem.java:504)
at org.eclipse.gmf.runtime.common.ui.action.AbstractContributionItem.runWithEvent(AbstractContributionItem.java:529)
at org.eclipse.gmf.runtime.diagram.ui.actions.internal.ColorPropertyContributionItem.handleEvent(ColorPropertyContributionItem.java:533)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1053)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4066)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3657)
at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2640)
at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2604)
at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2438)
at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:671)
at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:664)
at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
Comment 1 Aurelien Pupier CLA 2011-02-18 12:31:52 EST
Hi,

it works for me on windows vista with logic diagram sample.

Is there someone that can test on Windows 7?

@Nathalie Did you do this via properties view or contextual menu? both? Do you choose a custom color or not?

Which version of GMF are you using?

Regards,
Comment 2 Aurelien Pupier CLA 2011-02-18 12:57:54 EST
Created attachment 189305 [details]
use ColorSelector and another event

Ok,asked to colleagues and we have already fixed it.

This is an issue on mac and Windows 7

I cleaned a little what we have done and no mac nor windows 7 to test.
Can someone test on these platforms?

thanks
Comment 3 Nathalie Lepine CLA 2011-02-22 10:36:22 EST
Hi,

I try with the provided patch, i've already have the same exception when i customize the color with the context menu. My GMF version is 2.2.2.

Regards.
Comment 4 Aurelien Pupier CLA 2011-02-22 10:49:00 EST
Created attachment 189505 [details]
use a filter instead of a listener

Ok, my bad, I wasn't understanding the real issue before.
I uploaded a new patch.

In fact, perhaps it is more relevant to report bug to SWT becuase they hae different behavior on SWT.Deactivate on a shell between WIndows vista, 7 and Mac

You can try the patch provided.
Comment 5 Nathalie Lepine CLA 2011-02-22 11:28:21 EST
Thanks for the new patch provided but it does not work either, i have the same exception.
Comment 6 Maxime Porhel CLA 2011-03-01 06:09:32 EST
It seems to work with Eclipse 3.3. In 3.5 and 3.6 a new method org.eclipse.ui.internal.WorkbenchWindow.liftRestrictions() is called during shellActivation, leading to update the contextual menu and dipose the current ColorPropertyContributionItem. The dispose remove the workbenchpart causing the NPE.
Comment 7 Maxime Porhel CLA 2011-03-01 09:38:59 EST
The contextual menu update is caused by a detected changes in menus (WorkbenchWindow.liftRestrictions()).

It comes from one of our popup menu which is computed with visibleWhen > With expression based on activeMenuSelection. This variable is available just after right click. 

The click on "More colors" shows a ColorDialog/ColorSelector" in its own shell. The click on "Ok" quit this dialog, the workbench window is reactivated, the activeMenuSelection variables is not found, causing the call of WorkbenchMenuService.updateManager().  

ColorPropertyContributionItem.dispose() leads to set a null WorkbenchPart. It causes the NullPointException in runWithEvent(Event).


We changed the variable to selection, and the NPE no longer occurs.
Comment 8 Aurelien Pupier CLA 2012-05-09 09:44:48 EDT
Hi,

so we can close the bug as NOT_ECLIPSE?

regards,
Comment 9 Aurelien Pupier CLA 2012-09-19 12:45:12 EDT
Feel free to reopen and add a patch if it is an Eclipse bug
Comment 10 Maxime Porhel CLA 2012-09-19 16:46:53 EDT
Hi, 

Sorry I did not see the notification mail.

It was a NOT_ECLIPSE bug.

Regards,

(In reply to comment #8)
> Hi,
> 
> so we can close the bug as NOT_ECLIPSE?
> 
> regards,