Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Link;
Expand Down Expand Up @@ -80,7 +81,13 @@ public void testEnabledWhenHover(TestInfo info) throws Exception {
assertNotNull(findControl(shell, StyledText.class, AlrightyHoverProvider.LABEL));
assertNull(findControl(shell, StyledText.class, WorldHoverProvider.LABEL));

// Capture the first shell and its display to wait for disposal
Shell firstShell = shell;
Display display = firstShell.getDisplay();
cleanFileAndEditor();
// Wait for the hover shell to be disposed after editor cleanup
DisplayHelper.waitForCondition(display, 3000, () -> firstShell.isDisposed());

EnabledPropertyTester.setEnabled(false);
createAndOpenFile("enabledWhen.txt", "bar 'bar'");
shell= getHoverShell(info, triggerCompletionAndRetrieveInformationControlManager(), true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import java.nio.charset.StandardCharsets;
import java.util.HashSet;
import java.util.Set;
import java.util.concurrent.atomic.AtomicBoolean;

import org.eclipse.core.internal.registry.ExtensionRegistry;
import org.eclipse.core.runtime.ContributorFactoryOSGi;
Expand Down Expand Up @@ -412,14 +413,15 @@ public void testDynamicRegistry() throws NotDefinedException {
assertFalse(category.isDefined());
// set to true when the activity/category in question have had an event
// fired
final boolean[] registryChanged = new boolean[] { false, false };
final AtomicBoolean activityChanged = new AtomicBoolean(false);
final AtomicBoolean categoryChanged = new AtomicBoolean(false);
activity.addActivityListener(activityEvent -> {
System.err.println("activityChanged");
registryChanged[0] = true;
activityChanged.set(true);
});
category.addCategoryListener(categoryEvent -> {
System.err.println("categoryChanged");
registryChanged[1] = true;
categoryChanged.set(true);

});

Expand All @@ -442,10 +444,10 @@ public void testDynamicRegistry() throws NotDefinedException {
// spin the event loop and ensure that the changes come down the pipe.
// 20 seconds should be more than enough
DisplayHelper.waitForCondition(PlatformUI.getWorkbench().getDisplay(), 20000,
() -> registryChanged[0] && registryChanged[1]);
() -> activityChanged.get() && categoryChanged.get());

assertTrue("Activity Listener not called", registryChanged[0]);
assertTrue("Category Listener not called", registryChanged[1]);
assertTrue("Activity Listener not called", activityChanged.get());
assertTrue("Category Listener not called", categoryChanged.get());

assertTrue(activity.isDefined());
Set<IActivityPatternBinding> patternBindings = activity.getActivityPatternBindings();
Expand Down
Loading