01: /*******************************************************************************
02: * Copyright (c) 2000, 2006 IBM Corporation and others.
03: * All rights reserved. This program and the accompanying materials
04: * are made available under the terms of the Eclipse Public License v1.0
05: * which accompanies this distribution, and is available at
06: * http://www.eclipse.org/legal/epl-v10.html
07: *
08: * Contributors:
09: * IBM Corporation - initial API and implementation
10: *******************************************************************************/package org.eclipse.jdt.ui.tests.refactoring.ccp;
11:
12: import java.util.ArrayList;
13: import java.util.List;
14:
15: import org.eclipse.core.runtime.OperationCanceledException;
16:
17: import org.eclipse.jdt.internal.corext.refactoring.reorg.IConfirmQuery;
18: import org.eclipse.jdt.internal.corext.refactoring.reorg.IReorgQueries;
19:
20: public class MockReorgQueries implements IReorgQueries {
21: private final List fQueriesRun = new ArrayList();
22:
23: public IConfirmQuery createYesNoQuery(String queryTitle,
24: boolean allowCancel, int queryID) {
25: run(queryID);
26: return yesQuery;
27: }
28:
29: public IConfirmQuery createYesYesToAllNoNoToAllQuery(
30: String queryTitle, boolean allowCancel, int queryID) {
31: run(queryID);
32: return yesQuery;
33: }
34:
35: private void run(int queryID) {
36: fQueriesRun.add(new Integer(queryID));
37: }
38:
39: //List<Integer>
40: public List getRunQueryIDs() {
41: return fQueriesRun;
42: }
43:
44: private final IConfirmQuery yesQuery = new IConfirmQuery() {
45: public boolean confirm(String question)
46: throws OperationCanceledException {
47: return true;
48: }
49:
50: public boolean confirm(String question, Object[] elements)
51: throws OperationCanceledException {
52: return true;
53: }
54: };
55:
56: public IConfirmQuery createSkipQuery(String queryTitle, int queryID) {
57: run(queryID);
58: return yesQuery;
59: }
60: }
|