mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
don't wrap editor actions in transactions by default (IDEA-155679)
This commit is contained in:
@@ -146,7 +146,7 @@ public class TransactionGuardImpl extends TransactionGuard {
|
||||
if (!canRunTransactionNow(transaction, true)) {
|
||||
LOG.error("Cannot run synchronous submitTransactionAndWait from invokeLater. " +
|
||||
"Please use asynchronous submit*Transaction. " +
|
||||
"See TransactionGuard FAQ for details.");
|
||||
"See TransactionGuard FAQ for details. Transaction: " + runnable);
|
||||
}
|
||||
runSyncTransaction(transaction);
|
||||
return;
|
||||
|
||||
@@ -319,6 +319,10 @@ public abstract class AnAction implements PossiblyDumbAware {
|
||||
return this instanceof DumbAware;
|
||||
}
|
||||
|
||||
public boolean startInTransaction() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public interface TransparentUpdate {
|
||||
}
|
||||
|
||||
|
||||
@@ -190,14 +190,28 @@ public class ActionUtil {
|
||||
}
|
||||
|
||||
public static void performActionDumbAware(AnAction action, AnActionEvent e) {
|
||||
TransactionGuard.getInstance().submitTransactionAndWait(() -> {
|
||||
try {
|
||||
action.actionPerformed(e);
|
||||
Runnable runnable = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
action.actionPerformed(e);
|
||||
}
|
||||
catch (IndexNotReadyException e1) {
|
||||
showDumbModeWarning(e);
|
||||
}
|
||||
}
|
||||
catch (IndexNotReadyException e1) {
|
||||
showDumbModeWarning(e);
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return action + " of " + action.getClass();
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
if (action.startInTransaction()) {
|
||||
TransactionGuard.getInstance().submitTransactionAndWait(runnable);
|
||||
} else {
|
||||
runnable.run();
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -44,6 +44,11 @@ public abstract class EditorAction extends AnAction implements DumbAware {
|
||||
setEnabledInModalContext(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean startInTransaction() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public final EditorActionHandler setupHandler(@NotNull EditorActionHandler newHandler) {
|
||||
ensureHandlersLoaded();
|
||||
EditorActionHandler tmp = myHandler;
|
||||
|
||||
Reference in New Issue
Block a user