Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 317689 - SWTBotGefFigureCanvas: abstract from FigureCanvas
Summary: SWTBotGefFigureCanvas: abstract from FigureCanvas
Status: RESOLVED FIXED
Alias: None
Product: SWTBot
Classification: Technology
Component: GEFBot (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Mariot Chauvin CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-06-23 08:20 EDT by Tim Kaiser CLA
Modified: 2011-02-20 12:28 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tim Kaiser CLA 2010-06-23 08:20:05 EDT
In Graphiti, we directly extend Canvas. So we cannot supply a FigureCanvas.

SWTBotGefFigureCanvas can be made to work with a plain Canvas and an according Lightweightsystem in the following fashion:

(1) change 
public class SWTBotGefFigureCanvas extends AbstractSWTBotControl<FigureCanvas> to
public class SWTBotGefFigureCanvas extends AbstractSWTBotControl<Canvas>

(2) add the following constructor:
public SWTBotGefFigureCanvas(Canvas w, LightweightSystem l) throws     
                                                WidgetNotFoundException {
        super(w);
	eventDispatcher = l.getRootFigure().internalGetEventDispatcher();
}

It would be great if we can get the change soon, since it blocks us from developing UI Tests with SWTBot!
The change should be API-compatible since it is additive only.

Best, Tim
Comment 1 Mariot Chauvin CLA 2010-06-23 09:10:39 EDT
Committed to trunk - Revision 581
Comment 2 Tim Kaiser CLA 2011-01-24 10:59:53 EST
Hi, recent changes in SWTBot made it impossible 
for Graphiti to run tests -- again since we have
our own FigureCanvas Class which extends only from Canvas
(our shame;-).

I found a solution on the SWTBot side. If you would change
your init method in SWTBotGefViewer as follows we run again!

It would be great if you could bring in the patch, since
at the moment we have to run our tests against an
archived version of SWTBot. Also our customers would have to.

Best, Tim


protected void init() throws WidgetNotFoundException {
		UIThreadRunnable.syncExec(new VoidResult() {
			public void run() {
				final Control control = graphicalViewer.getControl();
				if (control instanceof FigureCanvas) {
					canvas = new SWTBotGefFigureCanvas((FigureCanvas) control);
				} else if (control instanceof Canvas) {
					if (control instanceof IAdaptable) {
						IAdaptable adaptable = (IAdaptable) control;
						Object adapter = adaptable.getAdapter(LightweightSystem.class);
						if (adapter != null && adapter instanceof LightweightSystem) {
							canvas = new SWTBotGefFigureCanvas((Canvas) control, (LightweightSystem) adapter);
						}
					}
				}
				editDomain = graphicalViewer.getEditDomain();
			}
		});

		if (graphicalViewer == null) {
			throw new WidgetNotFoundException("Editor does not adapt to a GraphicalViewer");
		}
	}
Comment 3 Mariot Chauvin CLA 2011-01-24 11:47:04 EST
Fixed on master.
Commit id a60f77bad54e5cbb7dc3e865c34b02fa920b8873.
Comment 4 Tim Kaiser CLA 2011-01-25 04:09:10 EST
Thanks Mariot,
this was really fast!

When and where will the improved version be available via an update site
such that we can use it in our buckminster build?

Best, Tim
Comment 5 Mariot Chauvin CLA 2011-01-31 09:37:55 EST
(In reply to comment #4)
> Thanks Mariot,
> this was really fast!
> 
> When and where will the improved version be available via an update site
> such that we can use it in our buckminster build?
> 
> Best, Tim

Have a look to :

https://hudson.eclipse.org/hudson/view/SWTBot/

You could find an update site for each build. I do not know when we will promote a build as the new release.
Comment 6 Tim Kaiser CLA 2011-01-31 10:19:45 EST
Hi Mariot,

as far as i can see, the update site sits
in a directory on the build server. 
These directories get wiped from time to time.

Are the build results copied to a stable directory?

Thanks, Tim
Comment 7 Mariot Chauvin CLA 2011-01-31 10:59:43 EST
(In reply to comment #6)
> Hi Mariot,
> 
> as far as i can see, the update site sits
> in a directory on the build server. 
> These directories get wiped from time to time.
> 
> Are the build results copied to a stable directory?
> 
> Thanks, Tim

(In reply to comment #6)
> Hi Mariot,
> 
> as far as i can see, the update site sits
> in a directory on the build server. 
> These directories get wiped from time to time.
> 
> Are the build results copied to a stable directory?
> 
> Thanks, Tim

You are right, I do not think build results are copied to a stable directory, but I understand your need.

We probably need an integration update site with a stable URI which link to the last build update site. I will open an issue.
Comment 8 Mariot Chauvin CLA 2011-02-20 12:28:17 EST
(In reply to comment #7)
> (In reply to comment #6)
> > Hi Mariot,
> > 
> > as far as i can see, the update site sits
> > in a directory on the build server. 
> > These directories get wiped from time to time.
> > 
> > Are the build results copied to a stable directory?
> > 
> > Thanks, Tim
> 
> (In reply to comment #6)
> > Hi Mariot,
> > 
> > as far as i can see, the update site sits
> > in a directory on the build server. 
> > These directories get wiped from time to time.
> > 
> > Are the build results copied to a stable directory?
> > 
> > Thanks, Tim
> 
> You are right, I do not think build results are copied to a stable directory,
> but I understand your need.
> 
> We probably need an integration update site with a stable URI which link to the
> last build update site. I will open an issue.

See Bug 335863.