mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
no need for OccurrencesChooser to be abstract
This commit is contained in:
+1
-6
@@ -579,12 +579,7 @@ public abstract class IntroduceVariableBase extends IntroduceHandlerBase impleme
|
||||
callback.pass(null);
|
||||
}
|
||||
else {
|
||||
new OccurrencesChooser<PsiExpression>(editor) {
|
||||
@Override
|
||||
protected TextRange getOccurrenceRange(PsiExpression occurrence) {
|
||||
return occurrence.getTextRange();
|
||||
}
|
||||
}.showChooser(callback, occurrencesMap);
|
||||
new OccurrencesChooser<PsiExpression>(editor).showChooser(callback, occurrencesMap);
|
||||
}
|
||||
return wasSucceed[0];
|
||||
}
|
||||
|
||||
+5
-2
@@ -25,6 +25,7 @@ import com.intellij.openapi.ui.popup.JBPopupFactory;
|
||||
import com.intellij.openapi.ui.popup.LightweightWindowEvent;
|
||||
import com.intellij.openapi.util.Pass;
|
||||
import com.intellij.openapi.util.TextRange;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.ui.components.JBList;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -39,7 +40,7 @@ import java.util.List;
|
||||
* User: anna
|
||||
* Date: 10/14/10
|
||||
*/
|
||||
public abstract class OccurrencesChooser<T> {
|
||||
public class OccurrencesChooser<T extends PsiElement> {
|
||||
public static enum ReplaceChoice {
|
||||
NO("Replace this occurrence only"), NO_WRITE("Replace all occurrences but write"), ALL("Replace all {0} occurrences");
|
||||
|
||||
@@ -141,7 +142,9 @@ public abstract class OccurrencesChooser<T> {
|
||||
.createPopup().showInBestPositionFor(myEditor);
|
||||
}
|
||||
|
||||
protected abstract TextRange getOccurrenceRange(T occurrence);
|
||||
protected TextRange getOccurrenceRange(T occurrence) {
|
||||
return occurrence.getTextRange();
|
||||
}
|
||||
|
||||
private void dropHighlighters() {
|
||||
for (RangeHighlighter highlight : myRangeHighlighters) {
|
||||
|
||||
Reference in New Issue
Block a user