Project

General

Profile

« Previous | Next » 

Revision 87110d2e

Added by Patrick Plitzner almost 7 years ago

fix #6726 Use correct selection service for dynamic menu

View differences:

eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/descriptive/handler/DynamicFeatureMenu.java
37 37
import eu.etaxonomy.taxeditor.store.CdmStore;
38 38

  
39 39
/**
40
 * <p>
41
 * DynamicFeatureMenu class.
42
 * </p>
43 40
 *
44 41
 * @author n.hoffmann
45 42
 * @created 17.04.2009
......
47 44
 */
48 45
public class DynamicFeatureMenu extends CompoundContributionItem {
49 46

  
50
	private final ISelectionService selectionService = TaxeditorEditorPlugin.getDefault().getWorkbench().getService(ISelectionService.class);
51
	private final IHandlerService handlerService = TaxeditorEditorPlugin.getDefault().getWorkbench().getService(IHandlerService.class);
52

  
53
	/*
54
	 * (non-Javadoc)
55
	 *
56
	 * @see
57
	 * org.eclipse.ui.actions.CompoundContributionItem#getContributionItems()
58
	 */
59 47
	/** {@inheritDoc} */
60 48
	@Override
61 49
	protected IContributionItem[] getContributionItems() {
......
63 51
		return new IContributionItem[] { new ContributionItem() {
64 52
			@Override
65 53
            public void fill(Menu menu, int index) {
54
			    ISelectionService selectionService = TaxeditorEditorPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getSelectionService();
66 55

  
67
				ISelection selection = selectionService
68
						.getSelection(DescriptiveViewPart.ID);
56
				ISelection selection = selectionService.getSelection(DescriptiveViewPart.ID);
69 57

  
70 58
				if (selection instanceof IStructuredSelection) {
71 59
					IStructuredSelection structuredSelection = (IStructuredSelection) selection;
......
121 109
				Event event = new Event();
122 110
				event.data = deproxiedFeature;
123 111
				try {
124
					handlerService.executeCommand(
112
				    TaxeditorEditorPlugin.getDefault().getWorkbench().getService(IHandlerService.class).executeCommand(
125 113
							CreateDescriptionElementOperation.ID, event);
126 114
				} catch (Exception e) {
127 115
					MessagingUtils.error(getClass(), e);

Also available in: Unified diff