Retargetable breakpoint actions always enabled for text selections [message #488249] |
Sat, 26 September 2009 19:12 |
Matthew Dickie Messages: 56 Registered: July 2009 |
Member |
|
|
Hi all,
Looking at the code for
org.eclipse.ui.debug.internal.action.RetargetAction it appears that the
retargetable breakpoint actions (such as RetargetWatchpointAction) are
always enabled for text selections. The method selectionChanged is
copied below. Is this deliberate? One of our QA people has created a bug
against our IDE because of this. Why is isTargetEnabled() only called
for IStructuredSelection and not ITextSelection, which would make the
actions enablement behave as one would expect.
public void selectionChanged(IAction action, ISelection selection) {
// if the active part did not provide an adapter, see if the selection
does
if (fTargetAdapter == null && selection instanceof IStructuredSelection) {
IStructuredSelection ss = (IStructuredSelection) selection;
if (!ss.isEmpty()) {
Object object = ss.getFirstElement();
if (object instanceof IAdaptable) {
fTargetAdapter = getAdapter((IAdaptable) object);
}
}
}
boolean enabled = fTargetAdapter != null;
if (selection instanceof IStructuredSelection) {
enabled = isTargetEnabled();
}
action.setEnabled(enabled);
}
Thanks in advance,
Matt D.
|
|
|
Powered by
FUDForum. Page generated in 0.02444 seconds