Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » What Widget is that?(Button? DropDownList? List? Tree?)
What Widget is that? [message #546889] Wed, 14 July 2010 09:51 Go to next message
Caio Bulgarelli is currently offline Caio Bulgarelli
Messages: 16
Registered: February 2010
Junior Member
I need to access and click on these "Buttons" in the image below:

(highlighted with blue border)

http://i752.photobucket.com/albums/xx163/caiob3/0001_snippets.jpg

But... What kind of element is that?

Button?
DropDownList?
Table?
Tree?
List?


I'm trying to access in a lot of differents ways.. but without success.

Someone, Can help me? Any idea?
Re: What Widget is that? [message #546894 is a reply to message #546889] Wed, 14 July 2010 09:56 Go to previous messageGo to next message
Pascal G is currently offline Pascal G
Messages: 157
Registered: July 2009
Senior Member
On 10-07-14 09:51 AM, Caio Bulgarelli wrote:
> I need to access and click on these "Buttons" in the image below:
>
> (highlighted with blue border)
>
>
>
> But... What kind of element is that?
>
> Button?
> DropDownList?
> Table?
> Tree?
> List?
>
> I'm trying to access in a lot of differents ways.. but without success.
>
> Someone, Can help me? Any idea?

I haven't got a clue since I can't see your image, but there's this very
handy-dandy feature of SWTBot that's called the Spy view. Once opened in
your workbench, it will show all kinds of information regarding the
Widget currently under your mouse. Give it a try, you'll love it ;)

--
Pascal Gélinas | Software Developer
*Nu Echo Inc.*
http://www.nuecho.com/ | http://blog.nuecho.com/

*Because performance matters.*
Re: What Widget is that? [message #546897 is a reply to message #546894] Wed, 14 July 2010 10:09 Go to previous messageGo to next message
Caio Bulgarelli is currently offline Caio Bulgarelli
Messages: 16
Registered: February 2010
Junior Member
The image is posted in a WebServer called "Photo Bucket.com" ...

Whatever...

The direct link is this:

http://i752.photobucket.com/albums/xx163/caiob3/0001_snippet s.jpg

Re: What Widget is that? [message #546909 is a reply to message #546897] Wed, 14 July 2010 10:56 Go to previous messageGo to next message
Pascal G is currently offline Pascal G
Messages: 157
Registered: July 2009
Senior Member
On 10-07-14 10:09 AM, Caio Bulgarelli wrote:
> The image is posted in a WebServer called "Photo Bucket.com" ...
>
> Whatever...
>
> The direct link is this:
>
> http://i752.photobucket.com/albums/xx163/caiob3/0001_snippet s.jpg
>
>

I'm using Thunderbird to view my newsgroups and it doesn't seem to show
me any image at all in any newsgroup posts. Might be a problem related
to my configuration, but this is clearly not the place to rant about this.

Anyways, your Widget looks like.... hummm.... something? It's really
hard to tell, it doesn't look like any standard widget I know of. It
also seems to be cropped on the right side by the scroll bar since there
doesn't seem to be any kind of border on the right (or I might be crazy,
who knows). Maybe a bunch CTabFolder/Item inside a "Stack" Layout?

And that Plug-in Selection Spy, I don't think it's the same Spy view I
talked about. This thing (is it some kind of tooltip??) seems to be
provided by PDE, not SWTBot. The SWTBot one is called EclipseSpy View,
and can be found in the SWTBot Category in the Show View dialog
(Alt+Shift+Q Q).

Hope this helps.
--
Pascal Gélinas | Software Developer
*Nu Echo Inc.*
http://www.nuecho.com/ | http://blog.nuecho.com/

*Because performance matters.*
Re: What Widget is that? [message #546947 is a reply to message #546909] Wed, 14 July 2010 13:01 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan Padegaonkar
Messages: 873
Registered: July 2009
Senior Member
On 7/14/10 7:56 AM, Pascal Gelinas wrote:
> I'm using Thunderbird to view my newsgroups and it doesn't seem to show
> me any image at all in any newsgroup posts. Might be a problem related
> to my configuration, but this is clearly not the place to rant about this.

You're not the only one, I've noticed this as well.
http://bugs.eclipse.org/289899

--
Ketan
http://ketan.padegaonkar.name | http://eclipse.org/swtbot
Re: What Widget is that? [message #546956 is a reply to message #546897] Wed, 14 July 2010 13:25 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan Padegaonkar
Messages: 873
Registered: July 2009
Senior Member
On 7/14/10 7:09 AM, Caio Bulgarelli wrote:
> The image is posted in a WebServer called "Photo Bucket.com" ...
>
> Whatever...
>
> The direct link is this:
>
> http://i752.photobucket.com/albums/xx163/caiob3/0001_snippet s.jpg
>
>

I just added an FAQ on finding more information about a widget.
http://goo.gl/LzPT

--
Ketan
http://ketan.padegaonkar.name | http://eclipse.org/swtbot
Re: What Widget is that? [message #547361 is a reply to message #546889] Fri, 16 July 2010 09:12 Go to previous messageGo to next message
Caio Bulgarelli is currently offline Caio Bulgarelli
Messages: 16
Registered: February 2010
Junior Member
Ohhh nice!

I didn't know this feature of SWTBot!

Thanks a lot Pascal and Ketan for the tip! It's very usefull

So... I was using the Spy View from PDE,
but ... now, using this SpyView (from SWTBot Plugin)

I got this:


>>>>>

Location:
//Shell/-1//Composite/4//Composite/0//Composite/21//Composit e/0//FigureCanvas/0

Layout Information:
FigureCanvas {}
Style: HORIZONTAL | VERTICAL | NO_BACKGROUND | NO_REDRAW_RESIZE | LEFT_TO_RIGHT
Layout Data: null
Bounds: Rectangle {0, 0, 572, 271}


Children: 0

Siblings: 1
[*]FigureCanvas {}: Layout Data: null

Parent Tree:
Composite {}[0]@
Layout: FillLayout
LayoutData: null
Composite {}[21]@
Layout: FillLayout
LayoutData: null
Composite {}[0]@
Layout: null
LayoutData: null
Composite {}[4]@
Layout: StackLayout
LayoutData: null
Shell {MOTODEV Studio for A...}[-1]@
Layout: TrimLayout
LayoutData: null


>>>>>>

So, what is this FigureCanvas and how can use it?

.
Re: What Widget is that? [message #547731 is a reply to message #547361] Mon, 19 July 2010 09:52 Go to previous messageGo to next message
Pascal G is currently offline Pascal G
Messages: 157
Registered: July 2009
Senior Member
On 10-07-16 09:12 AM, Caio Bulgarelli wrote:
> Ohhh nice!
>
> I didn't know this feature of SWTBot!
>
> Thanks a lot Pascal and Ketan for the tip! It's very usefull
>
> So... I was using the Spy View from PDE,
> but ... now, using this SpyView (from SWTBot Plugin)
>
> I got this:
>
>
>>>>>>
>
> Location: //Shell/-1//Composite/4//Composite/0//Composite/21//Composit
> e/0//FigureCanvas/0
>
> Layout Information: FigureCanvas {}
> Style: HORIZONTAL | VERTICAL | NO_BACKGROUND | NO_REDRAW_RESIZE |
> LEFT_TO_RIGHT Layout Data: null
> Bounds: Rectangle {0, 0, 572, 271}
>
>
> Children: 0
>
> Siblings: 1
> [*]FigureCanvas {}: Layout Data: null
>
> Parent Tree:
> Composite {}[0]@
> Layout: FillLayout
> LayoutData: null
> Composite {}[21]@
> Layout: FillLayout
> LayoutData: null
> Composite {}[0]@
> Layout: null
> LayoutData: null
> Composite {}[4]@
> Layout: StackLayout
> LayoutData: null
> Shell {MOTODEV Studio for A...}[-1]@
> Layout: TrimLayout
> LayoutData: null
>
>
>>>>>>>
>
> So, what is this FigureCanvas and how can use it?
>

Ouch, though luck. FigureCanvas is a widget on which you draw something:
you can draw rectangle, circle, all kinds of things. It's not really a
widget you can interact with using regular SWTBot API.

Although, I think it might be related to GEF's TreeViewer, so you could
interact with it using GEF support in SWTBot
(org.eclipse.swtbot.eclipse.gef packages), but I've only used it with a
GraphicalViewer. Maybe Mariot has more insight for that part though...
Mariot?

--
Pascal Gélinas | Software Developer
*Nu Echo Inc.*
http://www.nuecho.com/ | http://blog.nuecho.com/

*Because performance matters.*
Re: What Widget is that? [message #548934 is a reply to message #547731] Fri, 23 July 2010 09:40 Go to previous messageGo to next message
Caio Bulgarelli is currently offline Caio Bulgarelli
Messages: 16
Registered: February 2010
Junior Member
I'm trying to use and create an object of FigureCanvas, in order to use it posteriorly.

So... I needed to import:

import org.eclipse.draw2d.FigureCanvas;

and initialize it

FigureCanvas f = new FigureCanvas( (Composite) bot.viewByTitle("Snippets").getWidget() );

However, the parameter of FigureCanvas must be a "Composite" ... and the code above doesn't work.

So... Does anyone have any ideas?
Re: What Widget is that? [message #548950 is a reply to message #548934] Fri, 23 July 2010 10:10 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan Padegaonkar
Messages: 873
Registered: July 2009
Senior Member
On 7/23/10 6:40 AM, Caio Bulgarelli wrote:
> I'm trying to use and create an object of FigureCanvas, in order to use
> it posteriorly.
>
> So... I needed to import:
>
> import org.eclipse.draw2d.FigureCanvas;
>
> and initialize it
>
> FigureCanvas f = new FigureCanvas( (Composite)
> bot.viewByTitle("Snippets").getWidget() );
>
> However, the parameter of FigureCanvas must be a "Composite" ... and the
> code above doesn't work.
>
> So... Does anyone have any ideas?
>

I don't understand GEF much, but AFAIK. This is tricky and will create a
canvas, but since SWTBot is running on a non-ui thread, you'd likely get
a SWT Thread error.

Perhaps someone with a bit more of GEF/Draw2d needs to pitch in ?

--
Ketan
http://ketan.padegaonkar.name | http://eclipse.org/swtbot
Re: What Widget is that? [message #549399 is a reply to message #548950] Mon, 26 July 2010 10:54 Go to previous messageGo to next message
Pascal G is currently offline Pascal G
Messages: 157
Registered: July 2009
Senior Member
On 10-07-23 10:10 AM, Ketan Padegaonkar wrote:
>
> On 7/23/10 6:40 AM, Caio Bulgarelli wrote:
>> I'm trying to use and create an object of FigureCanvas, in order to use
>> it posteriorly.
>>
>> So... I needed to import:
>>
>> import org.eclipse.draw2d.FigureCanvas;
>>
>> and initialize it
>>
>> FigureCanvas f = new FigureCanvas( (Composite)
>> bot.viewByTitle("Snippets").getWidget() );
>>
>> However, the parameter of FigureCanvas must be a "Composite" ... and the
>> code above doesn't work.
>>
>> So... Does anyone have any ideas?
>>
>
> I don't understand GEF much, but AFAIK. This is tricky and will create a
> canvas, but since SWTBot is running on a non-ui thread, you'd likely get
> a SWT Thread error.
>
> Perhaps someone with a bit more of GEF/Draw2d needs to pitch in ?
>

Oops, a bit of misunderstanding here. FigureCanvas is the actual widget;
it's like a Button or a a Combo, or anything else. FigureCanvas
subclasses Canvas, on which you can draw ANYTHING; much like a Button
you can click on it and a ComboBox you make a choice. The FigureCanvas,
on the other hand, draws Figure (which is draw2d API).

To "use" a FigureCanvas in SWTBot, you need the proper Mock object; much
like Button and SWTBotButton, Combo and SWTBotCombo.
SWTBotGefFigureCanvas is the mock object you are looking for, but it
should not be part of SWTBot's API IMHO. The only thing you can do with
it is interact using the mouse and keyboard: move the mouse there,
left-click, move the mouse elsewhere, etc. which is not a very stable
method to unit testing. You can start using that for quick testing if
you want though...

To make your tests more reliable, you should use Edit parts' Mock
objects: SWTBotGefEditPart. The mechanics are a bit different then
regular SWTBot testing though. To obtain a reference to a
SWTBotGefEditPart (BEP for short, please), you can't simply create one
using the constructor (which is package private anyway), you need a
SWTBotGefEditor. To create a SWTBotGefEditor, you need a
IEditorReference; this means that you need an eclipse editor. A common
way to create a SWTBotGefEditor is:

SWTWorkbenchBot bot = new SWTWorkbenchBot();
SWTBotEditor temp = bot.editorByTitle("Snippets");
SWTBotGefEditor editor = new SWTBotGefEditor(temp.getReference(), new
SWTGefBot());

There! You have a reference to the editor, you can access BEP!

SWTBotGefEditPart part = editor.getEditPart("General");
part.click();

Now, you might have noticed that I spoke about EDITOR, not VIEW. Simple:
there is currently no support for view-based GEF viewers. It should be
quite simple to implement though. I suspect that the thing you use is a
view, so the above method MIGHT NOT WORK. I've opened a bug/feature
request on this: https://bugs.eclipse.org/bugs/show_bug.cgi?id=320912

Hope this helps.
--
Pascal Gélinas | Software Developer
*Nu Echo Inc.*
http://www.nuecho.com/ | http://blog.nuecho.com/

*Because performance matters.*
Re: What Widget is that? [message #549404 is a reply to message #549399] Mon, 26 July 2010 11:06 Go to previous messageGo to next message
Pascal G is currently offline Pascal G
Messages: 157
Registered: July 2009
Senior Member
On 10-07-26 10:54 AM, Pascal Gelinas wrote:
> A common way to create a SWTBotGefEditor is:
>
> SWTWorkbenchBot bot = new SWTWorkbenchBot();
> SWTBotEditor temp = bot.editorByTitle("Snippets");
> SWTBotGefEditor editor = new SWTBotGefEditor(temp.getReference(), new
> SWTGefBot());

Haha! Just found an even easier way!

SWTGefBot bot = new SWTGefBot();
SWTBotGefEditor editor = bot.gefEditor("Snippets");

But still, notice that this only works with editors and I'd like to
change this. Even this method javadoc says it all:

Parameters:
fileName the name of the file.
Returns:
an editor for the specified fileName.
--
Pascal Gélinas | Software Developer
*Nu Echo Inc.*
http://www.nuecho.com/ | http://blog.nuecho.com/

*Because performance matters.*
Re: What Widget is that? [message #549922 is a reply to message #546889] Wed, 28 July 2010 09:37 Go to previous messageGo to next message
John Ormerod is currently offline John Ormerod
Messages: 39
Registered: January 2010
Member
These 'buttons' look like Nebula PShelfItems - see:
http://www.eclipse.org/nebula/widgets/pshelf/pshelf.php

The PShelf extends org.eclipse.swt.widgets.Canvas, and the PShelfItem extends org.eclipse.swt.widgets.Item.

This could explain why the SWTBotSpy is finding Canvas. I guess in terms of clicking a 'button' so that the shelf item expands, you could be looking to grab the Item object.

At this very moment, I have an RCP client in which a single PShelfItem is effectively providing the View title bar. My PShelfItem gets its items from a jFace TableViewer. I have found that I can bypass the PShelf and select a TableItem directly.

However, at some point I am going to want to expand a PShelfItem, so, in the absence of PShelf support in SWTBot, I'll watch this space with interest to see if a solution emerges.

Regards, John
Re: What Widget is that? [message #549935 is a reply to message #549922] Wed, 28 July 2010 09:47 Go to previous messageGo to next message
Pascal G is currently offline Pascal G
Messages: 157
Registered: July 2009
Senior Member
On 10-07-28 09:37 AM, John Ormerod wrote:
> These 'buttons' look like Nebula PShelfItems - see:
> http://www.eclipse.org/nebula/widgets/pshelf/pshelf.php
>
> The PShelf extends org.eclipse.swt.widgets.Canvas, and the PShelfItem
> extends org.eclipse.swt.widgets.Item.
>
> This could explain why the SWTBotSpy is finding Canvas. I guess in terms
> of clicking a 'button' so that the shelf item expands, you could be
> looking to grab the Item object.
>
> At this very moment, I have an RCP client in which a single PShelfItem
> is effectively providing the View title bar. My PShelfItem gets its
> items from a jFace TableViewer. I have found that I can bypass the
> PShelf and select a TableItem directly.
>
> However, at some point I am going to want to expand a PShelfItem, so, in
> the absence of PShelf support in SWTBot, I'll watch this space with
> interest to see if a solution emerges.
>
> Regards, John

It does kinda look like that, but the Spy view is indicating a
FigureCanvas, not a Canvas. And FigureCanvas is dra2d API.

And, AFAIK, the spy view would of shown the proper class name (Location:
//Shell/-1//Composite/4//Composite/0//Composite/21//Composit
e/0//PShelf/0 ) if it really was a PShelf.

--
Pascal Gélinas | Software Developer
*Nu Echo Inc.*
http://www.nuecho.com/ | http://blog.nuecho.com/

*Because performance matters.*
Re: What Widget is that? [message #550996 is a reply to message #549935] Wed, 04 August 2010 15:13 Go to previous message
Caio Bulgarelli is currently offline Caio Bulgarelli
Messages: 16
Registered: February 2010
Junior Member
First of all... John Ormerod and mainly Pascal G. thanks for your answers!


So... I have tried to do in a lot of ways... but It's a little confused to me to use this APIs of "FigureCanvas" =/

I imported theses libraries:

import org.eclipse.draw2d.FigureCanvas;
import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEditP art;
import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefEdito r;
import org.eclipse.swtbot.eclipse.gef.finder.widgets.SWTBotGefFigur eCanvas;

And, I could not use and initialize this:

SWTGefBot bot = new SWTGefBot();


But... OK,
I have just 2 TestCases to develop for this session ... and I intend to see a new solution in other time.

However, thank you anyway! =)

Previous Topic:bot.waitUntil does not work as expected when running swtbot through ant
Next Topic:SWTBot source repository
Goto Forum:
  


Current Time: Sat Aug 23 15:57:11 EDT 2014

Powered by FUDForum. Page generated in 0.08120 seconds