1

I'm walking through the gwt "StockWatcher" example at the moment. Trying this on IntelliJ though I've got a bit of a strange problem; It seems IntelliJ doesn't find my css classes.

I've added this line to StockWatcher.gwt.xml:

<stylesheet src="css/stockwatcher.css"/>

And my web module has StockWatcher/css/stockwatcher.css:

body {
  padding: 10px;
}
.watchListHeader {
  background-color: #2062b8;
  color: white;
  font-style: italic;
}
.watchList {
  border: 1px solid silver;
  padding: 2px;
  margin-bottom: 6px;
}
.watchListNumericColumn {
  color: red;
}

In the StockWatcher class:

stockFlexTable.getRowFormatter().addStyleName(0,"watchListHeader");
// no error, but I can't "go to"  ----------------^
stockFlexTable.addStyleName("watchList");
// ----------------------------^
stockFlexTable.getCellFormatter().addStyleName(0, 1, "watchListNumericColumn");
// ----------------------------------------------------^
stockFlexTable.getCellFormatter().addStyleName(0, 2, "watchListNumericColumn");
// ----------------------------------------------------^
// On these lines I get "Unknown CSS class"

How can I resolve this? Am I supposed to tell IntelliJ where to look for these css classes? If so, how? Or does IntelliJ only look in some fixed css file? The only "resolution" that the inspection offers is to suppress the warning, which I'd rather not do unless there's no other way.

Braj
  • 46,415
  • 5
  • 60
  • 76
Cubic
  • 14,902
  • 5
  • 47
  • 92

1 Answers1

0

Try this one in your HTML/JSP file

<link type="text/css" rel="stylesheet" href="css/stockwatcher.css">

There is no need to add stylesheet in your gwt.xml.


Try this one in your gwt.xml

<stylesheet src="/css/stockwatcher.css"/>
Braj
  • 46,415
  • 5
  • 60
  • 76
  • That's the way it's recommended by the gwt guys though. Anyway... that made the warnings go away, but I still only get completion and goto for one of these classes. Really weird. – Cubic Apr 10 '14 at 20:29
  • I think you have missed / in the beginning. – Braj Apr 10 '14 at 20:30
  • The url was supposed to be that way (see http://www.gwtproject.org/doc/latest/DevGuideOrganizingProjects.html#DevGuideAutomaticResourceInclusion, Relative vs Absolute URL). Should I regard it as a bug that intellij doesn't know what to do with in gwt.xml? – Cubic Apr 10 '14 at 20:36
  • Read here about [use custom css with gwt](http://stackoverflow.com/questions/11538463/use-custom-css-with-gwt) – Braj Apr 10 '14 at 20:41
  • I don't have a problem with gwt; It sees my styles just fine. It's just that IntelliJ doesn't unless I include it manually on the html page. – Cubic Apr 10 '14 at 20:43
  • Sorry I don't have any idea about `IntelliJ` but it works perfect in gwt using HTML/JSP as well as gwt.xml. – Braj Apr 10 '14 at 20:44