mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-23 17:05:26 +02:00
Bug 473098 - Reflect tp action changes from while-stepping
The action changes were not immediately shown when changes were done from the while-stepping action dialog Change-Id: I36c4b366f0fd97d0a5c939b17eda5e6cd696d89d
This commit is contained in:
parent
05a2939d54
commit
bb50c58c02
5 changed files with 98 additions and 24 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2010 Nokia and others.
|
* Copyright (c) 2010, 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
|
||||||
|
@ -74,6 +74,10 @@ public class TracepointActionDialog extends Dialog {
|
||||||
private int lastSelectedActionTypeIndex;
|
private int lastSelectedActionTypeIndex;
|
||||||
private IBreakpointAction originalAction;
|
private IBreakpointAction originalAction;
|
||||||
private boolean isSubAction;
|
private boolean isSubAction;
|
||||||
|
|
||||||
|
// If this dialog is for a "while-stepping" action, we keep track
|
||||||
|
// of the parent global list, so that it can be updated.
|
||||||
|
private TracepointGlobalActionsList parentGlobalList;
|
||||||
|
|
||||||
private IExtension[] breakpointActionPageExtensions;
|
private IExtension[] breakpointActionPageExtensions;
|
||||||
|
|
||||||
|
@ -82,13 +86,15 @@ public class TracepointActionDialog extends Dialog {
|
||||||
/**
|
/**
|
||||||
* Create the dialog
|
* Create the dialog
|
||||||
*/
|
*/
|
||||||
public TracepointActionDialog(Shell parentShell, ITracepointAction action, boolean isSub) {
|
public TracepointActionDialog(Shell parentShell, ITracepointAction action,
|
||||||
|
TracepointGlobalActionsList parentList, boolean isSub) {
|
||||||
super(parentShell);
|
super(parentShell);
|
||||||
setShellStyle(getShellStyle() | SWT.MAX | SWT.RESIZE);
|
setShellStyle(getShellStyle() | SWT.MAX | SWT.RESIZE);
|
||||||
originalAction = action;
|
originalAction = action;
|
||||||
tracepointAction = action;
|
tracepointAction = action;
|
||||||
lastSelectedActionTypeIndex = 0;
|
lastSelectedActionTypeIndex = 0;
|
||||||
isSubAction = isSub;
|
isSubAction = isSub;
|
||||||
|
parentGlobalList = parentList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -235,6 +241,9 @@ public class TracepointActionDialog extends Dialog {
|
||||||
if (actionPage == null) {
|
if (actionPage == null) {
|
||||||
actionPages[selectedTypeIndex] = getActionPage(tracepointActions.get(selectedTypeIndex));
|
actionPages[selectedTypeIndex] = getActionPage(tracepointActions.get(selectedTypeIndex));
|
||||||
actionPage = actionPages[selectedTypeIndex];
|
actionPage = actionPages[selectedTypeIndex];
|
||||||
|
if (actionPage instanceof WhileSteppingActionPage) {
|
||||||
|
((WhileSteppingActionPage)actionPage).setParentGlobalList(parentGlobalList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (actionComposites[selectedTypeIndex] == null) {
|
if (actionComposites[selectedTypeIndex] == null) {
|
||||||
Composite actionComposite = actionPages[selectedTypeIndex].createComposite(tracepointAction, actionArea, SWT.NONE);
|
Composite actionComposite = actionPages[selectedTypeIndex].createComposite(tracepointAction, actionArea, SWT.NONE);
|
||||||
|
|
|
@ -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
|
||||||
|
@ -45,7 +45,7 @@ public class TracepointActionsPreferencePage extends PreferencePage implements I
|
||||||
|
|
||||||
final Label breakpointActionsAvailableLabel = new Label(container, SWT.NONE);
|
final Label breakpointActionsAvailableLabel = new Label(container, SWT.NONE);
|
||||||
breakpointActionsAvailableLabel.setText(MessagesForTracepointActions.TracepointActions_Preferences_Actions_Available);
|
breakpointActionsAvailableLabel.setText(MessagesForTracepointActions.TracepointActions_Preferences_Actions_Available);
|
||||||
final TracepointGlobalActionsList actionsList = new TracepointGlobalActionsList(container, SWT.NONE, false, false);
|
final TracepointGlobalActionsList actionsList = new TracepointGlobalActionsList(container, SWT.NONE, false, null, false);
|
||||||
actionsList.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
|
actionsList.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true));
|
||||||
|
|
||||||
actionsList.getDeleteButton().addSelectionListener(new SelectionAdapter() {
|
actionsList.getDeleteButton().addSelectionListener(new SelectionAdapter() {
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class TracepointActionsPropertyPage extends PropertyPage {
|
||||||
allAvailableActionsLabel.setLayoutData(gridData_3);
|
allAvailableActionsLabel.setLayoutData(gridData_3);
|
||||||
allAvailableActionsLabel.setText(MessagesForTracepointActions.TracepointActions_Available_actions);
|
allAvailableActionsLabel.setText(MessagesForTracepointActions.TracepointActions_Available_actions);
|
||||||
|
|
||||||
globalActionsList = new TracepointGlobalActionsList(container, SWT.NONE, true, false);
|
globalActionsList = new TracepointGlobalActionsList(container, SWT.NONE, true, null, false);
|
||||||
final GridData gridData_1 = new GridData(GridData.FILL_BOTH);
|
final GridData gridData_1 = new GridData(GridData.FILL_BOTH);
|
||||||
gridData_1.horizontalSpan = 2;
|
gridData_1.horizontalSpan = 2;
|
||||||
globalActionsList.setLayoutData(gridData_1);
|
globalActionsList.setLayoutData(gridData_1);
|
||||||
|
|
|
@ -40,10 +40,16 @@ public class TracepointGlobalActionsList extends Composite {
|
||||||
private Table table;
|
private Table table;
|
||||||
private TracepointActionsList clientList;
|
private TracepointActionsList clientList;
|
||||||
private boolean isSubAction;
|
private boolean isSubAction;
|
||||||
|
|
||||||
|
// When dealing with a "while-stepping" action, we deal with a "child" global
|
||||||
|
// list, and must keep track of the parent global list, to properly update it.
|
||||||
|
// This field will be null when the this class represents the parent class itself.
|
||||||
|
private TracepointGlobalActionsList parentGlobalList;
|
||||||
|
|
||||||
public TracepointGlobalActionsList(Composite parent, int style, boolean useAttachButton, boolean isSub) {
|
public TracepointGlobalActionsList(Composite parent, int style, boolean useAttachButton, TracepointGlobalActionsList parentList, boolean isSub) {
|
||||||
super(parent, style);
|
super(parent, style);
|
||||||
isSubAction = isSub;
|
isSubAction = isSub;
|
||||||
|
parentGlobalList = parentList;
|
||||||
|
|
||||||
final GridLayout gridLayout = new GridLayout();
|
final GridLayout gridLayout = new GridLayout();
|
||||||
gridLayout.numColumns = 5;
|
gridLayout.numColumns = 5;
|
||||||
|
@ -153,21 +159,41 @@ public class TracepointGlobalActionsList extends Composite {
|
||||||
if (clientList != null) {
|
if (clientList != null) {
|
||||||
clientList.removeAction(action);
|
clientList.removeAction(action);
|
||||||
}
|
}
|
||||||
|
if (parentGlobalList != null) {
|
||||||
|
assert isSubAction;
|
||||||
|
// Update the parent list also
|
||||||
|
parentGlobalList.removeAction(action);
|
||||||
|
}
|
||||||
TracepointActionManager.getInstance().deleteAction(action);
|
TracepointActionManager.getInstance().deleteAction(action);
|
||||||
}
|
}
|
||||||
|
// Remove all selected actions at once
|
||||||
table.remove(table.getSelectionIndices());
|
table.remove(table.getSelectionIndices());
|
||||||
if (table.getItemCount() > 0) {
|
if (table.getItemCount() > 0) {
|
||||||
table.select(table.getItemCount() - 1);
|
table.select(table.getItemCount() - 1);
|
||||||
}
|
}
|
||||||
updateButtons();
|
updateButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void removeAction(ITracepointAction action) {
|
||||||
|
TableItem[] currentItems = table.getItems();
|
||||||
|
for (int i = 0; i < currentItems.length; i++) {
|
||||||
|
if (((ITracepointAction) currentItems[i].getData()).equals(action)) {
|
||||||
|
table.remove(i);
|
||||||
|
if (clientList != null) {
|
||||||
|
clientList.removeAction(action);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updateButtons();
|
||||||
|
}
|
||||||
|
|
||||||
protected void HandleEditButton() {
|
protected void HandleEditButton() {
|
||||||
|
|
||||||
TableItem[] selectedItems = table.getSelection();
|
TableItem[] selectedItems = table.getSelection();
|
||||||
ITracepointAction action = (ITracepointAction) selectedItems[0].getData();
|
ITracepointAction action = (ITracepointAction) selectedItems[0].getData();
|
||||||
|
|
||||||
TracepointActionDialog dialog = new TracepointActionDialog(this.getShell(), action, isSubAction);
|
TracepointActionDialog dialog = new TracepointActionDialog(this.getShell(), action, this, isSubAction);
|
||||||
int result = dialog.open();
|
int result = dialog.open();
|
||||||
if (result == Window.OK) {
|
if (result == Window.OK) {
|
||||||
action.setName(dialog.getActionName());
|
action.setName(dialog.getActionName());
|
||||||
|
@ -177,28 +203,40 @@ public class TracepointGlobalActionsList extends Composite {
|
||||||
if (clientList != null) {
|
if (clientList != null) {
|
||||||
clientList.updateAction(action);
|
clientList.updateAction(action);
|
||||||
}
|
}
|
||||||
|
if (parentGlobalList != null) {
|
||||||
|
assert isSubAction;
|
||||||
|
// Update the parent list also
|
||||||
|
parentGlobalList.updateAction(action);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void HandleNewButton() throws CoreException {
|
protected void HandleNewButton() throws CoreException {
|
||||||
|
|
||||||
TracepointActionDialog dialog = new TracepointActionDialog(this.getShell(), null, isSubAction);
|
TracepointActionDialog dialog = new TracepointActionDialog(this.getShell(), null, this, isSubAction);
|
||||||
int result = dialog.open();
|
int result = dialog.open();
|
||||||
if (result == Window.OK) {
|
if (result == Window.OK) {
|
||||||
ITracepointAction action = (ITracepointAction)dialog.getTracepointAction();
|
ITracepointAction action = (ITracepointAction)dialog.getTracepointAction();
|
||||||
action.setName(dialog.getActionName());
|
action.setName(dialog.getActionName());
|
||||||
TracepointActionManager.getInstance().addAction(action);
|
TracepointActionManager.getInstance().addAction(action);
|
||||||
final TableItem tableItem = new TableItem(table, SWT.NONE);
|
addAction(action);
|
||||||
tableItem.setText(0, action.getName());
|
|
||||||
tableItem.setText(1, action.getTypeName());
|
if (parentGlobalList != null) {
|
||||||
tableItem.setText(2, action.getSummary());
|
assert isSubAction;
|
||||||
tableItem.setData(action);
|
// Update the parent list also
|
||||||
|
parentGlobalList.addAction(action);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void addAction(ITracepointAction action) {
|
||||||
|
final TableItem tableItem = new TableItem(table, SWT.NONE);
|
||||||
|
tableItem.setText(0, action.getName());
|
||||||
|
tableItem.setText(1, action.getTypeName());
|
||||||
|
tableItem.setText(2, action.getSummary());
|
||||||
|
tableItem.setData(action);
|
||||||
|
}
|
||||||
|
|
||||||
public void updateButtons() {
|
public void updateButtons() {
|
||||||
TableItem[] selectedItems = table.getSelection();
|
TableItem[] selectedItems = table.getSelection();
|
||||||
if (attachButton != null)
|
if (attachButton != null)
|
||||||
|
@ -214,4 +252,25 @@ public class TracepointGlobalActionsList extends Composite {
|
||||||
void setClientList(TracepointActionsList actionsList) {
|
void setClientList(TracepointActionsList actionsList) {
|
||||||
clientList = actionsList;
|
clientList = actionsList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the appearance of given action.
|
||||||
|
* @param action
|
||||||
|
*/
|
||||||
|
void updateAction(ITracepointAction action) {
|
||||||
|
TableItem[] currentItems = table.getItems();
|
||||||
|
for (int i = 0; i < currentItems.length; i++) {
|
||||||
|
if (((ITracepointAction) currentItems[i].getData()).equals(action)) {
|
||||||
|
TableItem tableItem = currentItems[i];
|
||||||
|
tableItem.setText(0, action.getName());
|
||||||
|
tableItem.setText(1, action.getTypeName());
|
||||||
|
tableItem.setText(2, action.getSummary());
|
||||||
|
if (clientList != null) {
|
||||||
|
clientList.updateAction(action);
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
updateButtons();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* Copyright (c) 2010 Ericsson and others.
|
* Copyright (c) 2010, 2015 Ericsson 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
|
||||||
|
@ -33,6 +33,9 @@ public class WhileSteppingActionPage extends PlatformObject implements IBreakpoi
|
||||||
private Text fStepCountText;
|
private Text fStepCountText;
|
||||||
private TracepointActionsList actionsList;
|
private TracepointActionsList actionsList;
|
||||||
private TracepointGlobalActionsList globalActionsList;
|
private TracepointGlobalActionsList globalActionsList;
|
||||||
|
// When dealing with a "while-stepping" action, we deal with a "child" global
|
||||||
|
// list, and must keep track of the parent global list, to properly update it.
|
||||||
|
private TracepointGlobalActionsList parentGlobalActionsList;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the composite
|
* Create the composite
|
||||||
|
@ -74,7 +77,7 @@ public class WhileSteppingActionPage extends PlatformObject implements IBreakpoi
|
||||||
allAvailableActionsLabel.setLayoutData(gridData);
|
allAvailableActionsLabel.setLayoutData(gridData);
|
||||||
allAvailableActionsLabel.setText(MessagesForTracepointActions.TracepointActions_Available_actions);
|
allAvailableActionsLabel.setText(MessagesForTracepointActions.TracepointActions_Available_actions);
|
||||||
|
|
||||||
globalActionsList = new TracepointGlobalActionsList(composite, SWT.NONE, true, true);
|
globalActionsList = new TracepointGlobalActionsList(composite, SWT.NONE, true, parentGlobalActionsList, true);
|
||||||
gridData = new GridData(GridData.FILL_BOTH);
|
gridData = new GridData(GridData.FILL_BOTH);
|
||||||
gridData.horizontalSpan = 2;
|
gridData.horizontalSpan = 2;
|
||||||
globalActionsList.setLayoutData(gridData);
|
globalActionsList.setLayoutData(gridData);
|
||||||
|
@ -82,6 +85,9 @@ public class WhileSteppingActionPage extends PlatformObject implements IBreakpoi
|
||||||
String actionNames = fWhileSteppingAction.getSubActionsNames();
|
String actionNames = fWhileSteppingAction.getSubActionsNames();
|
||||||
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) {
|
||||||
|
@ -112,12 +118,8 @@ public class WhileSteppingActionPage extends PlatformObject implements IBreakpoi
|
||||||
* @since 7.0
|
* @since 7.0
|
||||||
*/
|
*/
|
||||||
protected void HandleDeleteButton() {
|
protected void HandleDeleteButton() {
|
||||||
// First remove any attached action that was just deleted
|
// attached actions are now handled by the GlobalActionsList
|
||||||
ITracepointAction[] selectedActions = globalActionsList.getSelectedActions();
|
|
||||||
for (ITracepointAction action : selectedActions) {
|
|
||||||
actionsList.removeAction(action);
|
|
||||||
}
|
|
||||||
// Now cleanup the global action list
|
|
||||||
globalActionsList.HandleDeleteButton();
|
globalActionsList.HandleDeleteButton();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -148,4 +150,8 @@ public class WhileSteppingActionPage extends PlatformObject implements IBreakpoi
|
||||||
fWhileSteppingAction = (WhileSteppingAction)action;
|
fWhileSteppingAction = (WhileSteppingAction)action;
|
||||||
return createWhileSteppingActionComposite(composite, style);
|
return createWhileSteppingActionComposite(composite, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void setParentGlobalList(TracepointGlobalActionsList list) {
|
||||||
|
parentGlobalActionsList = list;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue