/** * Opens an editor for a specific {@link URI}. * * @param uri * to open editor for * @return editor opened */ public XtextEditor openEditor(final URI uri) { XtextEditor editor = UiThreadDispatcher.dispatchAndWait(new Function<XtextEditor>() { @Override public XtextEditor run() { closeWelcomePage(); return (XtextEditor) get(GlobalURIEditorOpener.class).open(uri, false); } }); waitForEditorJobs(editor); return editor; }
/** * Opens an {@link IEditorPart} for a provided {@link org.eclipse.emf.common.util.URI}. * * @param uri * {@link org.eclipse.emf.common.util.URI} to open editor for * @param activate * true if focus is to be set to the opened editor * @return {@link IEditorPart} created */ private IEditorPart openEditor(final org.eclipse.emf.common.util.URI uri, final boolean activate) { UiAssert.isNotUiThread(); final IEditorPart editorPart = UIThreadRunnable.syncExec(getBot().getDisplay(), new Result<IEditorPart>() { @Override public IEditorPart run() { IEditorPart editor = getXtextTestUtil().get(GlobalURIEditorOpener.class).open(uri, activate); editor.setFocus(); return editor; } }); waitForEditorJobs(editorPart); getBot().waitUntil(new DefaultCondition() { @Override public boolean test() { if (editorPart.getEditorSite() != null && editorPart.getEditorInput() != null) { IEditorInput input = editorPart.getEditorInput(); if (input instanceof IFileEditorInput) { return !((IFileEditorInput) input).getFile().isReadOnly(); } } return false; } @Override public String getFailureMessage() { return "Editor must be initialized."; } }, EDITOR_ENABLED_TIMEOUT); return editorPart; }
public static GlobalURIEditorOpener getGlobalURIEditorOpener() { if (globalURIEditorOpener == null) { AgreeActivator activator = AgreeActivator.getInstance(); String language = AgreeActivator.COM_ROCKWELLCOLLINS_ATC_AGREE_AGREE; Injector injector = activator.getInjector(language); globalURIEditorOpener = injector.getInstance(GlobalURIEditorOpener.class); } return globalURIEditorOpener; }
public Class<? extends GlobalURIEditorOpener> bindGlobalURIEditorOpener() { return GlobalDerivedMemberAwareURIEditorOpener.class; }