use of org.eclipse.jface.text.AbstractInformationControl 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;
}
use of org.eclipse.jface.text.AbstractInformationControl in project eclipse.platform.text by eclipse.
the class CompositeInformationControl method createContent.
@Override
public void createContent(Composite parent) {
// TODO maybe use canReuse or canReplace
this.controls = new LinkedHashMap<>();
GridLayout layout = new GridLayout(1, false);
parent.setLayout(layout);
boolean firstControl = true;
for (Entry<ITextHover, IInformationControlCreator> hoverControlCreator : this.creators.entrySet()) {
IInformationControl informationControl = hoverControlCreator.getValue().createInformationControl(parent.getShell());
if (informationControl instanceof AbstractInformationControl) {
List<Control> children = Arrays.asList(((AbstractInformationControl) informationControl).getShell().getChildren());
children.remove(parent);
if (children.size() == 0) {
continue;
}
for (Control control : children) {
control.setParent(parent);
control.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
}
if (!firstControl) {
((GridData) children.get(0).getLayoutData()).verticalIndent = 15;
}
controls.put(hoverControlCreator.getKey(), informationControl);
firstControl = false;
} else {
GenericEditorPlugin.getDefault().getLog().log(new Status(IStatus.WARNING, GenericEditorPlugin.BUNDLE_ID, // $NON-NLS-1$
"Only text hovers producing an AbstractInformationControl can be aggregated; got a " + informationControl.getClass().getSimpleName()));
informationControl.dispose();
}
}
}
Aggregations