mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-113936 Dependency autocompletion causes confusing behaviour when editing POMs
This commit is contained in:
+92
@@ -15,8 +15,24 @@
|
||||
*/
|
||||
package org.jetbrains.idea.maven.dom.converters;
|
||||
|
||||
import com.intellij.codeInsight.completion.CompletionType;
|
||||
import com.intellij.codeInsight.completion.InsertHandler;
|
||||
import com.intellij.codeInsight.completion.InsertionContext;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.lookup.LookupElementBuilder;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.xml.XmlFile;
|
||||
import com.intellij.psi.xml.XmlTag;
|
||||
import com.intellij.util.xml.ConvertContext;
|
||||
import com.intellij.util.xml.DomElement;
|
||||
import com.intellij.util.xml.DomManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.idea.maven.dom.model.MavenDomArtifactCoordinates;
|
||||
import org.jetbrains.idea.maven.dom.model.MavenDomDependency;
|
||||
import org.jetbrains.idea.maven.indices.MavenProjectIndicesManager;
|
||||
import org.jetbrains.idea.maven.model.MavenArtifact;
|
||||
import org.jetbrains.idea.maven.model.MavenId;
|
||||
@@ -46,9 +62,85 @@ public class MavenArtifactCoordinatesArtifactIdConverter extends MavenArtifactCo
|
||||
return false;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public LookupElement createLookupElement(String s) {
|
||||
LookupElementBuilder res = LookupElementBuilder.create(s);
|
||||
res = res.withInsertHandler(MavenArtifactInsertHandler.INSTANCE);
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Set<String> doGetVariants(MavenId id, MavenProjectIndicesManager manager) {
|
||||
if (StringUtil.isEmptyOrSpaces(id.getGroupId())) return Collections.emptySet();
|
||||
return manager.getArtifactIds(id.getGroupId());
|
||||
}
|
||||
|
||||
private static class MavenArtifactInsertHandler implements InsertHandler<LookupElement> {
|
||||
|
||||
public static final InsertHandler<LookupElement> INSTANCE = new MavenArtifactInsertHandler();
|
||||
|
||||
@Override
|
||||
public void handleInsert(final InsertionContext context, LookupElement item) {
|
||||
context.commitDocument();
|
||||
|
||||
XmlFile xmlFile = (XmlFile)context.getFile();
|
||||
|
||||
PsiElement element = xmlFile.findElementAt(context.getStartOffset());
|
||||
XmlTag tag = PsiTreeUtil.getParentOfType(element, XmlTag.class);
|
||||
if (tag == null) return;
|
||||
|
||||
XmlTag dependencyTag = tag.getParentTag();
|
||||
|
||||
DomElement domElement = DomManager.getDomManager(context.getProject()).getDomElement(dependencyTag);
|
||||
if (!(domElement instanceof MavenDomDependency)) return;
|
||||
|
||||
MavenDomArtifactCoordinates dependency = (MavenDomArtifactCoordinates)domElement;
|
||||
|
||||
String artifactId = item.getLookupString();
|
||||
|
||||
String groupId = dependency.getGroupId().getStringValue();
|
||||
if (StringUtil.isEmpty(groupId)) {
|
||||
String g = getUniqueGroupIdOrNull(context.getProject(), artifactId);
|
||||
if (g != null) {
|
||||
dependency.getGroupId().setStringValue(g);
|
||||
groupId = g;
|
||||
}
|
||||
else {
|
||||
if (groupId == null) {
|
||||
dependency.getGroupId().setStringValue("");
|
||||
}
|
||||
|
||||
XmlTag groupIdTag = dependency.getGroupId().getXmlTag();
|
||||
context.getEditor().getCaretModel().moveToOffset(groupIdTag.getValue().getTextRange().getStartOffset());
|
||||
|
||||
MavenDependencyCompletionUtil.invokeCompletion(context, CompletionType.SMART);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
MavenDependencyCompletionUtil.completeVersion(context, dependency, groupId, artifactId);
|
||||
}
|
||||
|
||||
private static String getUniqueGroupIdOrNull(@NotNull Project project, @NotNull String artifactId) {
|
||||
MavenProjectIndicesManager manager = MavenProjectIndicesManager.getInstance(project);
|
||||
|
||||
String res = null;
|
||||
|
||||
for (String groupId : manager.getGroupIds()) {
|
||||
if (manager.getArtifactIds(groupId).contains(artifactId)) {
|
||||
if (res == null) {
|
||||
res = groupId;
|
||||
}
|
||||
else {
|
||||
return null; // There are more then one appropriate groupId.
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+5
-5
@@ -315,12 +315,12 @@ public abstract class MavenArtifactCoordinatesConverter extends ResolvingConvert
|
||||
public Set<String> getVariants(MavenId id, MavenProjectIndicesManager manager, MavenDomShortArtifactCoordinates coordinates) {
|
||||
if (StringUtil.isEmpty(id.getGroupId())) {
|
||||
Set<String> result = new THashSet<String>();
|
||||
if (DomUtil.hasXml(coordinates.getGroupId())) {
|
||||
for (String each : manager.getGroupIds()) {
|
||||
id = new MavenId(each, id.getArtifactId(), id.getVersion());
|
||||
result.addAll(super.getVariants(id, manager, coordinates));
|
||||
}
|
||||
|
||||
for (String each : manager.getGroupIds()) {
|
||||
id = new MavenId(each, id.getArtifactId(), id.getVersion());
|
||||
result.addAll(super.getVariants(id, manager, coordinates));
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
return super.getVariants(id, manager, coordinates);
|
||||
|
||||
+50
@@ -1,8 +1,21 @@
|
||||
package org.jetbrains.idea.maven.dom.converters;
|
||||
|
||||
import com.intellij.codeInsight.completion.InsertHandler;
|
||||
import com.intellij.codeInsight.completion.InsertionContext;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.lookup.LookupElementBuilder;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.xml.XmlFile;
|
||||
import com.intellij.psi.xml.XmlTag;
|
||||
import com.intellij.util.containers.hash.HashSet;
|
||||
import com.intellij.util.xml.ConvertContext;
|
||||
import com.intellij.util.xml.DomElement;
|
||||
import com.intellij.util.xml.DomManager;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.idea.maven.dom.model.MavenDomArtifactCoordinates;
|
||||
import org.jetbrains.idea.maven.dom.model.MavenDomDependency;
|
||||
import org.jetbrains.idea.maven.indices.MavenProjectIndicesManager;
|
||||
import org.jetbrains.idea.maven.model.MavenArtifact;
|
||||
import org.jetbrains.idea.maven.model.MavenId;
|
||||
@@ -36,6 +49,14 @@ public class MavenArtifactCoordinatesGroupIdConverter extends MavenArtifactCoord
|
||||
return manager.getGroupIds();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public LookupElement createLookupElement(String s) {
|
||||
LookupElementBuilder res = LookupElementBuilder.create(s);
|
||||
res = res.withInsertHandler(MavenGroupIdInsertHandler.INSTANCE);
|
||||
return res;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<String> getSmartVariants(ConvertContext convertContext) {
|
||||
Set<String> groupIds = new HashSet<String>();
|
||||
@@ -50,4 +71,33 @@ public class MavenArtifactCoordinatesGroupIdConverter extends MavenArtifactCoord
|
||||
}
|
||||
return groupIds;
|
||||
}
|
||||
|
||||
private static class MavenGroupIdInsertHandler implements InsertHandler<LookupElement> {
|
||||
|
||||
public static final InsertHandler<LookupElement> INSTANCE = new MavenGroupIdInsertHandler();
|
||||
|
||||
@Override
|
||||
public void handleInsert(final InsertionContext context, LookupElement item) {
|
||||
context.commitDocument();
|
||||
|
||||
XmlFile xmlFile = (XmlFile)context.getFile();
|
||||
|
||||
PsiElement element = xmlFile.findElementAt(context.getStartOffset());
|
||||
XmlTag tag = PsiTreeUtil.getParentOfType(element, XmlTag.class);
|
||||
if (tag == null) return;
|
||||
|
||||
XmlTag dependencyTag = tag.getParentTag();
|
||||
|
||||
DomElement domElement = DomManager.getDomManager(context.getProject()).getDomElement(dependencyTag);
|
||||
if (!(domElement instanceof MavenDomDependency)) return;
|
||||
|
||||
MavenDomArtifactCoordinates dependency = (MavenDomArtifactCoordinates)domElement;
|
||||
|
||||
String artifactId = dependency.getArtifactId().getStringValue();
|
||||
if (StringUtil.isEmpty(artifactId)) return;
|
||||
|
||||
MavenDependencyCompletionUtil.completeVersion(context, dependency, item.getLookupString(), artifactId);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+112
@@ -0,0 +1,112 @@
|
||||
/*
|
||||
* Copyright 2000-2013 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 org.jetbrains.idea.maven.dom.converters;
|
||||
|
||||
import com.intellij.codeInsight.completion.CodeCompletionHandlerBase;
|
||||
import com.intellij.codeInsight.completion.CompletionType;
|
||||
import com.intellij.codeInsight.completion.InsertionContext;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.xml.DomElement;
|
||||
import com.intellij.util.xml.DomUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.idea.maven.dom.MavenDomProjectProcessorUtils;
|
||||
import org.jetbrains.idea.maven.dom.model.*;
|
||||
import org.jetbrains.idea.maven.indices.MavenProjectIndicesManager;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author Sergey Evdokimov
|
||||
*/
|
||||
public class MavenDependencyCompletionUtil {
|
||||
|
||||
public static MavenDomDependency findManagedDependency(MavenDomProjectModel domModel, Project project,
|
||||
@NotNull final String groupId, @NotNull final String artifactId) {
|
||||
|
||||
final Ref<MavenDomDependency> ref = new Ref<MavenDomDependency>();
|
||||
|
||||
MavenDomProjectProcessorUtils.processDependenciesInDependencyManagement(domModel,
|
||||
new Processor<MavenDomDependency>() {
|
||||
@Override
|
||||
public boolean process(MavenDomDependency dependency) {
|
||||
if (groupId.equals(dependency.getGroupId().getStringValue())
|
||||
&&
|
||||
artifactId.equals(
|
||||
dependency.getArtifactId().getStringValue())) {
|
||||
ref.set(dependency);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}, project);
|
||||
|
||||
return ref.get();
|
||||
}
|
||||
|
||||
private static boolean isInsideManagedDependency(MavenDomArtifactCoordinates dependency) {
|
||||
DomElement parent = dependency.getParent();
|
||||
if (!(parent instanceof MavenDomDependencies)) return false;
|
||||
|
||||
return parent.getParent() instanceof MavenDomDependencyManagement;
|
||||
}
|
||||
|
||||
public static void completeVersion(@NotNull InsertionContext context,
|
||||
@NotNull MavenDomArtifactCoordinates dependency,
|
||||
@NotNull String groupId, @NotNull String artifactId) {
|
||||
if (!StringUtil.isEmpty(dependency.getVersion().getStringValue())) return;
|
||||
|
||||
Project project = context.getProject();
|
||||
|
||||
if (!isInsideManagedDependency(dependency)) {
|
||||
MavenDomProjectModel model = DomUtil.<MavenDomProjectModel>getFileElement(dependency).getRootElement();
|
||||
if (findManagedDependency(model, project, groupId, artifactId) != null) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
MavenProjectIndicesManager manager = MavenProjectIndicesManager.getInstance(project);
|
||||
|
||||
Set<String> versions = manager.getVersions(groupId, artifactId);
|
||||
if (versions.size() == 1) {
|
||||
dependency.getVersion().setStringValue(ContainerUtil.getFirstItem(versions));
|
||||
return;
|
||||
}
|
||||
|
||||
dependency.getVersion().setStringValue("");
|
||||
|
||||
int versionPosition = dependency.getVersion().getXmlTag().getValue().getTextRange().getStartOffset();
|
||||
|
||||
context.getEditor().getCaretModel().moveToOffset(versionPosition);
|
||||
|
||||
if (versions.size() > 0) {
|
||||
invokeCompletion(context, CompletionType.BASIC);
|
||||
}
|
||||
}
|
||||
|
||||
public static void invokeCompletion(@NotNull final InsertionContext context, final CompletionType completionType) {
|
||||
context.setLaterRunnable(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
new CodeCompletionHandlerBase(completionType).invokeCompletion(context.getProject(), context.getEditor());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
+2
-1
@@ -17,12 +17,13 @@ package org.jetbrains.idea.maven.dom.model;
|
||||
|
||||
import com.intellij.spellchecker.xml.NoSpellchecking;
|
||||
import com.intellij.util.xml.Convert;
|
||||
import com.intellij.util.xml.DomElement;
|
||||
import com.intellij.util.xml.GenericDomValue;
|
||||
import com.intellij.util.xml.Required;
|
||||
import org.jetbrains.idea.maven.dom.converters.MavenArtifactCoordinatesArtifactIdConverter;
|
||||
import org.jetbrains.idea.maven.dom.converters.MavenArtifactCoordinatesGroupIdConverter;
|
||||
|
||||
public interface MavenDomShortArtifactCoordinates {
|
||||
public interface MavenDomShortArtifactCoordinates extends DomElement {
|
||||
@Required
|
||||
@NoSpellchecking
|
||||
@Convert(MavenArtifactCoordinatesGroupIdConverter.class)
|
||||
|
||||
+4
-34
@@ -6,7 +6,6 @@ import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.codeInsight.lookup.LookupElementBuilder;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
@@ -15,12 +14,10 @@ import com.intellij.psi.xml.XmlFile;
|
||||
import com.intellij.psi.xml.XmlTag;
|
||||
import com.intellij.psi.xml.XmlText;
|
||||
import com.intellij.psi.xml.XmlTokenType;
|
||||
import com.intellij.util.Processor;
|
||||
import com.intellij.util.xml.DomElement;
|
||||
import com.intellij.util.xml.DomFileElement;
|
||||
import com.intellij.util.xml.DomManager;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.idea.maven.dom.MavenDomProjectProcessorUtils;
|
||||
import org.jetbrains.idea.maven.dom.converters.MavenDependencyCompletionUtil;
|
||||
import org.jetbrains.idea.maven.dom.model.MavenDomDependency;
|
||||
import org.jetbrains.idea.maven.dom.model.MavenDomProjectModel;
|
||||
import org.jetbrains.idea.maven.indices.MavenProjectIndicesManager;
|
||||
@@ -67,29 +64,6 @@ public class MavenDependenciesCompletionProvider extends CompletionContributor {
|
||||
}
|
||||
}
|
||||
|
||||
private static MavenDomDependency findManagedDependency(MavenDomProjectModel domModel, Project project,
|
||||
@NotNull final String groupId, @NotNull final String artifactId) {
|
||||
|
||||
final Ref<MavenDomDependency> ref = new Ref<MavenDomDependency>();
|
||||
|
||||
MavenDomProjectProcessorUtils.processDependenciesInDependencyManagement(domModel,
|
||||
new Processor<MavenDomDependency>() {
|
||||
@Override
|
||||
public boolean process(MavenDomDependency dependency) {
|
||||
if (groupId.equals(dependency.getGroupId().getStringValue())
|
||||
&&
|
||||
artifactId.equals(
|
||||
dependency.getArtifactId().getStringValue())) {
|
||||
ref.set(dependency);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}, project);
|
||||
|
||||
return ref.get();
|
||||
}
|
||||
|
||||
private static class MavenDependencyInsertHandler implements InsertHandler<LookupElement> {
|
||||
|
||||
public static final InsertHandler<LookupElement> INSTANCE = new MavenDependencyInsertHandler();
|
||||
@@ -111,7 +85,8 @@ public class MavenDependenciesCompletionProvider extends CompletionContributor {
|
||||
|
||||
boolean shouldInvokeCompletion = false;
|
||||
|
||||
MavenDomDependency managedDependency = findManagedDependency(domModel.getRootElement(), context.getProject(), groupId, artifactId);
|
||||
MavenDomDependency managedDependency = MavenDependencyCompletionUtil.findManagedDependency(domModel.getRootElement(),
|
||||
context.getProject(), groupId, artifactId);
|
||||
if (managedDependency == null) {
|
||||
String value = "<groupId>" + groupId + "</groupId>\n" +
|
||||
"<artifactId>" + artifactId + "</artifactId>\n" +
|
||||
@@ -153,12 +128,7 @@ public class MavenDependenciesCompletionProvider extends CompletionContributor {
|
||||
}
|
||||
|
||||
if (shouldInvokeCompletion) {
|
||||
context.setLaterRunnable(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
new CodeCompletionHandlerBase(CompletionType.BASIC).invokeCompletion(context.getProject(), context.getEditor());
|
||||
}
|
||||
});
|
||||
MavenDependencyCompletionUtil.invokeCompletion(context, CompletionType.BASIC);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-6
@@ -17,6 +17,7 @@ import com.intellij.util.xml.DomFileDescription;
|
||||
import com.intellij.util.xml.DomManager;
|
||||
import org.jetbrains.idea.maven.dom.MavenDomProjectModelDescription;
|
||||
import org.jetbrains.idea.maven.dom.MavenDomUtil;
|
||||
import org.jetbrains.idea.maven.dom.converters.MavenDependencyCompletionUtil;
|
||||
import org.jetbrains.idea.maven.dom.model.MavenDomDependency;
|
||||
|
||||
import java.util.Set;
|
||||
@@ -71,12 +72,7 @@ public class MavenPomXmlCompletionTagListenerContributor extends CompletionContr
|
||||
|
||||
new ReformatCodeProcessor(context.getProject(), context.getFile(), xmlTag.getTextRange(), true).run();
|
||||
|
||||
context.setLaterRunnable(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
new CodeCompletionHandlerBase(CompletionType.BASIC).invokeCompletion(context.getProject(), context.getEditor());
|
||||
}
|
||||
});
|
||||
MavenDependencyCompletionUtil.invokeCompletion(context, CompletionType.BASIC);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+23
-4
@@ -20,8 +20,7 @@ import com.intellij.codeInsight.completion.CompletionContributor;
|
||||
import com.intellij.codeInsight.completion.CompletionParameters;
|
||||
import com.intellij.codeInsight.completion.CompletionResultSet;
|
||||
import com.intellij.codeInsight.completion.CompletionType;
|
||||
import com.intellij.openapi.application.AccessToken;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiReference;
|
||||
import com.intellij.psi.impl.source.xml.TagNameReference;
|
||||
@@ -63,11 +62,19 @@ public class MavenSmartCompletionContributor extends CompletionContributor {
|
||||
Converter converter = reference.getConverter();
|
||||
|
||||
if (converter instanceof MavenSmartConverter) {
|
||||
result.addAll(((MavenSmartConverter)converter).getSmartVariants(reference.getConvertContext()));
|
||||
Collection variants = ((MavenSmartConverter)converter).getSmartVariants(reference.getConvertContext());
|
||||
if (converter instanceof ResolvingConverter) {
|
||||
addVariants((ResolvingConverter)converter, variants, result);
|
||||
}
|
||||
else {
|
||||
result.addAll(variants);
|
||||
}
|
||||
}
|
||||
else if (converter instanceof ResolvingConverter) {
|
||||
//noinspection unchecked
|
||||
result.addAll(((ResolvingConverter)converter).getVariants(reference.getConvertContext()));
|
||||
ResolvingConverter resolvingConverter = (ResolvingConverter)converter;
|
||||
Collection variants = resolvingConverter.getVariants(reference.getConvertContext());
|
||||
addVariants(resolvingConverter, variants, result);
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -78,6 +85,18 @@ public class MavenSmartCompletionContributor extends CompletionContributor {
|
||||
return result;
|
||||
}
|
||||
|
||||
private static <T> void addVariants(ResolvingConverter<T> converter, Collection<T> variants, Collection result) {
|
||||
for (T variant : variants) {
|
||||
LookupElement lookupElement = converter.createLookupElement(variant);
|
||||
if (lookupElement != null) {
|
||||
result.add(lookupElement);
|
||||
}
|
||||
else {
|
||||
result.add(variant);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static PsiReference[] getReferences(CompletionParameters parameters) {
|
||||
PsiElement psiElement = parameters.getPosition().getParent();
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
#NOTE: This is an internal implementation file, its format can be changed without prior notice.
|
||||
#Fri Mar 01 18:02:46 MSK 2013
|
||||
asm-3.3.1.pom>remote-repos=
|
||||
asm-3.3.1.jar>remote-repos=
|
||||
asm-3.3.1.jar>central=
|
||||
asm-3.3.1.pom>central=
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
1d5f20b4ea675e6fab6ab79f1cd60ec268ddc015
|
||||
@@ -0,0 +1,14 @@
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<artifactId>asm-parent</artifactId>
|
||||
<groupId>asm</groupId>
|
||||
<version>3.3.1</version>
|
||||
</parent>
|
||||
|
||||
<name>ASM Core</name>
|
||||
<artifactId>asm</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1 @@
|
||||
bbcde0189656fa6cc671f27437432ac7e7f95673
|
||||
@@ -0,0 +1,4 @@
|
||||
#NOTE: This is an internal implementation file, its format can be changed without prior notice.
|
||||
#Mon Mar 25 15:17:33 MSK 2013
|
||||
asm-3.3.pom>remote-repos=
|
||||
asm-3.3.jar>remote-repos=
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
fb0f302a91a376fd5cfe23167c419375e8fc9b8f
|
||||
@@ -0,0 +1,14 @@
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<artifactId>asm-parent</artifactId>
|
||||
<groupId>asm</groupId>
|
||||
<version>3.3</version>
|
||||
</parent>
|
||||
|
||||
<name>ASM Core</name>
|
||||
<artifactId>asm</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1 @@
|
||||
3a860b74b902e6f67fa389c336984792826025a1
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
b1b6ea3b7e4aa4f492509a4952029cd8e48019ad ./commons-io-2.4.jar
|
||||
@@ -0,0 +1,323 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one or more
|
||||
contributor license agreements. See the NOTICE file distributed with
|
||||
this work for additional information regarding copyright ownership.
|
||||
The ASF licenses this file to You 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.
|
||||
-->
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
|
||||
<parent>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-parent</artifactId>
|
||||
<version>25</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.4</version>
|
||||
<name>Commons IO</name>
|
||||
|
||||
<inceptionYear>2002</inceptionYear>
|
||||
<description>
|
||||
The Commons IO library contains utility classes, stream implementations, file filters,
|
||||
file comparators, endian transformation classes, and much more.
|
||||
</description>
|
||||
|
||||
<url>http://commons.apache.org/io/</url>
|
||||
|
||||
<issueManagement>
|
||||
<system>jira</system>
|
||||
<url>http://issues.apache.org/jira/browse/IO</url>
|
||||
</issueManagement>
|
||||
|
||||
<distributionManagement>
|
||||
<site>
|
||||
<id>apache.website</id>
|
||||
<name>Apache Commons IO Site</name>
|
||||
<url>${commons.deployment.protocol}://people.apache.org/www/commons.apache.org/${commons.componentid}</url>
|
||||
</site>
|
||||
</distributionManagement>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:http://svn.apache.org/repos/asf/commons/proper/io/trunk</connection>
|
||||
<developerConnection>scm:svn:https://svn.apache.org/repos/asf/commons/proper/io/trunk</developerConnection>
|
||||
<url>http://svn.apache.org/viewvc/commons/proper/io/trunk</url>
|
||||
</scm>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<name>Scott Sanders</name>
|
||||
<id>sanders</id>
|
||||
<email>sanders@apache.org</email>
|
||||
<organization></organization>
|
||||
<roles>
|
||||
<role>Java Developer</role>
|
||||
</roles>
|
||||
</developer>
|
||||
<developer>
|
||||
<name>dIon Gillard</name>
|
||||
<id>dion</id>
|
||||
<email>dion@apache.org</email>
|
||||
<organization></organization>
|
||||
<roles>
|
||||
<role>Java Developer</role>
|
||||
</roles>
|
||||
</developer>
|
||||
<developer>
|
||||
<name>Nicola Ken Barozzi</name>
|
||||
<id>nicolaken</id>
|
||||
<email>nicolaken@apache.org</email>
|
||||
<organization></organization>
|
||||
<roles>
|
||||
<role>Java Developer</role>
|
||||
</roles>
|
||||
</developer>
|
||||
<developer>
|
||||
<name>Henri Yandell</name>
|
||||
<id>bayard</id>
|
||||
<email>bayard@apache.org</email>
|
||||
<organization></organization>
|
||||
<roles>
|
||||
<role>Java Developer</role>
|
||||
</roles>
|
||||
</developer>
|
||||
<developer>
|
||||
<name>Stephen Colebourne</name>
|
||||
<id>scolebourne</id>
|
||||
<organization></organization>
|
||||
<roles>
|
||||
<role>Java Developer</role>
|
||||
</roles>
|
||||
<timezone>0</timezone>
|
||||
</developer>
|
||||
<developer>
|
||||
<name>Jeremias Maerki</name>
|
||||
<id>jeremias</id>
|
||||
<email>jeremias@apache.org</email>
|
||||
<organization />
|
||||
<roles>
|
||||
<role>Java Developer</role>
|
||||
</roles>
|
||||
<timezone>+1</timezone>
|
||||
</developer>
|
||||
<developer>
|
||||
<name>Matthew Hawthorne</name>
|
||||
<id>matth</id>
|
||||
<email>matth@apache.org</email>
|
||||
<organization />
|
||||
<roles>
|
||||
<role>Java Developer</role>
|
||||
</roles>
|
||||
</developer>
|
||||
<developer>
|
||||
<name>Martin Cooper</name>
|
||||
<id>martinc</id>
|
||||
<email>martinc@apache.org</email>
|
||||
<organization />
|
||||
<roles>
|
||||
<role>Java Developer</role>
|
||||
</roles>
|
||||
</developer>
|
||||
<developer>
|
||||
<name>Rob Oxspring</name>
|
||||
<id>roxspring</id>
|
||||
<email>roxspring@apache.org</email>
|
||||
<organization />
|
||||
<roles>
|
||||
<role>Java Developer</role>
|
||||
</roles>
|
||||
</developer>
|
||||
<developer>
|
||||
<name>Jochen Wiedmann</name>
|
||||
<id>jochen</id>
|
||||
<email>jochen.wiedmann@gmail.com</email>
|
||||
</developer>
|
||||
<developer>
|
||||
<name>Niall Pemberton</name>
|
||||
<id>niallp</id>
|
||||
<roles>
|
||||
<role>Java Developer</role>
|
||||
</roles>
|
||||
</developer>
|
||||
<developer>
|
||||
<name>Jukka Zitting</name>
|
||||
<id>jukka</id>
|
||||
<roles>
|
||||
<role>Java Developer</role>
|
||||
</roles>
|
||||
</developer>
|
||||
<developer>
|
||||
<name>Gary Gregory</name>
|
||||
<id>ggregory</id>
|
||||
<email>ggregory@apache.org</email>
|
||||
<url>http://www.garygregory.com</url>
|
||||
<timezone>-5</timezone>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
<contributors>
|
||||
<contributor>
|
||||
<name>Rahul Akolkar</name>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Jason Anderson</name>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Nathan Beyer</name>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Emmanuel Bourg</name>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Chris Eldredge</name>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Magnus Grimsell</name>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Jim Harrington</name>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Thomas Ledoux</name>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Andy Lehane</name>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Marcelo Liberato</name>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Alban Peignier</name>
|
||||
<email>alban.peignier at free.fr</email>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Ian Springer</name>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Masato Tezuka</name>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>James Urie</name>
|
||||
</contributor>
|
||||
<contributor>
|
||||
<name>Frank W. Zammetti</name>
|
||||
</contributor>
|
||||
</contributors>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.10</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<properties>
|
||||
<maven.compile.source>1.6</maven.compile.source>
|
||||
<maven.compile.target>1.6</maven.compile.target>
|
||||
<commons.componentid>io</commons.componentid>
|
||||
<commons.rc.version>RC1</commons.rc.version>
|
||||
<commons.release.version>2.4</commons.release.version>
|
||||
<commons.release.desc>(requires JDK 1.6+)</commons.release.desc>
|
||||
<commons.release.2.version>2.2</commons.release.2.version>
|
||||
<commons.release.2.desc>(requires JDK 1.5+)</commons.release.2.desc>
|
||||
<commons.jira.id>IO</commons.jira.id>
|
||||
<commons.jira.pid>12310477</commons.jira.pid>
|
||||
<commons.osgi.export>
|
||||
<!-- Explicit list of packages from IO 1.4 -->
|
||||
org.apache.commons.io;
|
||||
org.apache.commons.io.comparator;
|
||||
org.apache.commons.io.filefilter;
|
||||
org.apache.commons.io.input;
|
||||
org.apache.commons.io.output;version=1.4.9999;-noimport:=true,
|
||||
<!-- Same list plus * for new packages -->
|
||||
org.apache.commons.io;
|
||||
org.apache.commons.io.comparator;
|
||||
org.apache.commons.io.filefilter;
|
||||
org.apache.commons.io.input;
|
||||
org.apache.commons.io.output;
|
||||
org.apache.commons.io.*;version=${project.version};-noimport:=true
|
||||
</commons.osgi.export>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<pluginManagement>
|
||||
</pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<configuration>
|
||||
<forkMode>pertest</forkMode>
|
||||
<!-- limit memory size see IO-161 -->
|
||||
<argLine>-Xmx25M</argLine>
|
||||
<includes>
|
||||
<!-- Only include test classes, not test data -->
|
||||
<include>**/*Test*.class</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>**/*AbstractTestCase*</exclude>
|
||||
<exclude>**/testtools/**</exclude>
|
||||
<!-- http://jira.codehaus.org/browse/SUREFIRE-44 -->
|
||||
<exclude>**/*$*</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<configuration>
|
||||
<descriptors>
|
||||
<descriptor>src/main/assembly/bin.xml</descriptor>
|
||||
<descriptor>src/main/assembly/src.xml</descriptor>
|
||||
</descriptors>
|
||||
<tarLongFileMode>gnu</tarLongFileMode>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<reporting>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-checkstyle-plugin</artifactId>
|
||||
<version>2.9.1</version>
|
||||
<configuration>
|
||||
<configLocation>${basedir}/checkstyle.xml</configLocation>
|
||||
<enableRulesSummary>false</enableRulesSummary>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>findbugs-maven-plugin</artifactId>
|
||||
<version>2.4.0</version>
|
||||
<configuration>
|
||||
<threshold>Normal</threshold>
|
||||
<effort>Default</effort>
|
||||
<excludeFilterFile>${basedir}/findbugs-exclude-filter.xml</excludeFilterFile>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.rat</groupId>
|
||||
<artifactId>apache-rat-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>src/test/resources/**/*.bin</exclude>
|
||||
<exclude>.pmd</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</reporting>
|
||||
</project>
|
||||
@@ -0,0 +1 @@
|
||||
9ece23effe8bce3904f3797a76b1ba6ab681e1b9 ./commons-io-2.4.pom
|
||||
@@ -0,0 +1,4 @@
|
||||
#NOTE: This is an internal implementation file, its format can be changed without prior notice.
|
||||
#Tue Apr 09 20:46:20 MSD 2013
|
||||
asm-4.1.pom>remote-repos=
|
||||
asm-4.1.jar>remote-repos=
|
||||
Binary file not shown.
@@ -0,0 +1 @@
|
||||
ad568238ee36a820bd6c6806807e8a14ea34684d
|
||||
@@ -0,0 +1,44 @@
|
||||
<!--
|
||||
! ASM: a very small and fast Java bytecode manipulation framework
|
||||
! Copyright (c) 2000-2011 INRIA, France Telecom
|
||||
! All rights reserved.
|
||||
!
|
||||
! Redistribution and use in source and binary forms, with or without
|
||||
! modification, are permitted provided that the following conditions
|
||||
! are met:
|
||||
! 1. Redistributions of source code must retain the above copyright
|
||||
! notice, this list of conditions and the following disclaimer.
|
||||
! 2. Redistributions in binary form must reproduce the above copyright
|
||||
! notice, this list of conditions and the following disclaimer in the
|
||||
! documentation and/or other materials provided with the distribution.
|
||||
! 3. Neither the name of the copyright holders nor the names of its
|
||||
! contributors may be used to endorse or promote products derived from
|
||||
! this software without specific prior written permission.
|
||||
!
|
||||
! THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
! AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
! IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
! ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
! LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
! CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
! SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
! INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
! CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
! ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
||||
! THE POSSIBILITY OF SUCH DAMAGE.
|
||||
-->
|
||||
|
||||
<project>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<artifactId>asm-parent</artifactId>
|
||||
<groupId>org.ow2.asm</groupId>
|
||||
<version>4.1</version>
|
||||
</parent>
|
||||
|
||||
<name>ASM Core</name>
|
||||
<artifactId>asm</artifactId>
|
||||
<packaging>jar</packaging>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1 @@
|
||||
14520f912710fa80079305bdcf8d52bd68764b60
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+1
-15
@@ -56,7 +56,7 @@ public class MavenDependencyCompletionAndResolutionTest extends MavenDomWithIndi
|
||||
" </dependency>" +
|
||||
"</dependencies>");
|
||||
|
||||
assertCompletionVariants(myProjectPom, "junit", "jmock", "test");
|
||||
assertCompletionVariantsInclude(myProjectPom, "junit", "jmock", "test");
|
||||
}
|
||||
|
||||
public void testArtifactIdCompletion() throws Exception {
|
||||
@@ -89,20 +89,6 @@ public class MavenDependencyCompletionAndResolutionTest extends MavenDomWithIndi
|
||||
assertCompletionVariants(myProjectPom);
|
||||
}
|
||||
|
||||
public void testDoNotCompleteArtifactIdIfNoGroupId() throws Exception {
|
||||
createProjectPom("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>" +
|
||||
|
||||
"<dependencies>" +
|
||||
" <dependency>" +
|
||||
" <artifactId><caret></artifactId>" +
|
||||
" </dependency>" +
|
||||
"</dependencies>");
|
||||
|
||||
assertCompletionVariants(myProjectPom); // should not throw
|
||||
}
|
||||
|
||||
public void testVersionCompletion() throws Exception {
|
||||
createProjectPom("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
|
||||
+320
@@ -1,8 +1,10 @@
|
||||
package org.jetbrains.idea.maven.dom;
|
||||
|
||||
import com.intellij.codeInsight.completion.CompletionType;
|
||||
import com.intellij.codeInsight.lookup.LookupElement;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* @author Sergey Evdokimov
|
||||
@@ -141,4 +143,322 @@ public class MavenDependencySmartCompletionTest extends MavenDomWithIndicesTestC
|
||||
"</dependencies>\n"));
|
||||
}
|
||||
|
||||
public void testCompletionArtifactIdThenVersion() throws IOException {
|
||||
importProject("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>");
|
||||
|
||||
createProjectPom("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>\n" +
|
||||
|
||||
"<dependencies>\n" +
|
||||
" <dependency>\n" +
|
||||
" <artifactId>juni<caret></artifactId>\n" +
|
||||
" </dependency>\n" +
|
||||
"</dependencies>\n");
|
||||
|
||||
myFixture.configureFromExistingVirtualFile(myProjectPom);
|
||||
|
||||
LookupElement[] elements = myFixture.completeBasic();
|
||||
assertSize(1, elements);
|
||||
|
||||
myFixture.type('\n');
|
||||
|
||||
myFixture.checkResult(createPomXml("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>\n" +
|
||||
|
||||
"<dependencies>\n" +
|
||||
" <dependency>\n" +
|
||||
" <groupId>junit</groupId>\n" +
|
||||
" <artifactId>junit</artifactId>\n" +
|
||||
" <version><caret></version>\n" +
|
||||
" </dependency>\n" +
|
||||
"</dependencies>\n"));
|
||||
|
||||
myFixture.getLookupElementStrings().containsAll(Arrays.asList("3.8.1", "4.0"));
|
||||
}
|
||||
|
||||
public void testCompletionArtifactIdThenGroupIdThenInsertVersion() throws IOException {
|
||||
importProject("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>");
|
||||
|
||||
createProjectPom("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>\n" +
|
||||
|
||||
"<dependencies>\n" +
|
||||
" <dependency>\n" +
|
||||
" <artifactId>as<caret></artifactId>\n" +
|
||||
" </dependency>\n" +
|
||||
"</dependencies>\n");
|
||||
|
||||
myFixture.configureFromExistingVirtualFile(myProjectPom);
|
||||
|
||||
LookupElement[] elements = myFixture.completeBasic();
|
||||
assertSize(1, elements);
|
||||
|
||||
myFixture.type('\n');
|
||||
|
||||
assertUnorderedElementsAreEqual(myFixture.getLookupElementStrings(), "asm", "org.ow2.asm");
|
||||
|
||||
myFixture.type("org\n");
|
||||
|
||||
myFixture.checkResult(createPomXml("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>\n" +
|
||||
|
||||
"<dependencies>\n" +
|
||||
" <dependency>\n" +
|
||||
" <groupId>org.ow2.asm</groupId>\n" +
|
||||
" <artifactId>asm</artifactId>\n" +
|
||||
" <version>4.1</version>\n" +
|
||||
" </dependency>\n" +
|
||||
"</dependencies>\n"));
|
||||
}
|
||||
|
||||
public void testCompletionArtifactIdThenGroupIdThenCompleteVersion() throws IOException {
|
||||
importProject("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>");
|
||||
|
||||
createProjectPom("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>\n" +
|
||||
|
||||
"<dependencies>\n" +
|
||||
" <dependency>\n" +
|
||||
" <artifactId>as<caret></artifactId>\n" +
|
||||
" </dependency>\n" +
|
||||
"</dependencies>\n");
|
||||
|
||||
myFixture.configureFromExistingVirtualFile(myProjectPom);
|
||||
|
||||
LookupElement[] elements = myFixture.completeBasic();
|
||||
assertSize(1, elements);
|
||||
|
||||
myFixture.type('\n');
|
||||
|
||||
assertUnorderedElementsAreEqual(myFixture.getLookupElementStrings(), "asm", "org.ow2.asm");
|
||||
|
||||
myFixture.type("asm\n");
|
||||
|
||||
myFixture.checkResult(createPomXml("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>\n" +
|
||||
|
||||
"<dependencies>\n" +
|
||||
" <dependency>\n" +
|
||||
" <groupId>asm</groupId>\n" +
|
||||
" <artifactId>asm</artifactId>\n" +
|
||||
" <version><caret></version>\n" +
|
||||
" </dependency>\n" +
|
||||
"</dependencies>\n"));
|
||||
|
||||
myFixture.getLookupElementStrings().equals(Arrays.asList("3.3", "3.3.1"));
|
||||
}
|
||||
|
||||
public void testCompletionArtifactIdWithFullInsert() throws IOException {
|
||||
importProject("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>");
|
||||
|
||||
createProjectPom("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>\n" +
|
||||
|
||||
"<dependencies>\n" +
|
||||
" <dependency>\n" +
|
||||
" <artifactId>common-i<caret></artifactId>\n" +
|
||||
" </dependency>\n" +
|
||||
"</dependencies>\n");
|
||||
|
||||
myFixture.configureFromExistingVirtualFile(myProjectPom);
|
||||
|
||||
LookupElement[] elements = myFixture.completeBasic();
|
||||
assertSize(1, elements);
|
||||
|
||||
myFixture.type('\n');
|
||||
|
||||
myFixture.checkResult(createPomXml("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>\n" +
|
||||
|
||||
"<dependencies>\n" +
|
||||
" <dependency>\n" +
|
||||
" <groupId>commons-io</groupId>\n" +
|
||||
" <artifactId>commons-io</artifactId>\n" +
|
||||
" <version>2.4</version>\n" +
|
||||
" </dependency>\n" +
|
||||
"</dependencies>\n"));
|
||||
}
|
||||
|
||||
public void testCompletionArtifactIdInsideManagedDependency() throws IOException {
|
||||
importProject("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>");
|
||||
|
||||
createProjectPom("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>\n" +
|
||||
|
||||
"<dependencyManagement>\n" +
|
||||
" <dependencies>\n" +
|
||||
" <dependency>\n" +
|
||||
" <artifactId>commons-i<caret></artifactId>\n" +
|
||||
" </dependency>\n" +
|
||||
" </dependencies>\n" +
|
||||
"</dependencyManagement>\n");
|
||||
|
||||
myFixture.configureFromExistingVirtualFile(myProjectPom);
|
||||
|
||||
LookupElement[] elements = myFixture.completeBasic();
|
||||
assertSize(1, elements);
|
||||
myFixture.type('\n');
|
||||
|
||||
myFixture.checkResult(createPomXml("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>\n" +
|
||||
|
||||
"<dependencyManagement>\n" +
|
||||
" <dependencies>\n" +
|
||||
" <dependency>\n" +
|
||||
" <groupId>commons-io</groupId>\n" +
|
||||
" <artifactId>commons-io</artifactId>\n" +
|
||||
" <version>2.4</version>\n" +
|
||||
" </dependency>\n" +
|
||||
" </dependencies>\n" +
|
||||
"</dependencyManagement>\n"));
|
||||
}
|
||||
|
||||
public void testCompletionArtifactIdWithManagedDependency() throws IOException {
|
||||
importProject("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>\n" +
|
||||
"" +
|
||||
" <dependencyManagement>\n" +
|
||||
" <dependencies>\n" +
|
||||
" <dependency>\n" +
|
||||
" <groupId>commons-io</groupId>\n" +
|
||||
" <artifactId>commons-io</artifactId>\n" +
|
||||
" <version>2.4</version>\n" +
|
||||
" </dependency>\n" +
|
||||
" </dependencies>\n" +
|
||||
" </dependencyManagement>\n");
|
||||
|
||||
createProjectPom("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>\n" +
|
||||
" <dependencyManagement>\n" +
|
||||
" <dependencies>\n" +
|
||||
" <dependency>\n" +
|
||||
" <groupId>commons-io</groupId>\n" +
|
||||
" <artifactId>commons-io</artifactId>\n" +
|
||||
" <version>2.4</version>\n" +
|
||||
" </dependency>\n" +
|
||||
" </dependencies>\n" +
|
||||
" </dependencyManagement>\n" +
|
||||
|
||||
"<dependencies>\n" +
|
||||
" <dependency>\n" +
|
||||
" <artifactId>common-i<caret></artifactId>\n" +
|
||||
" </dependency>\n" +
|
||||
"</dependencies>\n");
|
||||
|
||||
myFixture.configureFromExistingVirtualFile(myProjectPom);
|
||||
|
||||
LookupElement[] elements = myFixture.completeBasic();
|
||||
assertSize(1, elements);
|
||||
myFixture.type('\n');
|
||||
|
||||
myFixture.checkResult(createPomXml("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>\n" +
|
||||
|
||||
" <dependencyManagement>\n" +
|
||||
" <dependencies>\n" +
|
||||
" <dependency>\n" +
|
||||
" <groupId>commons-io</groupId>\n" +
|
||||
" <artifactId>commons-io</artifactId>\n" +
|
||||
" <version>2.4</version>\n" +
|
||||
" </dependency>\n" +
|
||||
" </dependencies>\n" +
|
||||
" </dependencyManagement>\n" +
|
||||
|
||||
"<dependencies>\n" +
|
||||
" <dependency>\n" +
|
||||
" <groupId>commons-io</groupId>\n" +
|
||||
" <artifactId>commons-io</artifactId>\n" +
|
||||
" </dependency>\n" +
|
||||
"</dependencies>\n"
|
||||
));
|
||||
}
|
||||
|
||||
public void testCompletionGroupIdWithManagedDependency() throws IOException {
|
||||
importProject("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>\n" +
|
||||
"" +
|
||||
"<dependencyManagement>\n" +
|
||||
" <dependencies>\n" +
|
||||
" <dependency>\n" +
|
||||
" <groupId>commons-io</groupId>\n" +
|
||||
" <artifactId>commons-io</artifactId>\n" +
|
||||
" <version>2.4</version>\n" +
|
||||
" </dependency>\n" +
|
||||
" </dependencies>\n" +
|
||||
"</dependencyManagement>\n");
|
||||
|
||||
createProjectPom("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>\n" +
|
||||
"<dependencyManagement>\n" +
|
||||
" <dependencies>\n" +
|
||||
" <dependency>\n" +
|
||||
" <groupId>commons-io</groupId>\n" +
|
||||
" <artifactId>commons-io</artifactId>\n" +
|
||||
" <version>2.4</version>\n" +
|
||||
" </dependency>\n" +
|
||||
" </dependencies>\n" +
|
||||
"</dependencyManagement>\n" +
|
||||
|
||||
"<dependencies>\n" +
|
||||
" <dependency>\n" +
|
||||
" <groupId>commons-i<caret></groupId>\n" +
|
||||
" <artifactId>commons-io</artifactId>\n" +
|
||||
" </dependency>\n" +
|
||||
"</dependencies>\n");
|
||||
|
||||
myFixture.configureFromExistingVirtualFile(myProjectPom);
|
||||
|
||||
LookupElement[] elements = myFixture.complete(CompletionType.SMART);
|
||||
assertNull(elements);
|
||||
// assertSize(1, elements);
|
||||
// myFixture.type('\n');
|
||||
|
||||
myFixture.checkResult(createPomXml("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
"<version>1</version>\n" +
|
||||
|
||||
"<dependencyManagement>\n" +
|
||||
" <dependencies>\n" +
|
||||
" <dependency>\n" +
|
||||
" <groupId>commons-io</groupId>\n" +
|
||||
" <artifactId>commons-io</artifactId>\n" +
|
||||
" <version>2.4</version>\n" +
|
||||
" </dependency>\n" +
|
||||
" </dependencies>\n" +
|
||||
"</dependencyManagement>\n" +
|
||||
|
||||
"<dependencies>\n" +
|
||||
" <dependency>\n" +
|
||||
" <groupId>commons-io</groupId>\n" +
|
||||
" <artifactId>commons-io</artifactId>\n" +
|
||||
" </dependency>\n" +
|
||||
"</dependencies>\n"
|
||||
));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+2
-2
@@ -34,9 +34,9 @@ public class MavenParentCompletionAndResolutionTest extends MavenDomWithIndicesT
|
||||
"<parent>" +
|
||||
" <groupId><caret></groupId>" +
|
||||
" <artifactId>junit</artifactId>" +
|
||||
" <version><caret></version>" +
|
||||
" <version></version>" +
|
||||
"</parent>");
|
||||
assertCompletionVariants(myProjectPom, "junit", "jmock", "test");
|
||||
assertCompletionVariantsInclude(myProjectPom, "junit", "jmock", "test");
|
||||
|
||||
createProjectPom("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
|
||||
+1
-1
@@ -823,7 +823,7 @@ public class MavenPluginCompletionAndResolutionTest extends MavenDomWithIndicesT
|
||||
assertCompletionVariants(myProjectPom);
|
||||
}
|
||||
|
||||
@Bombed(year = 2013, month = Calendar.MARCH, day = 25, user = "sergey.evdokimov")
|
||||
@Bombed(year = 2014, month = Calendar.MARCH, day = 25, user = "sergey.evdokimov")
|
||||
public void testDocumentationForParameter() throws Exception {
|
||||
createProjectPom("<groupId>test</groupId>" +
|
||||
"<artifactId>project</artifactId>" +
|
||||
|
||||
+12
-12
@@ -81,7 +81,7 @@ public class MavenIndicesTest extends MavenIndicesTestCase {
|
||||
MavenIndex i = myIndices.add("id", myRepositoryHelper.getTestDataPath("local1"), MavenIndex.Kind.LOCAL);
|
||||
myIndices.updateOrRepair(i, true, getMavenGeneralSettings(), EMPTY_MAVEN_PROCESS);
|
||||
|
||||
assertUnorderedElementsAreEqual(i.getGroupIds(), "junit");
|
||||
assertUnorderedElementsAreEqual(i.getGroupIds(), "junit", "asm", "commons-io", "org.ow2.asm");
|
||||
}
|
||||
|
||||
public void testCreatingAndUpdatingLocalWhenNoDirectory() throws Exception {
|
||||
@@ -97,7 +97,7 @@ public class MavenIndicesTest extends MavenIndicesTestCase {
|
||||
myIndices.updateOrRepair(i1, true, getMavenGeneralSettings(), EMPTY_MAVEN_PROCESS);
|
||||
myIndices.updateOrRepair(i2, true, getMavenGeneralSettings(), EMPTY_MAVEN_PROCESS);
|
||||
|
||||
assertUnorderedElementsAreEqual(i1.getGroupIds(), "junit");
|
||||
assertUnorderedElementsAreEqual(i1.getGroupIds(), "junit", "asm", "commons-io", "org.ow2.asm");
|
||||
assertUnorderedElementsAreEqual(i2.getGroupIds(), "jmock");
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ public class MavenIndicesTest extends MavenIndicesTestCase {
|
||||
myIndices.updateOrRepair(i1, true, getMavenGeneralSettings(), EMPTY_MAVEN_PROCESS);
|
||||
myIndices.updateOrRepair(i2, true, getMavenGeneralSettings(), EMPTY_MAVEN_PROCESS);
|
||||
|
||||
assertUnorderedElementsAreEqual(i1.getGroupIds(), "junit");
|
||||
assertUnorderedElementsAreEqual(i1.getGroupIds(), "junit", "asm", "commons-io", "org.ow2.asm");
|
||||
assertUnorderedElementsAreEqual(i2.getGroupIds(), "jmock");
|
||||
}
|
||||
|
||||
@@ -119,8 +119,8 @@ public class MavenIndicesTest extends MavenIndicesTestCase {
|
||||
myIndices.updateOrRepair(i1, true, getMavenGeneralSettings(), EMPTY_MAVEN_PROCESS);
|
||||
myIndices.updateOrRepair(i2, true, getMavenGeneralSettings(), EMPTY_MAVEN_PROCESS);
|
||||
|
||||
assertUnorderedElementsAreEqual(i1.getGroupIds(), "junit");
|
||||
assertUnorderedElementsAreEqual(i2.getGroupIds(), "junit");
|
||||
assertUnorderedElementsAreEqual(i1.getGroupIds(), "junit", "asm", "commons-io", "org.ow2.asm");
|
||||
assertUnorderedElementsAreEqual(i2.getGroupIds(), "junit", "asm", "commons-io", "org.ow2.asm");
|
||||
}
|
||||
|
||||
public void testAddingWithoutUpdate() throws Exception {
|
||||
@@ -132,7 +132,7 @@ public class MavenIndicesTest extends MavenIndicesTestCase {
|
||||
MavenIndex i = myIndices.add("id", myRepositoryHelper.getTestDataPath("local1"), MavenIndex.Kind.LOCAL);
|
||||
|
||||
myIndices.updateOrRepair(i, true, getMavenGeneralSettings(), EMPTY_MAVEN_PROCESS);
|
||||
assertUnorderedElementsAreEqual(i.getGroupIds(), "junit");
|
||||
assertUnorderedElementsAreEqual(i.getGroupIds(), "junit", "asm", "commons-io", "org.ow2.asm");
|
||||
|
||||
myRepositoryHelper.delete("local1");
|
||||
myRepositoryHelper.copy("local2", "local1");
|
||||
@@ -240,7 +240,7 @@ public class MavenIndicesTest extends MavenIndicesTestCase {
|
||||
myIndices.updateOrRepair(i1, true, getMavenGeneralSettings(), EMPTY_MAVEN_PROCESS);
|
||||
myIndices.updateOrRepair(i2, true, getMavenGeneralSettings(), EMPTY_MAVEN_PROCESS);
|
||||
|
||||
assertUnorderedElementsAreEqual(i1.getGroupIds(), "junit");
|
||||
assertUnorderedElementsAreEqual(i1.getGroupIds(), "junit", "asm", "commons-io", "org.ow2.asm");
|
||||
assertUnorderedElementsAreEqual(i2.getGroupIds(), "jmock");
|
||||
|
||||
shutdownIndices();
|
||||
@@ -253,7 +253,7 @@ public class MavenIndicesTest extends MavenIndicesTestCase {
|
||||
assertUnorderedElementsAreEqual(myIndices.getIndices().get(1).getGroupIds(), "jmock");
|
||||
|
||||
myIndices.updateOrRepair(myIndices.getIndices().get(0), false, getMavenGeneralSettings(), EMPTY_MAVEN_PROCESS);
|
||||
assertUnorderedElementsAreEqual(myIndices.getIndices().get(0).getGroupIds(), "junit");
|
||||
assertUnorderedElementsAreEqual(myIndices.getIndices().get(0).getGroupIds(), "junit", "asm", "commons-io", "org.ow2.asm");
|
||||
}
|
||||
|
||||
public void testDoNotLoadSameIndexTwice() throws Exception {
|
||||
@@ -318,7 +318,7 @@ public class MavenIndicesTest extends MavenIndicesTestCase {
|
||||
assertTrue(index.getGroupIds().isEmpty());
|
||||
|
||||
myIndices.updateOrRepair(myIndices.getIndices().get(0), false, getMavenGeneralSettings(), EMPTY_MAVEN_PROCESS);
|
||||
assertUnorderedElementsAreEqual(index.getGroupIds(), "junit");
|
||||
assertUnorderedElementsAreEqual(index.getGroupIds(), "junit", "asm", "commons-io", "org.ow2.asm");
|
||||
}
|
||||
|
||||
public void testRepairingIndicesOnReadWhileAddingArtifact() throws Exception {
|
||||
@@ -337,7 +337,7 @@ public class MavenIndicesTest extends MavenIndicesTestCase {
|
||||
assertTrue(index.getGroupIds().isEmpty());
|
||||
|
||||
myIndices.updateOrRepair(myIndices.getIndices().get(0), false, getMavenGeneralSettings(), EMPTY_MAVEN_PROCESS);
|
||||
assertUnorderedElementsAreEqual(index.getGroupIds(), "junit");
|
||||
assertUnorderedElementsAreEqual(index.getGroupIds(), "junit", "asm", "commons-io", "org.ow2.asm");
|
||||
}
|
||||
|
||||
public void testCorrectlyClosingIndicesOnRemoteFacadeShutdown() throws Exception {
|
||||
@@ -390,7 +390,7 @@ public class MavenIndicesTest extends MavenIndicesTestCase {
|
||||
MavenIndex i = myIndices.add("id", myRepositoryHelper.getTestDataPath("local1"), MavenIndex.Kind.LOCAL);
|
||||
myIndices.updateOrRepair(i, true, getMavenGeneralSettings(), EMPTY_MAVEN_PROCESS);
|
||||
|
||||
assertUnorderedElementsAreEqual(i.getGroupIds(), "junit", "jmock");
|
||||
assertUnorderedElementsAreEqual(i.getGroupIds(), "junit", "jmock", "asm", "commons-io", "org.ow2.asm");
|
||||
|
||||
assertUnorderedElementsAreEqual(i.getArtifactIds("junit"), "junit");
|
||||
assertUnorderedElementsAreEqual(i.getArtifactIds("jmock"), "jmock");
|
||||
@@ -414,7 +414,7 @@ public class MavenIndicesTest extends MavenIndicesTestCase {
|
||||
shutdownIndices();
|
||||
initIndices();
|
||||
|
||||
assertUnorderedElementsAreEqual(myIndices.getIndices().get(0).getGroupIds(), "junit");
|
||||
assertUnorderedElementsAreEqual(myIndices.getIndices().get(0).getGroupIds(), "junit", "asm", "commons-io", "org.ow2.asm");
|
||||
}
|
||||
|
||||
public void testHasArtifactInfo() throws Exception {
|
||||
|
||||
@@ -89,8 +89,11 @@ public class MavenSearcherTest extends MavenIndicesTestCase {
|
||||
|
||||
public void testArtifactSearch() throws Exception {
|
||||
assertArtifactSearchResults("",
|
||||
"asm:asm:3.3.1 asm:asm:3.3",
|
||||
"commons-io:commons-io:2.4",
|
||||
"jmock:jmock:1.2.0 jmock:jmock:1.1.0 jmock:jmock:1.0.0",
|
||||
"junit:junit:4.0 junit:junit:3.8.2 junit:junit:3.8.1");
|
||||
"junit:junit:4.0 junit:junit:3.8.2 junit:junit:3.8.1",
|
||||
"org.ow2.asm:asm:4.1");
|
||||
assertArtifactSearchResults("j *1*",
|
||||
"jmock:jmock:1.2.0 jmock:jmock:1.1.0 jmock:jmock:1.0.0",
|
||||
"junit:junit:3.8.1");
|
||||
|
||||
Reference in New Issue
Block a user