1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-23 17:05:26 +02:00

[300718] Remove breakpoint action immediately when it is deleted.

This commit is contained in:
Marc Khouzam 2010-01-25 19:41:51 +00:00
parent 28c7d3f789
commit 4197295a2c
3 changed files with 45 additions and 5 deletions

View file

@ -107,6 +107,22 @@ public class ActionsList extends Composite {
updateButtons();
}
/**
* Remove an action from the list
*
* @since 7.0
*/
public void removeAction(IBreakpointAction action) {
TableItem[] currentItems = table.getItems();
for (int i = 0; i < currentItems.length; i++) {
if (((IBreakpointAction) currentItems[i].getData()).equals(action)) {
table.remove(i);
break;
}
}
updateButtons();
}
public String getActionNames() {
StringBuffer result = new StringBuffer();
TableItem[] currentItems = table.getItems();

View file

@ -85,6 +85,12 @@ public class ActionsPropertyPage extends PropertyPage {
}
});
globalActionsList.getDeleteButton().addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
HandleDeleteButton();
}
});
return container;
}
@ -96,6 +102,22 @@ public class ActionsPropertyPage extends PropertyPage {
}
}
/**
* Clean up attached actions that were just deleted from the GlobalActionList
*
* @since 7.0
*/
protected void HandleDeleteButton() {
// First remove any attached action that was just deleted
IBreakpointAction[] selectedActions = globalActionsList.getSelectedActions();
for (int i = 0; i < selectedActions.length; i++) {
actionsList.removeAction(selectedActions[i]);
}
// Now cleanup the global action list
globalActionsList.HandleDeleteButton();
}
protected void performDefaults() {
try {
breakpointMarker.setAttribute(BreakpointActionManager.BREAKPOINT_ACTION_ATTRIBUTE, ""); //$NON-NLS-1$

View file

@ -117,11 +117,6 @@ public class GlobalActionsList extends Composite {
editButton.setEnabled(hasActions);
deleteButton = new Button(this, SWT.NONE);
deleteButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
HandleDeleteButton();
}
});
deleteButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
deleteButton.setText(Messages.getString("GlobalActionsList.6")); //$NON-NLS-1$
deleteButton.setEnabled(hasActions);
@ -132,6 +127,13 @@ public class GlobalActionsList extends Composite {
return attachButton;
}
/**
* @since 7.0
*/
public Button getDeleteButton() {
return deleteButton;
}
public IBreakpointAction[] getSelectedActions() {
TableItem[] selectedItems = table.getSelection();
IBreakpointAction[] actionList = new IBreakpointAction[selectedItems.length];