mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-06-09 18:56:02 +02:00
Bug 466516 - Editing a breakpoint action is not immediately reflected in the list of attached actions
Change-Id: Ifa5b5d88d1174f350555b28f15d375073364a56a Signed-off-by: Anton Leherbauer <anton.leherbauer@windriver.com>
This commit is contained in:
parent
e78acb4fdf
commit
10079aca6b
3 changed files with 39 additions and 24 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2010 Nokia and others.
|
* Copyright (c) 2007, 2015 Nokia and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -200,4 +200,22 @@ public class ActionsList extends Composite {
|
||||||
removeButton.setEnabled(selectedItems.length > 0);
|
removeButton.setEnabled(selectedItems.length > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the appearance of given action.
|
||||||
|
* @param action
|
||||||
|
*/
|
||||||
|
void updateAction(IBreakpointAction action) {
|
||||||
|
TableItem[] currentItems = table.getItems();
|
||||||
|
for (int i = 0; i < currentItems.length; i++) {
|
||||||
|
if (((IBreakpointAction) currentItems[i].getData()).equals(action)) {
|
||||||
|
TableItem tableItem = currentItems[i];
|
||||||
|
tableItem.setText(0, action.getName());
|
||||||
|
tableItem.setText(1, action.getTypeName());
|
||||||
|
tableItem.setText(2, action.getSummary());
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updateButtons();
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2010 Nokia and others.
|
* Copyright (c) 2007, 2015 Nokia and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -80,6 +80,9 @@ public class ActionsPropertyPage extends PropertyPage {
|
||||||
String actionNames = breakpointMarker.getAttribute(BreakpointActionManager.BREAKPOINT_ACTION_ATTRIBUTE, ""); //$NON-NLS-1$
|
String actionNames = breakpointMarker.getAttribute(BreakpointActionManager.BREAKPOINT_ACTION_ATTRIBUTE, ""); //$NON-NLS-1$
|
||||||
actionsList.setNames(actionNames);
|
actionsList.setNames(actionNames);
|
||||||
|
|
||||||
|
// connect attached actions list to global list
|
||||||
|
globalActionsList.setClientList(actionsList);
|
||||||
|
|
||||||
globalActionsList.getAttachButton().addSelectionListener(new SelectionAdapter() {
|
globalActionsList.getAttachButton().addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
@ -98,7 +101,6 @@ public class ActionsPropertyPage extends PropertyPage {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void HandleAttachButton() {
|
protected void HandleAttachButton() {
|
||||||
|
|
||||||
IBreakpointAction[] selectedActions = globalActionsList.getSelectedActions();
|
IBreakpointAction[] selectedActions = globalActionsList.getSelectedActions();
|
||||||
for (int i = 0; i < selectedActions.length; i++) {
|
for (int i = 0; i < selectedActions.length; i++) {
|
||||||
actionsList.addAction(selectedActions[i]);
|
actionsList.addAction(selectedActions[i]);
|
||||||
|
@ -111,13 +113,7 @@ public class ActionsPropertyPage extends PropertyPage {
|
||||||
* @since 7.0
|
* @since 7.0
|
||||||
*/
|
*/
|
||||||
protected void HandleDeleteButton() {
|
protected void HandleDeleteButton() {
|
||||||
|
// attached actions are now handled by the GlobalActionsList
|
||||||
// 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();
|
globalActionsList.HandleDeleteButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2007, 2010 Nokia and others.
|
* Copyright (c) 2007, 2015 Nokia and others.
|
||||||
* All rights reserved. This program and the accompanying materials
|
* All rights reserved. This program and the accompanying materials
|
||||||
* are made available under the terms of the Eclipse Public License v1.0
|
* are made available under the terms of the Eclipse Public License v1.0
|
||||||
* which accompanies this distribution, and is available at
|
* which accompanies this distribution, and is available at
|
||||||
|
@ -10,9 +10,6 @@
|
||||||
*******************************************************************************/
|
*******************************************************************************/
|
||||||
package org.eclipse.cdt.debug.ui.breakpointactions;
|
package org.eclipse.cdt.debug.ui.breakpointactions;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Iterator;
|
|
||||||
|
|
||||||
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
import org.eclipse.cdt.debug.core.CDebugCorePlugin;
|
||||||
import org.eclipse.cdt.debug.core.breakpointactions.IBreakpointAction;
|
import org.eclipse.cdt.debug.core.breakpointactions.IBreakpointAction;
|
||||||
import org.eclipse.core.runtime.CoreException;
|
import org.eclipse.core.runtime.CoreException;
|
||||||
|
@ -35,6 +32,7 @@ public class GlobalActionsList extends Composite {
|
||||||
private Button editButton = null;
|
private Button editButton = null;
|
||||||
private Button newButton = null;
|
private Button newButton = null;
|
||||||
private Table table = null;
|
private Table table = null;
|
||||||
|
private ActionsList clientList;
|
||||||
|
|
||||||
public GlobalActionsList(Composite parent, int style, boolean useAttachButton) {
|
public GlobalActionsList(Composite parent, int style, boolean useAttachButton) {
|
||||||
super(parent, style);
|
super(parent, style);
|
||||||
|
@ -74,10 +72,7 @@ public class GlobalActionsList extends Composite {
|
||||||
summaryTableColumn.setWidth(120);
|
summaryTableColumn.setWidth(120);
|
||||||
summaryTableColumn.setText(Messages.getString("GlobalActionsList.2")); //$NON-NLS-1$
|
summaryTableColumn.setText(Messages.getString("GlobalActionsList.2")); //$NON-NLS-1$
|
||||||
|
|
||||||
ArrayList actions = CDebugCorePlugin.getDefault().getBreakpointActionManager().getBreakpointActions();
|
for (IBreakpointAction element : CDebugCorePlugin.getDefault().getBreakpointActionManager().getBreakpointActions()) {
|
||||||
|
|
||||||
for (Iterator iter = CDebugCorePlugin.getDefault().getBreakpointActionManager().getBreakpointActions().iterator(); iter.hasNext();) {
|
|
||||||
IBreakpointAction element = (IBreakpointAction) iter.next();
|
|
||||||
final TableItem tableItem = new TableItem(table, SWT.NONE);
|
final TableItem tableItem = new TableItem(table, SWT.NONE);
|
||||||
tableItem.setText(0, element.getName());
|
tableItem.setText(0, element.getName());
|
||||||
tableItem.setText(1, element.getTypeName());
|
tableItem.setText(1, element.getTypeName());
|
||||||
|
@ -111,7 +106,6 @@ public class GlobalActionsList extends Composite {
|
||||||
editButton.addSelectionListener(new SelectionAdapter() {
|
editButton.addSelectionListener(new SelectionAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void widgetSelected(SelectionEvent e) {
|
public void widgetSelected(SelectionEvent e) {
|
||||||
|
|
||||||
HandleEditButton();
|
HandleEditButton();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -150,6 +144,8 @@ public class GlobalActionsList extends Composite {
|
||||||
TableItem[] selectedItems = table.getSelection();
|
TableItem[] selectedItems = table.getSelection();
|
||||||
for (int i = 0; i < selectedItems.length; i++) {
|
for (int i = 0; i < selectedItems.length; i++) {
|
||||||
IBreakpointAction action = (IBreakpointAction) selectedItems[i].getData();
|
IBreakpointAction action = (IBreakpointAction) selectedItems[i].getData();
|
||||||
|
if (clientList != null)
|
||||||
|
clientList.removeAction(action);
|
||||||
CDebugCorePlugin.getDefault().getBreakpointActionManager().deleteAction(action);
|
CDebugCorePlugin.getDefault().getBreakpointActionManager().deleteAction(action);
|
||||||
}
|
}
|
||||||
table.remove(table.getSelectionIndices());
|
table.remove(table.getSelectionIndices());
|
||||||
|
@ -160,7 +156,6 @@ public class GlobalActionsList extends Composite {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void HandleEditButton() {
|
protected void HandleEditButton() {
|
||||||
|
|
||||||
TableItem[] selectedItems = table.getSelection();
|
TableItem[] selectedItems = table.getSelection();
|
||||||
IBreakpointAction action = (IBreakpointAction) selectedItems[0].getData();
|
IBreakpointAction action = (IBreakpointAction) selectedItems[0].getData();
|
||||||
|
|
||||||
|
@ -171,12 +166,12 @@ public class GlobalActionsList extends Composite {
|
||||||
selectedItems[0].setText(0, action.getName());
|
selectedItems[0].setText(0, action.getName());
|
||||||
selectedItems[0].setText(1, action.getTypeName());
|
selectedItems[0].setText(1, action.getTypeName());
|
||||||
selectedItems[0].setText(2, action.getSummary());
|
selectedItems[0].setText(2, action.getSummary());
|
||||||
|
if (clientList != null)
|
||||||
|
clientList.updateAction(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void HandleNewButton() throws CoreException {
|
protected void HandleNewButton() throws CoreException {
|
||||||
|
|
||||||
ActionDialog dialog = new ActionDialog(this.getShell(), null);
|
ActionDialog dialog = new ActionDialog(this.getShell(), null);
|
||||||
int result = dialog.open();
|
int result = dialog.open();
|
||||||
if (result == Window.OK) {
|
if (result == Window.OK) {
|
||||||
|
@ -188,9 +183,7 @@ public class GlobalActionsList extends Composite {
|
||||||
tableItem.setText(1, action.getTypeName());
|
tableItem.setText(1, action.getTypeName());
|
||||||
tableItem.setText(2, action.getSummary());
|
tableItem.setText(2, action.getSummary());
|
||||||
tableItem.setData(action);
|
tableItem.setData(action);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void updateButtons() {
|
public void updateButtons() {
|
||||||
|
@ -201,4 +194,12 @@ public class GlobalActionsList extends Composite {
|
||||||
editButton.setEnabled(selectedItems.length > 0);
|
editButton.setEnabled(selectedItems.length > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register client list to be notified of changes to actions.
|
||||||
|
* @param actionsList
|
||||||
|
*/
|
||||||
|
void setClientList(ActionsList actionsList) {
|
||||||
|
clientList = actionsList;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue