mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
[297387] [disassembly] When location combo box has focus, 'Home' key shouldn't jump to PC address
Patch from Navid Mehregani
This commit is contained in:
parent
1a64d13fda
commit
a326de8cbd
3 changed files with 36 additions and 8 deletions
|
@ -223,7 +223,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
|||
// private static final String COMMAND_ID_RUN_TO_LINE = "org.eclipse.debug.ui.commands.RunToLine"; //$NON-NLS-1$
|
||||
// private static final String COMMAND_ID_TOGGLE_STEPPING_MODE = "org.eclipse.cdt.dsf.debug.ui.debug.ui.menu.showDisassemblyAction"; //$NON-NLS-1$
|
||||
|
||||
private static final String KEY_BINDING_CONTEXT_DISASSEMBLY = "org.eclipse.cdt.dsf.debug.ui.disassembly.context"; //$NON-NLS-1$
|
||||
public static final String KEY_BINDING_CONTEXT_DISASSEMBLY = "org.eclipse.cdt.dsf.debug.ui.disassembly.context"; //$NON-NLS-1$
|
||||
|
||||
protected DisassemblyViewer fViewer;
|
||||
|
||||
|
@ -749,10 +749,9 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
|||
handlerService.deactivateHandlers(fHandlerActivations);
|
||||
fHandlerActivations = null;
|
||||
}
|
||||
if (fContextActivation != null) {
|
||||
IContextService ctxService = (IContextService)site.getService(IContextService.class);
|
||||
ctxService.deactivateContext(fContextActivation);
|
||||
}
|
||||
|
||||
deactivateDisassemblyContext();
|
||||
|
||||
fViewer = null;
|
||||
setDebugContext(null);
|
||||
DsfSession.removeSessionEndedListener(this);
|
||||
|
@ -1187,8 +1186,7 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
|||
private void contributeToActionBars() {
|
||||
IWorkbenchPartSite site = getSite();
|
||||
site.setSelectionProvider(new DisassemblySelectionProvider(this));
|
||||
IContextService ctxService = (IContextService)site.getService(IContextService.class);
|
||||
fContextActivation = ctxService.activateContext(KEY_BINDING_CONTEXT_DISASSEMBLY);
|
||||
activateDisassemblyContext();
|
||||
contributeToActionBars(getActionBars());
|
||||
}
|
||||
|
||||
|
@ -3409,5 +3407,17 @@ public abstract class DisassemblyPart extends WorkbenchPart implements IDisassem
|
|||
MessageDialog messageDialog = new MessageDialog(PlatformUI.getWorkbench().getDisplay().getActiveShell(), DisassemblyMessages.Disassembly_Error_Dialog_title, null, message, MessageDialog.ERROR, new String[]{DisassemblyMessages.Disassembly_Error_Dialog_ok_button}, 0);
|
||||
messageDialog.open();
|
||||
}
|
||||
|
||||
|
||||
public void activateDisassemblyContext() {
|
||||
IContextService ctxService = (IContextService)getSite().getService(IContextService.class);
|
||||
if (ctxService!=null)
|
||||
fContextActivation = ctxService.activateContext(KEY_BINDING_CONTEXT_DISASSEMBLY);
|
||||
}
|
||||
|
||||
public void deactivateDisassemblyContext() {
|
||||
if (fContextActivation != null) {
|
||||
IContextService ctxService = (IContextService)getSite().getService(IContextService.class);
|
||||
ctxService.deactivateContext(fContextActivation);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -232,6 +232,11 @@ public class AddressBarContributionItem extends ContributionItem {
|
|||
};
|
||||
|
||||
public void focusGained(FocusEvent e) {
|
||||
// [nmehregani] bugzilla 297387: 'Home' shouldn't jump to PC address when focus is on location combo box
|
||||
if (action instanceof JumpToAddressAction)
|
||||
((JumpToAddressAction)action).deactivateDisassemblyContext();
|
||||
// end 297387
|
||||
|
||||
// Erase the guide text when the focus is gained.
|
||||
if (addressBox.getText().trim().equals(initialText))
|
||||
addressBox.setText(""); //$NON-NLS-1$
|
||||
|
@ -241,6 +246,11 @@ public class AddressBarContributionItem extends ContributionItem {
|
|||
}
|
||||
|
||||
public void focusLost(FocusEvent e) {
|
||||
// [nmehregani] bugzilla 297387: 'Home' shouldn't jump to PC address when focus is on location combo box
|
||||
if (action instanceof JumpToAddressAction)
|
||||
((JumpToAddressAction)action).activateDisassemblyContext();
|
||||
// end 297387
|
||||
|
||||
// Re-insert the guide text when the focus is lost and the text
|
||||
// field is empty.
|
||||
if (addressBox.getText().trim().length() == 0)
|
||||
|
|
|
@ -61,4 +61,12 @@ public class JumpToAddressAction extends Action {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void activateDisassemblyContext() {
|
||||
fDisassemblyPart.activateDisassemblyContext();
|
||||
}
|
||||
|
||||
protected void deactivateDisassemblyContext() {
|
||||
fDisassemblyPart.deactivateDisassemblyContext();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue