blob: 22c3e5a4df34b48bd7224fc5401c01d921e1a2d3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
|
/*******************************************************************************
* Copyright (c) 2006, 2007 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.wst.jsdt.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.
*
*
*/
public final class CreateTargetExecutionLog {
private Map fCreations= new LinkedHashMap(2);
/**
* 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.
*
* @return all created elements
*/
public Object[] getCreatedElements() {
return fCreations.values().toArray();
}
/**
* 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.
*
* @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);
}
}
|