1 | /** |
2 | * |
3 | */ |
4 | package de.uka.ipd.sdq.pcmbench.tabs.operations; |
5 | |
6 | import org.eclipse.emf.transaction.RecordingCommand; |
7 | import org.eclipse.emf.transaction.TransactionalEditingDomain; |
8 | import org.eclipse.emf.transaction.util.TransactionUtil; |
9 | import org.eclipse.jface.viewers.TableViewer; |
10 | import org.eclipse.swt.events.SelectionEvent; |
11 | import org.eclipse.swt.events.SelectionListener; |
12 | |
13 | import de.uka.ipd.sdq.pcm.repository.OperationSignature; |
14 | import de.uka.ipd.sdq.pcmbench.tabs.generic.SelectionChangedListener; |
15 | |
16 | /** |
17 | * @author Roman Andrej |
18 | */ |
19 | public class OperationDeleteCellValueListener extends SelectionChangedListener implements SelectionListener { |
20 | |
21 | |
22 | private TableViewer viewer; |
23 | |
24 | /** Constructor */ |
25 | public OperationDeleteCellValueListener(TableViewer viewer) { |
26 | this.viewer = viewer; |
27 | } |
28 | |
29 | /* (non-Javadoc) |
30 | * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent) |
31 | */ |
32 | public void widgetSelected(SelectionEvent e) { |
33 | |
34 | final OperationSignature signature = (OperationSignature) getSelectedElement(); |
35 | |
36 | TransactionalEditingDomain editingDomain = TransactionUtil |
37 | .getEditingDomain(signature); |
38 | |
39 | RecordingCommand recCommand = new RecordingCommand(editingDomain) { |
40 | @Override |
41 | protected void doExecute() { |
42 | signature.setReturnType__OperationSignature(null); |
43 | } |
44 | }; |
45 | |
46 | recCommand.setDescription("Set void return type signature"); |
47 | editingDomain.getCommandStack().execute(recCommand); |
48 | |
49 | viewer.refresh(); |
50 | } |
51 | |
52 | /* (non-Javadoc) |
53 | * @see org.eclipse.swt.events.SelectionListener#widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent) |
54 | */ |
55 | public void widgetDefaultSelected(SelectionEvent e) { |
56 | // The implementation is not necessary. |
57 | } |
58 | } |