diff --git a/java/compiler/impl/src/com/intellij/compiler/server/DefaultMessageHandler.java b/java/compiler/impl/src/com/intellij/compiler/server/DefaultMessageHandler.java index bfde64d4396e..cd244d690e0d 100644 --- a/java/compiler/impl/src/com/intellij/compiler/server/DefaultMessageHandler.java +++ b/java/compiler/impl/src/com/intellij/compiler/server/DefaultMessageHandler.java @@ -31,6 +31,7 @@ import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.*; import com.intellij.psi.search.*; import com.intellij.util.SmartList; +import com.intellij.util.TimeoutUtil; import com.intellij.util.concurrency.SequentialTaskExecutor; import io.netty.channel.Channel; import org.jetbrains.annotations.NotNull; @@ -254,12 +255,7 @@ public abstract class DefaultMessageHandler implements BuilderMessageHandler { if (isDumb) { // wait some time for (int idx = 0; idx < 5; idx++) { - try { - //noinspection BusyWait - Thread.sleep(10L); - } - catch (InterruptedException ignored) { - } + TimeoutUtil.sleep(10L); isDumb = dumbService.isDumb(); if (!isDumb) { break; diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java index dbcf43fd6168..7a5641ef22c1 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -55,6 +55,7 @@ import com.intellij.psi.PsiFile; import com.intellij.psi.search.GlobalSearchScope; import com.intellij.unscramble.ThreadState; import com.intellij.util.Alarm; +import com.intellij.util.TimeoutUtil; import com.intellij.xdebugger.AbstractDebuggerSession; import com.intellij.xdebugger.XDebugProcess; import com.intellij.xdebugger.XDebugSession; @@ -467,10 +468,7 @@ public class DebuggerSession implements AbstractDebuggerSession { while (!currentThread.isSuspended()) { // wait until thread is considered suspended. Querying data from a thread immediately after VM.suspend() // may result in IncompatibleThreadStateException, most likely some time after suspend() VM erroneously thinks that thread is still running - try { - Thread.sleep(10); - } - catch (InterruptedException ignored) {} + TimeoutUtil.sleep(10); } proxy = (currentThread.frameCount() > 0) ? currentThread.frame(0) : null; } diff --git a/java/execution/impl/src/com/intellij/execution/impl/DefaultJavaProgramRunner.java b/java/execution/impl/src/com/intellij/execution/impl/DefaultJavaProgramRunner.java index 3e6d6062cd2c..31d51f8388ea 100644 --- a/java/execution/impl/src/com/intellij/execution/impl/DefaultJavaProgramRunner.java +++ b/java/execution/impl/src/com/intellij/execution/impl/DefaultJavaProgramRunner.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,6 +38,7 @@ import com.intellij.unscramble.AnalyzeStacktraceUtil; import com.intellij.unscramble.ThreadDumpConsoleFactory; import com.intellij.unscramble.ThreadDumpParser; import com.intellij.unscramble.ThreadState; +import com.intellij.util.TimeoutUtil; import com.intellij.util.text.DateFormatUtil; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; @@ -211,13 +212,7 @@ public class DefaultJavaProgramRunner extends JavaPatchableProgramRunner { final String stdout = myListener.getOutput().getStdout(); threadStates = ThreadDumpParser.parse(stdout); if (threadStates == null || threadStates.isEmpty()) { - try { - //noinspection BusyWait - Thread.sleep(50); - } - catch (InterruptedException ignored) { - // - } + TimeoutUtil.sleep(50); threadStates = null; continue; } diff --git a/java/testFramework/src/com/intellij/debugger/ExecutionWithDebuggerToolsTestCase.java b/java/testFramework/src/com/intellij/debugger/ExecutionWithDebuggerToolsTestCase.java index c4f7d920969d..1a3e8c82a3e6 100644 --- a/java/testFramework/src/com/intellij/debugger/ExecutionWithDebuggerToolsTestCase.java +++ b/java/testFramework/src/com/intellij/debugger/ExecutionWithDebuggerToolsTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -46,6 +46,7 @@ import com.intellij.psi.PsiFile; import com.intellij.testFramework.CompositeException; import com.intellij.ui.classFilter.ClassFilter; import com.intellij.util.IJSwingUtilities; +import com.intellij.util.TimeoutUtil; import com.intellij.util.ui.UIUtil; import com.sun.jdi.Method; import com.sun.jdi.ThreadReference; @@ -445,11 +446,7 @@ public abstract class ExecutionWithDebuggerToolsTestCase extends ExecutionTestCa } private void pauseExecution() { - try { - Thread.sleep(10); - } - catch (InterruptedException ignored) { - } + TimeoutUtil.sleep(10); } } } diff --git a/jps/jps-builders/testSrc/org/jetbrains/jps/builders/JpsBuildTestCase.java b/jps/jps-builders/testSrc/org/jetbrains/jps/builders/JpsBuildTestCase.java index 339f0b2436ac..d6ad7c093ed7 100644 --- a/jps/jps-builders/testSrc/org/jetbrains/jps/builders/JpsBuildTestCase.java +++ b/jps/jps-builders/testSrc/org/jetbrains/jps/builders/JpsBuildTestCase.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ import com.intellij.openapi.util.io.FileSystemUtil; import com.intellij.openapi.util.io.FileUtil; import com.intellij.openapi.util.text.StringUtil; import com.intellij.testFramework.UsefulTestCase; +import com.intellij.util.TimeoutUtil; import com.intellij.util.containers.hash.HashMap; import com.intellij.util.io.TestFileSystemBuilder; import org.jetbrains.annotations.NotNull; @@ -154,12 +155,7 @@ public abstract class JpsBuildTestCase extends UsefulTestCase { //we need this to ensure that the file won't be treated as changed by user during compilation and therefore marked for recompilation long delta; while ((delta = time - System.currentTimeMillis()) > 0) { - try { - //noinspection BusyWait - Thread.sleep(delta); - } - catch (InterruptedException ignored) { - } + TimeoutUtil.sleep(delta); } } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionSettingsTree.java b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionSettingsTree.java index 86f9d3735d01..a252ebd52690 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionSettingsTree.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/intention/impl/config/IntentionSettingsTree.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -30,6 +30,7 @@ import com.intellij.openapi.util.Ref; import com.intellij.packageDependencies.ui.TreeExpansionMonitor; import com.intellij.ui.*; import com.intellij.util.ArrayUtil; +import com.intellij.util.TimeoutUtil; import com.intellij.util.ui.UIUtil; import com.intellij.util.ui.tree.TreeUtil; @@ -124,11 +125,7 @@ public abstract class IntentionSettingsTree { public void reset(){ while (((IntentionManagerImpl)IntentionManager.getInstance()).hasActiveRequests()) { - try { - Thread.sleep(100); - } - catch (InterruptedException ignored) { - } + TimeoutUtil.sleep(100); } resetCheckStatus(); reset(IntentionManagerSettings.getInstance().getMetaData()); diff --git a/platform/lang-impl/src/com/intellij/ui/debugger/extensions/PlaybackDebugger.java b/platform/lang-impl/src/com/intellij/ui/debugger/extensions/PlaybackDebugger.java index 20c2a7ae110c..90fff128c545 100644 --- a/platform/lang-impl/src/com/intellij/ui/debugger/extensions/PlaybackDebugger.java +++ b/platform/lang-impl/src/com/intellij/ui/debugger/extensions/PlaybackDebugger.java @@ -39,6 +39,7 @@ import com.intellij.openapi.wm.impl.IdeFrameImpl; import com.intellij.ui.JBColor; import com.intellij.ui.ScrollPaneFactory; import com.intellij.ui.debugger.UiDebuggerExtension; +import com.intellij.util.TimeoutUtil; import com.intellij.util.WaitFor; import com.intellij.util.ui.PlatformColors; import com.intellij.util.ui.UIUtil; @@ -420,10 +421,7 @@ public class PlaybackDebugger implements UiDebuggerExtension, PlaybackRunner.Sta message(null, "Starting script...", -1, Type.message, true); - try { - sleep(1000); - } - catch (InterruptedException e) {} + TimeoutUtil.sleep(1000); if (myRunner == null) { diff --git a/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java b/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java index a291ab32e950..08b6a0420838 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/DialogWrapper.java @@ -45,6 +45,7 @@ import com.intellij.ui.components.JBOptionButton; import com.intellij.ui.components.JBScrollPane; import com.intellij.util.Alarm; import com.intellij.util.ArrayUtil; +import com.intellij.util.TimeoutUtil; import com.intellij.util.ui.AwtVisitor; import com.intellij.util.ui.DialogUtil; import com.intellij.util.ui.UIUtil; @@ -1899,12 +1900,7 @@ public abstract class DialogWrapper { int w = (size.width - cur.width) / steps; while (step++ < steps) { setSize(cur.width + w * step, cur.height + h * step); - try { - //noinspection BusyWait - sleep(time / steps); - } - catch (InterruptedException ignore) { - } + TimeoutUtil.sleep(time / steps); } setSize(size.width, size.height); //repaint(); diff --git a/platform/platform-impl/src/com/intellij/ide/ClipboardSynchronizer.java b/platform/platform-impl/src/com/intellij/ide/ClipboardSynchronizer.java index e909ea060af6..90d726537d0c 100644 --- a/platform/platform-impl/src/com/intellij/ide/ClipboardSynchronizer.java +++ b/platform/platform-impl/src/com/intellij/ide/ClipboardSynchronizer.java @@ -24,6 +24,7 @@ import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.registry.Registry; import com.intellij.ui.mac.foundation.Foundation; import com.intellij.ui.mac.foundation.ID; +import com.intellij.util.TimeoutUtil; import com.intellij.util.concurrency.FutureResult; import com.sun.jna.IntegerType; import org.jetbrains.annotations.NotNull; @@ -146,12 +147,7 @@ public class ClipboardSynchronizer implements ApplicationComponent { return Toolkit.getDefaultToolkit().getSystemClipboard().getContents(this); } catch (IllegalStateException e) { - try { - //noinspection BusyWait - Thread.sleep(50); - } - catch (InterruptedException ignored) { - } + TimeoutUtil.sleep(50); last = e; } } @@ -164,12 +160,7 @@ public class ClipboardSynchronizer implements ApplicationComponent { Toolkit.getDefaultToolkit().getSystemClipboard().setContents(content, owner); } catch (IllegalStateException e) { - try { - //noinspection BusyWait - Thread.sleep(50); - } - catch (InterruptedException ignored) { - } + TimeoutUtil.sleep(50); continue; } break; diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaTest.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaTest.java index 3a7c85e04947..695a530654b9 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaTest.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ import com.intellij.ide.ui.laf.darcula.DarculaLaf; import com.intellij.ui.ShowUIDefaultsAction; import com.intellij.ui.components.JBCheckBox; import com.intellij.ui.table.JBTable; +import com.intellij.util.TimeoutUtil; import javax.swing.*; import javax.swing.table.DefaultTableModel; @@ -81,19 +82,11 @@ public class DarculaTest { @Override public void run() { while (myProgressBar2.getValue() < 100) { - try { - sleep(20); - } - catch (InterruptedException e1) { - } + TimeoutUtil.sleep(20); myProgressBar2.setValue(myProgressBar2.getValue() + 1); } - try { - sleep(1000); - } - catch (InterruptedException e1) { - } + TimeoutUtil.sleep(1000); myProgressBar2.setValue(0); myStartButton.setEnabled(true); diff --git a/platform/platform-impl/src/com/intellij/notification/impl/actions/ShowDelayedMessageInternalAction.java b/platform/platform-impl/src/com/intellij/notification/impl/actions/ShowDelayedMessageInternalAction.java index ad133f1c7574..a870b9373302 100644 --- a/platform/platform-impl/src/com/intellij/notification/impl/actions/ShowDelayedMessageInternalAction.java +++ b/platform/platform-impl/src/com/intellij/notification/impl/actions/ShowDelayedMessageInternalAction.java @@ -21,6 +21,7 @@ import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.application.ApplicationBundle; import com.intellij.openapi.project.DumbAware; import com.intellij.openapi.ui.MessageDialogBuilder; +import com.intellij.util.TimeoutUtil; import javax.swing.*; @@ -37,10 +38,7 @@ public class ShowDelayedMessageInternalAction extends AnAction implements DumbAw super.run(); //noinspection EmptyCatchBlock - try { - Thread.sleep(3000); - } - catch (InterruptedException e1) {} // does not matter for an internal action + TimeoutUtil.sleep(3000); //noinspection SSBasedInspection SwingUtilities.invokeLater(new Runnable() { diff --git a/platform/platform-impl/src/com/intellij/ui/AnimatorTestAction.java b/platform/platform-impl/src/com/intellij/ui/AnimatorTestAction.java index f150cd7a39ef..51872a033bcc 100644 --- a/platform/platform-impl/src/com/intellij/ui/AnimatorTestAction.java +++ b/platform/platform-impl/src/com/intellij/ui/AnimatorTestAction.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.ui; import com.intellij.icons.AllIcons; @@ -5,6 +20,7 @@ import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.ui.DialogWrapper; import com.intellij.util.ConcurrencyUtil; +import com.intellij.util.TimeoutUtil; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.ui.AnimatedIcon; import org.jetbrains.annotations.Nullable; @@ -27,11 +43,7 @@ public class AnimatorTestAction extends AnAction { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { - try { - Thread.sleep(30); - } - catch (InterruptedException ignore) { - } + TimeoutUtil.sleep(30); } }); } diff --git a/platform/util/src/com/intellij/util/Restarter.java b/platform/util/src/com/intellij/util/Restarter.java index b593094726f6..679ef27a990f 100644 --- a/platform/util/src/com/intellij/util/Restarter.java +++ b/platform/util/src/com/intellij/util/Restarter.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -125,11 +125,7 @@ public class Restarter { // Since the process ID is passed through the command line, we want to make sure that we don't exit before the "restarter" // process has a chance to open the handle to our process, and that it doesn't wait for the termination of an unrelated // process which happened to have the same process ID. - try { - Thread.sleep(500); - } - catch (InterruptedException ignore) { - } + TimeoutUtil.sleep(500); } private static void restartOnMac(@NotNull final String... beforeRestart) throws IOException { diff --git a/platform/util/src/com/intellij/util/io/MappedBufferWrapper.java b/platform/util/src/com/intellij/util/io/MappedBufferWrapper.java index 56ce86c62e7a..30490f454c84 100644 --- a/platform/util/src/com/intellij/util/io/MappedBufferWrapper.java +++ b/platform/util/src/com/intellij/util/io/MappedBufferWrapper.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -16,6 +16,7 @@ package com.intellij.util.io; import com.intellij.openapi.diagnostic.Logger; +import com.intellij.util.TimeoutUtil; import sun.nio.ch.DirectBuffer; import java.io.File; @@ -88,11 +89,7 @@ public abstract class MappedBufferWrapper extends ByteBufferWrapper { } catch (Throwable e) { LOG.info(e); - try { - //noinspection BusyWait - Thread.sleep(10); - } - catch (InterruptedException ignored) { } + TimeoutUtil.sleep(10); } } return false; diff --git a/platform/vcs-impl/src/com/intellij/openapi/diff/impl/dir/DirDiffTableModel.java b/platform/vcs-impl/src/com/intellij/openapi/diff/impl/dir/DirDiffTableModel.java index 7db646c94b5b..8bd61595ba7c 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/diff/impl/dir/DirDiffTableModel.java +++ b/platform/vcs-impl/src/com/intellij/openapi/diff/impl/dir/DirDiffTableModel.java @@ -41,6 +41,7 @@ import com.intellij.ui.TableUtil; import com.intellij.ui.awt.RelativePoint; import com.intellij.ui.components.JBLoadingPanel; import com.intellij.ui.table.JBTable; +import com.intellij.util.TimeoutUtil; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.ui.StatusText; import org.jetbrains.annotations.NotNull; @@ -870,11 +871,7 @@ public class DirDiffTableModel extends AbstractTableModel implements DirDiffMode @Override public void run() { if (myLoadingPanel.isLoading()) { - try { - Thread.sleep(mySleep); - } - catch (InterruptedException e) {// - } + TimeoutUtil.sleep(mySleep); ApplicationManager.getApplication().invokeLater(new Runnable() { @Override public void run() { diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/update/TestContinuationAction.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/update/TestContinuationAction.java index 2816c9544213..97c825f6ffd4 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/update/TestContinuationAction.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/update/TestContinuationAction.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ import com.intellij.openapi.progress.Task; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.Messages; import com.intellij.util.PlatformIcons; +import com.intellij.util.TimeoutUtil; import com.intellij.util.continuation.*; import org.jetbrains.annotations.NotNull; @@ -65,12 +66,7 @@ public class TestContinuationAction extends AnAction { @Override public void run(final ContinuationContext context) { addMore(context); - try { - Thread.sleep(10000); - } - catch (InterruptedException e1) { - // - } + TimeoutUtil.sleep(10000); } }, new LongTaskDescriptor("Second"), new ReportTask("Second complete"), @@ -78,12 +74,7 @@ public class TestContinuationAction extends AnAction { @Override public void run(final ContinuationContext context) { addMoreSurviving(context); - try { - Thread.sleep(10000); - } - catch (InterruptedException e1) { - // - } + TimeoutUtil.sleep(10000); throw new IllegalStateException(); /*context.suspend(); ApplicationManager.getApplication().invokeLater(new Runnable() { @@ -147,12 +138,7 @@ public class TestContinuationAction extends AnAction { public void run(ContinuationContext context) { final ProgressIndicator pi = ProgressManager.getInstance().getProgressIndicator(); pi.setText(getName()); - try { - Thread.sleep(10000); - } - catch (InterruptedException e) { - // - } + TimeoutUtil.sleep(10000); pi.setText(""); } } diff --git a/platform/vcs-impl/src/com/intellij/util/continuation/ModalityIgnorantBackgroundableTask.java b/platform/vcs-impl/src/com/intellij/util/continuation/ModalityIgnorantBackgroundableTask.java index e57336abb8c9..4173ed822471 100644 --- a/platform/vcs-impl/src/com/intellij/util/continuation/ModalityIgnorantBackgroundableTask.java +++ b/platform/vcs-impl/src/com/intellij/util/continuation/ModalityIgnorantBackgroundableTask.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ import com.intellij.openapi.progress.ProgressIndicator; import com.intellij.openapi.progress.Task; import com.intellij.openapi.project.Project; import com.intellij.util.Consumer; +import com.intellij.util.TimeoutUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -73,12 +74,7 @@ public abstract class ModalityIgnorantBackgroundableTask extends Task.Background if (myRunner != null && myCnt > 0) { -- myCnt; // we are on some background thread and do not want to reschedule too often - try { - Thread.sleep(100); - } - catch (InterruptedException e) { - // - } + TimeoutUtil.sleep(100); myRunner.consume(this); return; } diff --git a/plugins/ant/src/com/intellij/lang/ant/config/AntConfigurationBase.java b/plugins/ant/src/com/intellij/lang/ant/config/AntConfigurationBase.java index b2e45120ecd7..479979fa9eff 100644 --- a/plugins/ant/src/com/intellij/lang/ant/config/AntConfigurationBase.java +++ b/plugins/ant/src/com/intellij/lang/ant/config/AntConfigurationBase.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ import com.intellij.lang.ant.config.impl.AntInstallation; import com.intellij.openapi.project.Project; import com.intellij.psi.PsiFile; import com.intellij.psi.xml.XmlFile; +import com.intellij.util.TimeoutUtil; import com.intellij.util.config.ExternalizablePropertyContainer; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -63,11 +64,7 @@ public abstract class AntConfigurationBase extends AntConfiguration { public final void ensureInitialized() { int attemptCount = 0; // need this in order to make sure we will not block swing thread forever while (!isInitialized() && attemptCount < 6000) { - try { - Thread.sleep(10); - } - catch (InterruptedException ignored) { - } + TimeoutUtil.sleep(10); attemptCount++; } } diff --git a/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/ConnectionOnProcess.java b/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/ConnectionOnProcess.java index 69110fc00c0a..57a8d125bf13 100644 --- a/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/ConnectionOnProcess.java +++ b/plugins/cvs/cvs-core/src/com/intellij/cvsSupport2/connections/ConnectionOnProcess.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ import com.intellij.openapi.application.Application; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.vfs.encoding.EncodingManager; +import com.intellij.util.TimeoutUtil; import com.intellij.util.concurrency.Semaphore; import org.netbeans.lib.cvsclient.connection.AuthenticationException; import org.netbeans.lib.cvsclient.connection.IConnection; @@ -68,23 +69,14 @@ public abstract class ConnectionOnProcess implements IConnection { try { if (myInputStream != null && !myContainsError) { myInputStream.close(); - try { - Thread.sleep(10); - } catch (InterruptedException e) { - //ignore - } + TimeoutUtil.sleep(10); } } finally { try { if (myOutputStream != null && !myContainsError) { myOutputStream.close(); - try { - Thread.sleep(10); - } catch (InterruptedException e) { - //ignore - } - + TimeoutUtil.sleep(10); } try { if (myErrThread != null) { @@ -214,11 +206,7 @@ public abstract class ConnectionOnProcess implements IConnection { public void run() { try { while (readAvailable()) { - try { - Thread.sleep(50L); - } - catch (InterruptedException ignore) { - } + TimeoutUtil.sleep(50L); } } catch (Exception e) { diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/RepeatSvnActionThroughBusy.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/RepeatSvnActionThroughBusy.java index e078c572d65d..896015cbe6e2 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/RepeatSvnActionThroughBusy.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/RepeatSvnActionThroughBusy.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ package org.jetbrains.idea.svn; import com.intellij.openapi.vcs.VcsException; import com.intellij.util.Processor; +import com.intellij.util.TimeoutUtil; import org.tmatesoft.sqljet.core.SqlJetErrorCode; import org.tmatesoft.sqljet.core.SqlJetException; import org.tmatesoft.svn.core.SVNErrorCode; @@ -72,12 +73,7 @@ public abstract class RepeatSvnActionThroughBusy { catch (VcsException e) { if (ourBusyExceptionProcessor.process(e)) { if (myCnt > 0) { - try { - Thread.sleep(myTimeout * (REPEAT - myCnt + 1)); - } - catch (InterruptedException e1) { - // - } + TimeoutUtil.sleep(myTimeout * (REPEAT - myCnt + 1)); -- myCnt; continue; } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnAbstractWriteOperationLocks.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnAbstractWriteOperationLocks.java index 29e87422bb53..04dc234897a0 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnAbstractWriteOperationLocks.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnAbstractWriteOperationLocks.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -17,6 +17,7 @@ package org.jetbrains.idea.svn; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.vcs.changes.FilePathsHelper; +import com.intellij.util.TimeoutUtil; import org.jetbrains.annotations.Nullable; import org.tmatesoft.sqljet.core.SqlJetException; import org.tmatesoft.sqljet.core.table.ISqlJetBusyHandler; @@ -51,12 +52,7 @@ public abstract class SvnAbstractWriteOperationLocks { @Override public boolean call(int i) { if (myDisposed) return false; - try { - Thread.sleep(myTimeout); - } - catch (InterruptedException e) { - // - } + TimeoutUtil.sleep(myTimeout); return true; } }; diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/SvnTestCase.java b/plugins/svn4idea/testSource/org/jetbrains/idea/SvnTestCase.java index 364906460fe6..393995a29da8 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/SvnTestCase.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/SvnTestCase.java @@ -49,6 +49,7 @@ import com.intellij.testFramework.vcs.MockChangeListManagerGate; import com.intellij.testFramework.vcs.MockChangelistBuilder; import com.intellij.testFramework.vcs.TestClientRunner; import com.intellij.util.Processor; +import com.intellij.util.TimeoutUtil; import com.intellij.util.concurrency.Semaphore; import com.intellij.util.io.ZipUtil; import com.intellij.util.ui.UIUtil; @@ -379,10 +380,7 @@ public abstract class SvnTestCase extends AbstractJunitVcsTestCase { } protected static void sleep(final int millis) { - try { - Thread.sleep(millis); - } - catch (InterruptedException ignore) { } + TimeoutUtil.sleep(millis); } public String prepareBranchesStructure() throws Exception { diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/ConflictCreator.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/ConflictCreator.java index cca76e17f234..b4bbe646f424 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/ConflictCreator.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/ConflictCreator.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,6 +24,7 @@ import com.intellij.openapi.vcs.changes.LocalChangeList; import com.intellij.openapi.vfs.VfsUtil; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.util.Processor; +import com.intellij.util.TimeoutUtil; import com.intellij.util.containers.Convertor; import junit.framework.Assert; import org.jetbrains.idea.svn.info.Info; @@ -84,12 +85,7 @@ public class ConflictCreator { Assert.assertEquals(0, applier.getRemainingPatches().size()); } - try { - Thread.sleep(10); - } - catch (InterruptedException e) { - // - } + TimeoutUtil.sleep(10); SvnVcs vcs = SvnVcs.getInstance(myProject); diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnBusyOnAddTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnBusyOnAddTest.java index 10860179338c..1afccd7673e7 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnBusyOnAddTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnBusyOnAddTest.java @@ -17,6 +17,7 @@ package org.jetbrains.idea.svn; import com.intellij.openapi.application.PathManager; import com.intellij.openapi.application.PluginPathManager; +import com.intellij.util.TimeoutUtil; import com.intellij.util.concurrency.Semaphore; import junit.framework.Assert; import junit.framework.TestCase; @@ -151,11 +152,7 @@ public class SvnBusyOnAddTest extends TestCase { }).start(); semaphoreMain.waitFor(); - try { - Thread.sleep(5); - } catch (InterruptedException e) { - // - } + TimeoutUtil.sleep(5); SVNWCClient client = new SVNWCClient((ISVNRepositoryPool)null, new DefaultSVNOptions()); client.doAdd(ioFile.getParentFile(), true, false, true, true); semaphore.up(); diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCachingRepositoryPoolTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCachingRepositoryPoolTest.java index ecad58e2b20d..a72386554503 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCachingRepositoryPoolTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCachingRepositoryPoolTest.java @@ -20,6 +20,7 @@ import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.progress.impl.ProgressManagerImpl; import com.intellij.testFramework.vcs.FileBasedTest; import com.intellij.util.ThrowableConvertor; +import com.intellij.util.TimeoutUtil; import com.intellij.util.concurrency.Semaphore; import junit.framework.Assert; import org.jetbrains.idea.svn.svnkit.lowLevel.ApplicationLevelNumberConnectionsGuardImpl; @@ -55,11 +56,7 @@ public class SvnCachingRepositoryPoolTest extends FileBasedTest { guard.setDelay(20); ((CachingSvnRepositoryPool) poolManager.getPool()).setConnectionTimeout(20); testBigFlow(poolManager, false); - try { - Thread.sleep(50); - } catch (InterruptedException e) { - // - } + TimeoutUtil.sleep(50); Assert.assertEquals(0, guard.getCurrentlyActiveConnections()); final CachingSvnRepositoryPool pool = (CachingSvnRepositoryPool) poolManager.getPool(); Map groups = pool.getGroups(); @@ -116,11 +113,7 @@ public class SvnCachingRepositoryPoolTest extends FileBasedTest { }); thread.start(); - try { - Thread.sleep(10); - } catch (InterruptedException e) { - // - } + TimeoutUtil.sleep(10); Assert.assertTrue(thread.isAlive()); indicator.cancel(); final Object obj = new Object(); @@ -184,12 +177,7 @@ public class SvnCachingRepositoryPoolTest extends FileBasedTest { return; } repository.fireConnectionOpened(); - try { - Thread.sleep(random.nextInt(10)); - } - catch (InterruptedException e) { - // - } + TimeoutUtil.sleep(random.nextInt(10)); repository.fireConnectionClosed(); synchronized (cnt) { -- cnt[0]; diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCommandLineStabilityTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCommandLineStabilityTest.java index 4918ef06eb39..f9b76fde7215 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCommandLineStabilityTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnCommandLineStabilityTest.java @@ -1,7 +1,23 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package org.jetbrains.idea.svn; import com.intellij.openapi.vcs.VcsException; import com.intellij.openapi.vfs.VfsUtilCore; +import com.intellij.util.TimeoutUtil; import junit.framework.Assert; import org.jetbrains.annotations.NotNull; import org.jetbrains.idea.svn.auth.AuthenticationService; @@ -24,7 +40,7 @@ public class SvnCommandLineStabilityTest extends Svn17TestCase { public void testCallInfoManyTimes() throws Exception { for (int i = 0; i < 200; i++) { call(); - try { Thread.sleep(5); } catch (InterruptedException e) {} + TimeoutUtil.sleep(5); } } diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnExternalCommitNoticedTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnExternalCommitNoticedTest.java index 9b3cc55549e8..04ad868acf95 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnExternalCommitNoticedTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnExternalCommitNoticedTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ import com.intellij.openapi.vcs.changes.ChangeListManagerImpl; import com.intellij.openapi.vcs.changes.VcsDirtyScopeManager; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.util.TimeoutUtil; import org.junit.Assert; import org.junit.Before; import org.junit.Test; @@ -68,11 +69,7 @@ public class SvnExternalCommitNoticedTest extends Svn17TestCase { clManager.ensureUpToDate(false); Assert.assertEquals(3, clManager.getChangesIn(myWorkingCopyDir).size()); - try { - Thread.sleep(100); - } catch (InterruptedException e) { - // - } + TimeoutUtil.sleep(100); checkin(); @@ -94,11 +91,7 @@ public class SvnExternalCommitNoticedTest extends Svn17TestCase { clManager.ensureUpToDate(false); Assert.assertEquals(11, clManager.getChangesIn(myWorkingCopyDir).size()); - try { - Thread.sleep(100); - } catch (InterruptedException e) { - // - } + TimeoutUtil.sleep(100); checkin(); @@ -177,11 +170,7 @@ public class SvnExternalCommitNoticedTest extends Svn17TestCase { clManager.ensureUpToDate(false); Assert.assertEquals(2, clManager.getChangesIn(myWorkingCopyDir).size()); - try { - Thread.sleep(100); - } catch (InterruptedException e) { - // - } + TimeoutUtil.sleep(100); runInAndVerifyIgnoreOutput("ci", "-m", "test", sourceDir.getPath()); runInAndVerifyIgnoreOutput("ci", "-m", "test", externalDir.getPath()); diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnLocalChangesAndRootsTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnLocalChangesAndRootsTest.java index 6c2ae8f8bfeb..dd36b64092cd 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnLocalChangesAndRootsTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnLocalChangesAndRootsTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ import com.intellij.openapi.vcs.changes.ChangeListManager; import com.intellij.openapi.vcs.changes.IgnoredBeanFactory; import com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.util.TimeoutUtil; import org.junit.Test; import java.io.File; @@ -80,12 +81,7 @@ public class SvnLocalChangesAndRootsTest extends Svn17TestCase { } private void sleep100() { - try { - Thread.sleep(100); - } - catch (InterruptedException e) { - // - } + TimeoutUtil.sleep(100); } } @@ -215,11 +211,6 @@ public class SvnLocalChangesAndRootsTest extends Svn17TestCase { } private void sleep100() { - try { - Thread.sleep(100); - } - catch (InterruptedException e) { - // - } + TimeoutUtil.sleep(100); } } diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnLockingTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnLockingTest.java index 3ddbb0cd1f3a..471540b4f649 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnLockingTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnLockingTest.java @@ -18,6 +18,7 @@ package org.jetbrains.idea.svn; import com.intellij.idea.Bombed; import com.intellij.openapi.application.PathManager; import com.intellij.openapi.application.PluginPathManager; +import com.intellij.util.TimeoutUtil; import com.intellij.util.concurrency.Semaphore; import junit.framework.Assert; import junit.framework.TestCase; @@ -119,32 +120,16 @@ public class SvnLockingTest extends TestCase { try { thread1.start(); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - // - } + TimeoutUtil.sleep(500); Assert.assertTrue(operation1.isInsideWrite()); thread2.start(); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - // - } + TimeoutUtil.sleep(500); Assert.assertFalse(operation2.isInsideWrite()); operation1.go(); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - // - } + TimeoutUtil.sleep(500); Assert.assertTrue(operation2.isInsideWrite()); operation2.go(); - try { - Thread.sleep(500); - } catch (InterruptedException e) { - // - } + TimeoutUtil.sleep(500); } finally { myLocks.dispose(); operation1.stop(); @@ -250,11 +235,7 @@ public class SvnLockingTest extends TestCase { private void waitForRunning(HangRun operation1, int multiply) { int cnt = 10 * multiply; while (cnt > 0) { - try { - Thread.sleep(10 * multiply); - } catch (InterruptedException e) { - // - } + TimeoutUtil.sleep(10 * multiply); if (operation1.isRunning()) break; -- cnt; } @@ -385,12 +366,7 @@ public class SvnLockingTest extends TestCase { public boolean call(int i) { if (myStopped) return false; System.out.println("busy " + myName); - try { - Thread.sleep(10); - } - catch (InterruptedException e) { - // - } + TimeoutUtil.sleep(10); return true; } }); diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnNativeListsTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnNativeListsTest.java index b7aa1ef979a6..47605cb5988c 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnNativeListsTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnNativeListsTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import com.intellij.openapi.vcs.VcsException; import com.intellij.openapi.vcs.VcsTestUtil; import com.intellij.openapi.vcs.changes.*; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.util.TimeoutUtil; import org.junit.Test; import java.util.Collection; @@ -230,11 +231,6 @@ public class SvnNativeListsTest extends Svn17TestCase { } private void sleepABit() { - try { - Thread.sleep(50); - } - catch (InterruptedException e) { - // - } + TimeoutUtil.sleep(50); } } diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnRenameTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnRenameTest.java index c86ed0cc04aa..0b350ab2b0d2 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnRenameTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnRenameTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -26,6 +26,7 @@ import com.intellij.openapi.vcs.changes.ChangeListManager; import com.intellij.openapi.vcs.changes.ChangeListManagerImpl; import com.intellij.openapi.vcs.rollback.RollbackProgressListener; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.util.TimeoutUtil; import org.jetbrains.annotations.NonNls; import org.junit.Assert; import org.junit.Test; @@ -263,12 +264,7 @@ public class SvnRenameTest extends Svn17TestCase { final List exceptions = new ArrayList(); SvnVcs.getInstance(myProject).getRollbackEnvironment().rollbackChanges(changes, exceptions, RollbackProgressListener.EMPTY); - try { - Thread.sleep(300); - } - catch (InterruptedException e) { - // - } + TimeoutUtil.sleep(300); Assert.assertTrue(exceptions.isEmpty()); final File fileA = new File(childPath, "a.txt"); Assert.assertTrue(fileA.getAbsolutePath(), fileA.exists()); diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnRootAboveTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnRootAboveTest.java index 4a3741d90930..bd15bc65253b 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnRootAboveTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnRootAboveTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ import com.intellij.openapi.vcs.VcsDirectoryMapping; import com.intellij.openapi.vcs.changes.ChangeListManager; import com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.util.TimeoutUtil; import org.junit.Test; import java.io.File; @@ -176,11 +177,6 @@ public class SvnRootAboveTest extends Svn17TestCase { } private void sleep100() { - try { - Thread.sleep(100); - } - catch (InterruptedException e) { - // - } + TimeoutUtil.sleep(100); } } diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnTestDirtyScopeStateTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnTestDirtyScopeStateTest.java index 2e8ff81b4a2e..dffc52f454f2 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnTestDirtyScopeStateTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/SvnTestDirtyScopeStateTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ import com.intellij.openapi.vcs.changes.VcsDirtyScopeManager; import com.intellij.openapi.vcs.changes.VcsDirtyScopeManagerImpl; import com.intellij.openapi.vcs.changes.VcsDirtyScopeVfsListener; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.util.TimeoutUtil; import junit.framework.Assert; import org.junit.Test; @@ -89,12 +90,7 @@ public class SvnTestDirtyScopeStateTest extends Svn17TestCase { } private void waitABit() { - try { - Thread.sleep(100); - } - catch (InterruptedException e) { - // - } + TimeoutUtil.sleep(100); } @Test diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnExternalCommitNoticedTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnExternalCommitNoticedTest.java index 691544fb4275..3c1642a10dbe 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnExternalCommitNoticedTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnExternalCommitNoticedTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -23,6 +23,7 @@ import com.intellij.openapi.vcs.changes.ChangeListManagerImpl; import com.intellij.openapi.vcs.changes.VcsDirtyScopeManager; import com.intellij.openapi.vfs.LocalFileSystem; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.util.TimeoutUtil; import org.jetbrains.idea.svn.RootUrlInfo; import org.jetbrains.idea.svn.Svn17TestCase; import org.jetbrains.idea.svn.SvnFileUrlMapping; @@ -72,11 +73,7 @@ public class SvnExternalCommitNoticedTest extends Svn17TestCase { clManager.ensureUpToDate(false); Assert.assertEquals(3, clManager.getChangesIn(myWorkingCopyDir).size()); - try { - Thread.sleep(100); - } catch (InterruptedException e) { - // - } + TimeoutUtil.sleep(100); checkin(); @@ -98,11 +95,7 @@ public class SvnExternalCommitNoticedTest extends Svn17TestCase { clManager.ensureUpToDate(false); Assert.assertEquals(11, clManager.getChangesIn(myWorkingCopyDir).size()); - try { - Thread.sleep(100); - } catch (InterruptedException e) { - // - } + TimeoutUtil.sleep(100); checkin(); @@ -181,11 +174,7 @@ public class SvnExternalCommitNoticedTest extends Svn17TestCase { clManager.ensureUpToDate(false); Assert.assertEquals(2, clManager.getChangesIn(myWorkingCopyDir).size()); - try { - Thread.sleep(100); - } catch (InterruptedException e) { - // - } + TimeoutUtil.sleep(100); runInAndVerifyIgnoreOutput("ci", "-m", "test", sourceDir.getPath()); runInAndVerifyIgnoreOutput("ci", "-m", "test", externalDir.getPath()); diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnLocalChangesAndRootsTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnLocalChangesAndRootsTest.java index bb08a1842ddc..294a9c2dc458 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnLocalChangesAndRootsTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnLocalChangesAndRootsTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -21,6 +21,7 @@ import com.intellij.openapi.vcs.changes.ChangeListManager; import com.intellij.openapi.vcs.changes.IgnoredBeanFactory; import com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.util.TimeoutUtil; import org.jetbrains.idea.svn.SvnVcs; import org.junit.Test; @@ -81,12 +82,7 @@ public class SvnLocalChangesAndRootsTest extends Svn16TestCase { } private void sleep100() { - try { - Thread.sleep(100); - } - catch (InterruptedException e) { - // - } + TimeoutUtil.sleep(100); } } @@ -216,11 +212,6 @@ public class SvnLocalChangesAndRootsTest extends Svn16TestCase { } private void sleep100() { - try { - Thread.sleep(100); - } - catch (InterruptedException e) { - // - } + TimeoutUtil.sleep(100); } } diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnNativeListsTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnNativeListsTest.java index fd1f7d483829..98c0916f47cf 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnNativeListsTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnNativeListsTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,6 +20,7 @@ import com.intellij.openapi.vcs.VcsException; import com.intellij.openapi.vcs.VcsTestUtil; import com.intellij.openapi.vcs.changes.*; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.util.TimeoutUtil; import org.jetbrains.idea.svn.SvnChangeProvider; import org.jetbrains.idea.svn.SvnChangelistListener; import org.junit.Test; @@ -232,11 +233,6 @@ public class SvnNativeListsTest extends Svn16TestCase { } private void sleepABit() { - try { - Thread.sleep(50); - } - catch (InterruptedException e) { - // - } + TimeoutUtil.sleep(50); } } diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnRenameTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnRenameTest.java index e09aad24a96d..de801da2b1d6 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnRenameTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnRenameTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,6 +25,7 @@ import com.intellij.openapi.vcs.changes.Change; import com.intellij.openapi.vcs.changes.ChangeListManager; import com.intellij.openapi.vcs.rollback.RollbackProgressListener; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.util.TimeoutUtil; import org.jetbrains.annotations.NonNls; import org.jetbrains.idea.svn.SvnVcs; import org.junit.Assert; @@ -224,12 +225,7 @@ public class SvnRenameTest extends Svn16TestCase { final List exceptions = new ArrayList(); SvnVcs.getInstance(myProject).getRollbackEnvironment().rollbackChanges(changes, exceptions, RollbackProgressListener.EMPTY); - try { - Thread.sleep(300); - } - catch (InterruptedException e) { - // - } + TimeoutUtil.sleep(300); Assert.assertTrue(exceptions.isEmpty()); final File fileA = new File(childPath, "a.txt"); Assert.assertTrue(fileA.getAbsolutePath(), fileA.exists()); diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnRootAboveTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnRootAboveTest.java index 99834173c94f..7df512115b1f 100644 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnRootAboveTest.java +++ b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/SvnRootAboveTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,7 @@ import com.intellij.openapi.vcs.VcsDirectoryMapping; import com.intellij.openapi.vcs.changes.ChangeListManager; import com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.util.TimeoutUtil; import org.jetbrains.idea.svn.SvnVcs; import org.junit.Test; @@ -177,11 +178,6 @@ public class SvnRootAboveTest extends Svn16TestCase { } private void sleep100() { - try { - Thread.sleep(100); - } - catch (InterruptedException e) { - // - } + TimeoutUtil.sleep(100); } } diff --git a/python/src/com/jetbrains/python/console/PydevConsoleRunner.java b/python/src/com/jetbrains/python/console/PydevConsoleRunner.java index c710fd0abf4e..67fbe1a373e0 100644 --- a/python/src/com/jetbrains/python/console/PydevConsoleRunner.java +++ b/python/src/com/jetbrains/python/console/PydevConsoleRunner.java @@ -73,6 +73,7 @@ import com.intellij.testFramework.LightVirtualFile; import com.intellij.util.ArrayUtil; import com.intellij.util.IJSwingUtilities; import com.intellij.util.PathMappingSettings; +import com.intellij.util.TimeoutUtil; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.net.NetUtils; import com.intellij.util.ui.UIUtil; @@ -491,12 +492,7 @@ public class PydevConsoleRunner extends AbstractConsoleRunnerWithHistory