mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
fix ProjectOpeningTest
GitOrigin-RevId: 75548ee7fd3a7319c2b8d2d7c0dd57a48d202403
This commit is contained in:
committed by
intellij-monorepo-bot
parent
7839d203ef
commit
30cb7b88c7
+16
-7
@@ -294,6 +294,13 @@ public abstract class ExtensionPointImpl<T> implements ExtensionPoint<T>, Iterab
|
||||
assertBeforeProcessing();
|
||||
CHECK_CANCELED.run();
|
||||
|
||||
if (isInReadOnlyMode()) {
|
||||
for (T extension : myExtensionsCache) {
|
||||
consumer.accept(extension, myDescriptor /* doesn't matter for tests */);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
List<ExtensionComponentAdapter> adapters = myAdapters;
|
||||
int size = adapters.size();
|
||||
if (size == 0) {
|
||||
@@ -376,6 +383,7 @@ public abstract class ExtensionPointImpl<T> implements ExtensionPoint<T>, Iterab
|
||||
@NotNull
|
||||
private synchronized T[] processAdapters() {
|
||||
assertBeforeProcessing();
|
||||
assertNotReadOnlyMode();
|
||||
|
||||
long startTime = StartUpMeasurer.getCurrentTime();
|
||||
|
||||
@@ -473,7 +481,6 @@ public abstract class ExtensionPointImpl<T> implements ExtensionPoint<T>, Iterab
|
||||
throw new IllegalStateException("Recursive processAdapters() detected. You must have called 'getExtensions()' from within your extension constructor - don't. " +
|
||||
"Either pass extension via constructor parameter or call getExtensions() later.");
|
||||
}
|
||||
assertNotReadOnlyMode();
|
||||
}
|
||||
|
||||
// used in upsource
|
||||
@@ -529,13 +536,15 @@ public abstract class ExtensionPointImpl<T> implements ExtensionPoint<T>, Iterab
|
||||
myExtensionsCacheAsArray = list.toArray(ArrayUtil.newArray(getExtensionClass(), 0));
|
||||
POINTS_IN_READONLY_MODE.add(this);
|
||||
|
||||
if (oldList != null) {
|
||||
for (T extension : oldList) {
|
||||
notifyListenersOnRemove(extension, null, myListeners);
|
||||
if (myListeners.length > 0) {
|
||||
if (oldList != null) {
|
||||
for (T extension : oldList) {
|
||||
notifyListenersOnRemove(extension, null, myListeners);
|
||||
}
|
||||
}
|
||||
for (T extension : list) {
|
||||
notifyListenersOnAdd(extension, null, myListeners);
|
||||
}
|
||||
}
|
||||
for (T extension : list) {
|
||||
notifyListenersOnAdd(extension, null, myListeners);
|
||||
}
|
||||
|
||||
Disposer.register(parentDisposable, new Disposable() {
|
||||
|
||||
+7
-6
@@ -17,25 +17,26 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
|
||||
import static com.intellij.openapi.startup.StartupActivity.POST_STARTUP_ACTIVITY;
|
||||
import static org.assertj.core.api.AssertionsForClassTypes.assertThat;
|
||||
|
||||
/**
|
||||
* @author Dmitry Avdeev
|
||||
*/
|
||||
public class ProjectOpeningTest extends PlatformTestCase {
|
||||
public void testOpenProjectCancelling() throws Exception {
|
||||
File foo = createTempDir("foo");
|
||||
Project project = null;
|
||||
MyStartupActivity activity = new MyStartupActivity();
|
||||
POST_STARTUP_ACTIVITY.getPoint(null).registerExtension(activity, getTestRootDisposable());
|
||||
|
||||
PlatformTestUtil.maskExtensions(POST_STARTUP_ACTIVITY, Collections.singletonList(activity), getTestRootDisposable());
|
||||
try {
|
||||
ProjectManagerEx manager = ProjectManagerEx.getInstanceEx();
|
||||
File foo = createTempDir("foo");
|
||||
project = manager.createProject(null, foo.getPath());
|
||||
assertFalse(manager.openProject(project));
|
||||
assertFalse(project.isOpen());
|
||||
assertTrue(activity.passed);
|
||||
assertThat(manager.openProject(project)).isFalse();
|
||||
assertThat(project.isOpen()).isFalse();
|
||||
assertThat(activity.passed).isTrue();
|
||||
}
|
||||
finally {
|
||||
closeProject(project);
|
||||
|
||||
Reference in New Issue
Block a user