| 1 | /** |
| 2 | * |
| 3 | */ |
| 4 | package de.uka.ipd.sdq.pcmbench.tabs; |
| 5 | |
| 6 | import org.eclipse.gef.GraphicalEditPart; |
| 7 | import org.eclipse.gmf.runtime.notation.View; |
| 8 | import org.eclipse.jface.viewers.IFilter; |
| 9 | |
| 10 | import de.uka.ipd.sdq.pcm.core.composition.AssemblyContext; |
| 11 | |
| 12 | /** |
| 13 | * @author Roman Andrej |
| 14 | * |
| 15 | */ |
| 16 | public class AssemblyContextFilter implements IFilter { |
| 17 | |
| 18 | /* (non-Javadoc) |
| 19 | * @see org.eclipse.jface.viewers.IFilter#select(java.lang.Object) |
| 20 | */ |
| 21 | public boolean select(Object toTest) { |
| 22 | Object input = toTest; |
| 23 | if (input instanceof GraphicalEditPart) { |
| 24 | GraphicalEditPart ep = (GraphicalEditPart) input; |
| 25 | input = ep.getModel(); |
| 26 | } |
| 27 | if (input instanceof View) { |
| 28 | input = ((View) input).getElement(); |
| 29 | } |
| 30 | return input instanceof AssemblyContext; |
| 31 | } |
| 32 | |
| 33 | } |