ReadonlyStatusHandler.setClearReadOnlyInTests moved from public API to Impl only

This commit is contained in:
Tagir Valeev
2016-09-23 10:03:58 +07:00
parent abee2c021f
commit 2532207baf
3 changed files with 9 additions and 13 deletions
@@ -29,6 +29,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vcs.readOnlyHandler.ReadonlyStatusHandlerImpl;
import com.intellij.openapi.vfs.CharsetToolkit;
import com.intellij.openapi.vfs.ReadonlyStatusHandler;
import com.intellij.psi.PsiFile;
@@ -196,7 +197,7 @@ public abstract class LightQuickFixTestCase extends LightDaemonAnalyzerTestCase
throw new UncheckedIOException(e);
}
});
ReadonlyStatusHandler handler = ReadonlyStatusHandler.getInstance(file.getProject());
ReadonlyStatusHandlerImpl handler = (ReadonlyStatusHandlerImpl)ReadonlyStatusHandler.getInstance(file.getProject());
handler.setClearReadOnlyInTests(true);
try {
ShowIntentionActionsHandler.chooseActionAndInvoke(file, getEditor(), action, action.getText());
@@ -21,7 +21,6 @@ import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.TestOnly;
import java.util.Collection;
@@ -68,14 +67,4 @@ public abstract class ReadonlyStatusHandler {
public static ReadonlyStatusHandler getInstance(@NotNull Project project) {
return ServiceManager.getService(project, ReadonlyStatusHandler.class);
}
/**
* Normally when file is read-only and ensureFilesWritable is called, a dialog box appears which allows user to decide
* whether to clear read-only flag or not. This method allows to control what will happen in unit-test mode.
*
* @param clearReadOnlyInTests if true, ensureFilesWritable will try to clear read-only status from passed files.
* Otherwise, read-only status is not modified (as if user refused to modify it).
*/
@TestOnly
public abstract void setClearReadOnlyInTests(boolean clearReadOnlyInTests);
}
@@ -158,7 +158,13 @@ public class ReadonlyStatusHandlerImpl extends ReadonlyStatusHandler implements
}
}
@Override
/**
* Normally when file is read-only and ensureFilesWritable is called, a dialog box appears which allows user to decide
* whether to clear read-only flag or not. This method allows to control what will happen in unit-test mode.
*
* @param clearReadOnlyInTests if true, ensureFilesWritable will try to clear read-only status from passed files.
* Otherwise, read-only status is not modified (as if user refused to modify it).
*/
@TestOnly
public void setClearReadOnlyInTests(boolean clearReadOnlyInTests) {
assert ApplicationManager.getApplication().isUnitTestMode();