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

Bug 473098 - Reflect tracepoint action changes

Tracepoint action changes were not immediately reflected in
the list of attached actions.

Change-Id: I6d0ad788d40c69febf2df5226252a7eeabde39b4
Signed-off-by: Marc Khouzam <marc.khouzam@ericsson.com>
This commit is contained in:
Marc Khouzam 2015-07-17 10:42:05 -04:00 committed by Gerrit Code Review @ Eclipse.org
parent df39cb4b09
commit 2b3d664972
5 changed files with 42 additions and 12 deletions

View file

@ -3,7 +3,7 @@ Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-Vendor: %providerName
Bundle-SymbolicName: org.eclipse.cdt.dsf.gdb.ui;singleton:=true
Bundle-Version: 2.4.0.qualifier
Bundle-Version: 2.5.0.qualifier
Bundle-Activator: org.eclipse.cdt.dsf.gdb.internal.ui.GdbUIPlugin
Bundle-Localization: plugin
Require-Bundle: org.eclipse.ui,

View file

@ -11,7 +11,7 @@
<relativePath>../../pom.xml</relativePath>
</parent>
<version>2.4.0-SNAPSHOT</version>
<version>2.5.0-SNAPSHOT</version>
<artifactId>org.eclipse.cdt.dsf.gdb.ui</artifactId>
<packaging>eclipse-plugin</packaging>
</project>

View file

@ -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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -203,4 +203,22 @@ public class TracepointActionsList extends Composite {
downButton.setEnabled(selectedItems.length == 1 && selectedItems[0] < (table.getItemCount() - 1));
upButton.setEnabled(selectedItems.length == 1 && selectedItems[0] > 0);
}
/**
* 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());
break;
}
}
updateButtons();
}
}

View file

@ -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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -84,6 +84,9 @@ public class TracepointActionsPropertyPage extends PropertyPage {
String actionNames = tracepointMarker.getAttribute(BreakpointActionManager.BREAKPOINT_ACTION_ATTRIBUTE, ""); //$NON-NLS-1$
actionsList.setNames(actionNames);
// connect attached actions list to global list
globalActionsList.setClientList(actionsList);
globalActionsList.getAttachButton().addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
@ -115,13 +118,8 @@ public class TracepointActionsPropertyPage extends PropertyPage {
* @since 7.0
*/
protected void HandleDeleteButton() {
// attached actions are now handled by the GlobalActionsList
// First remove any attached action that was just deleted
ITracepointAction[] selectedActions = globalActionsList.getSelectedActions();
for (int i = 0; i < selectedActions.length; i++) {
actionsList.removeAction(selectedActions[i]);
}
// Now cleanup the global action list
globalActionsList.HandleDeleteButton();
}

View file

@ -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
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -38,6 +38,7 @@ public class TracepointGlobalActionsList extends Composite {
private Button editButton;
private Button newButton;
private Table table;
private TracepointActionsList clientList;
private boolean isSubAction;
public TracepointGlobalActionsList(Composite parent, int style, boolean useAttachButton, boolean isSub) {
@ -149,6 +150,9 @@ public class TracepointGlobalActionsList extends Composite {
TableItem[] selectedItems = table.getSelection();
for (int i = 0; i < selectedItems.length; i++) {
ITracepointAction action = (ITracepointAction) selectedItems[i].getData();
if (clientList != null) {
clientList.removeAction(action);
}
TracepointActionManager.getInstance().deleteAction(action);
}
table.remove(table.getSelectionIndices());
@ -170,6 +174,9 @@ public class TracepointGlobalActionsList extends Composite {
selectedItems[0].setText(0, action.getName());
selectedItems[0].setText(1, action.getTypeName());
selectedItems[0].setText(2, action.getSummary());
if (clientList != null) {
clientList.updateAction(action);
}
}
}
@ -199,5 +206,12 @@ public class TracepointGlobalActionsList extends Composite {
deleteButton.setEnabled(selectedItems.length > 0);
editButton.setEnabled(selectedItems.length == 1);
}
/**
* Register client list to be notified of changes to actions.
* @param actionsList
*/
void setClientList(TracepointActionsList actionsList) {
clientList = actionsList;
}
}