blob: e8c56d0b4fe67b6f9fc7f225dae7ab659cec59ac (
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
|
/*******************************************************************************
* Copyright (c) 2006-2009 Wind River Systems, Inc. and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* Ted R Williams (Wind River Systems, Inc.) - initial implementation
*******************************************************************************/
package org.eclipse.cdt.debug.ui.memory.transport.actions;
import org.eclipse.cdt.debug.ui.memory.transport.ImportMemoryDialog;
import org.eclipse.cdt.debug.ui.memory.transport.MemoryTransportPlugin;
import org.eclipse.debug.ui.memory.IMemoryRenderingSite;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.ui.IViewActionDelegate;
import org.eclipse.ui.IViewPart;
/**
* Action for downloading memory.
*/
public class ImportMemoryAction implements IViewActionDelegate {
private IMemoryRenderingSite fView;
public void init(IViewPart view) {
if (view instanceof IMemoryRenderingSite)
fView = (IMemoryRenderingSite) view;
}
public void run(IAction action) {
ISelection selection = fView.getSite().getSelectionProvider().getSelection();
// use utility function in export code
ExportMemoryAction.BlockAndAddress blockAndAddr = ExportMemoryAction
.getMemoryBlockAndInitialStartAddress(selection);
if (blockAndAddr.block == null)
return;
ImportMemoryDialog dialog = new ImportMemoryDialog(MemoryTransportPlugin.getShell(), blockAndAddr.block,
blockAndAddr.addr, fView);
dialog.open();
dialog.getResult();
}
public void selectionChanged(IAction action, ISelection selection) {
// use utility function in export code
action.setEnabled(ExportMemoryAction.getMemoryBlockAndInitialStartAddress(selection).block != null);
}
}
|