|
|
|
Re: How to set duplicates at EList [message #1033327 is a reply to message #1033052] |
Thu, 04 April 2013 05:45 |
Ed Merks Messages: 33218 Registered: July 2009 |
Senior Member |
|
|
Fatla,
Comments below.
On 03/04/2013 10:04 PM, Fatla 777 wrote:
> Frankly I have set it manually at myClassImpl to test it.
> The default is unique so the old code was:
> {
> if (students == null)
> { students= new EDataTypeUniqueEList<String>(String.class,
> this, StudentPackage.PARAMS);
> }
Best you do it in the model so that StudentPackage.PARAMS.isUnique
returns false.
>
>
> My new manual updates:
> students= new EObjectEList<String>(String.class, this,
> StudentPackage.PARAMS);
>
> that makes it work perfect.
>
> I am in middle in smth and I will try to update at ecore file later ..
> will that produce the same result .EObjectEList !
It's not generally supported for EObject
https://bugs.eclipse.org/bugs/show_bug.cgi?id=89325
so you'd have to create a specialized list that overrides isUnique to
return false (and then live with the consequences that the framework
generally assumes all EObject lists contain only unique objects).
>
> Additionally,would you save sometime for me and tell me the flag that
> enables me to disable the uniqueness at emf !
org.eclipse.emf.ecore.ETypedElement.isUnique(), but as I mentioned,
that's effectively ignored for EReferences.
>
> Thanks Ed.
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
|
|
|
Re: How to set duplicates at EList [message #1035144 is a reply to message #1035133] |
Sat, 06 April 2013 11:33 |
Ed Merks Messages: 33218 Registered: July 2009 |
Senior Member |
|
|
Fatla,
Comments below.
On 06/04/2013 1:17 PM, Fatla 777 wrote:
> Thanks Ed for you assistance.
> I have found out this solution over other forum.
> Here is the solution for my issue, in case someone was following up
> the thread:
>
>
> TableViewerColumn tableViewerColumn = new
> TableViewerColumn(tableViewer, SWT.NONE);
> tableViewerColumn.setLabelProvider(new ColumnLabelProvider() {
>
> public String getText(Object object) {
> int index = 1;
> for (String employee : company.getEmployeeNames()) {
> if (employee == object) return
> String.valueOf(index);
So you have two identical string instances in this list?
> index++;
> }
> return "";
> }
> });
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.06266 seconds