This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 27523 - EditorOperator(String) constructor not working
Summary: EditorOperator(String) constructor not working
Status: RESOLVED WORKSFORME
Alias: None
Product: qa
Classification: Unclassified
Component: Jellytools (show other bugs)
Version: 3.x
Hardware: PC Windows 3.1/NT
: P3 blocker (vote)
Assignee: issues@qa
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2002-09-24 04:20 UTC by ssffleming
Modified: 2002-10-23 10:23 UTC (History)
0 users

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ssffleming 2002-09-24 04:20:00 UTC
See code below:

EditorOperator e = new EditorOperator("Source Editor [" + ejbName + "Bean" + " *] ");
Originally I had expected to be able to use just EditorOperator(ejbName + "Bean"),
but from the trace I saw it was not looking for the right thing so I put the extra text in.

I was not using EditorWindowOperator, but will use that as a workaround.

Using jemmy 2.0.4, trace is:

Trace:
Start to wait action "Wait TopComponent with name=Source Editor [SteveBMPBean *]  
index=0 
loaded"
Error:
"Wait TopComponent with name=Source Editor [SteveBMPBean *]  index=0 loaded" action 
has 
not been produced in 10016 milliseconds
null
org.netbeans.jemmy.TimeoutExpiredException: Wait TopComponent with name=Source Editor 
[SteveBMPBean *]  index=0 loaded
        at org.netbeans.jemmy.Waiter.waitAction(Unknown Source)
        at org.netbeans.jellytools.TopComponentOperator.waitTopComponent(Unknown Source)
        at org.netbeans.jellytools.TopComponentOperator.<init>(Unknown Source)
        at org.netbeans.jellytools.TopComponentOperator.<init>(Unknown Source)
        at org.netbeans.jellytools.EditorOperator.<init>(Unknown Source)
        at j2ee.EndToEnd.run(EndToEnd.java:60)
        at j2ee.EndToEnd.main(EndToEnd.java:171)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at 
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:324)
        at org.openide.execution.ThreadExecutor.executeClass(ThreadExecutor.java:132)
        at org.openide.execution.ThreadExecutor$TERunnable.run(ThreadExecutor.java:209)
        at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:119)

JDK 1.4
Comment 1 Alexandre Iline 2002-09-24 11:34:27 UTC
TopComponentOperator(String) constructor looks for a TopComponent
which is visible, and has a name comparable with the parameter by
default StringComparator. In your case, editor component (one you 
are looking for) lays on a tab which is not currently active, so 
it is _not_ visible. I.e. you have to switch tabs before this 
constructor using.  

Such EditorOperator(String) constructor could be used if editor
component is docked in a different frame than Source Editor. All 
this mentioned clearly in Jelly2 javadoc.

Comment 2 ssffleming 2002-09-24 18:04:09 UTC
Hi Shura,

The pane WAS active and had the keyboard focus until the test infrastructure took it away...
Comment 3 ssffleming 2002-09-24 18:13:31 UTC
To explain a little better.  The immediately preceding step in the test case is to
open the java source file that was not previously opened.  The file opened has the
keyboard focus and its tab is selected.  In this case we are opening an ejb method
so the cursor is positioned on the first source line of code for the method within
the java file.  Hope this helps.
Comment 4 ssffleming 2002-09-24 18:30:11 UTC
More information.  I'm testing by executing within the IDE.  The source editor window
is already open with a few "panes" before opening the java source file in the test case steps.
Hope this helps you to reproduce it.
Comment 5 Alexandre Iline 2002-09-24 19:04:53 UTC
I don't know then.
I tried the very same thing - it works perfect for me.

I'm affraid we need more information on this one. 

Could you send the whole test class code? I mean, we do not 
exactly know how you build your test: what do you extends 
and so on.

Same goes for 27525.

Comment 6 Jiri Skrivanek 2002-09-25 10:10:21 UTC
Steve, do your comments really fit into this issue?
new EditorOperator("Source Editor [whatever]"); is 
definitely wrong usage. As javadoc says "Waits for fist 
visible TopComponent within whle IDE". It means you can 
use it only if editor pane is visible. And its name is 
only filename: new EditorOperator("whatever");
But I would recommend to use sequence:

EditorWindowOperator ewo = new EditorWindowOperator
("whatever");
EditorOperator eo = ewo.getEditor("whatever");

Please, give us a test case which doesn't work for you and 
environment description. I think it works, so I would 
close this bug as invalid if you agree.
Comment 7 ssffleming 2002-09-25 16:11:47 UTC
Hi Jiri,

Thanks for your patience.  Is:

new EditorOperator(String) just for use with SDI?
If yes, then I would suggest we change this to a docs bug and
add a note all those constructors that are SDI only.

If this is the case, my suggestion is to globally change:
"Waits for first visible TopComponent with given name in whole IDE. "
to
"Waits for first visible TopComponent with given name in whole IDE when it is in SDI mode."

I was a bit confused by the new programming model but hopefully I am getting closer now.

For your humor, below the test case code I wrote based on my earlier understanding:

        start("Add code to the business method");
        b.open();
        EditorWindowOperator ewo = new EditorWindowOperator();
        EditorOperator e = ewo.getEditor(ejbName + "Bean");      // wait for the window
        e = new EditorOperator(ejbName + "Bean");                // we waited but still doesn't work
Comment 8 ssffleming 2002-09-25 16:13:08 UTC
Oops I mean of course MDI above (instead of SDI)
Comment 9 Jiri Skrivanek 2002-09-26 07:29:08 UTC
new EditorOperator(String) can be used both in SDI and MDI.
Test case:

        // open file ejbName + "Bean"
        EditorWindowOperator ewo = new EditorWindowOperator();
        EditorOperator e = ewo.getEditor(ejbName + "Bean");    

should work. If not, please attach whole class with reproducible test
case and description of environment.
Comment 10 ssffleming 2002-09-27 01:21:40 UTC
Hi Shura, for this one use the test case for bug 27524.
Try it on NT with a previous file already open in the editor.
Hope this helps.  I'm OOTO Friday, Monday.  Back Tues, Steve
As needed we can look at Tuesday in my office
Comment 11 Adam Sotona 2002-10-23 10:23:45 UTC
I made some changes to TopComponentOperator and related operators to
unify behaviour.
Currently all TopComponent can be searched through all active
workspace (even when in inactive tab) in both SDI and MDI mode.

But correct usage is EditorOperator(ejbName+"Bean");
TopComponent does not contain texts like "Source Editor [...*]" and
thus it could not match.