mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -175,6 +175,11 @@ public abstract class JavaTestFrameworkRunnableState<T extends
|
||||
|
||||
final DefaultExecutionResult result = new DefaultExecutionResult(consoleView, handler);
|
||||
result.setRestartActions(rerunFailedTestsAction, new ToggleAutoTestAction() {
|
||||
@Override
|
||||
public boolean isDelayApplicable() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractAutoTestManager getAutoTestManager(Project project) {
|
||||
return JavaAutoRunManager.getInstance(project);
|
||||
|
||||
+3
-2
@@ -465,7 +465,7 @@ public class AnnotationsHighlightUtil {
|
||||
final PsiTypeElement operand = expression.getOperand();
|
||||
final PsiClass classType = PsiUtil.resolveClassInType(operand.getType());
|
||||
if (classType != null) {
|
||||
checkAccessibility(expression, classType, HighlightUtil.formatClass(classType));
|
||||
checkAccessibility(operand.getInnermostComponentReferenceElement(), classType, HighlightUtil.formatClass(classType));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -478,7 +478,7 @@ public class AnnotationsHighlightUtil {
|
||||
}
|
||||
}
|
||||
|
||||
private void checkAccessibility(PsiExpression expression, PsiMember resolve, String memberString) {
|
||||
private void checkAccessibility(PsiJavaCodeReferenceElement expression, PsiMember resolve, String memberString) {
|
||||
if (resolve.hasModifierProperty(PsiModifier.PRIVATE) &&
|
||||
PsiTreeUtil.isAncestor(parent, resolve, true)) {
|
||||
String description = JavaErrorMessages.message("private.symbol",
|
||||
@@ -486,6 +486,7 @@ public class AnnotationsHighlightUtil {
|
||||
HighlightUtil.formatClass((PsiClass)parent));
|
||||
infos[0] =
|
||||
HighlightInfo.newHighlightInfo(HighlightInfoType.ERROR).range(expression).descriptionAndTooltip(description).create();
|
||||
HighlightUtil.registerAccessQuickFixAction(resolve, expression, infos[0], null);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
@@ -51,6 +51,11 @@ public class InlineMethodDialog extends InlineOptionsWithSearchSettingsDialog {
|
||||
init();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean allowInlineAll() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getNameLabelText() {
|
||||
String methodText = PsiFormatUtil.formatMethod(myMethod,
|
||||
@@ -72,9 +77,7 @@ public class InlineMethodDialog extends InlineOptionsWithSearchSettingsDialog {
|
||||
@Override
|
||||
protected String getInlineAllText() {
|
||||
final String occurrencesString = myOccurrencesNumber > -1 ? " (" + myOccurrencesNumber + " occurrence" + (myOccurrencesNumber == 1 ? ")" : "s)") : "";
|
||||
return (myMethod.isWritable()
|
||||
? RefactoringBundle.message("all.invocations.and.remove.the.method")
|
||||
: RefactoringBundle.message("all.invocations.in.project")) + occurrencesString;
|
||||
return (RefactoringBundle.message(myMethod.isWritable() ? "all.invocations.and.remove.the.method" : "all.invocations.in.project")) + occurrencesString;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -132,11 +132,12 @@ public class InlineMethodProcessor extends BaseRefactoringProcessor {
|
||||
if (myReference != null) {
|
||||
usages.add(new UsageInfo(myReference));
|
||||
}
|
||||
for (PsiReference reference : ReferencesSearch.search(myMethod)) {
|
||||
GlobalSearchScope searchScope = GlobalSearchScope.projectScope(myProject);
|
||||
for (PsiReference reference : ReferencesSearch.search(myMethod, searchScope)) {
|
||||
usages.add(new UsageInfo(reference.getElement()));
|
||||
}
|
||||
|
||||
OverridingMethodsSearch.search(myMethod, false).forEach(method -> {
|
||||
OverridingMethodsSearch.search(myMethod, searchScope, false).forEach(method -> {
|
||||
if (AnnotationUtil.isAnnotated(method, Override.class.getName(), false)) {
|
||||
usages.add(new UsageInfo(method));
|
||||
}
|
||||
@@ -159,7 +160,7 @@ public class InlineMethodProcessor extends BaseRefactoringProcessor {
|
||||
if (mySearchForTextOccurrences) {
|
||||
String stringToSearch = ElementDescriptionUtil.getElementDescription(myMethod, NonCodeSearchDescriptionLocation.NON_JAVA);
|
||||
TextOccurrencesUtil
|
||||
.addTextOccurences(myMethod, stringToSearch, GlobalSearchScope.projectScope(myProject), usages, infoFactory);
|
||||
.addTextOccurences(myMethod, stringToSearch, searchScope, usages, infoFactory);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -737,7 +737,8 @@ public abstract class BaseExpressionToFieldHandler extends IntroduceHandlerBase
|
||||
}
|
||||
PsiMember anchorMember = finalAnchorElement instanceof PsiMember ? (PsiMember)finalAnchorElement : null;
|
||||
|
||||
if (anchorMember instanceof PsiEnumConstant && destClass == anchorMember.getContainingClass()) {
|
||||
if (anchorMember instanceof PsiEnumConstant && destClass == anchorMember.getContainingClass() &&
|
||||
PsiTreeUtil.isAncestor(((PsiEnumConstant)anchorMember).getArgumentList(), initializer, false)) {
|
||||
final String initialName = "Constants";
|
||||
String constantsClassName = initialName;
|
||||
|
||||
|
||||
+7
-41
@@ -49,7 +49,6 @@ import com.intellij.usageView.UsageInfo;
|
||||
import com.intellij.usageView.UsageViewDescriptor;
|
||||
import com.intellij.usageView.UsageViewUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.VisibilityUtil;
|
||||
import com.intellij.util.containers.HashMap;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
@@ -73,6 +72,7 @@ public class MoveClassesOrPackagesProcessor extends BaseRefactoringProcessor {
|
||||
protected @NotNull final MoveDestination myMoveDestination;
|
||||
protected NonCodeUsageInfo[] myNonCodeUsages;
|
||||
private boolean myOpenInEditor;
|
||||
private MultiMap<PsiElement, String> myConflicts;
|
||||
|
||||
public MoveClassesOrPackagesProcessor(Project project,
|
||||
PsiElement[] elements,
|
||||
@@ -159,7 +159,7 @@ public class MoveClassesOrPackagesProcessor extends BaseRefactoringProcessor {
|
||||
protected UsageInfo[] findUsages() {
|
||||
final List<UsageInfo> allUsages = new ArrayList<>();
|
||||
final List<UsageInfo> usagesToSkip = new ArrayList<>();
|
||||
MultiMap<PsiElement, String> conflicts = new MultiMap<>();
|
||||
myConflicts = new MultiMap<>();
|
||||
for (PsiElement element : myElementsToMove) {
|
||||
String newName = getNewQName(element);
|
||||
if (newName == null) continue;
|
||||
@@ -179,17 +179,11 @@ public class MoveClassesOrPackagesProcessor extends BaseRefactoringProcessor {
|
||||
}
|
||||
}
|
||||
}
|
||||
myMoveDestination.analyzeModuleConflicts(Arrays.asList(myElementsToMove), conflicts,
|
||||
myMoveDestination.analyzeModuleConflicts(Arrays.asList(myElementsToMove), myConflicts,
|
||||
allUsages.toArray(new UsageInfo[allUsages.size()]));
|
||||
final UsageInfo[] usageInfos = allUsages.toArray(new UsageInfo[allUsages.size()]);
|
||||
detectPackageLocalsMoved(usageInfos, conflicts);
|
||||
detectPackageLocalsUsed(conflicts);
|
||||
if (!conflicts.isEmpty()) {
|
||||
for (PsiElement element : conflicts.keySet()) {
|
||||
allUsages.add(new ConflictsUsageInfo(element, conflicts.get(element)));
|
||||
}
|
||||
}
|
||||
|
||||
detectPackageLocalsMoved(usageInfos, myConflicts);
|
||||
detectPackageLocalsUsed(myConflicts);
|
||||
allUsages.removeAll(usagesToSkip);
|
||||
return UsageViewUtil.removeDuplicatedUsages(allUsages.toArray(new UsageInfo[allUsages.size()]));
|
||||
}
|
||||
@@ -206,19 +200,6 @@ public class MoveClassesOrPackagesProcessor extends BaseRefactoringProcessor {
|
||||
myOpenInEditor = openInEditor;
|
||||
}
|
||||
|
||||
protected static class ConflictsUsageInfo extends UsageInfo {
|
||||
private final Collection<String> myConflicts;
|
||||
|
||||
public ConflictsUsageInfo(PsiElement pseudoElement, Collection<String> conflicts) {
|
||||
super(pseudoElement);
|
||||
myConflicts = conflicts;
|
||||
}
|
||||
|
||||
public Collection<String> getConflicts() {
|
||||
return myConflicts;
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected String getRefactoringId() {
|
||||
@@ -244,21 +225,7 @@ public class MoveClassesOrPackagesProcessor extends BaseRefactoringProcessor {
|
||||
|
||||
protected boolean preprocessUsages(@NotNull Ref<UsageInfo[]> refUsages) {
|
||||
final UsageInfo[] usages = refUsages.get();
|
||||
final MultiMap<PsiElement, String> conflicts = new MultiMap<>();
|
||||
ArrayList<UsageInfo> filteredUsages = new ArrayList<>();
|
||||
for (UsageInfo usage : usages) {
|
||||
if (usage instanceof ConflictsUsageInfo) {
|
||||
final ConflictsUsageInfo info = (ConflictsUsageInfo)usage;
|
||||
final PsiElement element = info.getElement();
|
||||
conflicts.putValues(element, info.getConflicts());
|
||||
}
|
||||
else {
|
||||
filteredUsages.add(usage);
|
||||
}
|
||||
}
|
||||
|
||||
refUsages.set(filteredUsages.toArray(new UsageInfo[filteredUsages.size()]));
|
||||
return showConflicts(conflicts, usages);
|
||||
return showConflicts(myConflicts, usages);
|
||||
}
|
||||
|
||||
private boolean isInsideMoved(PsiElement place) {
|
||||
@@ -295,8 +262,7 @@ public class MoveClassesOrPackagesProcessor extends BaseRefactoringProcessor {
|
||||
if (!movedClasses.contains(aClass)) {
|
||||
movedClasses.add(aClass);
|
||||
}
|
||||
String visibility = VisibilityUtil.getVisibilityModifier(aClass.getModifierList());
|
||||
if (PsiModifier.PACKAGE_LOCAL.equals(visibility)) {
|
||||
if (aClass != null && aClass.hasModifierProperty(PsiModifier.PACKAGE_LOCAL)) {
|
||||
if (PsiTreeUtil.getParentOfType(element, PsiImportStatement.class) != null) continue;
|
||||
PsiElement container = ConflictsUtil.getContainer(element);
|
||||
HashSet<PsiElement> reported = reportedClassToContainers.get(aClass);
|
||||
|
||||
+1
-2
@@ -53,8 +53,7 @@ class PackageLocalsUsageCollector extends JavaRecursiveElementWalkingVisitor {
|
||||
|
||||
private void visitResolvedReference(PsiElement resolved, PsiJavaCodeReferenceElement reference) {
|
||||
if (resolved instanceof PsiModifierListOwner) {
|
||||
final PsiModifierList modifierList = ((PsiModifierListOwner)resolved).getModifierList();
|
||||
if (PsiModifier.PACKAGE_LOCAL.equals(VisibilityUtil.getVisibilityModifier(modifierList))) {
|
||||
if (((PsiModifierListOwner)resolved).hasModifierProperty(PsiModifier.PACKAGE_LOCAL)) {
|
||||
PsiFile aFile = resolved.getContainingFile();
|
||||
if (aFile != null && !isInsideMoved(resolved)) {
|
||||
final PsiDirectory containingDirectory = aFile.getContainingDirectory();
|
||||
|
||||
+4
-7
@@ -358,11 +358,10 @@ public abstract class TurnRefsToSuperProcessorBase extends BaseRefactoringProces
|
||||
final LocalSearchScope derivedScope = new LocalSearchScope(inheritingClass);
|
||||
final PsiSubstitutor substitutor = TypeConversionUtil.getClassSubstitutor(ownerClass, inheritingClass, PsiSubstitutor.EMPTY);
|
||||
if (substitutor == null) return;
|
||||
final LocalSearchScope baseScope = new LocalSearchScope(ownerClass);
|
||||
ReferencesSearch.search(typeParameter, baseScope).forEach(ref -> {
|
||||
final PsiElement element = ref.getElement();
|
||||
final PsiElement parent = element.getParent();
|
||||
if (parent instanceof PsiTypeElement) {
|
||||
ownerClass.accept(new JavaRecursiveElementVisitor() {
|
||||
@Override
|
||||
public void visitTypeElement(PsiTypeElement parent) {
|
||||
super.visitTypeElement(parent);
|
||||
final PsiElement pparent = parent.getParent();
|
||||
if (pparent instanceof PsiMethod && parent.equals(((PsiMethod)pparent).getReturnTypeElement())) {
|
||||
final PsiMethod method = (PsiMethod)pparent;
|
||||
@@ -393,8 +392,6 @@ public abstract class TurnRefsToSuperProcessorBase extends BaseRefactoringProces
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
@SomeAnnotation(<error descr="'Foo.Bar' has private access in 'Foo'">Foo.Bar.class</error>)
|
||||
@SomeAnnotation(<error descr="'Foo.Bar' has private access in 'Foo'">Foo.Bar</error>.class)
|
||||
public class Foo{
|
||||
private static class Bar {
|
||||
}
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Make 'Inner' protected" "true"
|
||||
@MyAnnotation(Outer.Inner.class)
|
||||
public class Outer {
|
||||
|
||||
protected static class Inner {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@interface MyAnnotation {
|
||||
Class<?> value();
|
||||
}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// "Make 'Inner' protected" "true"
|
||||
@MyAnnotation(Outer.I<caret>nner.class)
|
||||
public class Outer {
|
||||
|
||||
private static class Inner {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@interface MyAnnotation {
|
||||
Class<?> value();
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
|
||||
enum Foo {
|
||||
|
||||
FOO1 {
|
||||
public String bar() {
|
||||
return <selection>"bar"</selection>;
|
||||
}
|
||||
}
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
|
||||
enum Foo {
|
||||
|
||||
FOO1 {
|
||||
public String bar() {
|
||||
return xxx;
|
||||
}
|
||||
};
|
||||
public static final String xxx = "bar";
|
||||
}
|
||||
+24
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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.codeInsight.daemon.quickFix;
|
||||
|
||||
public class AccessibilityFixesTest extends LightQuickFixParameterizedTestCase {
|
||||
|
||||
@Override
|
||||
protected String getBasePath() {
|
||||
return "/codeInsight/daemonCodeAnalyzer/quickFix/makePublic";
|
||||
}
|
||||
}
|
||||
@@ -48,6 +48,12 @@ public class IntroduceConstantTest extends LightCodeInsightTestCase {
|
||||
checkResultByFile(BASE_PATH + getTestName(false) + "_after.java");
|
||||
}
|
||||
|
||||
public void testFromEnumConstantInitializer2() throws Exception {
|
||||
configureByFile(BASE_PATH + getTestName(false) + ".java");
|
||||
new MockIntroduceConstantHandler(null).invoke(getProject(), getEditor(), getFile(), null);
|
||||
checkResultByFile(BASE_PATH + getTestName(false) + "_after.java");
|
||||
}
|
||||
|
||||
public void testEnumConstant() throws Exception {
|
||||
doTest(true);
|
||||
}
|
||||
|
||||
@@ -75,7 +75,7 @@ public abstract class InlineOptionsDialog extends RefactoringDialog implements I
|
||||
new RadioUpDownListener(myRbInlineAll, myRbInlineThisOnly);
|
||||
|
||||
myRbInlineThisOnly.setEnabled(myInvokedOnReference);
|
||||
final boolean writable = myElement.isWritable();
|
||||
final boolean writable = allowInlineAll();
|
||||
myRbInlineAll.setEnabled(writable);
|
||||
if(myInvokedOnReference) {
|
||||
if (canInlineThisOnly()) {
|
||||
@@ -112,6 +112,10 @@ public abstract class InlineOptionsDialog extends RefactoringDialog implements I
|
||||
return optionsPanel;
|
||||
}
|
||||
|
||||
protected boolean allowInlineAll() {
|
||||
return myElement.isWritable();
|
||||
}
|
||||
|
||||
protected abstract String getNameLabelText();
|
||||
protected abstract String getBorderTitle();
|
||||
protected abstract String getInlineAllText();
|
||||
@@ -133,7 +137,7 @@ public abstract class InlineOptionsDialog extends RefactoringDialog implements I
|
||||
final String name = nameIdentifierOwner.getName();
|
||||
final boolean isCheapToSearch =
|
||||
name != null && searchHelper.isCheapEnoughToSearch(name, scope, null, progressManager.getProgressIndicator()) != PsiSearchHelper.SearchCostResult.TOO_MANY_OCCURRENCES;
|
||||
return isCheapToSearch ? ReferencesSearch.search(nameIdentifierOwner).findAll().size() : - 1;
|
||||
return isCheapToSearch ? ReferencesSearch.search(nameIdentifierOwner, scope).findAll().size() : - 1;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -33,7 +33,7 @@ public class TestIgnoredState extends AbstractState {
|
||||
myText = null;
|
||||
}
|
||||
else {
|
||||
myText = CompositePrintable.NEW_LINE + ignoredMsg;
|
||||
myText = CompositePrintable.NEW_LINE + ignoredMsg + CompositePrintable.NEW_LINE;
|
||||
}
|
||||
myStacktrace = stackTrace == null ? null : stackTrace + CompositePrintable.NEW_LINE;
|
||||
}
|
||||
|
||||
+8
-8
@@ -394,11 +394,11 @@ public class SMTRunnerConsoleTest extends BaseSMTRunnerTestCase {
|
||||
myEventsProcessor.onTestOutput(new TestOutputEvent("my_test", "stdout1 ", true));
|
||||
myEventsProcessor.onTestOutput(new TestOutputEvent("my_test", "stderr1 ", false));
|
||||
|
||||
assertAllOutputs(myMockResettablePrinter, "stdout1 ", "stderr1 ", "\nignored msg");
|
||||
assertAllOutputs(myMockResettablePrinter, "stdout1 ", "stderr1 ", "\nignored msg\n");
|
||||
|
||||
final MockPrinter mockPrinter1 = new MockPrinter(true);
|
||||
mockPrinter1.onNewAvailable(myTest1);
|
||||
assertAllOutputs(mockPrinter1, "stdout1 ", "stderr1 ", "\nignored msg");
|
||||
assertAllOutputs(mockPrinter1, "stdout1 ", "stderr1 ", "\nignored msg\n");
|
||||
|
||||
//other output order
|
||||
final SMTestProxy myTest2 = startTestWithPrinter("my_test2");
|
||||
@@ -406,10 +406,10 @@ public class SMTRunnerConsoleTest extends BaseSMTRunnerTestCase {
|
||||
myEventsProcessor.onTestOutput(new TestOutputEvent("my_test2", "stderr1 ", false));
|
||||
myEventsProcessor.onTestIgnored(new TestIgnoredEvent("my_test2", "ignored msg", null));
|
||||
|
||||
assertAllOutputs(myMockResettablePrinter, "stdout1 ", "stderr1 ", "\nignored msg");
|
||||
assertAllOutputs(myMockResettablePrinter, "stdout1 ", "stderr1 ", "\nignored msg\n");
|
||||
final MockPrinter mockPrinter2 = new MockPrinter(true);
|
||||
mockPrinter2.onNewAvailable(myTest2);
|
||||
assertAllOutputs(mockPrinter2, "stdout1 ", "stderr1 ", "\nignored msg");
|
||||
assertAllOutputs(mockPrinter2, "stdout1 ", "stderr1 ", "\nignored msg\n");
|
||||
}
|
||||
|
||||
public void testProcessor_OnIgnored_WithStacktrace() {
|
||||
@@ -421,14 +421,14 @@ public class SMTRunnerConsoleTest extends BaseSMTRunnerTestCase {
|
||||
|
||||
assertAllOutputs(myMockResettablePrinter, "stdout1 ",
|
||||
"\nmethod1:1\nmethod2:2\nstderr1 ",
|
||||
"\nignored2 msg");
|
||||
"\nignored2 msg\n");
|
||||
|
||||
final MockPrinter mockPrinter1 = new MockPrinter(true);
|
||||
mockPrinter1.onNewAvailable(myTest1);
|
||||
assertAllOutputs(mockPrinter1,
|
||||
"stdout1 ",
|
||||
"stderr1 \nmethod1:1\nmethod2:2\n",
|
||||
"\nignored2 msg");
|
||||
"\nignored2 msg\n");
|
||||
|
||||
//other output order
|
||||
final SMTestProxy myTest2 = startTestWithPrinter("my_test2");
|
||||
@@ -439,13 +439,13 @@ public class SMTRunnerConsoleTest extends BaseSMTRunnerTestCase {
|
||||
assertAllOutputs(myMockResettablePrinter,
|
||||
"stdout1 ",
|
||||
"stderr1 \nmethod1:1\nmethod2:2\n",
|
||||
"\nignored msg");
|
||||
"\nignored msg\n");
|
||||
final MockPrinter mockPrinter2 = new MockPrinter(true);
|
||||
mockPrinter2.onNewAvailable(myTest2);
|
||||
assertAllOutputs(mockPrinter2,
|
||||
"stdout1 ",
|
||||
"stderr1 \nmethod1:1\nmethod2:2\n",
|
||||
"\nignored msg");
|
||||
"\nignored msg\n");
|
||||
}
|
||||
|
||||
public void testOnUncapturedOutput_BeforeProcessStarted() {
|
||||
|
||||
+1
-1
@@ -43,7 +43,7 @@ public class AdjustAutotestDelayActionGroup extends ActionGroup {
|
||||
if (descriptor != null) {
|
||||
for (AnAction action : descriptor.getRestartActions()) {
|
||||
if (action instanceof ToggleAutoTestAction) {
|
||||
visible = true;
|
||||
visible = ((ToggleAutoTestAction)action).isDelayApplicable();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
+4
@@ -45,6 +45,10 @@ public class ToggleAutoTestAction extends ToggleAction {
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isDelayApplicable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public AbstractAutoTestManager getAutoTestManager(Project project) {
|
||||
return AutoTestManager.getInstance(project);
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import org.junit.platform.commons.util.AnnotationUtils;
|
||||
import org.junit.platform.engine.DiscoverySelector;
|
||||
import org.junit.platform.engine.discovery.DiscoverySelectors;
|
||||
import org.junit.platform.launcher.LauncherDiscoveryRequest;
|
||||
import org.junit.platform.launcher.TagFilter;
|
||||
import org.junit.platform.launcher.core.LauncherDiscoveryRequestBuilder;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
@@ -27,6 +28,10 @@ import java.io.IOException;
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.logging.Handler;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.LogManager;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
public class JUnit5TestRunnerUtil {
|
||||
|
||||
@@ -48,8 +53,7 @@ public class JUnit5TestRunnerUtil {
|
||||
final String packageName = reader.readLine();
|
||||
if (packageName == null) return null;
|
||||
|
||||
//todo category?
|
||||
reader.readLine();
|
||||
String tagName = reader.readLine();
|
||||
String line;
|
||||
|
||||
List<DiscoverySelector> selectors = new ArrayList<>();
|
||||
@@ -57,8 +61,12 @@ public class JUnit5TestRunnerUtil {
|
||||
selectors.add(createSelector(line));
|
||||
}
|
||||
packageNameRef[0] = packageName.length() == 0 ? "<default package>" : packageName;
|
||||
return (selectors.isEmpty() ? builder.selectors(DiscoverySelectors.selectPackage(packageName))
|
||||
: builder.selectors(selectors)).build();
|
||||
builder = selectors.isEmpty() ? builder.selectors(DiscoverySelectors.selectPackage(packageName))
|
||||
: builder.selectors(selectors);
|
||||
if (tagName != null && !tagName.isEmpty()) {
|
||||
builder = builder.filters(TagFilter.includeTags(tagName));
|
||||
}
|
||||
return builder.build();
|
||||
}
|
||||
finally {
|
||||
reader.close();
|
||||
@@ -74,6 +82,7 @@ public class JUnit5TestRunnerUtil {
|
||||
if (disableDisabledCondition) {
|
||||
builder = builder.configurationParameter("junit.conditions.deactivate", "org.junit.*DisabledCondition");
|
||||
}
|
||||
|
||||
return builder.selectors(createSelector(suiteClassNames[0])).build();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user