Invalid parsing in VE 1.2RC2 [message #126057] |
Wed, 14 June 2006 02:56  |
Eclipse User |
|
|
|
in VE 1.1.0.1 this sample parsed and drawing on screen correctly.
in latest VE with GEF-3.2RC3 and emf-2.2.0RC6 it behaving incorrectly.
Eclipse 3.2RC4, java1.5_06, os win2k sp4
For me it seems that problem occurs when I'm
trying to get reference to some visual object and VE going crazy.
For example in code below my method uSomeUserMethod() is the problem,
because
inside this method I'm get the reference for panel and try to do smth.
This is only an example this problem happens not only with panel it
happens with every visual object if I’m try to get reference to it...
Please help me!
P.S. sorry for bad English
//------------ sample code to show problem -------------
package test.ve.problems;
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Frame;
import java.awt.GridLayout;
import javax.swing.JButton;
import javax.swing.JDialog;
import javax.swing.JPanel;
public class VeProblemTest extends JDialog
{
private JPanel jContentPane = null;
private JPanel pnlBtns = null;
private JButton jButton1 = null;
public VeProblemTest(Frame owner)
{
super(owner);
initialize();
}
private void initialize()
{
this.setSize(357, 275);
this.setTitle("VE test");
this.setContentPane(getJContentPane());
}
private JPanel getJContentPane()
{
if (jContentPane == null)
{
jContentPane = new JPanel();
jContentPane.setLayout(new BorderLayout());
jContentPane.add(getPnlBtns(), BorderLayout.SOUTH);
}
return jContentPane;
}
private JPanel getPnlBtns()
{
if (pnlBtns == null)
{
GridLayout gridLayout = new GridLayout();
gridLayout.setRows(1);
pnlBtns = new JPanel();
pnlBtns.setLayout(gridLayout);
pnlBtns.setPreferredSize(new Dimension(0, 32));
pnlBtns.add(getJButton1(), null);
}
return pnlBtns;
}
private JButton getJButton1()
{
if (jButton1 == null)
{
jButton1 = new JButton();
jButton1.setText("Btn1");
jButton1.addActionListener(new java.awt.event.ActionListener()
{
public void actionPerformed(java.awt.event.ActionEvent e)
{
uSomeUserMethod();
}
});
}
return jButton1;
}
// HERE THE PROBLEM !!!
// trying to get reference to some visual object and VE going crazy
private void uSomeUserMethod()
{
// just cooment out this 2 lines and problem will disapear
JPanel aPnl = this.getPnlBtns();
aPnl.setBackground(Color.CYAN);
}
}
|
|
|
|
|
Re: Invalid parsing in VE 1.2RC2 [message #126109 is a reply to message #126071] |
Wed, 14 June 2006 12:10  |
Eclipse User |
|
|
|
Hello, Rich!
RK> We got a little too aggressive in parsing code in 1.2. :-(
RK> We were missing things before so now we parse everything.
......
RK> We need to put more tests in for this kind of
RK> stuff (or a way to say ignore this piece of code) but it is too late for
RK> 1.2. We are basically finished with 1.2.
It's a pity... But how about further development? In version 1.3?
Could I expect that it would be parsed better or there will be a some kind of hint
to tell VE ignore some code?
I suggest to use comments, because hints in comments already used by VE for example:
// @jve:decl-index=0:visual-constraint="69,161"
how about such kind of hint (or something like):
// @jve: ignore >>>
some code
// @jve: ignore <<<
To my mind it is really hard to develop ultimate parser that would parse everything fine.
There should be definitely be the way to let the developer manually put hints for VE.
We are migrating from Visual Age for Java 3.5 and it is really annoying and disappointing that VE works worse then VAJ, of course I
understand that it is much more complex to parse code as VE doing than draw something from repository as VAJ doing, but I hope that
soon VE would be stable and usable.
Alexey Kuznetsov
|
|
|
Re: Invalid parsing in VE 1.2RC2 [message #613337 is a reply to message #126057] |
Wed, 14 June 2006 11:01  |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
We got a little too aggressive in parsing code in 1.2. :-( We were
missing things before so now we parse everything. Unfortunately
JPanel aPnl = this.getPnlBtns();
aPnl.setBackground(Color.CYAN);
looks to us a lot like:
JPanel aPnl = new JPanel();
aPnl.setBackground(Color.CYAN);
We think it is a new jpanel. And so we rip it out from where it was and
put it on the freeform. We need to put more tests in for this kind of
stuff (or a way to say ignore this piece of code) but it is too late for
1.2. We are basically finished with 1.2.
But there is a kludgy workaround. Change to:
if (false)
;
else {
JPanel aPnl = this.getPnlBtns();
aPnl.setBackground(Color.CYAN);
}
We don't parse the else clause of an if statement. And most compilers
are smart enough to make the if test a no-op because of the primitive false.
--
Thanks,
Rich Kulp
|
|
|
Re: Invalid parsing in VE 1.2RC2 [message #613338 is a reply to message #126071] |
Wed, 14 June 2006 11:12  |
Eclipse User |
|
|
|
Originally posted by: richkulp.us.NO_SPAM.ibm.com
Also one other alternative is to put the method into the action listener
itself. We don't parse the contents of the methods of inner classes. But
that would only be of use if it is only called from the inner class
any nowhere else.
--
Thanks,
Rich Kulp
|
|
|
Re: Invalid parsing in VE 1.2RC2 [message #613340 is a reply to message #126071] |
Wed, 14 June 2006 12:10  |
Eclipse User |
|
|
|
Hello, Rich!
RK> We got a little too aggressive in parsing code in 1.2. :-(
RK> We were missing things before so now we parse everything.
......
RK> We need to put more tests in for this kind of
RK> stuff (or a way to say ignore this piece of code) but it is too late for
RK> 1.2. We are basically finished with 1.2.
It's a pity... But how about further development? In version 1.3?
Could I expect that it would be parsed better or there will be a some kind of hint
to tell VE ignore some code?
I suggest to use comments, because hints in comments already used by VE for example:
// @jve:decl-index=0:visual-constraint="69,161"
how about such kind of hint (or something like):
// @jve: ignore >>>
some code
// @jve: ignore <<<
To my mind it is really hard to develop ultimate parser that would parse everything fine.
There should be definitely be the way to let the developer manually put hints for VE.
We are migrating from Visual Age for Java 3.5 and it is really annoying and disappointing that VE works worse then VAJ, of course I
understand that it is much more complex to parse code as VE doing than draw something from repository as VAJ doing, but I hope that
soon VE would be stable and usable.
Alexey Kuznetsov
|
|
|
Powered by
FUDForum. Page generated in 0.14048 seconds