Create Test: refactoring + small fixes

This commit is contained in:
Anton Makeev
2010-06-27 18:24:39 +04:00
parent 7700e6501c
commit ca6bcdb07c
13 changed files with 226 additions and 247 deletions
@@ -19,27 +19,27 @@
*/
package com.intellij.codeInsight.daemon.impl;
import com.intellij.codeInsight.daemon.GutterIconNavigationHandler;
import com.intellij.codeInsight.daemon.DaemonBundle;
import com.intellij.codeInsight.CodeInsightBundle;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiUtil;
import com.intellij.psi.search.PsiElementProcessor;
import com.intellij.psi.search.PsiElementProcessorAdapter;
import com.intellij.psi.search.searches.OverridingMethodsSearch;
import com.intellij.psi.search.searches.ClassInheritorsSearch;
import com.intellij.util.Function;
import com.intellij.util.NullableFunction;
import com.intellij.util.CommonProcessors;
import com.intellij.codeInsight.daemon.DaemonBundle;
import com.intellij.codeInsight.daemon.GutterIconNavigationHandler;
import com.intellij.ide.util.MethodCellRenderer;
import com.intellij.ide.util.PsiClassListCellRenderer;
import com.intellij.openapi.progress.ProgressManager;
import com.intellij.psi.*;
import com.intellij.psi.search.PsiElementProcessor;
import com.intellij.psi.search.PsiElementProcessorAdapter;
import com.intellij.psi.search.searches.ClassInheritorsSearch;
import com.intellij.psi.search.searches.OverridingMethodsSearch;
import com.intellij.psi.util.PsiUtil;
import com.intellij.util.CommonProcessors;
import com.intellij.util.Function;
import com.intellij.util.NullableFunction;
import org.jetbrains.annotations.NonNls;
import javax.swing.*;
import java.util.Comparator;
import java.util.Arrays;
import java.awt.event.MouseEvent;
import java.util.Arrays;
import java.util.Comparator;
public enum MarkerType {
OVERRIDING_METHOD(new NullableFunction<PsiElement, String>() {
@@ -175,7 +175,7 @@ public enum MarkerType {
PsiClass[] inheritors = collectProcessor.toArray(PsiClass.EMPTY_ARRAY);
if (inheritors.length == 0) return;
String title = aClass.isInterface()
? CodeInsightBundle.message("goto.implementation.chooser.title", aClass.getName(), inheritors.length)
? CodeInsightBundle.message("goto.implementation.chooserTitle", aClass.getName(), inheritors.length)
: DaemonBundle.message("navigation.title.subclass", aClass.getName(), inheritors.length);
PsiClassListCellRenderer renderer = new PsiClassListCellRenderer();
Arrays.sort(inheritors, renderer.getComparator());
@@ -15,31 +15,22 @@
*/
package com.intellij.codeInsight.navigation;
import com.intellij.ide.util.PsiElementListCellRenderer;
import com.intellij.ide.util.MethodCellRenderer;
import com.intellij.ide.util.PsiClassListCellRenderer;
import com.intellij.ide.util.PsiElementListCellRenderer;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiMethod;
import com.intellij.psi.PsiClass;
import com.intellij.psi.util.PsiUtil;
import java.util.Arrays;
/**
* @author yole
*/
public class JavaGotoTargetRendererProvider implements GotoTargetRendererProvider {
public PsiElementListCellRenderer getRenderer(final PsiElement[] elements) {
boolean onlyMethods = true;
boolean onlyClasses = true;
for (PsiElement element : elements) {
if (!(element instanceof PsiMethod)) onlyMethods = false;
if (!(element instanceof PsiClass)) onlyClasses = false;
public PsiElementListCellRenderer getRenderer(final PsiElement element) {
if (element instanceof PsiMethod) {
return new MethodCellRenderer(false);
}
if (onlyMethods) {
return new MethodCellRenderer(!PsiUtil.allMethodsHaveSameSignature(Arrays.asList(elements).toArray(PsiMethod.EMPTY_ARRAY)));
}
else if (onlyClasses) {
else if (element instanceof PsiClass) {
return new PsiClassListCellRenderer();
}
return null;
@@ -16,33 +16,34 @@
package com.intellij.codeInsight.navigation;
import com.intellij.codeInsight.CodeInsightBundle;
import com.intellij.codeInsight.TargetElementUtilBase;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import java.util.Collections;
public class GotoImplementationHandler extends GotoTargetHandler {
protected String getFeatureUsedKey() {
return "navigation.goto.implementation";
}
public Pair<PsiElement, PsiElement[]> getSourceAndTargetElements(Editor editor, PsiFile file) {
public GotoData getSourceAndTargetElements(Editor editor, PsiFile file) {
int offset = editor.getCaretModel().getOffset();
PsiElement source = TargetElementUtilBase.getInstance().findTargetElement(editor, ImplementationSearcher.getFlags(), offset);
PsiElement[] target = new ImplementationSearcher().searchImplementations(editor, source, offset);
if (target.length == 0) {
return new Pair<PsiElement, PsiElement[]>(source, new PsiElement[] { source });
}
return new Pair<PsiElement, PsiElement[]>(source, target);
if (source == null) return null;
return new GotoData(source, new ImplementationSearcher().searchImplementations(editor, source, offset), Collections.EMPTY_LIST);
}
protected String getChooserInFileTitleKey(PsiElement sourceElement) {
return "goto.implementation.in.file.chooser.title";
protected String getChooserTitle(PsiElement sourceElement, String name, int length) {
return CodeInsightBundle.message("goto.implementation.chooserTitle", name, length);
}
protected String getChooserTitleKey(PsiElement sourceElement) {
return "goto.implementation.chooser.title";
@Override
protected String getNotFoundMessage(Project project, Editor editor, PsiFile file) {
return CodeInsightBundle.message("goto.implementation.notFound");
}
}
@@ -17,7 +17,7 @@
package com.intellij.codeInsight.navigation;
import com.intellij.codeInsight.CodeInsightActionHandler;
import com.intellij.codeInsight.CodeInsightBundle;
import com.intellij.codeInsight.hint.HintManager;
import com.intellij.featureStatistics.FeatureUsageTracker;
import com.intellij.ide.util.EditSourceUtil;
import com.intellij.ide.util.PsiElementListCellRenderer;
@@ -27,19 +27,26 @@ import com.intellij.openapi.project.DumbService;
import com.intellij.openapi.project.IndexNotReadyException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.popup.PopupChooserBuilder;
import com.intellij.openapi.util.Pair;
import com.intellij.pom.Navigatable;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiNamedElement;
import com.intellij.ui.components.JBList;
import com.intellij.util.Function;
import gnu.trove.THashMap;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.Arrays;
import java.awt.*;
import java.util.*;
import java.util.List;
public abstract class GotoTargetHandler implements CodeInsightActionHandler {
private PsiElementListCellRenderer myDefaultTargetElementRenderer = new DefaultPsiElementListCellRenderer();
private DefaultListCellRenderer myActionElementRenderer = new ActionCellRenderer();
public boolean startInWriteAction() {
return false;
}
@@ -48,9 +55,9 @@ public abstract class GotoTargetHandler implements CodeInsightActionHandler {
FeatureUsageTracker.getInstance().triggerFeatureUsed(getFeatureUsedKey());
try {
Pair<PsiElement, PsiElement[]> sourceAndTarget = getSourceAndTargetElements(editor, file);
if (sourceAndTarget.first != null) {
show(project, editor, file, sourceAndTarget.first, sourceAndTarget.second);
GotoData gotoData = getSourceAndTargetElements(editor, file);
if (gotoData.source != null) {
show(project, editor, file, gotoData.source, gotoData.targets, gotoData.additionalActions);
}
}
catch (IndexNotReadyException e) {
@@ -61,94 +68,146 @@ public abstract class GotoTargetHandler implements CodeInsightActionHandler {
@NonNls
protected abstract String getFeatureUsedKey();
protected abstract Pair<PsiElement, PsiElement[]> getSourceAndTargetElements(Editor editor, PsiFile file);
@Nullable
protected abstract GotoData getSourceAndTargetElements(Editor editor, PsiFile file);
private void show(Project project, final Editor editor, final PsiFile file, final PsiElement sourceElement, final PsiElement[] elements) {
if (elements == null || elements.length == 0) {
handleNoVariansCase(project, editor, file);
private void show(Project project,
Editor editor,
PsiFile file,
final PsiElement sourceElement,
final PsiElement[] targets,
final List<AdditionalAction> additionalActions) {
if (targets.length == 0 && additionalActions.isEmpty()) {
HintManager.getInstance().showErrorHint(editor, getNotFoundMessage(project, editor, file));
return;
}
if (elements.length == 1 && elements[0] != null) {
Navigatable descriptor = elements[0] instanceof Navigatable ? (Navigatable) elements[0] : EditSourceUtil.getDescriptor(elements[0]);
if (targets.length == 1 && additionalActions.isEmpty()) {
Navigatable descriptor = targets[0] instanceof Navigatable ? (Navigatable)targets[0] : EditSourceUtil.getDescriptor(targets[0]);
if (descriptor != null && descriptor.canNavigate()) {
navigateToElement(descriptor);
}
return;
}
else {
final Map<Object, PsiElementListCellRenderer> targetsWithRenderers = new THashMap<Object, PsiElementListCellRenderer>(targets.length);
GotoTargetRendererProvider[] providers = Extensions.getExtensions(GotoTargetRendererProvider.EP_NAME);
for (PsiElement eachTarget : targets) {
PsiElementListCellRenderer renderer = null;
for (GotoTargetRendererProvider provider : Extensions.getExtensions(GotoTargetRendererProvider.EP_NAME)) {
renderer = provider.getRenderer(elements);
for (GotoTargetRendererProvider eachProvider : providers) {
renderer = eachProvider.getRenderer(eachTarget);
if (renderer != null) break;
}
String titleKey;
if (renderer == null) {
renderer = new DefaultPsiElementListCellRenderer();
titleKey = getChooserInFileTitleKey(sourceElement);
} else {
titleKey = getChooserTitleKey(sourceElement);
renderer = myDefaultTargetElementRenderer;
}
String name = ((PsiNamedElement)sourceElement).getName();
String title = CodeInsightBundle.message(titleKey, name, hasNullUsage() ? elements.length - 1 : elements.length);
if (shouldSortResult()) Arrays.sort(elements, renderer.getComparator());
final JList list = new JList(elements);
list.setCellRenderer(renderer);
targetsWithRenderers.put(eachTarget, renderer);
}
final Runnable runnable = new Runnable() {
public void run() {
int[] ids = list.getSelectedIndices();
if (ids == null || ids.length == 0) return;
Object[] selectedElements = list.getSelectedValues();
for (Object element : selectedElements) {
final Navigatable descriptor = element instanceof Navigatable ? (Navigatable) element : EditSourceUtil.getDescriptor((PsiElement)element);
if (descriptor != null) {
if (descriptor.canNavigate()) {
navigateToElement(descriptor);
}
}
else {
navigateToElement(element, editor, file);
String name = ((PsiNamedElement)sourceElement).getName();
String title = getChooserTitle(sourceElement, name, targets.length);
if (shouldSortTargets()) {
Arrays.sort(targets, new Comparator<PsiElement>() {
@Override
public int compare(PsiElement o1, PsiElement o2) {
return getComparingObject(o1).compareTo(getComparingObject(o2));
}
private Comparable getComparingObject(PsiElement o1) {
return targetsWithRenderers.get(o1).getComparingObject(o1);
}
});
}
List<Object> allElements = new ArrayList<Object>(targets.length + additionalActions.size());
Collections.addAll(allElements, targets);
allElements.addAll(additionalActions);
final JList list = new JBList(allElements);
list.setCellRenderer(new DefaultListCellRenderer() {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
if (value == null) return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value instanceof AdditionalAction) {
return myActionElementRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
}
return targetsWithRenderers.get(value).getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
}
});
final Runnable runnable = new Runnable() {
public void run() {
int[] ids = list.getSelectedIndices();
if (ids == null || ids.length == 0) return;
Object[] selectedElements = list.getSelectedValues();
for (Object element : selectedElements) {
if (element instanceof AdditionalAction) {
((AdditionalAction)element).execute();
}
else {
Navigatable nav = element instanceof Navigatable ? (Navigatable)element : EditSourceUtil.getDescriptor((PsiElement)element);
if (nav != null && nav.canNavigate()) {
navigateToElement(nav);
}
}
}
};
}
};
final PopupChooserBuilder builder = new PopupChooserBuilder(list);
renderer.installSpeedSearch(builder);
builder.
setTitle(title).
setItemChoosenCallback(runnable).
setMovable(true).
createPopup().showInBestPositionFor(editor);
}
final PopupChooserBuilder builder = new PopupChooserBuilder(list);
builder.setFilteringEnabled(new Function<Object, String>() {
@Override
public String fun(Object o) {
if (o instanceof AdditionalAction) {
return ((AdditionalAction)o).getText();
}
return targetsWithRenderers.get(o).getElementText((PsiElement)o);
}
});
builder.
setTitle(title).
setItemChoosenCallback(runnable).
setMovable(true).
createPopup().showInBestPositionFor(editor);
}
protected void navigateToElement(@Nullable Object element, @NotNull Editor editor, @NotNull PsiFile file) {
//special case for null
}
protected boolean hasNullUsage() {
return false;
}
protected void navigateToElement(Navigatable descriptor) {
descriptor.navigate(true);
}
protected boolean shouldSortResult() {
protected boolean shouldSortTargets() {
return true;
}
protected void handleNoVariansCase(Project project, Editor editor, PsiFile file) {
protected abstract String getChooserTitle(PsiElement sourceElement, String name, int length);
protected abstract String getNotFoundMessage(Project project, Editor editor, PsiFile file);
public interface AdditionalAction {
String getText();
Icon getIcon();
void execute();
}
protected abstract String getChooserInFileTitleKey(PsiElement sourceElement);
public static class GotoData {
public final PsiElement source;
public final PsiElement[] targets;
public final List<AdditionalAction> additionalActions;
protected abstract String getChooserTitleKey(PsiElement sourceElement);
public GotoData(PsiElement source, PsiElement[] targets, List<AdditionalAction> additionalActions) {
this.source = source;
this.targets = targets;
this.additionalActions = additionalActions;
}
}
private static class DefaultPsiElementListCellRenderer extends PsiElementListCellRenderer {
public String getElementText(final PsiElement element) {
@@ -163,4 +222,17 @@ public abstract class GotoTargetHandler implements CodeInsightActionHandler {
return 0;
}
}
private class ActionCellRenderer extends DefaultListCellRenderer {
@Override
public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
Component result = super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
if (value != null) {
AdditionalAction action = (AdditionalAction)value;
setText(action.getText());
setIcon(action.getIcon());
}
return result;
}
}
}
@@ -28,5 +28,5 @@ public interface GotoTargetRendererProvider {
ExtensionPointName<GotoTargetRendererProvider> EP_NAME = ExtensionPointName.create("com.intellij.gotoTargetRendererProvider");
@Nullable
PsiElementListCellRenderer getRenderer(PsiElement[] elements);
PsiElementListCellRenderer getRenderer(PsiElement element);
}
@@ -37,6 +37,7 @@ import com.intellij.ui.SimpleTextAttributes;
import com.intellij.util.Function;
import com.intellij.util.IconUtil;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
@@ -117,8 +118,8 @@ public abstract class PsiElementListCellRenderer<T extends PsiElement> extends J
}
}
else {
setIcon(getNullIcon());
append(value == null ? getNullPresentation() : value.toString(), new SimpleTextAttributes(Font.PLAIN, list.getForeground()));
setIcon(IconUtil.getEmptyIcon(false));
append(value == null ? "" : value.toString(), new SimpleTextAttributes(Font.PLAIN, list.getForeground()));
}
setPaintFocusBorder(false);
setBackground(selected ? UIUtil.getListSelectionBackground() : bgColor);
@@ -161,14 +162,6 @@ public abstract class PsiElementListCellRenderer<T extends PsiElement> extends J
public abstract String getElementText(T element);
protected String getNullPresentation() {
return "";
}
protected Icon getNullIcon() {
return IconUtil.getEmptyIcon(false);
}
@Nullable
protected abstract String getContainerText(T element, final String name);
@@ -181,17 +174,18 @@ public abstract class PsiElementListCellRenderer<T extends PsiElement> extends J
public Comparator<T> getComparator() {
return new Comparator<T>() {
public int compare(T o1, T o2) {
return getText(o1).compareTo(getText(o2));
}
private String getText(T element) {
String elementText = getElementText(element);
String containerText = getContainerText(element, elementText);
return containerText != null ? elementText + " " + containerText : elementText;
return getComparingObject(o1).compareTo(getComparingObject(o2));
}
};
}
@NotNull
public Comparable getComparingObject(T element) {
String elementText = getElementText(element);
String containerText = getContainerText(element, elementText);
return containerText != null ? elementText + " " + containerText : elementText;
}
public void installSpeedSearch(PopupChooserBuilder builder) {
builder.setFilteringEnabled(new Function<Object, String>() {
public String fun(Object o) {
@@ -16,29 +16,36 @@
package com.intellij.testIntegration;
import com.intellij.codeInsight.hint.HintManager;
import com.intellij.codeInsight.CodeInsightBundle;
import com.intellij.codeInsight.navigation.GotoTargetHandler;
import com.intellij.codeInsight.navigation.NavigationUtil;
import com.intellij.idea.ActionsBundle;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.IconLoader;
import com.intellij.pom.Navigatable;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.psi.util.PsiUtilBase;
import com.intellij.util.SmartList;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.Collection;
import java.util.List;
public class GotoTestOrCodeHandler extends GotoTargetHandler {
protected String getFeatureUsedKey() {
return "navigation.goto.testOrCode";
}
protected Pair<PsiElement, PsiElement[]> getSourceAndTargetElements(Editor editor, PsiFile file) {
@Nullable
protected GotoData getSourceAndTargetElements(final Editor editor, final PsiFile file) {
PsiElement selectedElement = getSelectedElement(editor, file);
PsiElement sourceElement = TestFinderHelper.findSourceElement(selectedElement);
if (sourceElement == null) return null;
List<AdditionalAction> actions = new SmartList<AdditionalAction>();
Collection<PsiElement> candidates;
if (TestFinderHelper.isTest(selectedElement)) {
@@ -46,10 +53,26 @@ public class GotoTestOrCodeHandler extends GotoTargetHandler {
}
else {
candidates = TestFinderHelper.findTestsForClass(selectedElement);
actions.add(new AdditionalAction() {
@Override
public String getText() {
return "Create New Test...";
}
@Override
public Icon getIcon() {
return IconLoader.getIcon("/actions/intentionBulb.png");
}
@Override
public void execute() {
final TestCreator creator = LanguageTestCreators.INSTANCE.forLanguage(file.getLanguage());
if (creator != null) creator.createTest(file.getProject(), editor, file);
}
});
}
PsiElement sourceElement = TestFinderHelper.findSourceElement(selectedElement);
return new Pair<PsiElement, PsiElement[]>(sourceElement, candidates.toArray(new PsiElement[candidates.size()]));
return new GotoData(sourceElement, candidates.toArray(new PsiElement[candidates.size()]), actions);
}
@NotNull
@@ -58,34 +81,22 @@ public class GotoTestOrCodeHandler extends GotoTargetHandler {
}
@Override
protected boolean shouldSortResult() {
protected boolean shouldSortTargets() {
return false;
}
protected String getChooserTitle(PsiElement sourceElement, String name, int length) {
if (TestFinderHelper.isTest(sourceElement)) {
return CodeInsightBundle.message("goto.test.chooserTitle.subject", name, length);
}
else {
return CodeInsightBundle.message("goto.test.chooserTitle.test", name, length);
}
}
@Override
protected void handleNoVariansCase(Project project, Editor editor, PsiFile file) {
PsiElement selectedElement = getSelectedElement(editor, file);
if (TestFinderHelper.isTest(selectedElement)) {
HintManager.getInstance().showErrorHint(editor, ActionsBundle.message("action.GotoTestSubject.nothing.found"));
}
}
protected String getChooserInFileTitleKey(PsiElement sourceElement) {
if (TestFinderHelper.isTest(sourceElement)) {
return "goto.test.subject.in.file.chooser.title";
}
else {
return "goto.test.in.file.chooser.title";
}
}
protected String getChooserTitleKey(PsiElement sourceElement) {
if (TestFinderHelper.isTest(sourceElement)) {
return "goto.test.subject.chooser.title";
}
else {
return "goto.test.chooser.title";
}
protected String getNotFoundMessage(Project project, Editor editor, PsiFile file) {
return CodeInsightBundle.message("goto.test.notFound");
}
@Override
@@ -97,15 +108,4 @@ public class GotoTestOrCodeHandler extends GotoTargetHandler {
element.navigate(true);
}
}
@Override
protected void navigateToElement(@Nullable Object element, @NotNull Editor editor, @NotNull PsiFile file) {
final TestCreator creator = LanguageTestCreators.INSTANCE.forLanguage(file.getLanguage());
if (creator != null) creator.createTest(file.getProject(), editor, file);
}
@Override
protected boolean hasNullUsage() {
return true;
}
}
@@ -1,75 +0,0 @@
/*
* Copyright 2000-2010 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.
*/
/*
* User: anna
* Date: 25-May-2010
*/
package com.intellij.testIntegration;
import com.intellij.codeInsight.navigation.GotoTargetRendererProvider;
import com.intellij.ide.util.PsiElementListCellRenderer;
import com.intellij.openapi.ui.popup.PopupChooserBuilder;
import com.intellij.openapi.util.IconLoader;
import com.intellij.psi.PsiElement;
import com.intellij.util.Function;
import javax.swing.*;
public class GotoTestRendererProvider implements GotoTargetRendererProvider {
public PsiElementListCellRenderer getRenderer(PsiElement[] elements) {
return new PsiElementListCellRenderer() {
public String getElementText(final PsiElement element) {
return element.getContainingFile().getName();
}
protected String getContainerText(final PsiElement element, final String name) {
return null;
}
protected int getIconFlags() {
return 0;
}
@Override
protected String getNullPresentation() {
return "Create New Test ...";
}
@Override
protected Icon getNullIcon() {
return IconLoader.getIcon("/actions/intentionBulb.png");
}
@Override
public void installSpeedSearch(PopupChooserBuilder builder) {
builder.setFilteringEnabled(new Function<Object, String>() {
public String fun(Object o) {
if (o instanceof PsiElement) {
return getElementText((PsiElement)o);
}
else {
return getNullPresentation();
}
}
});
}
};
}
}
@@ -36,7 +36,6 @@ public class TestFinderHelper {
for (TestFinder each : getFinders()) {
result.addAll(each.findTestsForClass(element));
}
/*if (!result.isEmpty())*/ result.add(null);
return result;
}
@@ -388,7 +388,6 @@ action.GotoTest.text=T_est
action.GotoTest.description=Navigate to the test of the selected class
action.GotoTestSubject.text=T_est Subject
action.GotoTestSubject.description=Navigate to the subject of the selected test
action.GotoTestSubject.nothing.found=No test subject has been found.
action.GotoAspect.text=_Aspect
action.GotoAspect.description=Navigate to the declaration of the advice, error or warning declaration that affects a join point at caret
action.GotoNextError.text=_Next Highlighted Error
@@ -222,13 +222,12 @@ javadoc.method.specified.by=Specified by:
javadoc.external.fetch.error.message=Cannot fetch remote documentation: {0}
searching.for.implementations=Searching For Implementations...
goto.implementation.chooser.title=<html><body>Choose Implementation of <b>{0}</b> ({1} classes found)</body></html>
goto.implementation.in.file.chooser.title=<html><body>Choose Implementation of <b>{0}</b> ({1} files found)</body></html>
goto.implementation.chooserTitle=<html><body>Choose Implementation of <b>{0}</b> ({1} found)</body></html>
goto.implementation.notFound=Not implementations found
goto.test.chooser.title=<html><body>Choose Test for <b>{0}</b> ({1} classes found)</body></html>
goto.test.in.file.chooser.title=<html><body>Choose Test for <b>{0}</b> ({1} files found)</body></html>
goto.test.subject.chooser.title=<html><body>Choose Test Subject for <b>{0}</b> ({1} classes found)</body></html>
goto.test.subject.in.file.chooser.title=<html><body>Choose Test Subject for <b>{0}</b> ({1} files found)</body></html>
goto.test.chooserTitle.test=<html><body>Choose Test for <b>{0}</b> ({1} found)</body></html>
goto.test.chooserTitle.subject=<html><body>Choose Test Subject for <b>{0}</b> ({1} found)</body></html>
goto.test.notFound=Not test subjects found
incremental.search.tooltip.prefix=Search for:
goto.super.method.chooser.title=Choose super method
@@ -555,7 +555,6 @@
<filePasteProvider implementation="com.intellij.ide.FileListPasteProvider"/>
<definitionsSearch implementation="com.intellij.pom.PomDefinitionSearch"/>
<gotoTargetRendererProvider implementation="com.intellij.testIntegration.GotoTestRendererProvider"/>
<applicationService serviceInterface="com.intellij.ide.todo.TodoConfiguration"
serviceImplementation="com.intellij.ide.todo.TodoConfiguration"/>
@@ -24,10 +24,10 @@ import com.intellij.openapi.vfs.VfsUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
import com.intellij.testFramework.PsiTestUtil;
import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase;
import com.intellij.testFramework.fixtures.TempDirTestFixture;
import com.intellij.testFramework.fixtures.impl.TempDirTestFixtureImpl;
import com.intellij.testFramework.PsiTestUtil;
/**
* @author peter
@@ -51,7 +51,7 @@ public class GroovyGotoImplementationTest extends JavaCodeInsightFixtureTestCase
PsiFile inProject = myFixture.addFileToProject("Foo.groovy", "class <caret>Foo {}\n class Bar extends Foo {}");
myFixture.configureFromExistingVirtualFile(inProject.getVirtualFile());
final PsiElement[] impls = new GotoImplementationHandler().getSourceAndTargetElements(myFixture.getEditor(), inProject).second;
final PsiElement[] impls = new GotoImplementationHandler().getSourceAndTargetElements(myFixture.getEditor(), inProject).targets;
assertEquals(1, impls.length);
}
finally {