This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 223945 - List of css files is limited to recently opened file
Summary: List of css files is limited to recently opened file
Status: NEW
Alias: None
Product: web
Classification: Unclassified
Component: CSS Visual Tools (show other bugs)
Version: 7.3
Hardware: PC Linux
: P3 normal (vote)
Assignee: Jan Stola
URL:
Keywords:
: 225980 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-12-17 15:55 UTC by Vladimir Riha
Modified: 2014-10-06 13:26 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
IDE log (51.53 KB, text/x-log)
2012-12-19 13:21 UTC, Vladimir Riha
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Vladimir Riha 2012-12-17 15:55:11 UTC
To reproduce:
- run Responsive Rabbits/index.html
- on line 36, click on

<div class="navbar-inner">

=> CSS Styles is populated
- Ctrl+Click on the class and go to e.g. bootstrap-responsive.css
- close this css file
- now back in HTML (no clicking anywhere), cursor stays on the same place before opening css file
- in CSS Styles dialog, click on Edit CSS Rules icon/button
- modify class selector

=> list of style sheets contains only bootstrap-responsive.css and not other linked css files. You have to refocus the element again and open Edit CSS Rule dialog again to get full list of css files



Product Version: NetBeans IDE Dev (Build web-main-9541-on-20121216)
Java: 1.7.0_10; Java HotSpot(TM) 64-Bit Server VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_10-b18
System: Windows 8 version 6.2 running on amd64; Cp1252; en_US (nb)
Comment 1 Marek Fukala 2012-12-19 12:57:52 UTC
Works fine for me. If it didn't work that would be caused by the index - model synchronization issue I think.
Comment 2 Vladimir Riha 2012-12-19 13:21:42 UTC
I'm sorry but I just reproduced it 3 times of 3 attempts following exactly the steps above


Product Version: NetBeans IDE Dev (Build web-main-9561-on-20121219)
Java: 1.7.0_10; Java HotSpot(TM) Client VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_10-b18
System: Linux version 3.2.0-34-generic-pae running on i386; UTF-8; en_US (nb)
Comment 3 Vladimir Riha 2012-12-19 13:21:59 UTC
Created attachment 129540 [details]
IDE log
Comment 4 Marek Fukala 2012-12-19 15:15:09 UTC
I'm sorry too - I couldn't reproduce it three times from three attempts :-)
Comment 5 Marek Fukala 2012-12-19 15:30:59 UTC
Still can't reproduce, but looking into the code I can see that this behaviour might happen if the EditRulesAction has set the css file as context instead of the html file.
Comment 6 Marek Fukala 2012-12-19 16:00:05 UTC
OK, now I can even reproduce - the culprit is the Document view panel which sets the "Edit rules" action's context upon an active node change in lookup.
Comment 7 Marek Fukala 2012-12-20 11:39:51 UTC
Threading issue - too many stuff is done asynchronously. Apparently these two tasks are competing when the css file is closed:

INFO [null]: setting css model in EDT bootstrap-responsive.css
java.lang.Exception
	at org.netbeans.modules.css.visual.CssCaretAwareSourceTask.runInEDT(CssCaretAwareSourceTask.java:186)
	at org.netbeans.modules.css.visual.CssCaretAwareSourceTask.access$000(CssCaretAwareSourceTask.java:74)
	at org.netbeans.modules.css.visual.CssCaretAwareSourceTask$1.run(CssCaretAwareSourceTask.java:125)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)
	at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:702)


INFO [null]: context set to index.html
java.lang.Exception
	at org.netbeans.modules.css.visual.api.EditCSSRulesAction.setContext(EditCSSRulesAction.java:97)
	at org.netbeans.modules.css.visual.DocumentViewPanel.contextChanged(DocumentViewPanel.java:326)
	at org.netbeans.modules.css.visual.DocumentViewPanel.access$200(DocumentViewPanel.java:94)
	at org.netbeans.modules.css.visual.DocumentViewPanel$2.resultChanged(DocumentViewPanel.java:159)
	at org.openide.util.lookup.ProxyLookup$1Notify.run(ProxyLookup.java:181)
	at org.openide.util.lookup.ProxyLookup.setLookups(ProxyLookup.java:190)
	at org.openide.util.lookup.ProxyLookup.setLookups(ProxyLookup.java:126)
	at org.netbeans.modules.css.visual.CssStylesPanel$ModifiableLookup.updateLookup(CssStylesPanel.java:351)
	at org.netbeans.modules.css.visual.CssStylesPanel.setContext(CssStylesPanel.java:282)
	at org.netbeans.modules.css.visual.api.CssStylesTC.setContext(CssStylesTC.java:155)
	at org.netbeans.modules.css.visual.CssStylesTCController.openCssStyles(CssStylesTCController.java:169)
	at org.netbeans.modules.css.visual.CssStylesTCController.access$200(CssStylesTCController.java:65)
	at org.netbeans.modules.css.visual.CssStylesTCController$1$1.run(CssStylesTCController.java:130)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)

who wins, sets the action context. If the first one, then the consequence is that the list of files in the Edit CSS rules dialog contains files imported from the css file, not the html file.
Comment 8 Marek Fukala 2012-12-20 12:03:10 UTC
better disregard comment 7.

Normally the action's context file is set by the CssStylesTCController a css or html file TopComponent opens:

INFO [null]: context set to index.html
java.lang.Exception
	at org.netbeans.modules.css.visual.api.EditCSSRulesAction.setContext(EditCSSRulesAction.java:97)
	at org.netbeans.modules.css.visual.api.CssStylesTC.setContext(CssStylesTC.java:158)
	at org.netbeans.modules.css.visual.CssStylesTCController.openCssStyles(CssStylesTCController.java:169)
	at org.netbeans.modules.css.visual.CssStylesTCController.access$200(CssStylesTCController.java:65)
	at org.netbeans.modules.css.visual.CssStylesTCController$1$1.run(CssStylesTCController.java:130)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)

However in the scenario described by Vlada, *after* the code above runs

webkit.ui.CSSStylesPanel$RuleEditorTask runs RuleEditorController.setModel/Rule for the just closed css file, which then triggers:

INFO [null]: context set to bootstrap.css
java.lang.Exception
	at org.netbeans.modules.css.visual.api.EditCSSRulesAction.setContext(EditCSSRulesAction.java:97)
	at org.netbeans.modules.css.visual.DocumentViewPanel$3.resultChanged(DocumentViewPanel.java:189)
	at org.openide.util.lookup.ProxyLookup$1Notify.run(ProxyLookup.java:181)
	at org.openide.util.lookup.ProxyLookup.setLookups(ProxyLookup.java:190)
	at org.openide.util.lookup.ProxyLookup.setLookups(ProxyLookup.java:126)
	at org.openide.explorer.DefaultEMLookup.updateLookups(DefaultEMLookup.java:134)
	at org.openide.explorer.DefaultEMLookup.propertyChange(DefaultEMLookup.java:166)
	at org.openide.util.WeakListenerImpl$PropertyChange.propertyChange(WeakListenerImpl.java:196)
	at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:339)
	at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:276)
	at org.openide.explorer.ExplorerManager$2.run(ExplorerManager.java:876)
	at org.openide.util.Mutex.doEvent(Mutex.java:1343)
	at org.openide.util.Mutex.readAccess(Mutex.java:350)
	at org.openide.explorer.ExplorerManager.fireInAWT(ExplorerManager.java:873)
	at org.openide.explorer.ExplorerManager$1AtomicSetSelectedNodes.fire(ExplorerManager.java:292)
	at org.openide.explorer.ExplorerManager.setSelectedNodes(ExplorerManager.java:303)
	at org.netbeans.modules.css.visual.DocumentViewPanel.setSelectedRule(DocumentViewPanel.java:254)
	at org.netbeans.modules.css.visual.DocumentViewPanel.access$100(DocumentViewPanel.java:96)
	at org.netbeans.modules.css.visual.DocumentViewPanel$1$1.run(DocumentViewPanel.java:140)
	at org.netbeans.modules.css.model.api.Model$1.run(Model.java:273)
	at org.openide.util.Mutex.readAccess(Mutex.java:367)
	at org.netbeans.modules.css.model.api.Model.runReadTask(Model.java:270)
	at org.netbeans.modules.css.visual.DocumentViewPanel$1.propertyChange(DocumentViewPanel.java:137)
	at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:339)
	at java.beans.PropertyChangeSupport.firePropertyChange(PropertyChangeSupport.java:276)
	at org.netbeans.modules.css.visual.RuleEditorPanel.setRule(RuleEditorPanel.java:564)
	at org.netbeans.modules.css.visual.api.RuleEditorController$2.run(RuleEditorController.java:177)
	at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:209)

I believe the webkit.ui.CSSStylesPanel$RuleEditorTask  should not call RuleEditorController.setModel/Rule for the closed file.
Comment 9 Jan Stola 2013-01-02 16:07:29 UTC
I am sorry, I am not able to reproduce this issue and I don't understand what do you mean by

> I believe the webkit.ui.CSSStylesPanel$RuleEditorTask should not call
> RuleEditorController.setModel/Rule for the closed file.

RuleEditorTask is invoked for rules selected in Selection section of CSS Styles view. It has no relation to CSS files opened in the IDE, i.e., it  works the same way no matter what is/was opened in the IDE (intentionally).
Comment 10 Vladimir Riha 2013-01-07 11:50:35 UTC
No it seems to limit css files to only the one in which selected rule in Applied Styles section is declared and it happens even without interaction with Document view. This happens very often (maybe always?) and to get full list, I have  to open css file of selected rule in Applied Styles, switch back to HTML editor and for one attempt, I get full list of css files. If I open the Edit CSS Rules dialog one more time, it is again limited to the only one file.

If I repeat the same from Navigator, it is OK



Product Version: NetBeans IDE Dev (Build web-main-9643-on-20130106)
Java: 1.7.0_10; Java HotSpot(TM) Client VM 23.6-b04
Runtime: Java(TM) SE Runtime Environment 1.7.0_10-b18
System: Linux version 3.2.0-35-generic-pae running on i386; UTF-8; en_US (nb)
Comment 11 Vladimir Riha 2013-01-07 12:14:19 UTC
(In reply to comment #10)
> No it seems to limit css files to only the one in which selected rule in

* Now it seems...
Comment 12 Kenneth Ganfield 2013-01-29 21:46:53 UTC
For me, the index.html file is focused and it contains links to two css files.

When the cursor is in the body of the page and I invoke the edit css rules dialog there is only one css file listed as an option in the dialog.

When the cursor is in the head of the page and I invoke the edit css rules dialog I see both css files listed as options in the dialog.

If I am trying to create a class selector and Apply Changes to Element is selected then the result is that the class is applied to the element, eg head class="my-selector" or link class="my-selector". One must remember to deselect the Apply Changes to Element option.
Comment 13 Marek Fukala 2013-08-05 14:26:27 UTC
*** Bug 225980 has been marked as a duplicate of this bug. ***