org.eclipse.xtext.ui.editor.hover.IEObjectHoverProvider Java Examples

The following examples show how to use org.eclipse.xtext.ui.editor.hover.IEObjectHoverProvider. 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: XtextInformationProvider.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
@Override
public IInformationControlCreator getInformationPresenterControlCreator() {
	if(contextObject != null && textViewer != null && contextRegion != null){
		IEObjectHoverProvider hoverProvider = serviceProvider.findService(contextObject , IEObjectHoverProvider.class);
		if (hoverProvider!=null){
			IInformationControlCreatorProvider hoverInfo = hoverProvider.getHoverInfo(contextObject, textViewer, contextRegion);
			if(hoverInfo instanceof IInformationControlCreatorProvider2){
				return ((IInformationControlCreatorProvider2)hoverInfo).getInformationPresenterControlCreator();
			}
		}
	}
	return null;
}
 
Example #2
Source File: JavaDebugHoverProvider.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
public IInformationControlCreatorProvider getInformationControlCreatorProvider(ITextViewer textViewer,
		IRegion hoverRegion) {

	if (!IS_JAVA_DEBUG_HOVER_AVAILABLE)
		return null;

	final JavaDebugHover javaDebugHover = injector.getInstance(JavaDebugHover.class);
	final Object hoverInfo = javaDebugHover.getHoverInfo2(textViewer, hoverRegion);
	if (hoverInfo == null)
		return null;

	return new IEObjectHoverProvider.IInformationControlCreatorProvider2() {
		@Override
		public IInformationControlCreator getHoverControlCreator() {
			return javaDebugHover.getHoverControlCreator();
		}

		@Override
		public Object getInfo() {
			return hoverInfo;
		}

		@Override
		public IInformationControlCreator getInformationPresenterControlCreator() {
			return javaDebugHover.getInformationPresenterControlCreator();
		}
	};
}
 
Example #3
Source File: SharedCommonTypesModule.java    From xtext-eclipse with Eclipse Public License 2.0 5 votes vote down vote up
public void configure(Binder binder) {
	binder.bind(IEObjectHoverProvider.class).to(JdtHoverProvider.class);
	binder.bind(IEObjectHoverDocumentationProvider.class).to(JdtHoverDocumentationProvider.class);
	binder.bind(IResourceServiceProvider.class).to(SharedCommonTypesResourceServiceProvider.class);
	binder.bind(IResourceSetProvider.class).to(XtextResourceSetProvider.class);
	binder.bindConstant().annotatedWith(Names.named(Constants.FILE_EXTENSIONS)).to("java");

	binder.bind(IQualifiedNameProvider.class).to(JvmIdentifiableQualifiedNameProvider.class);
	binder.bind(ICopyQualifiedNameService.class).to(DefaultCopyQualifiedNameService.class);
	binder.bind(IJvmTypeProvider.Factory.class).to(JdtTypeProviderFactory.class);
	binder.bind(IRenameRefactoringProvider.class).to(DefaultRenameRefactoringProvider.class);
	binder.bind(AbstractRenameProcessor.class).to(JvmMemberRenameProcessor.class);
	binder.bind(IRenameStrategy.Provider.class).to(JvmMemberRenameStrategy.Provider.class);
	binder.bind(RefactoringResourceSetProvider.class).to(JvmRefactoringResourceSetProvider.class);
	binder.bind(String.class).annotatedWith(Names.named(Constants.LANGUAGE_NAME)).toInstance("Java");

	binder.bind(IResourceDescriptions.class).annotatedWith(Names.named(ResourceDescriptionsProvider.LIVE_SCOPE))
			.to(LiveShadowedResourceDescriptions.class);
	binder.bind(IResourceDescriptions.class)
			.annotatedWith(Names.named(ResourceDescriptionsProvider.NAMED_BUILDER_SCOPE))
			.to(CurrentDescriptions.ResourceSetAware.class);
	binder.bind(IResourceDescriptions.class)
			.annotatedWith(Names.named(ResourceDescriptionsProvider.PERSISTED_DESCRIPTIONS))
			.to(IBuilderState.class);

	binder.bind(IWorkspaceRoot.class).toInstance(ResourcesPlugin.getWorkspace().getRoot());
	binder.bind(ITraceForStorageProvider.class).to(TraceForStorageProvider.class);

	binder.bind(IReferenceUpdater.class).to(NullReferenceUpdater.class);
}
 
Example #4
Source File: AbstractHoverTest.java    From dsl-devkit with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Build a directory of node hovers indexed by the {@link EObject}.
 *
 * @param model
 *          the model for which to build the hover map, must not be {@code null}
 */
private void buildHoverMap(final EObject model) {
  // All contained features
  List<EStructuralFeature> features = model.eClass().getEAllStructuralFeatures();
  for (EStructuralFeature feature : features) {
    if (feature instanceof EReference && model.eIsSet(feature)) {
      EList<EObject> children = getFeatureValues(model, feature);
      boolean referenceAdded = false;
      IEObjectHoverProvider hoverProvider = getHoverProvider();
      for (EObject childModelElement : children) {
        if (!childModelElement.eIsProxy()) {
          buildHoverMap(childModelElement);
          Object element = childModelElement.eClass();
          Object hover = hoverProvider.getHoverInfo(childModelElement, null, null).getInfo();
          if (element != null && hover != null) {
            addToHoverMap(element, hover.toString());
            // also add the hover using the reference feature as key
            if (!referenceAdded) {
              addToHoverMap(feature, hover.toString());
              referenceAdded = true;
            }
          }
        }
      }
    }
  }
}
 
Example #5
Source File: N4JSUiModule.java    From n4js with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Bind custom IEObjectHoverProvider.
 */
public Class<? extends IEObjectHoverProvider> bindIEObjectHoverProvider() {
	return N4JSHoverProvider.class;
}
 
Example #6
Source File: DefaultXbaseUiModule.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IEObjectHoverProvider> bindIEObjectHoverProvider() {
	return XbaseHoverProvider.class;
}
 
Example #7
Source File: DotHtmlLabelUiModule.java    From gef with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IEObjectHoverProvider> bindIEObjectHoverProvider() {
	return DotHtmlLabelSubgrammarHoverProvider.class;
}
 
Example #8
Source File: DotUiModule.java    From gef with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IEObjectHoverProvider> bindIEObjectHoverProvider() {
	return DotHoverProvider.class;
}
 
Example #9
Source File: XtendUiModule.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public Class<? extends IEObjectHoverProvider> bindIEObjectHoverProvider() {
	return XtendHoverProvider.class;
}
 
Example #10
Source File: GamlUiModule.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
public Class<? extends IEObjectHoverProvider> bindIEObjectHoverProvider() {
	return GamlHoverProvider.class;
}
 
Example #11
Source File: YangUiModule.java    From yang-design-studio with Eclipse Public License 1.0 4 votes vote down vote up
public Class<? extends IEObjectHoverProvider> bindIEObjectHoverProvider() {
    return yangHoverProvider.class;
}
 
Example #12
Source File: AbstractSARLUiModule.java    From sarl with Apache License 2.0 4 votes vote down vote up
public Class<? extends IEObjectHoverProvider> bindIEObjectHoverProvider() {
	return SARLHoverProvider.class;
}
 
Example #13
Source File: AbstractHoverTest.java    From dsl-devkit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Returns {@link IEObjectHoverProvider} for hover functionality of the editor.
 *
 * @return the {@link IEObjectHoverProvider} class for hover functionality, never {@code null}
 */
protected IEObjectHoverProvider getHoverProvider() {
  return getXtextTestUtil().get(IEObjectHoverProvider.class);
}