org.eclipse.xtext.generator.IOutputConfigurationProvider Java Examples

The following examples show how to use org.eclipse.xtext.generator.IOutputConfigurationProvider. 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: SARLPreferences.java    From sarl with Apache License 2.0 6 votes vote down vote up
/** Replies the SARL output path for test in the global preferences.
 *
 * @return the output path for SARL compiler in the global preferences.
 * @since 0.8
 */
public static IPath getGlobalSARLTestOutputPath() {
	final Injector injector = LangActivator.getInstance().getInjector(LangActivator.IO_SARL_LANG_SARL);
	final IOutputConfigurationProvider configurationProvider =
			injector.getInstance(IOutputConfigurationProvider.class);
	final OutputConfiguration config = Iterables.find(
		configurationProvider.getOutputConfigurations(),
		it -> Objects.equals(it.getName(), SARLConfig.TEST_OUTPUT_CONFIGURATION));
	if (config != null) {
		final String path = config.getOutputDirectory();
		if (!Strings.isNullOrEmpty(path)) {
			final IPath pathObject = Path.fromOSString(path);
			if (pathObject != null) {
				return pathObject;
			}
		}
	}
	throw new IllegalStateException("No global preferences found for SARL."); //$NON-NLS-1$
}
 
Example #2
Source File: SARLPreferences.java    From sarl with Apache License 2.0 6 votes vote down vote up
/** Replies the SARL output path in the global preferences.
 *
 * @return the output path for SARL compiler in the global preferences.
 */
public static IPath getGlobalSARLOutputPath() {
	final Injector injector = LangActivator.getInstance().getInjector(LangActivator.IO_SARL_LANG_SARL);
	final IOutputConfigurationProvider configurationProvider =
			injector.getInstance(IOutputConfigurationProvider.class);
	final OutputConfiguration config = Iterables.find(
		configurationProvider.getOutputConfigurations(),
		it -> Objects.equals(it.getName(), IFileSystemAccess.DEFAULT_OUTPUT));
	if (config != null) {
		final String path = config.getOutputDirectory();
		if (!Strings.isNullOrEmpty(path)) {
			final IPath pathObject = Path.fromOSString(path);
			if (pathObject != null) {
				return pathObject;
			}
		}
	}
	throw new IllegalStateException("No global preferences found for SARL."); //$NON-NLS-1$
}
 
Example #3
Source File: ExtensionPointExtraLanguageContributions.java    From sarl with Apache License 2.0 5 votes vote down vote up
ExtensionPointContribution(IExtraLanguageGeneratorProvider generator, IExtraLanguageValidatorProvider validator,
		IOutputConfigurationProvider configuration, IExtraLanguageKeywordProvider keywords) {
	this.generator = generator;
	this.validator = validator;
	this.configuration = configuration;
	this.keywords = keywords;
}
 
Example #4
Source File: ExtensionPointExtraLanguageContributions.java    From sarl with Apache License 2.0 5 votes vote down vote up
@Override
public Collection<IExtraLanguageContribution> getContributions() {
	if (this.contributions == null) {
		this.contributions = new ArrayList<>();

		final IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint(
				SARLUiConfig.NAMESPACE, SARLUiConfig.EXTENSION_POINT_EXTRA_LANGUAGE_GENERATORS);
		if (extensionPoint != null) {
			for (final IConfigurationElement element : extensionPoint.getConfigurationElements()) {
				try {
					final IExtraLanguageGeneratorProvider generator = getType(
							IExtraLanguageGeneratorProvider.class, element, EXTENSION_POINT_GENERATOR_ATTRIBUTE);
					final IExtraLanguageValidatorProvider validator = getType(
							IExtraLanguageValidatorProvider.class, element, EXTENSION_POINT_VALIDATOR_ATTRIBUTE);
					final IOutputConfigurationProvider configuration = getType(
							IOutputConfigurationProvider.class, element, EXTENSION_POINT_OUTPUT_CONFIGURATION_ATTRIBUTE);
					final IExtraLanguageKeywordProvider keywords = getType(
							IExtraLanguageKeywordProvider.class, element, EXTENSION_POINT_KEYWORDS_ATTRIBUTE);
					this.contributions.add(new ExtensionPointContribution(generator, validator,
							configuration, keywords));
				} catch (CoreException exception) {
					LangActivator.getInstance().getLog().log(new Status(
							IStatus.WARNING,
							LangActivator.getInstance().getBundle().getSymbolicName(),
							exception.getLocalizedMessage(),
							exception));
				}
			}
		}
	}
	return this.contributions;
}
 
Example #5
Source File: LanguageAccess.java    From xtext-extras with Eclipse Public License 2.0 4 votes vote down vote up
public IOutputConfigurationProvider getOutputConfigurationProvider() {
	return resourceServiceProvider.get(IOutputConfigurationProvider.class);
}
 
Example #6
Source File: PyContribution.java    From sarl with Apache License 2.0 4 votes vote down vote up
@Override
public IOutputConfigurationProvider getOutputConfigurationProvider() {
	return this.configuration;
}
 
Example #7
Source File: AbstractSARLRuntimeModule.java    From sarl with Apache License 2.0 4 votes vote down vote up
public Class<? extends IOutputConfigurationProvider> bindIOutputConfigurationProvider() {
	return ContributionBasedOutputConfigurationProvider.class;
}
 
Example #8
Source File: ExtensionPointExtraLanguageContributions.java    From sarl with Apache License 2.0 4 votes vote down vote up
@Override
public IOutputConfigurationProvider getOutputConfigurationProvider() {
	return this.configuration;
}
 
Example #9
Source File: XtendRuntimeModule.java    From xtext-xtend with Eclipse Public License 2.0 4 votes vote down vote up
public Class<? extends IOutputConfigurationProvider> bindIOutputConfigurationProvider() {
	return XtendOutputConfigurationProvider.class;
}
 
Example #10
Source File: BuilderPreferenceAccess.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Inject
public void setOutputConfigurationProvider(IOutputConfigurationProvider outputConfigurationProvider) {
	this.outputConfigurationProvider = outputConfigurationProvider;
}
 
Example #11
Source File: BuilderPreferenceAccess.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
public IOutputConfigurationProvider getOutputConfigurationProvider() {
	return outputConfigurationProvider;
}
 
Example #12
Source File: EclipseOutputConfigurationProvider.java    From xtext-eclipse with Eclipse Public License 2.0 4 votes vote down vote up
@Inject
public EclipseOutputConfigurationProvider(IOutputConfigurationProvider delegate) {
	super(delegate);
}
 
Example #13
Source File: CheckRuntimeModule.java    From dsl-devkit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Binds a custom output configuration provider.
 *
 * @return the check output configuration provider
 */
public Class<? extends IOutputConfigurationProvider> bindIOutputConfigurationProvider() {
  return CheckOutputConfigurationProvider.class;
}
 
Example #14
Source File: ExportRuntimeModule.java    From dsl-devkit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Binds a custom output configuration provider.
 *
 * @return the format output configuration provider
 */
public Class<? extends IOutputConfigurationProvider> bindIOutputConfigurationProvider() {
  return ExportOutputConfigurationProvider.class;
}
 
Example #15
Source File: FormatRuntimeModule.java    From dsl-devkit with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * Binds a custom output configuration provider.
 *
 * @return the format output configuration provider
 */
public Class<? extends IOutputConfigurationProvider> bindIOutputConfigurationProvider() {
  return FormatOutputConfigurationProvider.class;
}
 
Example #16
Source File: IExtraLanguageContribution.java    From sarl with Apache License 2.0 2 votes vote down vote up
/** Replies the provider of an output configuration related to the extra-language generator.
 *
 * @return the provider of an output configuration.
 */
IOutputConfigurationProvider getOutputConfigurationProvider();
 
Example #17
Source File: N4JSUiModule.java    From n4js with Eclipse Public License 1.0 2 votes vote down vote up
/**
 * @return iterates over all registered composite generators to pick up the default output configurations of their
 *         contained sub generators
 */
public Class<? extends IOutputConfigurationProvider> bindIOutputConfigurationProvider() {
	return org.eclipse.n4js.ui.building.N4JSOutputConfigurationProvider.class;
}