| 1 | package de.uka.ipd.sdq.pcmbench.tabs.operations; |
| 2 | |
| 3 | import org.eclipse.emf.common.notify.AdapterFactory; |
| 4 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
| 5 | import org.eclipse.emf.edit.provider.ITableItemLabelProvider; |
| 6 | import org.eclipse.emf.edit.provider.ItemProviderDecorator; |
| 7 | |
| 8 | import de.uka.ipd.sdq.pcm.repository.InfrastructureSignature; |
| 9 | |
| 10 | /** |
| 11 | * @author Snowball |
| 12 | * |
| 13 | * This class is a decorator for the generated EMF.Edit item providers. It |
| 14 | * provides item providers which are used in the operations tab of the tabbed |
| 15 | * properties sheet when editing interfaces. It implements |
| 16 | * ITableItemLabelProvider to display the given EObject in a tabular form. |
| 17 | * Additionally it provided the labels by partial delegation to the original |
| 18 | * IItemLabelProvider. |
| 19 | * |
| 20 | * @author groenda |
| 21 | */ |
| 22 | public class InfrastructureSignaturesTabItemProvider extends ItemProviderDecorator implements |
| 23 | ITableItemLabelProvider, IItemLabelProvider { |
| 24 | |
| 25 | /** |
| 26 | * Inherited default constructor |
| 27 | * |
| 28 | * @param factory |
| 29 | * The factory which created this object |
| 30 | */ |
| 31 | public InfrastructureSignaturesTabItemProvider(AdapterFactory factory) { |
| 32 | super(factory); |
| 33 | } |
| 34 | |
| 35 | /* (non-Javadoc) |
| 36 | * @see org.eclipse.emf.edit.provider.ItemProviderDecorator#getColumnImage(java.lang.Object, |
| 37 | * int) |
| 38 | */ |
| 39 | @Override |
| 40 | public Object getColumnImage(Object object, int columnIndex) { |
| 41 | if (columnIndex == InfrastructureSignaturesEditorSection.ICON_COLUMN_INDEX) |
| 42 | return this.getImage(object); |
| 43 | return null; |
| 44 | } |
| 45 | |
| 46 | /** |
| 47 | * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang.Object, |
| 48 | * int) Format the columns with the given index constant as string text |
| 49 | * for displaying |
| 50 | */ |
| 51 | @Override |
| 52 | public String getColumnText(Object element, int columnIndex) { |
| 53 | String result = ""; |
| 54 | InfrastructureSignature signature = (InfrastructureSignature) element; |
| 55 | ParameterRepresentation parser = new ParameterRepresentation(); |
| 56 | |
| 57 | switch (columnIndex) { |
| 58 | case InfrastructureSignaturesEditorSection.ICON_COLUMN_INDEX: |
| 59 | break; |
| 60 | case InfrastructureSignaturesEditorSection.SIGNATURENAME_COLUMN_INDEX: |
| 61 | result = signature.getEntityName(); |
| 62 | break; |
| 63 | case InfrastructureSignaturesEditorSection.PARAMETER_COLUMN_INDEX: |
| 64 | result = parser.setParametersToString(signature |
| 65 | .getParameters__InfrastructureSignature()); |
| 66 | break; |
| 67 | case InfrastructureSignaturesEditorSection.EXCEPTIONS_COLUMN_INDEX: |
| 68 | result = parser.setExceptionsToString(signature |
| 69 | .getExceptions__Signature()); |
| 70 | break; |
| 71 | default: |
| 72 | break; |
| 73 | } |
| 74 | return parser.isNotNull(result); |
| 75 | } |
| 76 | } |