org.eclipse.xtext.ui.editor.GlobalURIEditorOpener Java Examples

The following examples show how to use org.eclipse.xtext.ui.editor.GlobalURIEditorOpener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AbstractXtextTestUtil.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #2
Source File: AbstractXtextUiTest.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * 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;
}
 
Example #3
Source File: AbstractDomainmodelUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends GlobalURIEditorOpener> bindGlobalURIEditorOpener() {
	return GlobalDerivedMemberAwareURIEditorOpener.class;
}
 
Example #4
Source File: AbstractRuleEngineUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends GlobalURIEditorOpener> bindGlobalURIEditorOpener() {
	return GlobalDerivedMemberAwareURIEditorOpener.class;
}
 
Example #5
Source File: AbstractPureXbaseUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends GlobalURIEditorOpener> bindGlobalURIEditorOpener() {
	return GlobalDerivedMemberAwareURIEditorOpener.class;
}
 
Example #6
Source File: AbstractBug462047LangUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends GlobalURIEditorOpener> bindGlobalURIEditorOpener() {
	return GlobalDerivedMemberAwareURIEditorOpener.class;
}
 
Example #7
Source File: AbstractXImportSectionTestLangUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends GlobalURIEditorOpener> bindGlobalURIEditorOpener() {
	return GlobalDerivedMemberAwareURIEditorOpener.class;
}
 
Example #8
Source File: AbstractContentAssistFragmentTestLangUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends GlobalURIEditorOpener> bindGlobalURIEditorOpener() {
	return GlobalDerivedMemberAwareURIEditorOpener.class;
}
 
Example #9
Source File: AbstractXtendUiModule.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends GlobalURIEditorOpener> bindGlobalURIEditorOpener() {
	return GlobalDerivedMemberAwareURIEditorOpener.class;
}
 
Example #10
Source File: OverrideIndicatorRulerAction.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@Inject
public void setUriEditorOpener(GlobalURIEditorOpener uriEditorOpener) {
	this.uriEditorOpener = uriEditorOpener;
}
 
Example #11
Source File: AbstractSARLUiModule.java    From sarl with Apache License 2.0 4 votes vote down vote up
public Class<? extends GlobalURIEditorOpener> bindGlobalURIEditorOpener() {
	return GlobalDerivedMemberAwareURIEditorOpener.class;
}