mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-24 09:25:31 +02:00
Bug 94139: User-defined register groups. Support fo the "Edit Register Group" action.
This commit is contained in:
parent
6e8ba9eebb
commit
34250c8463
13 changed files with 186 additions and 19 deletions
|
@ -1,3 +1,12 @@
|
|||
2005-06-07 Mikhail Khodjaiants
|
||||
Bug 94139: User-defined register groups.
|
||||
Support fo the "Edit Register Group" action.
|
||||
* ICDebugTarget.java
|
||||
* IPersistableRegisterGroup.java
|
||||
* CRegisterManager.java
|
||||
* CDebugTarget.java
|
||||
* CRegisterGroup.java
|
||||
|
||||
2005-06-07 Mikhail Khodjaiants
|
||||
The endianness flag is not chached.
|
||||
* CDebugTarget.java
|
||||
|
|
|
@ -106,7 +106,7 @@ public interface ICDebugTarget extends IDebugTarget,
|
|||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public void addUserDefinedRegisterGroup( String name, IRegisterDescriptor[] descriptors );
|
||||
public void addRegisterGroup( String name, IRegisterDescriptor[] descriptors );
|
||||
|
||||
/**
|
||||
* Removes the given register group from the target
|
||||
|
@ -116,4 +116,14 @@ public interface ICDebugTarget extends IDebugTarget,
|
|||
* @since 3.0
|
||||
*/
|
||||
public void removeRegisterGroups( IRegisterGroup[] groups );
|
||||
|
||||
/**
|
||||
* Replace the given group's register descriptors by the specified descriptors.
|
||||
*
|
||||
* @param group a group to be modified
|
||||
* @param descriptors a descriptor array to replace existing descriptors
|
||||
*
|
||||
* @since 3.0
|
||||
*/
|
||||
public void modifyRegisterGroup( IPersistableRegisterGroup group, IRegisterDescriptor[] descriptors );
|
||||
}
|
||||
|
|
|
@ -36,4 +36,18 @@ public interface IPersistableRegisterGroup extends IRegisterGroup {
|
|||
* @exception CoreException on failure to initialize
|
||||
*/
|
||||
public void initializeFromMemento( String memento ) throws CoreException;
|
||||
|
||||
/**
|
||||
* Returns the array of group's register descriptors.
|
||||
*
|
||||
* @return the array of group's register descriptors
|
||||
*/
|
||||
public IRegisterDescriptor[] getRegisterDescriptors();
|
||||
|
||||
/**
|
||||
* Replaces the group register descriptors by the specified descriptors.
|
||||
*
|
||||
* @param the array of register descriptors
|
||||
*/
|
||||
public void setRegisterDescriptors( IRegisterDescriptor[] registerDescriptors );
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.eclipse.cdt.debug.core.ICDTLaunchConfigurationConstants;
|
|||
import org.eclipse.cdt.debug.core.cdi.CDIException;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterDescriptor;
|
||||
import org.eclipse.cdt.debug.core.cdi.model.ICDIRegisterGroup;
|
||||
import org.eclipse.cdt.debug.core.model.IPersistableRegisterGroup;
|
||||
import org.eclipse.cdt.debug.core.model.IRegisterDescriptor;
|
||||
import org.eclipse.cdt.debug.internal.core.model.CDebugTarget;
|
||||
import org.eclipse.cdt.debug.internal.core.model.CRegisterDescriptor;
|
||||
|
@ -273,4 +274,15 @@ public class CRegisterManager {
|
|||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void modifyRegisterGroup( final IPersistableRegisterGroup group, final IRegisterDescriptor[] descriptors ) {
|
||||
DebugPlugin.getDefault().asyncExec(
|
||||
new Runnable() {
|
||||
public void run() {
|
||||
group.setRegisterDescriptors( descriptors );
|
||||
((CRegisterGroup)group).fireChangeEvent( DebugEvent.CONTENT );
|
||||
}
|
||||
} );
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -72,6 +72,7 @@ import org.eclipse.cdt.debug.core.model.IDebuggerProcessSupport;
|
|||
import org.eclipse.cdt.debug.core.model.IDisassembly;
|
||||
import org.eclipse.cdt.debug.core.model.IExecFileInfo;
|
||||
import org.eclipse.cdt.debug.core.model.IGlobalVariableDescriptor;
|
||||
import org.eclipse.cdt.debug.core.model.IPersistableRegisterGroup;
|
||||
import org.eclipse.cdt.debug.core.model.IRegisterDescriptor;
|
||||
import org.eclipse.cdt.debug.core.sourcelookup.CDirectorySourceContainer;
|
||||
import org.eclipse.cdt.debug.core.sourcelookup.ICSourceLocator;
|
||||
|
@ -1736,7 +1737,7 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
|||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICDebugTarget#addUserDefinedRegisterGroup(java.lang.String, org.eclipse.cdt.debug.core.model.IRegisterDescriptor[])
|
||||
*/
|
||||
public void addUserDefinedRegisterGroup( String name, IRegisterDescriptor[] descriptors ) {
|
||||
public void addRegisterGroup( String name, IRegisterDescriptor[] descriptors ) {
|
||||
getRegisterManager().addRegisterGroup( name, descriptors );
|
||||
}
|
||||
|
||||
|
@ -1747,6 +1748,13 @@ public class CDebugTarget extends CDebugElement implements ICDebugTarget, ICDIEv
|
|||
getRegisterManager().removeRegisterGroups( groups );
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.ICDebugTarget#modifyRegisterGroup(org.eclipse.cdt.debug.core.model.IPersistableRegisterGroup, org.eclipse.cdt.debug.core.model.IRegisterDescriptor[])
|
||||
*/
|
||||
public void modifyRegisterGroup( IPersistableRegisterGroup group, IRegisterDescriptor[] descriptors ) {
|
||||
getRegisterManager().modifyRegisterGroup( group, descriptors );
|
||||
}
|
||||
|
||||
protected void skipBreakpoints( boolean enabled ) {
|
||||
getBreakpointManager().skipBreakpoints( enabled );
|
||||
}
|
||||
|
|
|
@ -97,15 +97,7 @@ public class CRegisterGroup extends CDebugElement implements IPersistableRegiste
|
|||
|
||||
public void dispose() {
|
||||
fDisposed = true;
|
||||
if (fRegisters == null) {
|
||||
return;
|
||||
}
|
||||
for ( int i = 0; i < fRegisters.length; ++i ) {
|
||||
if ( fRegisters[i] != null ) {
|
||||
((CRegister)fRegisters[i]).dispose();
|
||||
}
|
||||
}
|
||||
fRegisters = null;
|
||||
invalidate();
|
||||
}
|
||||
|
||||
public void targetSuspended() {
|
||||
|
@ -216,7 +208,7 @@ public class CRegisterGroup extends CDebugElement implements IPersistableRegiste
|
|||
childNode = childNode.getNextSibling();
|
||||
}
|
||||
setName( groupName );
|
||||
setRegisterDescriptors( (IRegisterDescriptor[])list.toArray( new IRegisterDescriptor[list.size()] ) );
|
||||
fRegisterDescriptors = (IRegisterDescriptor[])list.toArray( new IRegisterDescriptor[list.size()] );
|
||||
setEnabled( enabled );
|
||||
}
|
||||
|
||||
|
@ -229,11 +221,34 @@ public class CRegisterGroup extends CDebugElement implements IPersistableRegiste
|
|||
fName = name;
|
||||
}
|
||||
|
||||
private void setRegisterDescriptors( IRegisterDescriptor[] registerDescriptors ) {
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.IPersistableRegisterGroup#setRegisterDescriptors(org.eclipse.cdt.debug.core.model.IRegisterDescriptor[])
|
||||
*/
|
||||
public void setRegisterDescriptors( IRegisterDescriptor[] registerDescriptors ) {
|
||||
invalidate();
|
||||
fRegisterDescriptors = registerDescriptors;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.cdt.debug.core.model.IPersistableRegisterGroup#getRegisterDescriptors()
|
||||
*/
|
||||
public IRegisterDescriptor[] getRegisterDescriptors() {
|
||||
return fRegisterDescriptors;
|
||||
}
|
||||
|
||||
private CRegisterManager getRegisterManager() {
|
||||
return (CRegisterManager)getDebugTarget().getAdapter( CRegisterManager.class );
|
||||
}
|
||||
|
||||
private void invalidate() {
|
||||
if (fRegisters == null) {
|
||||
return;
|
||||
}
|
||||
for ( int i = 0; i < fRegisters.length; ++i ) {
|
||||
if ( fRegisters[i] != null ) {
|
||||
((CRegister)fRegisters[i]).dispose();
|
||||
}
|
||||
}
|
||||
fRegisters = null;
|
||||
}
|
||||
}
|
|
@ -1,3 +1,13 @@
|
|||
2005-06-07 Mikhail Khodjaiants
|
||||
Bug 94139: User-defined register groups.
|
||||
Support fo the "Edit Register Group" action.
|
||||
* AbstractViewActionDelegate.java
|
||||
* ActionMessages.properties
|
||||
* AddRegisterGroupActionDelegate.java
|
||||
+ EditRegisterGroupActionDelegate.java
|
||||
* plugin.properties
|
||||
* plugin.xml
|
||||
|
||||
2005-05-31 Mikhail Khodjaiants
|
||||
Bug 84816: The modification of the signal properties should be done in the background.
|
||||
* SignalPropertyPage.java
|
||||
|
|
|
@ -124,3 +124,5 @@ AddRegisterGroupAction.label=Add Register Group
|
|||
AddRegisterGroupAction.tooltip=Add Register Group
|
||||
RemoveRegisterGroupAction.label=Remove Register Group
|
||||
RemoveRegisterGroupAction.tooltip=Remove Register Group
|
||||
EditRegisterGroupAction.label=Edit Register Group
|
||||
EditRegisterGroupAction.tooltip=Edit Register Group
|
||||
|
|
|
@ -729,7 +729,7 @@
|
|||
<objectContribution
|
||||
adaptable="false"
|
||||
id="org.eclipse.cdt.debug.ui.RegisterGroupActions"
|
||||
objectClass="org.eclipse.debug.core.model.IRegisterGroup">
|
||||
objectClass="org.eclipse.cdt.debug.core.model.IPersistableRegisterGroup">
|
||||
<action
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.RemoveRegisterGroupActionDelegate"
|
||||
enablesFor="+"
|
||||
|
@ -738,6 +738,14 @@
|
|||
label="%RemoveRegisterGroupAction.label"
|
||||
menubarPath="additions"
|
||||
tooltip="%RemoveRegisterGroupAction.tooltip"/>
|
||||
<action
|
||||
class="org.eclipse.cdt.debug.internal.ui.actions.EditRegisterGroupActionDelegate"
|
||||
enablesFor="1"
|
||||
helpContextId="edit_register_group_action_context"
|
||||
id="org.eclipse.cdt.debug.ui.editRegisterGroupAction"
|
||||
label="%EditRegisterGroupAction.label"
|
||||
menubarPath="additions"
|
||||
tooltip="%EditRegisterGroupAction.tooltip"/>
|
||||
</objectContribution>
|
||||
</extension>
|
||||
<extension
|
||||
|
|
|
@ -17,7 +17,6 @@ import org.eclipse.debug.core.DebugEvent;
|
|||
import org.eclipse.debug.core.DebugException;
|
||||
import org.eclipse.debug.core.DebugPlugin;
|
||||
import org.eclipse.debug.core.IDebugEventSetListener;
|
||||
import org.eclipse.debug.internal.ui.DebugUIPlugin;
|
||||
import org.eclipse.debug.ui.DebugUITools;
|
||||
import org.eclipse.debug.ui.IDebugUIConstants;
|
||||
import org.eclipse.debug.ui.IDebugView;
|
||||
|
@ -109,12 +108,12 @@ public abstract class AbstractViewActionDelegate extends ActionDelegate implemen
|
|||
}
|
||||
} );
|
||||
if ( !ms.isOK() ) {
|
||||
IWorkbenchWindow window = DebugUIPlugin.getActiveWorkbenchWindow();
|
||||
IWorkbenchWindow window = CDebugUIPlugin.getActiveWorkbenchWindow();
|
||||
if ( window != null ) {
|
||||
DebugUIPlugin.errorDialog( window.getShell(), getErrorDialogTitle(), getErrorDialogMessage(), ms.getChildren()[0] ); //$NON-NLS-1$
|
||||
CDebugUIPlugin.errorDialog( getErrorDialogMessage(), ms.getChildren()[0] ); //$NON-NLS-1$
|
||||
}
|
||||
else {
|
||||
DebugUIPlugin.log( ms );
|
||||
CDebugUIPlugin.log( ms );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -114,3 +114,4 @@ ToggleDetailPaneAction.6=Hide the Detail Pane so that only the Main Tree View is
|
|||
ToggleDetailPaneAction.7=Hide the Detail Pane so that only the Main Tree View is Visible
|
||||
AddRegisterGroupActionDelegate.0=Error
|
||||
AddRegisterGroupActionDelegate.1=Error(s) occurred adding register group.
|
||||
EditRegisterGroupActionDelegate.0=Unable to edit register group.
|
||||
|
|
|
@ -44,7 +44,7 @@ public class AddRegisterGroupActionDelegate extends AbstractViewActionDelegate {
|
|||
protected void doAction() throws DebugException {
|
||||
RegisterGroupDialog dialog = new RegisterGroupDialog( getView().getSite().getShell(), getDebugTarget().getRegisterDescriptors() );
|
||||
if ( dialog.open() == Window.OK ) {
|
||||
getDebugTarget().addUserDefinedRegisterGroup( dialog.getName(), dialog.getDescriptors() );
|
||||
getDebugTarget().addRegisterGroup( dialog.getName(), dialog.getDescriptors() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,79 @@
|
|||
/**********************************************************************
|
||||
* 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.cdt.debug.core.model.IPersistableRegisterGroup;
|
||||
import org.eclipse.cdt.debug.core.model.IRegisterDescriptor;
|
||||
import org.eclipse.cdt.debug.internal.core.model.CDebugTarget;
|
||||
import org.eclipse.cdt.debug.ui.CDebugUIPlugin;
|
||||
import org.eclipse.debug.core.DebugException;
|
||||
import org.eclipse.debug.core.model.IDebugTarget;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.window.Window;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.ui.IObjectActionDelegate;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
import org.eclipse.ui.actions.ActionDelegate;
|
||||
|
||||
|
||||
public class EditRegisterGroupActionDelegate extends ActionDelegate implements IObjectActionDelegate {
|
||||
|
||||
private IPersistableRegisterGroup fSelection;
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.IObjectActionDelegate#setActivePart(org.eclipse.jface.action.IAction, org.eclipse.ui.IWorkbenchPart)
|
||||
*/
|
||||
public void setActivePart( IAction action, IWorkbenchPart targetPart ) {
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.actions.ActionDelegate#selectionChanged(org.eclipse.jface.action.IAction, org.eclipse.jface.viewers.ISelection)
|
||||
*/
|
||||
public void selectionChanged( IAction action, ISelection selection ) {
|
||||
if ( selection instanceof IStructuredSelection ) {
|
||||
IStructuredSelection ss = (IStructuredSelection)selection;
|
||||
if ( !ss.isEmpty() ) {
|
||||
Object s = ss.getFirstElement();
|
||||
if ( s instanceof IPersistableRegisterGroup ) {
|
||||
fSelection = (IPersistableRegisterGroup)s;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private IPersistableRegisterGroup getRegisterGroup() {
|
||||
return fSelection;
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
* @see org.eclipse.ui.actions.ActionDelegate#run(org.eclipse.jface.action.IAction)
|
||||
*/
|
||||
public void run( IAction action ) {
|
||||
IPersistableRegisterGroup group = getRegisterGroup();
|
||||
IRegisterDescriptor[] all;
|
||||
try {
|
||||
all = ((CDebugTarget)group.getDebugTarget()).getRegisterDescriptors();
|
||||
RegisterGroupDialog dialog = new RegisterGroupDialog( Display.getCurrent().getActiveShell(), group.getName(), all, group.getRegisterDescriptors() );
|
||||
if ( dialog.open() == Window.OK ) {
|
||||
IDebugTarget target = group.getDebugTarget();
|
||||
if ( target instanceof ICDebugTarget ) {
|
||||
((ICDebugTarget)target).modifyRegisterGroup( group, dialog.getDescriptors() );
|
||||
}
|
||||
}
|
||||
}
|
||||
catch( DebugException e ) {
|
||||
CDebugUIPlugin.errorDialog( ActionMessages.getString( "EditRegisterGroupActionDelegate.0" ), e.getStatus() ); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Reference in a new issue