Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » Visual Editor (VE) » How to create a null IJavaInstance instance?
How to create a null IJavaInstance instance? [message #615183] Thu, 12 April 2007 03:47
Allen Wang is currently offline Allen WangFriend
Messages: 28
Registered: July 2009
Junior Member
This is a multi-part message in MIME format.

------=_NextPart_000_0024_01C77CF8.4D236F50
Content-Type: text/plain;
charset="gb2312"
Content-Transfer-Encoding: quoted-printable

Hi, all!

I have a problem during my development now.. That is how to create a =
null IJavaInstance?

I want the VE to generate a statement by editing property editor like =
this:

myCustomizedText.setFormatter(new DateFormatter("dd/mm/yyyy"));

and I write a method to generate a IJavaInstance I want to set in the =
statement:

private IJavaInstance createObject(){
......

//strClass is the class name("DateFormatter", including package =
path), and initString is the init string of the class("DateFormatter")

return BeanUtilities.createJavaObject(strClass, =
JavaEditDomainHelper.getResourceSet(editDomain), =
BeanPropertyDescriptorAdapter.createAllocation(initString, editDomain));
}

and now I want to generate a statement like this:

myCustomizedText.setFormatter(null);

How to generate the "null" parameter?

I write a new method to generate this statement, but I come across some =
mistake.

=20
private IJavaInstance createObject(){
......

//strClass is the class name(including package)

return BeanUtilities.createJavaObject(strClass, =
JavaEditDomainHelper.getResourceSet(editDomain), =
InstantiationFactory.eINSTANCE.createParseTreeAllocation(Ins tantiationFac=
tory.eINSTANCE.createPTNullLiteral()));
}

The statement has been generated with a warning: =
java.lang.IllegalStateException(IWAV0190E: No bean instantiated for some =
reason);

What's wrong with my code? Why this warning appears? And how to generate =
the "null" parameter?

Appreciate for your help!

Thanks,
Hexise


------=_NextPart_000_0024_01C77CF8.4D236F50
Content-Type: text/html;
charset="gb2312"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dgb2312">
<META content=3D"MSHTML 6.00.2900.3059" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY>
<DIV><FONT face=3DArial size=3D2>Hi, all!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I have a problem during my development =
now.. That=20
is how to create a null IJavaInstance?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I want the VE to generate a statement =
by editing=20
property editor like this:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2><FONT face=3DArial>&nbsp;&nbsp;&nbsp; <FONT=20
color=3D#0000ff>myCustomizedText.setFormatter(<FONT color=3D#ff0000>new=20
DateFormatter("dd/mm/yyyy")</FONT>);</FONT></FONT></FONT ></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>and I write a method to generate a=20
IJavaInstance&nbsp;I want to set in the statement:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; private =
IJavaInstance=20
createObject(){</FONT></DIV>
<DIV><FONT face=3DArial =
size=3D2> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;=20
.......</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
//strClass is=20
the class name("DateFormatter", including package path), and initString =
is the=20
init string of the class("DateFormatter")</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
return=20
BeanUtilities.createJavaObject(strClass,&nbsp;JavaEditDo mainHelper.getRes=
ourceSet(editDomain),=20
BeanPropertyDescriptorAdapter.createAllocation(initString,=2 0
editDomain));</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; }</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>and now I want to generate a statement =
like=20
this:</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2><FONT face=3DArial>&nbsp;&nbsp;&nbsp; <FONT=20
color=3D#0000ff>myCustomizedText.setFormatter(<FONT=20
color=3D#ff0000>null</FONT>);</FONT></FONT></FONT></DIV >
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>How to generate the "null" =
parameter?</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>I write a new method to generate this =
statement,=20
but I come across some mistake.</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; </FONT>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; private =
IJavaInstance=20
createObject(){</FONT></DIV>
<DIV><FONT face=3DArial =
size=3D2> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;=20
.......</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
//strClass is=20
the class name(including package)</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; =
return=20
BeanUtilities.createJavaObject(strClass,&nbsp;JavaEditDo mainHelper.getRes=
ourceSet(editDomain),=20
<FONT=20
color=3D#ff0000>InstantiationFactory.eINSTANCE.createParseTreeAllocation(=
InstantiationFactory.eINSTANCE.createPTNullLiteral())</FONT ><FONT=20
color=3D#000000>);</FONT></FONT></DIV>
<DIV><FONT face=3DArial size=3D2>&nbsp;&nbsp;&nbsp; }</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>The statement has been generated with a =
warning:=20
<FONT color=3D#0000ff>java.lang.IllegalStateException(IWAV0190E: No bean =

instantiated for some reason);</FONT></FONT></DIV>
<DIV><FONT face=3DArial color=3D#0000ff size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>What's wrong with my code? Why this =
warning=20
appears? And how to generate the "null" parameter?</FONT></DIV><FONT =
face=3DArial=20
size=3D2></FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT><FONT face=3DArial =
size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Appreciate for your help!</FONT></DIV>
<DIV><FONT face=3DArial size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT face=3DArial size=3D2>Thanks,</FONT></DIV>
<DIV><FONT face=3DArial size=3D2>Hexise</FONT></DIV>
<DIV><BR></DIV></BODY></HTML>

------=_NextPart_000_0024_01C77CF8.4D236F50--
Previous Topic:using - ScrolledComposite
Next Topic:I nearly managed to install VE!
Goto Forum:
  


Current Time: Fri Nov 28 18:38:46 GMT 2014

Powered by FUDForum. Page generated in 0.11057 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software