diff --git a/platform/vcs-api/src/com/intellij/openapi/vcs/changes/EnsureUpToDateFromNonAWTThread.java b/platform/vcs-api/src/com/intellij/openapi/vcs/changes/EnsureUpToDateFromNonAWTThread.java deleted file mode 100644 index 96240b0e9584..000000000000 --- a/platform/vcs-api/src/com/intellij/openapi/vcs/changes/EnsureUpToDateFromNonAWTThread.java +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright 2000-2009 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.openapi.vcs.changes; - -import com.intellij.diagnostic.ThreadDumper; -import com.intellij.openapi.application.ApplicationManager; -import com.intellij.openapi.project.Project; -import com.intellij.util.concurrency.Semaphore; -import org.jetbrains.annotations.TestOnly; - -/** - * for non-AWT threads, synchronously waits for completion of ChanegListManager update - */ -@TestOnly -public class EnsureUpToDateFromNonAWTThread { - private final Project myProject; - private volatile boolean myDone; - - public EnsureUpToDateFromNonAWTThread(final Project project) { - myProject = project; - } - - public void execute() { - assert !ApplicationManager.getApplication().isDispatchThread(); - final Semaphore lock = new Semaphore(); - - lock.down(); - - ChangeListManager.getInstance(myProject).invokeAfterUpdate(new Runnable() { - public void run() { - myDone = true; - lock.up(); - } - }, InvokeAfterUpdateMode.SILENT, null, null); - - if (myProject.isDisposed()) return; - - if (!lock.waitFor(100 * 1000) && !myProject.isDisposed()) { - //noinspection UseOfSystemOutOrSystemErr - System.out.println(ThreadDumper.dumpThreadsToString()); - throw new AssertionError("Couldn't wait for changes update"); - } - } - - public boolean isDone() { - return myDone; - } -} diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java index df48ba1c74d5..528263c9038d 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/ChangeListManagerImpl.java @@ -1722,11 +1722,9 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec return true; } myVfsListener.flushDirt(); - final EnsureUpToDateFromNonAWTThread worker = new EnsureUpToDateFromNonAWTThread(myProject); - worker.execute(); myUpdater.waitUntilRefreshed(); waitUpdateAlarm(); - return worker.isDone(); + return true; } @Override diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/VcsWaitForUpdateForTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn/VcsWaitForUpdateForTest.java deleted file mode 100644 index 7c95d06505f4..000000000000 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn/VcsWaitForUpdateForTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2000-2015 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.util.Ref; -import com.intellij.openapi.vcs.VcsConfiguration; -import com.intellij.openapi.vcs.changes.EnsureUpToDateFromNonAWTThread; -import com.intellij.openapi.vfs.VirtualFile; -import org.junit.Test; - - -public class VcsWaitForUpdateForTest extends Svn17TestCase { - @Test - public void testRefreshes() throws Exception { - enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD); - final VirtualFile file = createFileInCommand("a.txt", "old content"); - final Object lock = new Object(); - - final Ref done = new Ref(); - final Thread thread = new Thread(new Runnable() { - @Override - public void run() { - new EnsureUpToDateFromNonAWTThread(myProject).execute(); - done.set(Boolean.TRUE); - synchronized (lock) { - lock.notifyAll(); - } - } - },"vcs refresh"); - - thread.start(); - synchronized (lock) { - final long start = System.currentTimeMillis(); - final int timeout = 3000; - - while ((System.currentTimeMillis() - start < timeout) && (! Boolean.TRUE.equals(done.get()))) { - try { - lock.wait(timeout); - } - catch (InterruptedException e) { - // - } - } - } - - assert Boolean.TRUE.equals(done.get()); - thread.join(); - } -} diff --git a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/VcsWaitForUpdateForTest.java b/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/VcsWaitForUpdateForTest.java deleted file mode 100644 index f65393ae9133..000000000000 --- a/plugins/svn4idea/testSource/org/jetbrains/idea/svn16/VcsWaitForUpdateForTest.java +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Copyright 2000-2015 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.svn16; - -import com.intellij.openapi.util.Ref; -import com.intellij.openapi.vcs.VcsConfiguration; -import com.intellij.openapi.vcs.changes.EnsureUpToDateFromNonAWTThread; -import com.intellij.openapi.vfs.VirtualFile; -import org.junit.Test; - - -public class VcsWaitForUpdateForTest extends Svn16TestCase { - @Test - public void testRefreshes() throws Exception { - enableSilentOperation(VcsConfiguration.StandardConfirmation.ADD); - final VirtualFile file = createFileInCommand("a.txt", "old content"); - final Object lock = new Object(); - - final Ref done = new Ref(); - final Thread thread = new Thread(new Runnable() { - @Override - public void run() { - new EnsureUpToDateFromNonAWTThread(myProject).execute(); - done.set(Boolean.TRUE); - synchronized (lock) { - lock.notifyAll(); - } - } - },"svn6 refresh"); - - thread.start(); - synchronized (lock) { - final long start = System.currentTimeMillis(); - final int timeout = 3000; - - while ((System.currentTimeMillis() - start < timeout) && (! Boolean.TRUE.equals(done.get()))) { - try { - lock.wait(timeout); - } - catch (InterruptedException e) { - // - } - } - } - - assert Boolean.TRUE.equals(done.get()); - thread.join(); - } -}