I don't think so:
package st.extreme.jython;
public abstract class Dialog {
protected Dialog(String shell) {
System.out.println("protected Dialog(" + shell + ")");
}
public abstract void init();
}
Jython 2.2rc1 on java1.6.0_01
Type "copyright", "credits" or "license" for more information.
>>> from st.extreme.jython import Dialog
>>> d = Dialog()
Traceback (innermost last):
File "<console>", line 1, in ?
TypeError: can't instantiate abstract class (st.extreme.jython.Dialog)
>>> class GraphDialog(Dialog):
... def __init__(self, shell):
... Dialog.__init__(self, shell)
... print "constructed"
... def init(self):
... print "init"
...
>>> gd = GraphDialog("hi")
protected Dialog(hi)
constructed
>>> gd.init()
init
>>>
Are you looking at the correct Dialog class ?
Maybe use explicit import:
from org.eclipse.jface.dialogs import Dialog
instead of *
best wishes,
Oti.
On 7/6/07, David Huebel <davidhuebel@...> wrote:
> On 7/5/07, Oti <ohumbel@...> wrote:
> > Hi David,
> >
> > see pages 128 - 130 in JythonEssentials.
> > The thing you missed here is: you have to pass the instance (self in your
> > case) to the superclass constructor as well.
>
> I tried it that way, too. The error I get is:
>
> AttributeError: class 'org.eclipse.jface.dialogs.Dialog' has no
> attribute '__init__'
>
> org.eclipse.jface.dialogs.Dialog is abstract -- could that be the root
> of the problem?
>
> -David
>
|