blob: a2f44be72af330c9190b2bf97e00a89801e3d219 (
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
|
package org.eclipse.debug.internal.ui;
/*
* Licensed Materials - Property of IBM,
* WebSphere Studio Workbench
* (c) Copyright IBM Corp 2001
*/
import org.eclipse.debug.core.DebugException;
import org.eclipse.debug.ui.IDebugUIConstants;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.actions.SelectionProviderAction;
public abstract class InspectorAction extends SelectionProviderAction {
public InspectorAction(ISelectionProvider provider, String label) {
super(provider, label);
}
/**
* @see IAction
*/
public void run() {
// get the Inspector
IWorkbenchPage p= DebugUIPlugin.getActiveWorkbenchWindow().getActivePage();
InspectorView view= (InspectorView) p.findView(IDebugUIConstants.ID_INSPECTOR_VIEW);
if (view == null) {
// open a new view
try {
view= (InspectorView) p.showView(IDebugUIConstants.ID_INSPECTOR_VIEW);
} catch (PartInitException e) {
DebugUIUtils.logError(e);
return;
}
}
try {
doAction(view);
} catch (DebugException de) {
DebugUIUtils.logError(de);
}
}
/**
* @see SelectionProviderAction
*/
public void selectionChanged(IStructuredSelection sel) {
setEnabled(!sel.isEmpty());
}
protected abstract void doAction(InspectorView view) throws DebugException;
}
|