|
From: Philip M. <ph...@dy...> - 2002-01-26 19:00:34
|
Hi,
I'm having a problem updating ClassWizard to jEdit 4 and I thought maybe
y'all can help me.
I tracked down the issues with CW and jEdit 4 to the following line:
buf.insertString(0, cls.getDefinition().toString(), null);
Now this little thingie goes:
[error] BeanShell: java.lang.VerifyError: (class:
classwizard/ClassWizardDialog, method: okPressed signature: ()V)
Incompatible object argument for function call
[error] BeanShell: at java.lang.Class.getConstructors0(Native Method)
[error] BeanShell: at java.lang.Class.getDeclaredConstructors(Unknown
Source)
[error] BeanShell: at bsh.Reflect.constructObject(Reflect.java:580)
[error] BeanShell: at
bsh.BSHAllocationExpression.constructObject(BSHAllocationExpression.java:103
)
[error] BeanShell: at
bsh.BSHAllocationExpression.objectAllocation(BSHAllocationExpression.java:96
)
[error] BeanShell: at
bsh.BSHAllocationExpression.eval(BSHAllocationExpression.java:58)
[error] BeanShell: at
bsh.BSHPrimaryExpression.eval(BSHPrimaryExpression.java:69)
[error] BeanShell: at bsh.BSHBlock.eval(BSHBlock.java:74)
[error] BeanShell: at
bsh.BshMethod.invokeDeclaredMethod(BshMethod.java:164)
[error] BeanShell: at bsh.NameSpace.invokeMethod(NameSpace.java:1087)
[error] BeanShell: at bsh.NameSpace.invokeMethod(NameSpace.java:1059)
[error] BeanShell: at
org.gjt.sp.jedit.BeanShell.runCachedBlock(BeanShell.java:438)
[error] BeanShell: at
org.gjt.sp.jedit.BeanShellAction.invoke(BeanShellAction.java:58)
[error] BeanShell: at
org.gjt.sp.jedit.gui.InputHandler.invokeAction(InputHandler.java:250)
[error] BeanShell: at
org.gjt.sp.jedit.EditAction$Wrapper.actionPerformed(EditAction.java:176)
and more... on jEdit 4. Works fine on jEdit 3.2.2.
I can't understand why...
Now the quick solution was Buffer.insert(int, String) instead. However, this
breaks the things with jEdit 3.2.2, which has Buffer.insert(View, String)
(and I'm not sure it does the same thing).
So, is it my fault ? Have I used insertString (which I know is deprecated)
in a manner incompatible with its meaning ? How should I use it so I have
the same code (or something like that) working on both jEdit 3.2 and jEdit 4
?
Thank you very much,
Philip Mateescu
PS. The entire piece of code goes like this:
Buffer buf = jEdit.newFile(view);
Mode jMode = jEdit.getMode(selCW.buildClass().getLanguageName()); //get
jEdit's edit mode
if(jMode != null) {
buf.setMode(jMode);
}
try {
//System.out.println("Active tab said:\n\n" + clsstr);
buf.beginCompoundEdit();
buf.insertString(0, cls.getDefinition().toString(), null);
//buf.insert(0, cls.getDefinition());
buf.endCompoundEdit();
//buf.insert(0,cls.getDefinition());
} catch(BadLocationException e) {
Log.log(Log.ERROR, this, e);
}
|