Package com.intellij.openapi.command

Examples of com.intellij.openapi.command.WriteCommandAction.execute()


            protected void run(@NotNull Result result) throws Throwable {
                document.deleteString(start, end);
                document.insertString(statement.getTextOffset(), declaration + "\n");
            }
        };
        writeCommandAction.execute();
        reformatPositions(statement.getContainingFile(), range);
    }

    public static void moveSimpleStatementOut(Editor editor, GoIfStatement ifStatement) {
        final GoSimpleStatement simpleStatement = ifStatement.getSimpleStatement();
View Full Code Here


            protected void run(@NotNull Result result) throws Throwable {
                document.deleteString(simpleStatement.getTextOffset(), condition.getTextOffset());
                document.insertString(finalOutermostIf.getTextOffset(), simpleStatement.getText() + "\n");
            }
        };
        writeCommandAction.execute();
        reformatPositions(ifStatement.getContainingFile(), range);
    }

    private static void moveDependentSimpleStatementsFirst(Editor editor, GoIfStatement ifStatement,
                                                           GoSimpleStatement simpleStatement) {
View Full Code Here

                protected void run(@NotNull Result result) throws Throwable {
                    document.deleteString(rightCurlyPosition, rightCurlyPosition + 1);
                    document.insertString(leftCurlyPosition + 1, "\n" + finalReturnDeclaration + "\n}");
                }
            };
            writeCommandAction.execute();


            flipCondition(document, condition);

            GoSimpleStatement simpleStatement = stmt.getSimpleStatement();
View Full Code Here

                @Override
                protected void run(@NotNull Result result) throws Throwable {
                    document.insertString(leftCurlyPosition, "{\n} else ");
                }
            };
            writeCommandAction.execute();

            flipCondition(document, condition);
        }

        reformatPositions(file, stmtRange);
View Full Code Here

            protected void run(@NotNull Result result) throws Throwable {
                document.deleteString(simpleStatement.getTextOffset(), condition.getTextOffset());
                document.insertString(stmt.getTextOffset(), simpleStatementDecl);
            }
        };
        writeCommandAction.execute();
    }

    private void flipCondition(Document document, GoExpr condition) {
        replaceElementWithText(document, condition, flip(condition));
    }
View Full Code Here

                document.deleteString(outerIfRange.getStartOffset(), outerIfRange.getEndOffset());
                document.deleteString(rightCurlyRange.getStartOffset(), rightCurlyRange.getEndOffset());
            }
        };
        writeCommandAction.execute();

        PsiFile file = outer.getContainingFile();
        if (file != null) {
            reformatPositions(file, reformatRange);
        }
View Full Code Here

            @Override
            protected void run(@NotNull Result res) throws Throwable {
                editor.getDocument().replaceString(start, end, result);
            }
        };
        writeCommandAction.execute();
    }
}
View Full Code Here

            @Override
            protected void run(@NotNull Result res) throws Throwable {
                editor.getDocument().replaceString(start, end, result);
            }
        };
        writeCommandAction.execute();
    }
}
View Full Code Here

                    @Override
                    protected void run(@NotNull Result result) throws Throwable {
                        declarations.replace(newImport);
                    }
                };
                writeCommandAction.execute();
                return;
            }
        }

        // remove the whole declarations, if current one is the only one left.
View Full Code Here

            protected void run(@NotNull Result result) throws Throwable {
                block.addRangeBefore(elements[0], elements[elements.length - 1], rightCurly);
            }
        };

        writeCommandAction.execute();
        editor.getCaretModel().moveToOffset(doc.getLineEndOffset(lineNumber));
        editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
    }
}
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.