]> git.uio.no Git - ifi-stolz-refaktor.git/blame - case-study/jdt-before/core refactoring/org/eclipse/jdt/internal/corext/refactoring/reorg/IReorgPolicy.java
Case Study: adding data and statistics
[ifi-stolz-refaktor.git] / case-study / jdt-before / core refactoring / org / eclipse / jdt / internal / corext / refactoring / reorg / IReorgPolicy.java
CommitLineData
1b2798f6
EK
1/*******************************************************************************
2 * Copyright (c) 2000, 2010 IBM Corporation and others.
3 * All rights reserved. This program and the accompanying materials
4 * are made available under the terms of the Eclipse Public License v1.0
5 * which accompanies this distribution, and is available at
6 * http://www.eclipse.org/legal/epl-v10.html
7 *
8 * Contributors:
9 * IBM Corporation - initial API and implementation
10 *******************************************************************************/
11package org.eclipse.jdt.internal.corext.refactoring.reorg;
12
13import org.eclipse.core.runtime.CoreException;
14import org.eclipse.core.runtime.IProgressMonitor;
15
16import org.eclipse.core.resources.IResource;
17
18import org.eclipse.ltk.core.refactoring.Change;
19import org.eclipse.ltk.core.refactoring.ChangeDescriptor;
20import org.eclipse.ltk.core.refactoring.RefactoringStatus;
21import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
22import org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant;
23import org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor;
24import org.eclipse.ltk.core.refactoring.participants.ReorgExecutionLog;
25import org.eclipse.ltk.core.refactoring.participants.SharableParticipants;
26
27import org.eclipse.jdt.core.IJavaElement;
28import org.eclipse.jdt.core.JavaModelException;
29
30import org.eclipse.jdt.internal.corext.refactoring.JavaRefactoringArguments;
31import org.eclipse.jdt.internal.corext.refactoring.tagging.IQualifiedNameUpdating;
32import org.eclipse.jdt.internal.corext.refactoring.tagging.IReferenceUpdating;
33
34import org.eclipse.jdt.ui.refactoring.RefactoringSaveHelper;
35
36
37public interface IReorgPolicy extends IReorgDestinationValidator {
38
39 /**
40 * @return the unique id of this policy
41 */
42 public String getPolicyId();
43
44 /**
45 * @return the source resources to reorg
46 */
47 public IResource[] getResources();
48
49 /**
50 * @return the source java elements to reorg
51 */
52 public IJavaElement[] getJavaElements();
53
54 /**
55 * @return true if this policy can handle the source elements
56 * @throws JavaModelException in unexpected cases
57 */
58 public boolean canEnable() throws JavaModelException;
59
60 /**
61 * @return the save mode required for this reorg policy
62 *
63 * @see RefactoringSaveHelper
64 */
65 public int getSaveMode();
66
67 /**
68 * Can destination be a target for the given source elements?
69 *
70 * @param destination the destination to verify
71 * @return OK status if valid destination
72 * @throws JavaModelException in unexpected cases
73 */
74 public RefactoringStatus verifyDestination(IReorgDestination destination) throws JavaModelException;
75
76 /**
77 * @param destination the destination for this reorg
78 */
79 public void setDestination(IReorgDestination destination);
80
81 /**
82 * @return the destination of this reorg or null if not a resource
83 */
84 public IResource getResourceDestination();
85
86 /**
87 * @return the destination of this reorg or null if not a java element
88 */
89 public IJavaElement getJavaElementDestination();
90
91 /**
92 * @return a descriptor describing a reorg from source to target
93 */
94 public ChangeDescriptor getDescriptor();
95
96
97 /**
98 * Initializes the reorg policy with arguments from a script.
99 *
100 * @param arguments
101 * the arguments
102 * @return an object describing the status of the initialization. If the
103 * status has severity <code>FATAL_ERROR</code>, the refactoring
104 * will not be executed.
105 */
106 public RefactoringStatus initialize(JavaRefactoringArguments arguments);
107
108 public RefactoringStatus checkFinalConditions(IProgressMonitor monitor, CheckConditionsContext context, IReorgQueries queries) throws CoreException;
109
110 public RefactoringParticipant[] loadParticipants(RefactoringStatus status, RefactoringProcessor processor, String[] natures, SharableParticipants shared) throws CoreException;
111
112 public static interface ICopyPolicy extends IReorgPolicy{
113 public Change createChange(IProgressMonitor monitor, INewNameQueries queries) throws JavaModelException;
114 public ReorgExecutionLog getReorgExecutionLog();
115 }
116
117 public static interface IMovePolicy extends IReferenceUpdating, IQualifiedNameUpdating, IReorgPolicy{
118 public Change createChange(IProgressMonitor monitor) throws JavaModelException;
119 public Change postCreateChange(Change[] participantChanges, IProgressMonitor monitor) throws CoreException;
120 public ICreateTargetQuery getCreateTargetQuery(ICreateTargetQueries createQueries);
121 public boolean isTextualMove();
122 public CreateTargetExecutionLog getCreateTargetExecutionLog();
123 public void setDestinationCheck(boolean check);
124 public boolean hasAllInputSet();
125 /**
126 * Checks if <b>Java</b> references to the selected element(s) can be updated if moved to
127 * the selected destination. Even if <code>false</code>, participants could still update
128 * non-Java references.
129 *
130 * @return <code>true</code> iff <b>Java</b> references to the moved element can be updated
131 * @since 3.5
132 */
133 public boolean canUpdateJavaReferences();
134 public boolean canUpdateQualifiedNames();
135 }
136}