mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-13 11:15:38 +02:00
Bug 94139: User-defined register groups. Support fo the "Restore Default Register Groups" action.
This commit is contained in:
parent
8e3e261e91
commit
d66940d5a3
8 changed files with 139 additions and 2 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2005-06-09 Mikhail Khodjaiants
|
||||||
|
Bug 94139: User-defined register groups.
|
||||||
|
Support fo the "Restore Default Register Groups" action.
|
||||||
|
* ICDebugTarget.java
|
||||||
|
* CRegisterManager.java
|
||||||
|
* CDebugTarget.java
|
||||||
|
|
||||||
2005-06-07 Mikhail Khodjaiants
|
2005-06-07 Mikhail Khodjaiants
|
||||||
Bug 94139: User-defined register groups.
|
Bug 94139: User-defined register groups.
|
||||||
Support fo the "Edit Register Group" action.
|
Support fo the "Edit Register Group" action.
|
||||||
|
|
|
@ -126,4 +126,12 @@ public interface ICDebugTarget extends IDebugTarget,
|
||||||
* @since 3.0
|
* @since 3.0
|
||||||
*/
|
*/
|
||||||
public void modifyRegisterGroup( IPersistableRegisterGroup group, IRegisterDescriptor[] descriptors );
|
public void modifyRegisterGroup( IPersistableRegisterGroup group, IRegisterDescriptor[] descriptors );
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Removes all user-defined register groups and restores the hardware groups.
|
||||||
|
*
|
||||||
|
* @since 3.0
|
||||||
|
*/
|
||||||
|
public void restoreDefaultRegisterGroups();
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,18 @@ public class CRegisterManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dispose() {
|
public void dispose() {
|
||||||
removeAllRegisterGroups();
|
DebugPlugin.getDefault().asyncExec(
|
||||||
|
new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
synchronized( fRegisterGroups ) {
|
||||||
|
Iterator it = fRegisterGroups.iterator();
|
||||||
|
while( it.hasNext() ) {
|
||||||
|
((CRegisterGroup)it.next()).dispose();
|
||||||
|
}
|
||||||
|
fRegisterGroups.clear();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
public IRegisterDescriptor[] getAllRegisterDescriptors() throws DebugException {
|
public IRegisterDescriptor[] getAllRegisterDescriptors() throws DebugException {
|
||||||
|
@ -154,6 +165,23 @@ public class CRegisterManager {
|
||||||
} );
|
} );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void restoreDefaults() {
|
||||||
|
DebugPlugin.getDefault().asyncExec(
|
||||||
|
new Runnable() {
|
||||||
|
public void run() {
|
||||||
|
synchronized( fRegisterGroups ) {
|
||||||
|
Iterator it = fRegisterGroups.iterator();
|
||||||
|
while( it.hasNext() ) {
|
||||||
|
((CRegisterGroup)it.next()).dispose();
|
||||||
|
}
|
||||||
|
fRegisterGroups.clear();
|
||||||
|
initializeDefaults();
|
||||||
|
}
|
||||||
|
getDebugTarget().fireChangeEvent( DebugEvent.CONTENT );
|
||||||
|
}
|
||||||
|
} );
|
||||||
|
}
|
||||||
|
|
||||||
private void createRegisterGroups() {
|
private void createRegisterGroups() {
|
||||||
fRegisterGroups = Collections.synchronizedList( new ArrayList( 20 ) );
|
fRegisterGroups = Collections.synchronizedList( new ArrayList( 20 ) );
|
||||||
ILaunchConfiguration config = getDebugTarget().getLaunch().getLaunchConfiguration();
|
ILaunchConfiguration config = getDebugTarget().getLaunch().getLaunchConfiguration();
|
||||||
|
@ -209,7 +237,7 @@ public class CRegisterManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initializeDefaults() {
|
protected void initializeDefaults() {
|
||||||
String current = null;
|
String current = null;
|
||||||
int startIndex = 0;
|
int startIndex = 0;
|
||||||
for ( int i = 0; i < fRegisterDescriptors.length; ++i ) {
|
for ( int i = 0; i < fRegisterDescriptors.length; ++i ) {
|
||||||
|
|
|
@ -1755,6 +1755,13 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
||||||
getRegisterManager().modifyRegisterGroup( group, descriptors );
|
getRegisterManager().modifyRegisterGroup( group, descriptors );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.debug.core.model.ICDebugTarget#restoreDefaultRegisterGroups()
|
||||||
|
*/
|
||||||
|
public void restoreDefaultRegisterGroups() {
|
||||||
|
getRegisterManager().restoreDefaults();
|
||||||
|
}
|
||||||
|
|
||||||
protected void skipBreakpoints( boolean enabled ) {
|
protected void skipBreakpoints( boolean enabled ) {
|
||||||
getBreakpointManager().skipBreakpoints( enabled );
|
getBreakpointManager().skipBreakpoints( enabled );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,10 @@
|
||||||
|
2005-06-09 Mikhail Khodjaiants
|
||||||
|
Bug 94139: User-defined register groups.
|
||||||
|
Support fo the "Restore Default Register Groups" action.
|
||||||
|
+ RestoreDefaultRegisterGroupsActionDelegate.java
|
||||||
|
* plugin.properties
|
||||||
|
* plugin.xml
|
||||||
|
|
||||||
2005-06-07 Mikhail Khodjaiants
|
2005-06-07 Mikhail Khodjaiants
|
||||||
New images for mapping source containers.
|
New images for mapping source containers.
|
||||||
* icons/obj16/mapentry_obj.gif
|
* icons/obj16/mapentry_obj.gif
|
||||||
|
|
|
@ -126,3 +126,5 @@ RemoveRegisterGroupAction.label=Remove Register Group
|
||||||
RemoveRegisterGroupAction.tooltip=Remove Register Group
|
RemoveRegisterGroupAction.tooltip=Remove Register Group
|
||||||
EditRegisterGroupAction.label=Edit Register Group
|
EditRegisterGroupAction.label=Edit Register Group
|
||||||
EditRegisterGroupAction.tooltip=Edit Register Group
|
EditRegisterGroupAction.tooltip=Edit Register Group
|
||||||
|
RestoredefaultRegisterGroupsAction.label=Restore Default Register Groups
|
||||||
|
RestoredefaultRegisterGroupsAction.tooltip=Restore Default Register Groups
|
||||||
|
|
|
@ -650,6 +650,20 @@
|
||||||
class="org.eclipse.cdt.debug.core.model.ICVariable">
|
class="org.eclipse.cdt.debug.core.model.ICVariable">
|
||||||
</selection>
|
</selection>
|
||||||
</action>
|
</action>
|
||||||
|
<action
|
||||||
|
class="org.eclipse.cdt.debug.internal.ui.actions.RestoreDefaultRegisterGroupsActionDelegate"
|
||||||
|
helpContextId="restore_default_register_groups_action_context"
|
||||||
|
id="org.eclipse.cdt.debug.ui.restoreDefaultRegisterGroupsAction"
|
||||||
|
label="%RestoredefaultRegisterGroupsAction.label"
|
||||||
|
menubarPath="additions"
|
||||||
|
style="push"
|
||||||
|
tooltip="%RestoredefaultRegisterGroupsAction.tooltip">
|
||||||
|
<enablement>
|
||||||
|
<pluginState
|
||||||
|
id="org.eclipse.cdt.debug.ui.pluginState1"
|
||||||
|
value="activated"/>
|
||||||
|
</enablement>
|
||||||
|
</action>
|
||||||
<action
|
<action
|
||||||
class="org.eclipse.cdt.debug.internal.ui.actions.AddRegisterGroupActionDelegate"
|
class="org.eclipse.cdt.debug.internal.ui.actions.AddRegisterGroupActionDelegate"
|
||||||
helpContextId="add_register_group_action_context"
|
helpContextId="add_register_group_action_context"
|
||||||
|
|
|
@ -0,0 +1,64 @@
|
||||||
|
/**********************************************************************
|
||||||
|
* Copyright (c) 2004 QNX Software Systems and others.
|
||||||
|
* All rights reserved. This program and the accompanying materials
|
||||||
|
* are made available under the terms of the Common Public License v1.0
|
||||||
|
* which accompanies this distribution, and is available at
|
||||||
|
* http://www.eclipse.org/legal/cpl-v10.html
|
||||||
|
*
|
||||||
|
* Contributors:
|
||||||
|
* QNX Software Systems - Initial API and implementation
|
||||||
|
***********************************************************************/
|
||||||
|
package org.eclipse.cdt.debug.internal.ui.actions;
|
||||||
|
|
||||||
|
import org.eclipse.cdt.debug.core.model.ICDebugTarget;
|
||||||
|
import org.eclipse.debug.core.DebugEvent;
|
||||||
|
import org.eclipse.debug.core.DebugException;
|
||||||
|
import org.eclipse.debug.core.model.IDebugElement;
|
||||||
|
import org.eclipse.debug.ui.DebugUITools;
|
||||||
|
import org.eclipse.jface.action.IAction;
|
||||||
|
import org.eclipse.jface.viewers.StructuredSelection;
|
||||||
|
|
||||||
|
|
||||||
|
public class RestoreDefaultRegisterGroupsActionDelegate extends AbstractViewActionDelegate {
|
||||||
|
|
||||||
|
protected String getErrorDialogTitle() {
|
||||||
|
return "Error";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getErrorDialogMessage() {
|
||||||
|
return "Error(s) occurred restoring default register groups.";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void doAction() throws DebugException {
|
||||||
|
getDebugTarget().restoreDefaultRegisterGroups();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void update() {
|
||||||
|
IAction action = getAction();
|
||||||
|
if ( action != null ) {
|
||||||
|
ICDebugTarget target = getDebugTarget();
|
||||||
|
action.setEnabled( ( target != null ) ? target.isSuspended() : false );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected void doHandleDebugEvent( DebugEvent event ) {
|
||||||
|
}
|
||||||
|
|
||||||
|
private ICDebugTarget getDebugTarget() {
|
||||||
|
Object element = getSelection().getFirstElement();
|
||||||
|
if ( element instanceof IDebugElement ) {
|
||||||
|
return (ICDebugTarget)((IDebugElement)element).getDebugTarget().getAdapter( ICDebugTarget.class );
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.eclipse.cdt.debug.internal.ui.actions.AbstractViewActionDelegate#init(org.eclipse.jface.action.IAction)
|
||||||
|
*/
|
||||||
|
public void init( IAction action ) {
|
||||||
|
super.init( action );
|
||||||
|
Object element = DebugUITools.getDebugContext();
|
||||||
|
setSelection( (element != null) ? new StructuredSelection( element ) : new StructuredSelection() );
|
||||||
|
update();
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue