Search in sources :

Example 6 with DisplayHelper

use of org.eclipse.jface.text.tests.util.DisplayHelper in project eclipse.platform.text by eclipse.

the class HoverTest method getHoverShell.

private Shell getHoverShell(AbstractInformationControlManager manager) {
    AbstractInformationControl[] control = { null };
    new DisplayHelper() {

        @Override
        protected boolean condition() {
            control[0] = (AbstractInformationControl) new Accessor(manager, AbstractInformationControlManager.class).get("fInformationControl");
            return control[0] != null;
        }
    }.waitForCondition(this.editor.getSite().getShell().getDisplay(), 5000);
    if (control[0] == null) {
        ScreenshotTest.takeScreenshot(getClass(), testName.getMethodName(), System.out);
        fail();
    }
    Shell shell = (Shell) new Accessor(control[0], AbstractInformationControl.class).get("fShell");
    new DisplayHelper() {

        @Override
        protected boolean condition() {
            return shell.isVisible();
        }
    }.waitForCondition(this.editor.getSite().getShell().getDisplay(), 2000);
    assertTrue(shell.isVisible());
    return shell;
}
Also used : Shell(org.eclipse.swt.widgets.Shell) AbstractInformationControl(org.eclipse.jface.text.AbstractInformationControl) DisplayHelper(org.eclipse.jface.text.tests.util.DisplayHelper) Accessor(org.eclipse.text.tests.Accessor)

Aggregations

DisplayHelper (org.eclipse.jface.text.tests.util.DisplayHelper)6 Shell (org.eclipse.swt.widgets.Shell)3 AbstractInformationControl (org.eclipse.jface.text.AbstractInformationControl)2 AbstractInformationControlManager (org.eclipse.jface.text.AbstractInformationControlManager)2 StyledText (org.eclipse.swt.custom.StyledText)2 Event (org.eclipse.swt.widgets.Event)2 TableItem (org.eclipse.swt.widgets.TableItem)2 Accessor (org.eclipse.text.tests.Accessor)2 Test (org.junit.Test)2 Map (java.util.Map)1 IMarker (org.eclipse.core.resources.IMarker)1 BadLocationException (org.eclipse.jface.text.BadLocationException)1 IDocument (org.eclipse.jface.text.IDocument)1 ITextViewer (org.eclipse.jface.text.ITextViewer)1 ICompletionProposal (org.eclipse.jface.text.contentassist.ICompletionProposal)1 Control (org.eclipse.swt.widgets.Control)1 Label (org.eclipse.swt.widgets.Label)1 Link (org.eclipse.swt.widgets.Link)1 Table (org.eclipse.swt.widgets.Table)1 ContentAssistAction (org.eclipse.ui.texteditor.ContentAssistAction)1