|
Lines 21-29
Link Here
|
| 21 |
import org.eclipse.jface.viewers.IStructuredSelection; |
21 |
import org.eclipse.jface.viewers.IStructuredSelection; |
| 22 |
|
22 |
|
| 23 |
/** |
23 |
/** |
| 24 |
* Action to browse all references to selected object. |
24 |
* Action to browse all references to selected object. This action is retargettable, to do so, |
|
|
25 |
* implement <code>IAllReferencesAction</code> and contribute the implementation as an adapter |
| 26 |
* of the objects you want the custom action available for. |
| 25 |
* |
27 |
* |
| 26 |
* @since 3.3 |
28 |
* @since 3.3 |
|
|
29 |
* @see IAllReferencesAction |
| 27 |
*/ |
30 |
*/ |
| 28 |
public class AllReferencesActionDelegate extends ObjectActionDelegate { |
31 |
public class AllReferencesActionDelegate extends ObjectActionDelegate { |
| 29 |
|
32 |
|
|
Lines 33-38
Link Here
|
| 33 |
public void run(IAction action) { |
36 |
public void run(IAction action) { |
| 34 |
IStructuredSelection currentSelection = getCurrentSelection(); |
37 |
IStructuredSelection currentSelection = getCurrentSelection(); |
| 35 |
IJavaVariable var = (IJavaVariable) currentSelection.getFirstElement(); |
38 |
IJavaVariable var = (IJavaVariable) currentSelection.getFirstElement(); |
|
|
39 |
|
| 40 |
// See if there is adapter that can handle this action |
| 41 |
IAllReferencesAction altAction = (IAllReferencesAction)var.getAdapter(IAllReferencesAction.class); |
| 42 |
if (altAction != null){ |
| 43 |
altAction.setActivePart(action, getPart()); |
| 44 |
altAction.selectionChanged(action, currentSelection); |
| 45 |
altAction.run(action); |
| 46 |
return; |
| 47 |
} |
| 48 |
|
| 36 |
ReferencesPopupDialog popup; |
49 |
ReferencesPopupDialog popup; |
| 37 |
try { |
50 |
try { |
| 38 |
popup = new ReferencesPopupDialog(getWorkbenchWindow().getShell(), (IDebugView) getPart().getAdapter(IDebugView.class), (IJavaObject) var.getValue()); |
51 |
popup = new ReferencesPopupDialog(getWorkbenchWindow().getShell(), (IDebugView) getPart().getAdapter(IDebugView.class), (IJavaObject) var.getValue()); |