Package com.intellij.codeInsight.intention

Examples of com.intellij.codeInsight.intention.IntentionAction


    if (fileSetAvailable) {
      final AddToFileSetFix addToFileSetFix = new AddToFileSetFix(xmlFile.getName());
      annotation.registerFix(addToFileSetFix);
    }
    else {
      annotation.registerFix(new IntentionAction() {
        @NotNull
        public String getText() {
          return StrutsBundle.message("annotators.fileset.edit.facet.settings");
        }
View Full Code Here


   */
  public void testCreateActionMethodIntention() throws Throwable {
    createStrutsFileSet("struts-action-method.xml");
    final List<IntentionAction> list = myFixture.getAllQuickFixes("struts-action-method.xml");

    final IntentionAction action =
      CodeInsightTestUtil.findIntentionByText(list,
                                              "Create action-method 'unknownMethod'");
    assertNotNull(action);

    // myFixture.launchAction(action);
View Full Code Here

    doTest("Change block start");
  }

  private void doTest(String intentionHint) {
    myFixture.configureByFile("inspections/before" + getTestName(false) + ".hbs");
    final IntentionAction intention = myFixture.findSingleIntention(intentionHint);
    new WriteCommandAction.Simple(myFixture.getProject()) {
      @Override
      protected void run() throws Throwable {
        myFixture.launchAction(intention);
      }
View Full Code Here

    myFixture.configureByFile("createStep/" + getTestName(true) + ".feature");

    myFixture.checkHighlighting(true, false, false);

    final String fixName = createAll ? "Create All" : "Create step";
    final IntentionAction quickFix = ContainerUtil.find(myFixture.getAvailableIntentions(), new Condition<IntentionAction>() {
      @Override
      public boolean value(final IntentionAction intentionAction) {
        return intentionAction instanceof QuickFixWrapper && intentionAction.getText().contains(fixName);
      }
    });
View Full Code Here

  protected String getTestDataLocation() {
    return "strutsXml/highlighting";
  }

  public void testStrutsXmlNoFacetSetup() throws Throwable {
    final IntentionAction intention = myFixture.getAvailableIntention("Edit Struts 2 facet settings",
                                                                      "struts-simple.xml");
    assertIntentionFound(intention);
  }
View Full Code Here

    assertIntentionFound(intention);
  }

  public void testStrutsXmlNotInFileSet() throws Throwable {
    createStrutsFileSet("struts-simple.xml");
    final IntentionAction intention = myFixture.getAvailableIntention("Add struts-default.xml to file set",
                                                                      "struts-default.xml");
    assertIntentionFound(intention);
  }
View Full Code Here

  private void doTestFix(String classSource, String manifestSource, String expected) {
    myFixture.enableInspections(new PackageAccessibilityInspection());
    PsiFile manifest = myFixture.addFileToProject("META-INF/MANIFEST.MF", manifestSource);
    myFixture.configureByText("C.java", classSource);
    IntentionAction intention = myFixture.findSingleIntention(OsmorcBundle.message("PackageAccessibilityInspection.fix"));
    myFixture.launchAction(intention);
    assertEquals(expected, manifest.getText());
  }
View Full Code Here

      "import org.osgi.framework.*;\n" +
      "public class <caret>C implements BundleActivator {\n" +
      "  public void start(BundleContext context) throws Exception { }\n" +
      "  public void stop(BundleContext context) throws Exception { }\n" +
      "}");
    IntentionAction intention = myFixture.findSingleIntention(OsmorcBundle.message("UnregisteredActivatorInspection.fix.manifest"));
    myFixture.launchAction(intention);
    assertEquals(expected, manifest.getText());
  }
View Full Code Here

  public void testMultipleChoice() throws Exception {doTest("rule ::= a | b | c <caret>| d","rule ::= a | b | d | c");}
  public void testComplexCase() throws Exception {doTest("rule ::= a | b | c c c <caret>| d [d d]","rule ::= a | b | d [d d] | c c c");}

  private void doTest(/*@Language("BNF")*/ String text, /*@Language("BNF")*/ String expected) throws IOException {
    myFixture.configureByText("a.bnf", text);
    IntentionAction action = new BnfFlipChoiceIntention();
    assertTrue("intention not available", action.isAvailable(getProject(), myFixture.getEditor(), myFixture.getFile()));
    action.invoke(getProject(), myFixture.getEditor(), myFixture.getFile());
    assertSameLines(expected, myFixture.getFile().getText());
  }
View Full Code Here

  }

  public static void doIntentionTest(CodeInsightTestFixture fixture, @NonNls String file, @NonNls String actionText) throws Throwable {
    final List<IntentionAction> list = fixture.getAvailableIntentions(file + ".xml");
    assert list.size() > 0;
    final IntentionAction intentionAction = findIntentionByText(list, actionText);
    assert intentionAction != null : "Action not found: " + actionText;
    fixture.launchAction(intentionAction);
    fixture.checkResultByFile(file + "_after.xml");
  }
View Full Code Here

TOP

Related Classes of com.intellij.codeInsight.intention.IntentionAction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.