Bug 148427

Summary: Need ability to extend ElementSelectionService for transaction support
Product: [Modeling] GMF-Runtime Reporter: Christian Damus <give.a.damus>
Component: GeneralAssignee: Anthony Hunter <ahunter.eclipse>
Status: RESOLVED FIXED QA Contact:
Severity: major    
Priority: P3 Keywords: contributed
Version: 1.0   
Target Milestone: 1.0.1   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Patch for selection service extensibility none

Description Christian Damus CLA 2006-06-23 14:11:41 EDT
I have an application using GMF that uses the ElementSelectionService to find elements in EMF models.  My selection provider jobs use the EMFT Transaction API to lock the editing domain for read access.  This works well as long as the dialog in which I embed the ElementSelectionComposite is not launched while the UI thread has an active transaction.

When the UI thread does have a transaction (read-only or, in some cases, read-write because an AbstractEMFOperation is executing), then the selection composite never returns results because the jobs that are feeding it are blocked waiting for the editing domain lock that the UI is holding.  In read-write cases, yielding does not help, because the UI thread is busily waiting for the selection jobs to finish.  The current implementation of the service cannot be extended to provide the necessary transaction support.

I will attach a patch that tweaks the selection service API ever so slightly, by factoring a couple of key behaviours into protected methods that an extension could override to show what is required.
Comment 1 Christian Damus CLA 2006-06-23 14:17:00 EDT
Created attachment 45195 [details]
Patch for selection service extensibility

As promised, find attached a patch that makes the following small changes:

  - in ElementSelectionService and AbstractElementSelectionProvider,
    factors out the creation of ElementSelectionServiceJobs to allow a
    subclass to create a custom job implementation
  - in ElementSelectionService, factors out the scheduling of jobs so that
    a subclass can customize the scheduling of provider jobs
  - in ElementSelectionComposite, adds a constructor that allows clients
    to configure the composite with a custom selection service implementation
Comment 2 Anthony Hunter CLA 2006-07-12 14:40:48 EDT
Committed the patch to R1_0_maintenance.

I ran the JUnit tests for the element selection service and they pass.
I also ran the clients application and it works as required.
Comment 3 Eclipse Webmaster CLA 2010-07-19 21:55:59 EDT
[GMF Restructure] Bug 319140 : product GMF and component
Runtime Common was the original product and component for this bug