1 | package de.uka.ipd.sdq.pcm.dialogs.parameters; |
2 | |
3 | import org.eclipse.emf.ecore.EObject; |
4 | import org.eclipse.jface.viewers.ISelectionChangedListener; |
5 | import org.eclipse.jface.viewers.IStructuredSelection; |
6 | import org.eclipse.jface.viewers.SelectionChangedEvent; |
7 | |
8 | |
9 | /** |
10 | * The class delegates straight in the active View selected object on the |
11 | * subclass. |
12 | * |
13 | * @author Roman Andrej |
14 | */ |
15 | public class EditorContentsSelectionAction implements ISelectionChangedListener { |
16 | |
17 | private EObject selectedDeclaration = null; |
18 | |
19 | /* (non-Javadoc) |
20 | * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent) |
21 | */ |
22 | public void selectionChanged(SelectionChangedEvent event) { |
23 | IStructuredSelection sel = (IStructuredSelection) event.getSelection(); |
24 | Object selection = (Object) sel.getFirstElement(); |
25 | this.selectedDeclaration = (EObject) selection; |
26 | |
27 | /** make validation(Enabled/Unenabled) for delete-,up-,downToolItem */ |
28 | UpDownButtonsValidator.getSingelton().validateSelection(selection); |
29 | } |
30 | |
31 | public EObject getSelectedDeclaration() { |
32 | return selectedDeclaration; |
33 | } |
34 | } |