GWT problem
Hi,
Trying jetbrains software last days... I have installed IDEA 9.0.3 ultimate and spend about one hour to import GWT Project from eclipse - sucessfully it's work ok, but IDEA underline
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
The error is:
"
Class 'com.google.gwt.event.dom.client.ChangeEvent' is defined in module 'com.google.gwt.event.dom.DomEvent' which is not inherited in module com.myprojects.gwtproject
This inspection reports usages in client code of classes which is not presented in JRE Emulation Library
"
I have checked and module com.google.gwt.event.dom.DomEvent doesn't exists in gwt's jars
GWT version 2.0.4
What's this means? How to fix this?
请先登录再写评论。
Are you sure that you're using proper GWT jars? In my GWT 2.0.4 installation the gwt-user.jar has module com/google/gwt/event/dom/DomEvent.gwt.xml. So
if you want to use ChangeEvent class in your client code you need to inherit your GWT module from DomEvent module (e.g. by inheriting from module
com.google.gwt.user.User which inherits DomEvent).
>
>
>
>
>
>
>
--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
Hmm checked and com/google/gwt/event/dom/DomEvent.gwt.xml exists (before I dont't look at xml files)
In my project xml file I have:
<module rename-to='transmissionlines'>
<extend-property name="locale" values="pl_PL" />
<inherits name='com.google.gwt.user.theme.standard.Standard' />
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
<inherits name="com.smartgwt.SmartGwt" />
<!-- <inherits name="com.smartgwt.SmartGwtNoScript"/>-->
<inherits name='com.google.gwt.user.User' />
<entry-point class='com.ekapek.client.TransmissionLines' />
</module>
and in java file:
package com.ekapek.client.widget.slack;
import com.ekapek.client.AppConstants;
import com.ekapek.client.mvc.ApplicationModel;
import com.ekapek.client.mvc.PageController;
import com.ekapek.client.object.dto.PylonDTO;
import com.ekapek.client.widget.ListBoxView;
import com.ekapek.client.widget.RadioButtonView;
import com.ekapek.client.widget.TextBoxView;
import com.google.gwt.core.client.GWT;
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.ui.DecoratorPanel;
import com.google.gwt.user.client.ui.FlexTable;
import com.google.gwt.user.client.ui.HasHorizontalAlignment;
import com.google.gwt.user.client.ui.FlexTable.FlexCellFormatter;
import com.smartgwt.client.widgets.Slider;
only:
import com.google.gwt.event.dom.client.ChangeEvent;
import com.google.gwt.event.dom.client.ChangeHandler;
is underlined and as I mention project compiled and works fine...
BTW: If I create new project and add imports everything is ok... but in this not:/
Do you have only one *.gwt.xml in the project sources? Please press Ctrl+B on underlined ChangeEvent reference and check whether ChanveEvent class is
located in correct gwt-user.jar file.
>
>
>
>
>
--
Nikolay Chashnikov
Software Developer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"
Yes only one.
After Ctrl+B IDEA open:
package com.google.gwt.event.dom.client;
public static interface ChangeHandler extends com.google.gwt.event.shared.EventHandler {
void onChange(com.google.gwt.event.dom.client.ChangeEvent event);
}
and second file:
package com.google.gwt.event.dom.client;
public static class ChangeEvent extends com.google.gwt.event.dom.client.DomEvent<com.google.gwt.event.dom.client.ChangeHandler> {
private static final com.google.gwt.event.dom.client.DomEvent.Type<com.google.gwt.event.dom.client.ChangeHandler> TYPE;
public static com.google.gwt.event.dom.client.DomEvent.Type<com.google.gwt.event.dom.client.ChangeHandler> getType() { /* compiled code */ }
protected ChangeEvent() { /* compiled code */ }
public final com.google.gwt.event.dom.client.DomEvent.Type<com.google.gwt.event.dom.client.ChangeHandler> getAssociatedType() { /* compiled code */ }
protected void dispatch(com.google.gwt.event.dom.client.ChangeHandler handler) { /* compiled code */ }
}
Solved!
I comaprised new project and my project and see that in my libraries I only have gwt classes, so I add gwt sources with the same jar file - strange but problem is gone
When I add sources to eg. SmartGWT to the problem come back again... so that have to be only GWT sources in project...
Thanks for help
Hmm I look at SmartGWT's jar and see that there is com.google.gwt.event package too so that was that problem...
Smart GWT 2.x does bundle the event module of GWT because it uses the new event API event with GWT 1.5 where these classes do not exist. A future release of Smart GWT will get rid of them since it will no longer support GWT 1.5.
Having said that, I too use IDEA and have not seen the error message you are describing.
Sanjiv