Package com.intellij.openapi.command

Examples of com.intellij.openapi.command.WriteCommandAction


            String after = text.substring(offset);
            final int indent = 0;
            String spaces = StringUtil.repeatSymbol(' ', indent);
            final String newText = before + "\n" + spaces + after;

            new WriteCommandAction(project) {
                @Override
                protected void run(Result result) throws Throwable {
                    console.setInputText(newText);
                    caretModel.moveToOffset(offset + indent + 1);
                }
View Full Code Here


    final PsiReference ref = context.getFile().findReferenceAt(tailOffset);
    if (ref == null || ref.resolve() != null) {
      // no import statement needed
      return;
    }
    new WriteCommandAction(context.getProject(), context.getFile()) {
      @Override
      protected void run(Result result) throws Throwable {
        final String importPath = (String)item.getObject();
        HaxeAddImportHelper.addImport(importPath, context.getFile());
      }
View Full Code Here

      doImport(editor, candidates.iterator().next());
    }
  }

  private void doImport(final Editor editor, final PsiElement component) {
    new WriteCommandAction(myType.getProject(), myType.getContainingFile()) {
      @Override
      protected void run(Result result) throws Throwable {
        HaxeAddImportHelper.addImport(((HaxeClass)component).getQualifiedName(), myType.getContainingFile());
      }
    }.execute();
View Full Code Here

    HaxeRestoreReferencesDialog dialog = new HaxeRestoreReferencesDialog(project, ArrayUtil.toStringArray(haxeClassList));
    dialog.show();
    String[] selectedObjects = dialog.getSelectedElements();

    for (final String object : selectedObjects) {
      new WriteCommandAction(project, file) {
        @Override
        protected void run(Result result) throws Throwable {
          HaxeAddImportHelper.addImport(object, file);
        }
      }.execute();
View Full Code Here

  }

  public void doTest() {
    myFixture.configureByFile(getTestName(false) + ".hx");
    final List<SmartEnterProcessor> processors = SmartEnterProcessors.INSTANCE.forKey(HaxeLanguage.INSTANCE);
    new WriteCommandAction(myFixture.getProject()) {
      @Override
      protected void run(@NotNull Result result) throws Throwable {
        final Editor editor = myFixture.getEditor();
        for (SmartEnterProcessor processor : processors) {
          processor.process(myFixture.getProject(), editor, myFixture.getFile());
View Full Code Here

  private void applyFixInner(final Project project) {
    final PsiFile file = myAnnotation.getContainingFile();
    final Editor editor = CodeInsightUtil.positionCursor(project, file, myAnnotation);
    if (editor != null) {
      new WriteCommandAction(project, file) {
        protected void run(Result result) throws Throwable {
          final PsiNameValuePair valuePair = selectAnnotationAttribute();

          if (null != valuePair) {
            // delete this parameter
View Full Code Here

  private void applyFixInner(final Project project) {
    final PsiFile psiFile = myClass.getContainingFile();
    final Editor editor = CodeInsightUtil.positionCursor(project, psiFile, myClass.getLBrace());
    if (editor != null) {
      new WriteCommandAction(project, psiFile) {
        protected void run(Result result) throws Throwable {

          final PsiElementFactory psiElementFactory = JavaPsiFacade.getInstance(myClass.getProject()).getElementFactory();
          final PsiField psiField = psiElementFactory.createField(myName, myType);
View Full Code Here

  private void applyFixInner(final Project project) {
    final PsiFile psiFile = myClass.getContainingFile();
    final Editor editor = CodeInsightUtil.positionCursor(project, psiFile, myClass.getLBrace());
    if (editor != null) {
      new WriteCommandAction(project, psiFile) {
        protected void run(Result result) throws Throwable {

          final PsiElementFactory psiElementFactory = JavaPsiFacade.getInstance(myClass.getProject()).getElementFactory();
          final PsiField psiField = psiElementFactory.createField(myName, myType);
View Full Code Here

  private void applyFixInner(final Project project) {
    final PsiFile file = myAnnotation.getContainingFile();
    final Editor editor = CodeInsightUtil.positionCursor(project, file, myAnnotation);
    if (editor != null) {
      new WriteCommandAction(project, file) {
        protected void run(Result result) throws Throwable {
          final PsiNameValuePair valuePair = selectAnnotationAttribute();

          if (null != valuePair) {
            // delete this parameter
View Full Code Here

  protected JComponent getComponent() {
    myCheckBox.addActionListener(new ActionListener() {

      @Override
      public void actionPerformed(ActionEvent e) {
        new WriteCommandAction(myProject, BnfIntroduceRuleHandler.REFACTORING_NAME, BnfIntroduceRuleHandler.REFACTORING_NAME) {
          @Override
          protected void run(@NotNull Result result) throws Throwable {
            perform(myCheckBox.isSelected());
          }
        }.execute();
View Full Code Here

TOP

Related Classes of com.intellij.openapi.command.WriteCommandAction

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.