1 | package de.uka.ipd.sdq.pcm.dialogs.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 | |
11 | |
12 | public class ParametersItemProviderAdapterFactory extends |
13 | DecoratorAdapterFactory { |
14 | |
15 | public ParametersItemProviderAdapterFactory(AdapterFactory decoratedAdapterFactory) { |
16 | super(decoratedAdapterFactory); |
17 | } |
18 | |
19 | @Override |
20 | protected IItemProviderDecorator createItemProviderDecorator(Object target, |
21 | Object type) { |
22 | IItemProviderDecorator decorator = new ParametersItemProvider(this); |
23 | if (type == ITableItemLabelProvider.class) { |
24 | decorator |
25 | .setDecoratedItemProvider((IChangeNotifier) decoratedAdapterFactory |
26 | .adapt(target, IItemLabelProvider.class)); |
27 | } else { |
28 | decorator |
29 | .setDecoratedItemProvider((IChangeNotifier) decoratedAdapterFactory |
30 | .adapt(target, type)); |
31 | } |
32 | return decorator; |
33 | } |
34 | |
35 | @Override |
36 | public Object adapt(Object target, Object type) { |
37 | if (type == ITableItemLabelProvider.class) |
38 | return createItemProviderDecorator(target, type); |
39 | return super.adapt(target, type); |
40 | } |
41 | } |