Bug 259837 - Correct QuickFix Shell will not be found if application under test launched shell with no title
Summary: Correct QuickFix Shell will not be found if application under test launched s...
Status: ASSIGNED
Alias: None
Product: SWTBot
Classification: Technology
Component: EclipseBot (show other bugs)
Version: 2.0.0-dev   Edit
Hardware: PC Windows XP
: P3 major (vote)
Target Milestone: 2.0.0   Edit
Assignee: Ketan Padegaonkar CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-12-31 13:49 EST by Ketan Patel CLA
Modified: 2010-03-06 22:12 EST (History)
4 users (show)

See Also:


Attachments
Add api to find shell as descendant of parent shell and use it to with for quick fix shell (4.76 KB, patch)
2008-12-31 13:49 EST, Ketan Patel CLA
KetanPadegaonkar: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ketan Patel CLA 2008-12-31 13:49:58 EST
Created attachment 121403 [details]
Add api to find shell as descendant of parent shell and use it to with for quick fix  shell

Build ID: 2.0

Steps To Reproduce:
Current code to find quick fix shell in the SWTBotEclipseEditor searches all available shells in the display.  But if the application had already launched a shell with no title then quick fix will find the wrong shell.  Better approach would be to search for the quick fix shell as descendants of the editor's shell..i.e the active shell.    

Also should consider moving quick fix related api's from SWTBotEclipseEditor to its own class so can be shared in other places when quick fix is used...such as in preferences.

More information:
Comment 1 Ketan Padegaonkar CLA 2009-01-01 00:52:20 EST
The existing implementation of quickfix and autofix is quite flaky at times, and needless to say slow.

I've been thinking about a better way to go down to the ITextViewer level and pull out ICompletionProposal(s) or IQuickassistProposal(s).

I'll apply this patch for now, and cleanup later.
Comment 2 Ketan Padegaonkar CLA 2009-01-01 02:42:27 EST
I've pushed this into trunk, with some modifications, you may want to look at the changeset for revision 54: http://fisheye2.atlassian.com/changelog/swtbot/?cs=54

I've made slight changes to your patch:
 - the WaitForShellInParent is a subclass of WaitForShell, this got rid of the if statement in the WaitForShell, and there's now a template method in WaitForShell that is overridden to find children of a shell in WaitForShellInParent.
 
 If you're not happy with the change, let me know how that can be resolved. Please mark this bug VERIFIED if you're happy with the change.
Comment 3 Ketan Patel CLA 2009-01-01 14:34:30 EST
Making a WaitForShellInParent is the right way to do it.  I was going to go back and refactor the hack I had put into verify this would work.
Comment 4 Ketan Padegaonkar CLA 2009-01-02 12:26:05 EST
Comment on attachment 121403 [details]
Add api to find shell as descendant of parent shell and use it to with for quick fix  shell

Adding to the IPLog, so you're the first person on the 'SWTBot Hall of fame'!
Comment 5 Ketan Patel CLA 2009-01-08 14:12:13 EST
This still did not solve the case when main workbench shell opens a shell with no title and editor is opened by workbench shell.  Can we have to activatePopupShell method is editor protected so sub-class can override it?

I am thinking about using a matcher what will make sure popup shell contains only one table and that will be shell...

WaitForShell waitForShell = waitForShell(allOf(withText(""), new WithWidget(widgetOfType(Table.class), 1)), bot.activeShell().widget);
this.bot.waitUntilWidgetAppears(waitForShell);
SWTBotShell shell = new SWTBotShell(waitForShell.get(0));
Comment 6 Ketan Padegaonkar CLA 2009-01-28 02:12:38 EST
I think this should be fine, it's a minor issue, and I don't think many people would have their workbench shell with no title.

I'm looking to make this independent of UI so that quickfixes and auto completes can be triggered programatically, and opening activatePopupShell seems to be something I'm not comfortable with opening.

I'm marking this as closed.
Comment 7 Steffen Pingel CLA 2010-02-03 10:57:17 EST
We ran into a problem on one machine that is running SuSE and Xvfb. In 9/10 cases the call that activates the popup shell in activatePopupShell() failed with a timeout exception. To fix it we had to explicitly select the shell that had a table as a child. I couldn't quite figure out which shell got actually selected when tests were failing but my suspicion is that it might have been the InfoPopupDialog that is displayed next to the quickfix popup after a delay. 

I would recommend to make the condition more strict to spare others the hassle of debugging and working around it.
Comment 8 Jiri Peterka CLA 2010-02-28 17:26:48 EST
I had similar problems as Steffen, particularly with running in Fedora. My workaround solution is to find particular shell from shell list after content assist invocation which still works for my purposes, but it's not optimal.