Revision cf349935
Added by Patrick Plitzner over 5 years ago
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/featuretree/e4/handler/PasteFeatureHandler.java | ||
---|---|---|
3 | 3 |
|
4 | 4 |
import javax.inject.Named; |
5 | 5 |
|
6 |
import org.eclipse.core.runtime.NullProgressMonitor; |
|
6 | 7 |
import org.eclipse.e4.core.di.annotations.CanExecute; |
7 | 8 |
import org.eclipse.e4.core.di.annotations.Execute; |
8 | 9 |
import org.eclipse.e4.core.di.annotations.Optional; |
... | ... | |
15 | 16 |
|
16 | 17 |
import eu.etaxonomy.cdm.api.service.IFeatureNodeService; |
17 | 18 |
import eu.etaxonomy.cdm.model.description.FeatureNode; |
19 |
import eu.etaxonomy.taxeditor.featuretree.e4.FeatureNodeDropAdapter; |
|
18 | 20 |
import eu.etaxonomy.taxeditor.featuretree.e4.FeatureTreeEditor; |
21 |
import eu.etaxonomy.taxeditor.model.MessagingUtils; |
|
19 | 22 |
import eu.etaxonomy.taxeditor.store.CdmStore; |
20 | 23 |
|
21 | 24 |
public class PasteFeatureHandler { |
... | ... | |
23 | 26 |
@Execute |
24 | 27 |
public void execute(@Named(IServiceConstants.ACTIVE_PART) MPart part, |
25 | 28 |
@Named(IServiceConstants.ACTIVE_SELECTION) IStructuredSelection selection){ |
26 |
ISelection clipBoardSelection = LocalSelectionTransfer.getTransfer().getSelection(); |
|
27 | 29 |
FeatureTreeEditor editor = (FeatureTreeEditor)part.getObject(); |
30 |
|
|
31 |
if (editor.isDirty()) { |
|
32 |
if (MessagingUtils.confirmDialog(FeatureNodeDropAdapter.SAVE_CHANGES_TITLE, |
|
33 |
FeatureNodeDropAdapter.SAVE_CHANGES_MESSAGE)){ |
|
34 |
editor.save(new NullProgressMonitor()); |
|
35 |
} |
|
36 |
else{ |
|
37 |
return; |
|
38 |
} |
|
39 |
} |
|
40 |
|
|
41 |
ISelection clipBoardSelection = LocalSelectionTransfer.getTransfer().getSelection(); |
|
28 | 42 |
FeatureNode parentNode = (FeatureNode) selection.getFirstElement(); |
29 | 43 |
FeatureNode copiedNode = (FeatureNode) ((IStructuredSelection)clipBoardSelection).getFirstElement(); |
30 | 44 |
|
Also available in: Unified diff
Ask for saving before executing operations