Revision 1c54a64e
Added by Patrick Plitzner about 5 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/handler/CopyFeatureHandler.java | ||
---|---|---|
9 | 9 |
import org.eclipse.e4.ui.model.application.ui.basic.MPart; |
10 | 10 |
import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem; |
11 | 11 |
import org.eclipse.e4.ui.services.IServiceConstants; |
12 |
import org.eclipse.jface.util.LocalSelectionTransfer; |
|
13 | 12 |
import org.eclipse.jface.viewers.IStructuredSelection; |
14 | 13 |
|
15 | 14 |
import eu.etaxonomy.cdm.model.description.FeatureNode; |
16 |
import eu.etaxonomy.taxeditor.featuretree.e4.IFeatureTreeEditor;
|
|
15 |
import eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditor; |
|
17 | 16 |
|
18 | 17 |
public class CopyFeatureHandler { |
19 | 18 |
|
20 | 19 |
@Execute |
21 |
public void execute(@Named(IServiceConstants.ACTIVE_SELECTION) IStructuredSelection selection){ |
|
22 |
LocalSelectionTransfer.getTransfer().setSelection(selection); |
|
20 |
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart part, |
|
21 |
@Named(IServiceConstants.ACTIVE_SELECTION) IStructuredSelection selection){ |
|
22 |
((FeatureTreeEditor) part.getObject()).copy(selection); |
|
23 | 23 |
} |
24 | 24 |
|
25 | 25 |
@CanExecute |
... | ... | |
27 | 27 |
@Named(IServiceConstants.ACTIVE_PART) MPart part, |
28 | 28 |
MHandledMenuItem menuItem){ |
29 | 29 |
boolean canExecute = false; |
30 |
canExecute =part.getObject() instanceof IFeatureTreeEditor
|
|
30 |
canExecute =part.getObject() instanceof FeatureTreeEditor |
|
31 | 31 |
&& selection!=null |
32 | 32 |
&& selection.size()==1 |
33 | 33 |
&& selection.getFirstElement() instanceof FeatureNode; |
Also available in: Unified diff
ref #7873 Implement copy&paste keyboard shortcuts