2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com
.intellij
.refactoring
;
18 import com
.intellij
.openapi
.util
.Ref
;
19 import com
.intellij
.usageView
.UsageInfo
;
24 public abstract class RefactoringImpl
<T
extends BaseRefactoringProcessor
> implements Refactoring
{
25 protected final T myProcessor
;
27 public RefactoringImpl(T refactoringProcessor
) {
28 myProcessor
= refactoringProcessor
;
31 public void setPreviewUsages(boolean value
) {
32 myProcessor
.setPreviewUsages(value
);
35 public boolean isPreviewUsages() {
36 return myProcessor
.isPreviewUsages();
39 public void setInteractive(Runnable prepareSuccessfulCallback
) {
40 myProcessor
.setPrepareSuccessfulSwingThreadCallback(prepareSuccessfulCallback
);
43 public boolean isInteractive() {
44 return myProcessor
.myPrepareSuccessfulSwingThreadCallback
!= null;
47 public UsageInfo
[] findUsages() {
48 return myProcessor
.findUsages();
51 public boolean preprocessUsages(Ref
<UsageInfo
[]> usages
) {
52 return myProcessor
.preprocessUsages(usages
);
55 public boolean shouldPreviewUsages(UsageInfo
[] usages
) {
56 return myProcessor
.isPreviewUsages(usages
);
59 public void doRefactoring(UsageInfo
[] usages
) {
60 myProcessor
.execute(usages
);