Community
Participate
Working Groups
The code below works: Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout()); String style = "Button:hover { color: #0000ff }\n" + "Button:focus:hover { color: #00ff00 }"; CSSEngine engine = new CSSSWTEngineImpl(display); engine.setErrorHandler(new CSSErrorHandler() { public void error(Exception e) { fail(e.getMessage()); } }); try { engine.parseStyleSheet(new StringReader(style)); } catch (IOException e) { e.printStackTrace(); return; } Button button1 = new Button(shell, SWT.PUSH); button1.setText("Button 1"); //$NON-NLS-1$ Button button2 = new Button(shell, SWT.PUSH); button2.setText("Button 2"); //$NON-NLS-1$ engine.applyStyles(shell, true); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } display.dispose(); ----------------------- If we have... String style = "Button:focus { color: #0000ff }\n" + "Button:focus:hover { color: #00ff00 }"; ...instead, you can hover and tab between the two buttons all you want to alter focus and such but the buttons will never be coloured green. Likewise, just having... String style = "Button:focus:hover { color: #00ff00 }"; ...will also fail.
Hi remy, I believe the problem comes from with IDynamicPseudoClassesHandler which manage dfocus, hover. I know IDynamicPseudoClassesHandler is awfull (I don't know why I have done that?). I have send a patch at https://bugs.eclipse.org/bugs/show_bug.cgi?id=268249 to remove IDynamicPseudoClassesHandler and have cleaner API, but I don't know if Kevin is OK to apply this patch. We must check if this patch resolve your problem. Regards Angelo
(In reply to comment #1) > I believe the problem comes from with IDynamicPseudoClassesHandler which manage > dfocus, hover. > > I know IDynamicPseudoClassesHandler is awfull (I don't know why I have done > that?). I have send a patch at > https://bugs.eclipse.org/bugs/show_bug.cgi?id=268249 to remove > IDynamicPseudoClassesHandler and have cleaner API, but I don't know if Kevin > is OK to apply this patch. I'll try to read through the thread to see what's going on. > We must check if this patch resolve your problem. The patches do not seem to apply cleanly to HEAD.
Remy My answer is just a supposition(I have not tested), so I don't know if the patch which remove IDynamicPseudoClassesHandler will correct really your problem, but I suggest to test your case with the patch.
(In reply to comment #3) > My answer is just a supposition(I have not tested), so I don't know if the > patch which remove IDynamicPseudoClassesHandler will correct really your > problem, but I suggest to test your case with the patch. Agreed. I have CC'd myself on the other bug. Once updated patches have been submitted into bugzilla, I will test them to see if it resolves this problem.
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet. If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant. -- The automated Eclipse Genie.