001: /*******************************************************************************
002: * Copyright (c) 2000, 2006 IBM Corporation and others.
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * IBM Corporation - initial API and implementation
010: *******************************************************************************/package org.eclipse.jdt.internal.corext.refactoring.reorg;
011:
012: import org.eclipse.core.runtime.CoreException;
013: import org.eclipse.core.runtime.IProgressMonitor;
014:
015: import org.eclipse.core.resources.IResource;
016:
017: import org.eclipse.ltk.core.refactoring.Change;
018: import org.eclipse.ltk.core.refactoring.ChangeDescriptor;
019: import org.eclipse.ltk.core.refactoring.RefactoringStatus;
020: import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
021: import org.eclipse.ltk.core.refactoring.participants.RefactoringParticipant;
022: import org.eclipse.ltk.core.refactoring.participants.RefactoringProcessor;
023: import org.eclipse.ltk.core.refactoring.participants.ReorgExecutionLog;
024: import org.eclipse.ltk.core.refactoring.participants.SharableParticipants;
025:
026: import org.eclipse.jdt.core.IJavaElement;
027: import org.eclipse.jdt.core.JavaModelException;
028:
029: import org.eclipse.jdt.internal.corext.refactoring.tagging.IQualifiedNameUpdating;
030: import org.eclipse.jdt.internal.corext.refactoring.tagging.IReferenceUpdating;
031: import org.eclipse.jdt.internal.corext.refactoring.tagging.IScriptableRefactoring;
032:
033: import org.eclipse.jdt.internal.ui.refactoring.RefactoringSaveHelper;
034:
035: public interface IReorgPolicy extends IScriptableRefactoring,
036: IReorgDestinationValidator {
037:
038: /**
039: * @return the unique id of this policy
040: */
041: public String getPolicyId();
042:
043: /**
044: * @return the source resources to reorg
045: */
046: public IResource[] getResources();
047:
048: /**
049: * @return the source java elements to reorg
050: */
051: public IJavaElement[] getJavaElements();
052:
053: /**
054: * @return true if this policy can handle the source elements
055: * @throws JavaModelException
056: */
057: public boolean canEnable() throws JavaModelException;
058:
059: /**
060: * @return the save mode required for this reorg policy
061: *
062: * @see RefactoringSaveHelper#SAVE_ALL
063: * @see RefactoringSaveHelper#SAVE_JAVA_ONLY_UPDATES
064: * @see RefactoringSaveHelper#SAVE_NON_JAVA_UPDATES
065: */
066: public int getSaveMode();
067:
068: /**
069: * Can destination be a target for the given source elements?
070: *
071: * @param destination the destination to verify
072: * @return OK status if valid destination
073: * @throws JavaModelException
074: */
075: public RefactoringStatus verifyDestination(
076: IReorgDestination destination) throws JavaModelException;
077:
078: /**
079: * @param destination the destination for this reorg
080: */
081: public void setDestination(IReorgDestination destination);
082:
083: /**
084: * @return the destination of this reorg or null if not a resource
085: */
086: public IResource getResourceDestination();
087:
088: /**
089: * @return the destination of this reorg or null if not a java element
090: */
091: public IJavaElement getJavaElementDestination();
092:
093: /**
094: * @return a descriptor describing a reorg from source to target
095: */
096: public ChangeDescriptor getDescriptor();
097:
098: public RefactoringStatus checkFinalConditions(
099: IProgressMonitor monitor, CheckConditionsContext context,
100: IReorgQueries queries) throws CoreException;
101:
102: public RefactoringParticipant[] loadParticipants(
103: RefactoringStatus status, RefactoringProcessor processor,
104: String[] natures, SharableParticipants shared)
105: throws CoreException;
106:
107: public static interface ICopyPolicy extends IReorgPolicy {
108: public Change createChange(IProgressMonitor monitor,
109: INewNameQueries queries) throws JavaModelException;
110:
111: public ReorgExecutionLog getReorgExecutionLog();
112: }
113:
114: public static interface IMovePolicy extends IReferenceUpdating,
115: IQualifiedNameUpdating, IReorgPolicy {
116: public Change createChange(IProgressMonitor monitor)
117: throws JavaModelException;
118:
119: public Change postCreateChange(Change[] participantChanges,
120: IProgressMonitor monitor) throws CoreException;
121:
122: public ICreateTargetQuery getCreateTargetQuery(
123: ICreateTargetQueries createQueries);
124:
125: public boolean isTextualMove();
126:
127: public CreateTargetExecutionLog getCreateTargetExecutionLog();
128:
129: public void setDestinationCheck(boolean check);
130:
131: public boolean hasAllInputSet();
132:
133: public boolean canUpdateReferences();
134:
135: public boolean canUpdateQualifiedNames();
136: }
137: }
|