Copyright (c) 2006, 2011 IBM Corporation and others. This program and the accompanying materials are made available under the terms of the Eclipse Public License 2.0 which accompanies this distribution, and is available at https://www.eclipse.org/legal/epl-2.0/ SPDX-License-Identifier: EPL-2.0 Contributors: IBM Corporation - initial API and implementation
/******************************************************************************* * Copyright (c) 2006, 2011 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 * which accompanies this distribution, and is available at * https://www.eclipse.org/legal/epl-2.0/ * * SPDX-License-Identifier: EPL-2.0 * * Contributors: * IBM Corporation - initial API and implementation *******************************************************************************/
package org.eclipse.jdt.internal.corext.refactoring.reorg; import java.util.LinkedHashMap; import java.util.Map;
Objects of this class can be used as a log to trace the creation of new destinations during refactorings like move.
Since:3.3
/** * Objects of this class can be used as a log to trace the creation of new * destinations during refactorings like move. * * @since 3.3 */
public final class CreateTargetExecutionLog { private Map<Object, Object> fCreations= new LinkedHashMap<>(2);
Returns the element which got created for the given selection.
Params:
  • selection – the selection
Returns:the created element, or null
/** * Returns the element which got created for the given selection. * * @param selection * the selection * @return the created element, or <code>null</code> */
public Object getCreatedElement(Object selection) { return fCreations.get(selection); }
Returns all created elements.
Returns:all created elements
/** * Returns all created elements. * * @return all created elements */
public Object[] getCreatedElements() { return fCreations.values().toArray(); }
Returns all selected elements.
Returns:all selected elements
/** * Returns all selected elements. * * @return all selected elements */
public Object[] getSelectedElements() { return fCreations.keySet().toArray(); }
Logs that the given element got created by the refactoring.
Params:
  • selection – the selected object
  • element – the element that got created for the selection
/** * Logs that the given element got created by the refactoring. * * @param selection * the selected object * @param element * the element that got created for the selection */
public void markAsCreated(Object selection, Object element) { fCreations.put(selection, element); } }