1 | package de.uka.ipd.sdq.pcmbench.tabs.parameters; |
2 | |
3 | import org.eclipse.emf.common.notify.AdapterFactory; |
4 | import org.eclipse.emf.edit.provider.DecoratorAdapterFactory; |
5 | import org.eclipse.emf.edit.provider.IChangeNotifier; |
6 | import org.eclipse.emf.edit.provider.IItemLabelProvider; |
7 | import org.eclipse.emf.edit.provider.IItemProviderDecorator; |
8 | import org.eclipse.emf.edit.provider.ITableItemLabelProvider; |
9 | |
10 | public class ParametersTabItemProviderAdapterFactory extends |
11 | DecoratorAdapterFactory { |
12 | |
13 | public ParametersTabItemProviderAdapterFactory(AdapterFactory adapterFactory) { |
14 | super(adapterFactory); |
15 | } |
16 | |
17 | @Override |
18 | protected IItemProviderDecorator createItemProviderDecorator(Object target, |
19 | Object type) { |
20 | IItemProviderDecorator decorator = new ParametersTabItemProvider(this); |
21 | if (type == ITableItemLabelProvider.class) { |
22 | decorator |
23 | .setDecoratedItemProvider((IChangeNotifier) decoratedAdapterFactory |
24 | .adapt(target, IItemLabelProvider.class)); |
25 | } else { |
26 | decorator |
27 | .setDecoratedItemProvider((IChangeNotifier) decoratedAdapterFactory |
28 | .adapt(target, type)); |
29 | } |
30 | return decorator; |
31 | } |
32 | |
33 | @Override |
34 | public Object adapt(Object target, Object type) { |
35 | if (type == ITableItemLabelProvider.class) |
36 | return createItemProviderDecorator(target, type); |
37 | return super.adapt(target, type); |
38 | } |
39 | |
40 | } |