Skip to main content
summaryrefslogtreecommitdiffstats
blob: b73fb34753888ba1974493e20b830dae2301f540 (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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package org.eclipse.debug.internal.ui;

/*
 * (c) Copyright IBM Corp. 2000, 2001.
 * All Rights Reserved.
 */
 
import java.util.Iterator;
import java.util.List;

import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.core.model.*;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.*;

/**
 * Used to copy the values of variables to the clipboard from
 * the Variables and Inspector views.
 */
public class CopyVariablesToClipboardActionDelegate extends CopyToClipboardActionDelegate {
	
	private static final String PREFIX= "copy_variables_to_clipboard_action.";

	protected String getHelpContextId() {
		return IDebugHelpContextIds.COPY_VARIABLES_TO_CLIPBOARD_ACTION;
	}
	
	/**
	 * Only append children that are visible in the tree viewer
	 */
	protected boolean shouldAppendChildren(Object e) {
		return((TreeViewer)fViewer).getExpandedState(e);
	}
	
	/**
	 * @see ControlActionDelegate
	 */
	public void initializeForOwner(ControlAction controlAction) {		
		controlAction.setEnabled(!controlAction.getStructuredSelection().isEmpty());
		fViewer = (ContentViewer)controlAction.getSelectionProvider();		
	}
	
	/**
	 * @see ControlActionDelegate
	 */
	protected String getPrefix() {
		return PREFIX;
	}
	
	/**
	 * @see ControlActionDelegate
	 */
	public boolean isEnabledFor(Object element) {
		return element instanceof IDebugElement || element instanceof InspectItem;
	}
	
	/**
	 * @see IActionDelegate
	 */
	public void selectionChanged(IAction action, ISelection s) {
		action.setEnabled(!s.isEmpty());
	}
}

Back to the top