Question

I'm developing a RCP application that contains a TableViewer. This is my first attempt at a RCP app, so sorry if this is a silly question. I'm having trouble with the content provider's inputChanged method. The input objects in the table are Strings. Here is the method, as I have so far (Scenario is a class in my app, with a displayData method):

public void inputChanged(Viewer v, Object oldInput, Object newInput) {
    if (newInput != null) {
        String s = (String)newInput;
        Scenario.displayData(s);
    }
}

When I run it, I get the following Exception:

java.lang.ClassCastException: [Ljava.lang.String; cannot be cast to java.lang.String

How did the class name get garbled? I tried printing out the class name, using newInput.getClass().getName(), and still got the garbled version.

Était-ce utile?

La solution

The "[L" means it's an array of strings.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top