Search in sources :

Example 21 with IntentionAction

use of com.intellij.codeInsight.intention.IntentionAction in project intellij-community by JetBrains.

the class MavenModuleCompletionAndResolutionTest method testCreatePomQuickFix.

public void testCreatePomQuickFix() throws Throwable {
    createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<packaging>pom</packaging>");
    importProject();
    createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<packaging>pom</packaging>" + "<modules>" + "  <module>subDir/new<caret>Module</module>" + "</modules>");
    IntentionAction i = getIntentionAtCaret(CREATE_MODULE_INTENTION);
    assertNotNull(i);
    myFixture.launchAction(i);
    assertCreateModuleFixResult("subDir/newModule/pom.xml", "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n" + "         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" + "         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n" + "    <modelVersion>4.0.0</modelVersion>\n" + "\n" + "    <groupId>test</groupId>\n" + "    <artifactId>newModule</artifactId>\n" + "    <version>1</version>\n" + "\n" + "    \n" + "</project>");
}
Also used : IntentionAction(com.intellij.codeInsight.intention.IntentionAction)

Example 22 with IntentionAction

use of com.intellij.codeInsight.intention.IntentionAction in project intellij-community by JetBrains.

the class MavenModuleCompletionAndResolutionTest method testCreateModuleWithParentQuickFix.

public void testCreateModuleWithParentQuickFix() throws Throwable {
    createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<packaging>pom</packaging>");
    importProject();
    createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<packaging>pom</packaging>" + "<modules>" + "  <module>new<caret>Module</module>" + "</modules>");
    IntentionAction i = getIntentionAtCaret(CREATE_MODULE_WITH_PARENT_INTENTION);
    assertNotNull(i);
    myFixture.launchAction(i);
    assertCreateModuleFixResult("newModule/pom.xml", "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n" + "         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" + "         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n" + "    <modelVersion>4.0.0</modelVersion>\n" + "\n" + "    <parent>\n" + "        <groupId>test</groupId>\n" + "        <artifactId>project</artifactId>\n" + "        <version>1</version>\n" + "    </parent>\n" + "\n" + "    <groupId>test</groupId>\n" + "    <artifactId>newModule</artifactId>\n" + "    <version>1</version>\n" + "\n" + "    \n" + "</project>");
}
Also used : IntentionAction(com.intellij.codeInsight.intention.IntentionAction)

Example 23 with IntentionAction

use of com.intellij.codeInsight.intention.IntentionAction in project intellij-community by JetBrains.

the class MavenModuleCompletionAndResolutionTest method testCreatePomQuickFixWithProperties.

public void testCreatePomQuickFixWithProperties() throws Throwable {
    createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<packaging>pom</packaging>");
    importProject();
    createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<properties>" + "  <dirName>subDir</dirName>" + "</properties>" + "<modules>" + "  <module>${dirName}/new<caret>Module</module>" + "</modules>");
    IntentionAction i = getIntentionAtCaret(CREATE_MODULE_INTENTION);
    assertNotNull(i);
    myFixture.launchAction(i);
    VirtualFile pom = myProjectRoot.findFileByRelativePath("subDir/newModule/pom.xml");
    assertNotNull(pom);
}
Also used : VirtualFile(com.intellij.openapi.vfs.VirtualFile) IntentionAction(com.intellij.codeInsight.intention.IntentionAction)

Example 24 with IntentionAction

use of com.intellij.codeInsight.intention.IntentionAction in project intellij-community by JetBrains.

the class MavenModuleCompletionAndResolutionTest method testCreateModuleWithParentQuickFix2.

public void testCreateModuleWithParentQuickFix2() throws Throwable {
    createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<packaging>pom</packaging>");
    importProject();
    createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<packaging>pom</packaging>" + "<modules>" + "  <module>ppp/new<caret>Module</module>" + "</modules>");
    IntentionAction i = getIntentionAtCaret(CREATE_MODULE_WITH_PARENT_INTENTION);
    assertNotNull(i);
    myFixture.launchAction(i);
    assertCreateModuleFixResult("ppp/newModule/pom.xml", "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n" + "         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" + "         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n" + "    <modelVersion>4.0.0</modelVersion>\n" + "\n" + "    <parent>\n" + "        <groupId>test</groupId>\n" + "        <artifactId>project</artifactId>\n" + "        <version>1</version>\n" + "        <relativePath>../..</relativePath>\n" + "    </parent>\n" + "\n" + "    <groupId>test</groupId>\n" + "    <artifactId>newModule</artifactId>\n" + "    <version>1</version>\n" + "\n" + "    \n" + "</project>");
}
Also used : IntentionAction(com.intellij.codeInsight.intention.IntentionAction)

Example 25 with IntentionAction

use of com.intellij.codeInsight.intention.IntentionAction in project intellij-community by JetBrains.

the class MavenModuleCompletionAndResolutionTest method testCreatePomQuickFixTakesGroupAndVersionFromSuperParent.

public void testCreatePomQuickFixTakesGroupAndVersionFromSuperParent() throws Throwable {
    createProjectPom("<groupId>test</groupId>" + "<artifactId>project</artifactId>" + "<version>1</version>" + "<packaging>pom</packaging>");
    importProject();
    createProjectPom("<artifactId>project</artifactId>" + "<packaging>pom</packaging>" + "<parent>" + "  <groupId>parentGroup</groupId>" + "  <artifactId>parent</artifactId>" + "  <version>parentVersion</version>" + "</parent>" + "<modules>" + "  <module>new<caret>Module</module>" + "</modules>");
    IntentionAction i = getIntentionAtCaret(CREATE_MODULE_INTENTION);
    assertNotNull(i);
    myFixture.launchAction(i);
    assertCreateModuleFixResult("newModule/pom.xml", "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<project xmlns=\"http://maven.apache.org/POM/4.0.0\"\n" + "         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" + "         xsi:schemaLocation=\"http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd\">\n" + "    <modelVersion>4.0.0</modelVersion>\n" + "\n" + "    <groupId>parentGroup</groupId>\n" + "    <artifactId>newModule</artifactId>\n" + "    <version>parentVersion</version>\n" + "\n" + "    \n" + "</project>");
}
Also used : IntentionAction(com.intellij.codeInsight.intention.IntentionAction)

Aggregations

IntentionAction (com.intellij.codeInsight.intention.IntentionAction)241 VirtualFile (com.intellij.openapi.vfs.VirtualFile)39 HighlightInfo (com.intellij.codeInsight.daemon.impl.HighlightInfo)31 NotNull (org.jetbrains.annotations.NotNull)22 Project (com.intellij.openapi.project.Project)20 TextRange (com.intellij.openapi.util.TextRange)20 Editor (com.intellij.openapi.editor.Editor)17 PsiFile (com.intellij.psi.PsiFile)17 Annotation (com.intellij.lang.annotation.Annotation)16 PsiElement (com.intellij.psi.PsiElement)16 Nullable (org.jetbrains.annotations.Nullable)15 ArrayList (java.util.ArrayList)14 LocalQuickFix (com.intellij.codeInspection.LocalQuickFix)10 QuickFixWrapper (com.intellij.codeInspection.ex.QuickFixWrapper)9 Pair (com.intellij.openapi.util.Pair)9 IncorrectOperationException (com.intellij.util.IncorrectOperationException)7 EmptyIntentionAction (com.intellij.codeInsight.intention.EmptyIntentionAction)6 AndroidMissingOnClickHandlerInspection (org.jetbrains.android.inspections.AndroidMissingOnClickHandlerInspection)6 HighlightDisplayLevel (com.intellij.codeHighlighting.HighlightDisplayLevel)5 HighlightDisplayKey (com.intellij.codeInsight.daemon.HighlightDisplayKey)5