Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF "Technology" (Ecore Tools, EMFatic, etc)  » [EMFForms]Disable Create and Link button in Table Control
[EMFForms]Disable Create and Link button in Table Control [message #1747392] Mon, 14 November 2016 09:43 Go to next message
Annamalai Mising name is currently offline Annamalai Mising nameFriend
Messages: 126
Registered: July 2009
Senior Member
Hi

My model has a school containing Student and Class
School -> Student and School -> Class.
Now Class references Student [Association]

Now when i use a custom view model and on selection of Class, i show the list of Students as a table. I get 3 buttons above the table for create and link, link and delete.

Case 1 :
In this case create and link doesnt make sense as Class cannot create a Student, he can only link to an existing student.

Case 2:
In case i argue saying i need a create and link button, then on click of this, the student should be created inside the School but currently it gets created outside the School which again isnt correct. Coz the student cant exists without a school.

I would like to therefore disable create and link button or fix the way the object is created. any help would be appreciated.

Regards
Malai
Re: [EMFForms]Disable Create and Link button in Table Control [message #1747499 is a reply to message #1747392] Tue, 15 November 2016 13:53 Go to previous messageGo to next message
Eugen Neufeld is currently offline Eugen NeufeldFriend
Messages: 174
Registered: May 2015
Senior Member
Hi Malai,
you have two possibilities.
You can either subclass the table or you can provide your own referenceservice which behaves as you want.
You must override the org.eclipse.emf.ecp.edit.spi.ReferenceService#addNewModelElements(EObject, EReference) for customizing the the creation of new model elements.
On how to register your reference service take a look at org.eclipse.emf.ecp.ui.view.swt.DefaultReferenceService and org.eclipse.emf.ecp.ui.view.swt.DefaultReferenceServiceFactory .

Cheers,
Eugen


--
Eugen Neufeld

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: [EMFForms]Disable Create and Link button in Table Control [message #1747500 is a reply to message #1747499] Tue, 15 November 2016 13:56 Go to previous messageGo to next message
Eugen Neufeld is currently offline Eugen NeufeldFriend
Messages: 174
Registered: May 2015
Senior Member
Hi Malai,
I was to fast. The reference service is not used by the table renderer.
So instead of the ReferenceService you will need the org.eclipse.emf.ecp.view.spi.table.swt.TableControlService but you can register it just like the reference service.
In the org.eclipse.emf.ecp.view.spi.table.swt.TableControlService you can override the createNewElement method.

Cheers,
Eugen


--
Eugen Neufeld

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Re: [EMFForms]Disable Create and Link button in Table Control [message #1754177 is a reply to message #1747500] Wed, 15 February 2017 04:46 Go to previous messageGo to next message
Rahul Upadhyay is currently offline Rahul UpadhyayFriend
Messages: 11
Registered: February 2017
Junior Member
Hi ,
We are looking to perform some validation on UI as soon as that EObject is selected in Model Explorer. In the UI we have a button called "Link Type" and "Create and link new Type" etc. As soon as user clicks on "Link Type" in the Select Elements dialog appears where we want to filter some elements.
Basically it is like on the selection of an specific EObject . We want to filter elements in "Select Elements" dialog.


Re: [EMFForms]Disable Create and Link button in Table Control [message #1754208 is a reply to message #1747500] Wed, 15 February 2017 11:14 Go to previous messageGo to next message
Annamalai Mising name is currently offline Annamalai Mising nameFriend
Messages: 126
Registered: July 2009
Senior Member
Hi Eugen

Registering a ReferenceService. wouldnt that mean you need to use extension point view : org.eclipse.emf.ecp.view.context.viewServices and then provide a class for it that extends org.eclipse.emf.ecp.view.spi.table.swt.TableControlService

Regards
Malai

[Updated on: Wed, 15 February 2017 11:28]

Report message to a moderator

Re: [EMFForms]Disable Create and Link button in Table Control [message #1754340 is a reply to message #1754208] Thu, 16 February 2017 14:07 Go to previous message
Eugen Neufeld is currently offline Eugen NeufeldFriend
Messages: 174
Registered: May 2015
Senior Member
Hi Malai,

So we have introduced two services which must be unified in the future.
For a table you need the org.eclipse.emf.ecp.view.spi.table.swt.TableControlService. It can be provided as a plain OSGi-Service.
So just create a component which implements this interface and thus provides it.

For ReferenceControls and MultiReferenceControls we use the ReferenceService.
So in this case I would recommend to subclass the DefaultReferenceService and register yours with a higher priority.
On how to register your reference service take a look at org.eclipse.emf.ecp.ui.view.swt.DefaultReferenceService and org.eclipse.emf.ecp.ui.view.swt.DefaultReferenceServiceFactory .

Cheers,
Eugen


--
Eugen Neufeld

Get professional Eclipse developer support:
http://eclipsesource.com/en/services/developer-support/
Previous Topic:Need to Filter some objects in Select Element dialog.
Next Topic:[EMF Forms] Working with TransactionalEditingDomain
Goto Forum:
  


Current Time: Sat Apr 20 03:10:56 GMT 2024

Powered by FUDForum. Page generated in 0.03284 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top