use of org.eclipse.jdt.internal.corext.refactoring.reorg.IReorgQueries in project eclipse.jdt.ls by eclipse.
the class MoveHandler method move.
public static WorkspaceEdit move(IResource[] resources, IJavaElement[] javaElements, IReorgDestination destination, boolean updateReferences, IProgressMonitor monitor) throws CoreException {
IMovePolicy policy = ReorgPolicyFactory.createMovePolicy(resources, javaElements);
if (policy.canEnable()) {
JavaMoveProcessor processor = new JavaMoveProcessor(policy);
Refactoring refactoring = new MoveRefactoring(processor);
processor.setDestination(destination);
processor.setUpdateReferences(updateReferences);
processor.setReorgQueries(new IReorgQueries() {
@Override
public IConfirmQuery createSkipQuery(String queryTitle, int queryID) {
return yesQuery;
}
@Override
public IConfirmQuery createYesNoQuery(String queryTitle, boolean allowCancel, int queryID) {
return yesQuery;
}
@Override
public IConfirmQuery createYesYesToAllNoNoToAllQuery(String queryTitle, boolean allowCancel, int queryID) {
return yesQuery;
}
private final IConfirmQuery yesQuery = new IConfirmQuery() {
@Override
public boolean confirm(String question) throws OperationCanceledException {
return true;
}
@Override
public boolean confirm(String question, Object[] elements) throws OperationCanceledException {
return true;
}
};
});
CheckConditionsOperation check = new CheckConditionsOperation(refactoring, CheckConditionsOperation.ALL_CONDITIONS);
final CreateChangeOperation create = new CreateChangeOperation(check, RefactoringStatus.FATAL);
create.run(monitor);
Change change = create.getChange();
return ChangeUtil.convertToWorkspaceEdit(change);
}
return null;
}
Aggregations