From baf48ba830895510aa9734a9d60bc7222741eb02 Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 10 Mar 2016 15:08:54 +0100 Subject: [PATCH] remove TransactionKind.NO_MERGE as it seems to have no use cases --- .../openapi/application/TransactionGuard.java | 2 +- .../intellij/openapi/application/TransactionKind.java | 11 +---------- .../openapi/application/WrapInTransaction.java | 2 +- .../openapi/application/TransactionGuardImpl.java | 6 +++--- 4 files changed, 6 insertions(+), 15 deletions(-) diff --git a/platform/core-api/src/com/intellij/openapi/application/TransactionGuard.java b/platform/core-api/src/com/intellij/openapi/application/TransactionGuard.java index adf405fc0b0f..bef6ce81aabd 100644 --- a/platform/core-api/src/com/intellij/openapi/application/TransactionGuard.java +++ b/platform/core-api/src/com/intellij/openapi/application/TransactionGuard.java @@ -94,7 +94,7 @@ public abstract class TransactionGuard { * @param transaction code to execute inside a transaction. */ public static void submitTransaction(@NotNull Runnable transaction) { - getInstance().submitMergeableTransaction(TransactionKind.NO_MERGE, transaction); + getInstance().submitMergeableTransaction(TransactionKind.ANY_CHANGE, transaction); } /** diff --git a/platform/core-api/src/com/intellij/openapi/application/TransactionKind.java b/platform/core-api/src/com/intellij/openapi/application/TransactionKind.java index bc7d3be0da3b..6a666b98b0ad 100644 --- a/platform/core-api/src/com/intellij/openapi/application/TransactionKind.java +++ b/platform/core-api/src/com/intellij/openapi/application/TransactionKind.java @@ -27,11 +27,6 @@ public interface TransactionKind { */ TransactionKind TEXT_EDITING = Common.TEXT_EDITING; - /** - * Same as {@link Common#NO_MERGE} - */ - TransactionKind NO_MERGE = Common.NO_MERGE; - /** * Same as {@link Common#ANY_CHANGE} */ @@ -56,11 +51,7 @@ public interface TransactionKind { *
  • Project root set change *
  • Dumb mode (reindexing) start/finish, (see {@link com.intellij.openapi.project.DumbService}). */ - ANY_CHANGE, + ANY_CHANGE - /** - * Transactions of this kind won't be merged into other transactions - */ - NO_MERGE } } diff --git a/platform/core-api/src/com/intellij/openapi/application/WrapInTransaction.java b/platform/core-api/src/com/intellij/openapi/application/WrapInTransaction.java index b42f547b326f..63a839a91460 100644 --- a/platform/core-api/src/com/intellij/openapi/application/WrapInTransaction.java +++ b/platform/core-api/src/com/intellij/openapi/application/WrapInTransaction.java @@ -18,5 +18,5 @@ public @interface WrapInTransaction { /** * @return the kind of transaction to wrap the action into. By default, it's {@link TransactionKind#NO_MERGE}. */ - TransactionKind.Common value() default TransactionKind.Common.NO_MERGE; + TransactionKind.Common value() default TransactionKind.Common.ANY_CHANGE; } diff --git a/platform/core-impl/src/com/intellij/openapi/application/TransactionGuardImpl.java b/platform/core-impl/src/com/intellij/openapi/application/TransactionGuardImpl.java index 43ca3fb43d63..0f2456282efd 100644 --- a/platform/core-impl/src/com/intellij/openapi/application/TransactionGuardImpl.java +++ b/platform/core-impl/src/com/intellij/openapi/application/TransactionGuardImpl.java @@ -41,7 +41,7 @@ public class TransactionGuardImpl extends TransactionGuard { @NotNull public AccessToken startSynchronousTransaction(@NotNull TransactionKind kind) throws IllegalStateException { ApplicationManager.getApplication().assertIsDispatchThread(); - if (kind != TransactionKind.NO_MERGE && myMergeableKinds.contains(kind)) { + if (myMergeableKinds.contains(kind)) { return AccessToken.EMPTY_ACCESS_TOKEN; } if (myTransactionStartTrace != null) { @@ -71,7 +71,7 @@ public class TransactionGuardImpl extends TransactionGuard { Runnable next = myQueue.poll(); if (next != null) { - runSyncTransaction(TransactionKind.NO_MERGE, next); + runSyncTransaction(TransactionKind.ANY_CHANGE, next); } } }, app.getDisposed()); @@ -118,7 +118,7 @@ public class TransactionGuardImpl extends TransactionGuard { } protected boolean canRunTransactionNow(@NotNull TransactionKind kind) { - return !isInsideTransaction() || kind != TransactionKind.NO_MERGE && myMergeableKinds.contains(kind); + return !isInsideTransaction() || myMergeableKinds.contains(kind); } @Override