Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: fed26ebc0aebb778026fabf33ec61018341af25f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*******************************************************************************
 * Copyright (c) 2012, 2018 Wind River Systems and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Wind River Systems - initial implementation
 *     IBM Corporation - bug fixing
 */
package org.eclipse.debug.examples.ui.pda.adapters;

import java.util.HashMap;
import java.util.Map;

import org.eclipse.debug.internal.ui.viewers.model.provisional.IPresentationContext;
import org.eclipse.debug.internal.ui.viewers.model.provisional.IViewActionProvider;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.debug.ui.IDebugView;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;

/**
 * View action provider that returns a custom find action for the PDA debugger
 * in the variables view.
 * @since 3.8
 */
public class PDAViewActionProvider implements IViewActionProvider {

	Map<IPresentationContext, Action> fActions = new HashMap<>();

	@Override
	public IAction getAction(IPresentationContext presentationContext, String actionID) {
		if (presentationContext.getId().equals(IDebugUIConstants.ID_VARIABLE_VIEW) &&
			IDebugView.FIND_ACTION.equals(actionID) )
		{
			Action action = fActions.get(presentationContext);
			if (action == null) {
				action = new PDAVirtualFindAction(presentationContext);
				fActions.put(presentationContext, action);
			}
			return action;
		}
		return null;
	}
}

Back to the top