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

Bug 358135 - [Pin&Clone] Pinned view shows wrong content for multiple

selection
This commit is contained in:
Patrick Chuong 2011-12-15 15:05:02 -05:00
parent be303b5ca2
commit 349cdb089d

View file

@ -7,9 +7,11 @@
* *
* Contributors: * Contributors:
* Patrick Chuong (Texas Instruments) - Pin and Clone Supports (331781) * Patrick Chuong (Texas Instruments) - Pin and Clone Supports (331781)
* Patrick Chuong (Texas Instruments) - Bug 358135
*****************************************************************/ *****************************************************************/
package org.eclipse.cdt.debug.internal.ui.pinclone; package org.eclipse.cdt.debug.internal.ui.pinclone;
import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -20,6 +22,7 @@ import org.eclipse.debug.ui.contexts.IDebugContextListener;
import org.eclipse.debug.ui.contexts.IDebugContextService; import org.eclipse.debug.ui.contexts.IDebugContextService;
import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.IWorkbenchPart;
/** /**
@ -45,16 +48,18 @@ public class DebugEventFilterService {
public void debugContextChanged(DebugContextEvent event) { public void debugContextChanged(DebugContextEvent event) {
ISelection eventContext = event.getContext(); ISelection eventContext = event.getContext();
if (eventContext instanceof IStructuredSelection) { if (eventContext instanceof IStructuredSelection) {
List<Object> filteredContextList = new ArrayList<Object>();
List<?> eventContextList = ((IStructuredSelection)eventContext).toList(); List<?> eventContextList = ((IStructuredSelection)eventContext).toList();
for (Object o : eventContextList) { for (Object o : eventContextList) {
if (fProvider.isPinnedTo(o)) { if (fProvider.isPinnedTo(o)) {
if (fProvider != event.getDebugContextProvider()) { if (fProvider != event.getDebugContextProvider()) {
fProvider.delegateEvent(new DebugContextEvent(fProvider, event.getContext(), event.getFlags())); filteredContextList.add(o);
} }
return;
} }
} }
if (filteredContextList.size() > 0) {
fProvider.delegateEvent(new DebugContextEvent(fProvider, new StructuredSelection(filteredContextList), event.getFlags()));
}
} }
} }