Bug 211646 [JFace] StructuredSelection.toList(...) allows modification to original selection
3.4 The implementation of StructuredSelection.toList() looks like this: "return Arrays.asList(elements == null ? new Object[0] : elements);" This returns a list with the actual underlying array of selected elements. Changes to the list returned by this method write through to the underlying array and change the original selection. I don't think this is intentional?
bundles/org.eclipse.jface/src/org/eclipse/jface/viewers/IStructuredSelection.java
/*******************************************************************************
 * Copyright (c) 2000, 2006 IBM Corporation 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
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package org.eclipse.jface.viewers;
import java.util.Iterator;
import java.util.List;
/**
 * A selection containing elements.
 */
public interface IStructuredSelection extends ISelection {
    /**
     * Returns the first element in this selection, or <code>null</code>
     * if the selection is empty.