mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
SSR: introduce DefaultMatchResultSink
This commit is contained in:
+49
@@ -0,0 +1,49 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.structuralsearch;
|
||||
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.psi.PsiFile;
|
||||
|
||||
/**
|
||||
* @author Bas Leijdekkers
|
||||
*/
|
||||
public class DefaultMatchResultSink implements MatchResultSink {
|
||||
@Override
|
||||
public void newMatch(MatchResult result) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processFile(PsiFile element) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMatchingProcess(MatchingProcess matchingProcess) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void matchingFinished() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProgressIndicator getProgressIndicator() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+1
-18
@@ -158,28 +158,11 @@ public class MatcherImpl {
|
||||
|
||||
matchContext.setSink(
|
||||
new DuplicateFilteringResultSink(
|
||||
new MatchResultSink() {
|
||||
new DefaultMatchResultSink() {
|
||||
@Override
|
||||
public void newMatch(MatchResult result) {
|
||||
processor.process(result, configuration);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void processFile(PsiFile element) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMatchingProcess(MatchingProcess matchingProcess) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void matchingFinished() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public ProgressIndicator getProgressIndicator() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
)
|
||||
);
|
||||
|
||||
+3
-21
@@ -1,38 +1,20 @@
|
||||
package com.intellij.structuralsearch.plugin.util;
|
||||
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.structuralsearch.DefaultMatchResultSink;
|
||||
import com.intellij.structuralsearch.MatchResult;
|
||||
import com.intellij.structuralsearch.MatchResultSink;
|
||||
import com.intellij.structuralsearch.MatchingProcess;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CollectingMatchResultSink implements MatchResultSink {
|
||||
public class CollectingMatchResultSink extends DefaultMatchResultSink {
|
||||
private final List<MatchResult> matches = new ArrayList<MatchResult>();
|
||||
|
||||
@Override
|
||||
public void newMatch(MatchResult result) {
|
||||
matches.add(result);
|
||||
}
|
||||
|
||||
/* Notifies sink about starting the matching for given element
|
||||
* @param element the current file
|
||||
*/
|
||||
public void processFile(PsiFile element) {
|
||||
}
|
||||
|
||||
public void matchingFinished() {
|
||||
}
|
||||
|
||||
public ProgressIndicator getProgressIndicator() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setMatchingProcess(MatchingProcess process) {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public List<MatchResult> getMatches() {
|
||||
return matches;
|
||||
|
||||
Reference in New Issue
Block a user