mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-31 21:05:37 +02:00
[300718] Remove breakpoint action immediately when it is deleted.
This commit is contained in:
parent
28c7d3f789
commit
4197295a2c
3 changed files with 45 additions and 5 deletions
|
@ -107,6 +107,22 @@ public class ActionsList extends Composite {
|
||||||
updateButtons();
|
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() {
|
public String getActionNames() {
|
||||||
StringBuffer result = new StringBuffer();
|
StringBuffer result = new StringBuffer();
|
||||||
TableItem[] currentItems = table.getItems();
|
TableItem[] currentItems = table.getItems();
|
||||||
|
|
|
@ -85,6 +85,12 @@ public class ActionsPropertyPage extends PropertyPage {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
globalActionsList.getDeleteButton().addSelectionListener(new SelectionAdapter() {
|
||||||
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
HandleDeleteButton();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
return container;
|
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() {
|
protected void performDefaults() {
|
||||||
try {
|
try {
|
||||||
breakpointMarker.setAttribute(BreakpointActionManager.BREAKPOINT_ACTION_ATTRIBUTE, ""); //$NON-NLS-1$
|
breakpointMarker.setAttribute(BreakpointActionManager.BREAKPOINT_ACTION_ATTRIBUTE, ""); //$NON-NLS-1$
|
||||||
|
|
|
@ -117,11 +117,6 @@ public class GlobalActionsList extends Composite {
|
||||||
editButton.setEnabled(hasActions);
|
editButton.setEnabled(hasActions);
|
||||||
|
|
||||||
deleteButton = new Button(this, SWT.NONE);
|
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.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
|
||||||
deleteButton.setText(Messages.getString("GlobalActionsList.6")); //$NON-NLS-1$
|
deleteButton.setText(Messages.getString("GlobalActionsList.6")); //$NON-NLS-1$
|
||||||
deleteButton.setEnabled(hasActions);
|
deleteButton.setEnabled(hasActions);
|
||||||
|
@ -132,6 +127,13 @@ public class GlobalActionsList extends Composite {
|
||||||
return attachButton;
|
return attachButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @since 7.0
|
||||||
|
*/
|
||||||
|
public Button getDeleteButton() {
|
||||||
|
return deleteButton;
|
||||||
|
}
|
||||||
|
|
||||||
public IBreakpointAction[] getSelectedActions() {
|
public IBreakpointAction[] getSelectedActions() {
|
||||||
TableItem[] selectedItems = table.getSelection();
|
TableItem[] selectedItems = table.getSelection();
|
||||||
IBreakpointAction[] actionList = new IBreakpointAction[selectedItems.length];
|
IBreakpointAction[] actionList = new IBreakpointAction[selectedItems.length];
|
||||||
|
|
Loading…
Add table
Reference in a new issue