Skip to main content



      Home
Home » Archived » Visual Editor (VE) » Property editor problems
Property editor problems [message #126122] Wed, 14 June 2006 12:19 Go to next message
Eclipse UserFriend
Hello, All!

I've created my own PropertyEditor for String[] property and now I have two problems:
1) When I press [...] button in VE to invoke my custom PropertyEditor it is appearing UNDER main Eclipse window... looks very
strange and annoying.

2) In getJavaInitializationString() method of my custom PropertyEditor i'm returning a string like this one: "new String[] {" + ....
+ "}"
in VE 1.1.0.1 it was pasted as is but with VE 1.2RC2 it is pasting as new java.lang.String[]....
Why it started to add "java.lang" ???


With best regards, Alexey Kuznetsov. E-mail: kuaw26@mail.ru
Re: Property editor problems [message #126163 is a reply to message #126122] Wed, 14 June 2006 15:38 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

Alexey Kuznetsov wrote:
> Hello, All!
>
> I've created my own PropertyEditor for String[] property and now I have two problems:
> 1) When I press [...] button in VE to invoke my custom PropertyEditor it is appearing UNDER main Eclipse window... looks very
> strange and annoying.

The under window problem is a pain, but it is due to Windows. The
problem is that the property editor is actually executed in a separate
jvm than the one executing the Eclipse IDE. Windows, through standard
java, doesn't allow a window in the non-active application to be put on
top of the active window. You need to right special native code to do
that and java doesn't expose the necessary handles for us to that.

We use a separate jvm for various reasons, to protect the IDE from user
code crashing the IDE, to allow a different jvm version to run your code
than what is running the jvm, to allow us to change the code and not
have to recycle the IDE to get the changed code (without doing fancy
classloader stuff that doesn't always work).

>
> 2) In getJavaInitializationString() method of my custom PropertyEditor i'm returning a string like this one: "new String[] {" + ....
> + "}"
> in VE 1.1.0.1 it was pasted as is but with VE 1.2RC2 it is pasting as new java.lang.String[]....
> Why it started to add "java.lang" ???

This is a bug. We've never had any arrays in our tests for property
editors and the changed code for handling complicated expressions (such
as method calls or calls to static methods, or expressions like new
Integer(), etc) didn't handle the case of arrays correctly.

The enhanced coding would take a string like "new java.awt.Color(3,4,6)"
and turn it into "new Color(3,4,6)" with an "import java.awt.Color"
added. The 1.1.0.1 code wouldn't do that and would leave it as
java.awt.Color.

The process is actually a two step process. First we parse the init
string and find references to imported classes and we fully-qualify
them. We need to do that because we need to know the fully-qualified
string class later in the process. Then we go through the parse code and
we find fully-qualified classes and create the appropriate imports for
them and strip them down. Unfortunately this is where the bug is at. We
didn't recognize "java.lang.String[]" as a class because we forgot to
split on the "[]". So we didn't realize that it could be changed to
"String[]".

So this is a catch-22 problem. In VE 1.1.0.1 the init string wasn't
touched, so anything like new java.awt.Color(...) would be left in your
code. Nobody liked that. But String[] by itself is ok because java.lang
is automatically imported. So our fix for everything else broke the case
of arrays.

You should open a defect in Bugzilla. I doubt it would be fixed for 1.2.
We are essentially in release shutdown mode and only blocking/critical
defects would be handled. But with the Bugzilla we would at least see it
for next release.

>
>
> With best regards, Alexey Kuznetsov. E-mail: kuaw26@mail.ru
>

--
Thanks,
Rich Kulp
Re: Property editor problems [message #613344 is a reply to message #126122] Wed, 14 June 2006 15:38 Go to previous message
Eclipse UserFriend
Originally posted by: richkulp.us.NO_SPAM.ibm.com

Alexey Kuznetsov wrote:
> Hello, All!
>
> I've created my own PropertyEditor for String[] property and now I have two problems:
> 1) When I press [...] button in VE to invoke my custom PropertyEditor it is appearing UNDER main Eclipse window... looks very
> strange and annoying.

The under window problem is a pain, but it is due to Windows. The
problem is that the property editor is actually executed in a separate
jvm than the one executing the Eclipse IDE. Windows, through standard
java, doesn't allow a window in the non-active application to be put on
top of the active window. You need to right special native code to do
that and java doesn't expose the necessary handles for us to that.

We use a separate jvm for various reasons, to protect the IDE from user
code crashing the IDE, to allow a different jvm version to run your code
than what is running the jvm, to allow us to change the code and not
have to recycle the IDE to get the changed code (without doing fancy
classloader stuff that doesn't always work).

>
> 2) In getJavaInitializationString() method of my custom PropertyEditor i'm returning a string like this one: "new String[] {" + ....
> + "}"
> in VE 1.1.0.1 it was pasted as is but with VE 1.2RC2 it is pasting as new java.lang.String[]....
> Why it started to add "java.lang" ???

This is a bug. We've never had any arrays in our tests for property
editors and the changed code for handling complicated expressions (such
as method calls or calls to static methods, or expressions like new
Integer(), etc) didn't handle the case of arrays correctly.

The enhanced coding would take a string like "new java.awt.Color(3,4,6)"
and turn it into "new Color(3,4,6)" with an "import java.awt.Color"
added. The 1.1.0.1 code wouldn't do that and would leave it as
java.awt.Color.

The process is actually a two step process. First we parse the init
string and find references to imported classes and we fully-qualify
them. We need to do that because we need to know the fully-qualified
string class later in the process. Then we go through the parse code and
we find fully-qualified classes and create the appropriate imports for
them and strip them down. Unfortunately this is where the bug is at. We
didn't recognize "java.lang.String[]" as a class because we forgot to
split on the "[]". So we didn't realize that it could be changed to
"String[]".

So this is a catch-22 problem. In VE 1.1.0.1 the init string wasn't
touched, so anything like new java.awt.Color(...) would be left in your
code. Nobody liked that. But String[] by itself is ok because java.lang
is automatically imported. So our fix for everything else broke the case
of arrays.

You should open a defect in Bugzilla. I doubt it would be fixed for 1.2.
We are essentially in release shutdown mode and only blocking/critical
defects would be handled. But with the Bugzilla we would at least see it
for next release.

>
>
> With best regards, Alexey Kuznetsov. E-mail: kuaw26@mail.ru
>

--
Thanks,
Rich Kulp
Previous Topic:Property editor problems
Next Topic:V.E not writing the code returned by property editor --urgent :please help its
Goto Forum:
  


Current Time: Sun Jun 15 02:43:09 EDT 2025

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

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

Back to the top