Class EclipseConfigurator
- All Implemented Interfaces:
Generator, ResourceProvider
The EclipseConfigurator provides the resource EclipseConfiguration.
"The configuration" consists of the Eclipse configuration files
for a given project. The configurator generates the following
files as W3C DOM documents (for XML files) or as Properties
for a given project:
.project,.classpath,.settings/org.eclipse.core.resources.prefs,.settings/org.eclipse.core.runtime.prefsand.settings/org.eclipse.jdt.core.prefs.
Each generated data structure can be post processed by a corresponding
adapt method before being written to disk. Additional resources can
be generated by the method adaptConfiguration(Runnable).
Eclipse provides project nesting, but the outer project does not define a namespace. This can lead to problems if you have multiple (sub)projects in the workspace with the same name. The configurator allows you to define an alias for the project name to avoid this problem. The alias is used as Eclipse project name in all generated files.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceAllow derived classes to post process the project configuration. -
Field Summary
FieldsFields inherited from class AbstractProvider
log -
Constructor Summary
ConstructorsConstructorDescriptionEclipseConfigurator(Project project) Instantiates a new eclipse configurator. -
Method Summary
Modifier and TypeMethodDescriptionadaptClasspathConfiguration(BiConsumer<Document, Node> adaptor) Allow the user to post process the classpath configuration.adaptConfiguration(Runnable adaptor) Allow the user to add additional resources.adaptJdtCorePrefs(Consumer<Properties> adaptor) Allow the user to adapt the properties for the.settings/org.eclipse.jdt.core.prefsfile.Adapt project configuration.adaptResourcePrefs(Consumer<Properties> adaptor) Allow the user to adapt the properties for the.settings/org.eclipse.core.resources.prefsfile.adaptRuntimePrefs(Consumer<Properties> adaptor) Allow the user to adapt the properties for the.settings/org.eclipse.core.runtime.prefsfile.doProvide(ResourceRequest<T> requested) Provides anEclipseConfiguration.Returns the eclipse alias.eclipseAlias(String eclipseAlias) Define the eclipse (alias) project name.eclipseAlias(Supplier<String> eclipseAlias) Define the eclipse (alias) project name.protected voidGenerates the content of the.classpathfile into the given document.protected voidGenerate the properties for the.settings/org.eclipse.jdt.core.prefsfile.protected voidGenerates the content of the.projectfile into the given document.protected voidGenerate the properties for the.settings/org.eclipse.core.resources.prefsfile.protected voidGenerate the properties for the.settings/org.eclipse.core.runtime.prefsfile.Methods inherited from class AbstractGenerator
cleanup, name, name, newResource, project, toStringMethods inherited from class AbstractProvider
provideMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ResourceProvider
provide
-
Field Details
-
GENERATED_BY
-
-
Constructor Details
-
EclipseConfigurator
Instantiates a new eclipse configurator.- Parameters:
project- the project
-
-
Method Details
-
eclipseAlias
Define the eclipse (alias) project name.- Parameters:
eclipseAlias- the eclipse alias- Returns:
- the eclipse configurator
-
eclipseAlias
Define the eclipse (alias) project name.- Parameters:
eclipseAlias- the eclipse alias- Returns:
- the eclipse configurator
-
eclipseAlias
-
doProvide
Provides anEclipseConfiguration.- Specified by:
doProvidein classAbstractProvider- Type Parameters:
T- the generic type- Parameters:
requested- the requested- Returns:
- the stream
-
generateProjectConfiguration
Generates the content of the.projectfile into the given document.- Parameters:
doc- the document
-
adaptProjectConfiguration
public EclipseConfigurator adaptProjectConfiguration(EclipseConfigurator.ProjectConfigurationAdaptor adaptor) Adapt project configuration.- Parameters:
adaptor- the adaptor- Returns:
- the eclipse configurator
-
generateClasspathConfiguration
Generates the content of the.classpathfile into the given document.- Parameters:
doc- the doc
-
adaptClasspathConfiguration
Allow the user to post process the classpath configuration. The node passed to the consumer is theclasspathelement.- Parameters:
adaptor- the adaptor- Returns:
- the eclipse configurator
-
generateResourcesPrefs
Generate the properties for the.settings/org.eclipse.core.resources.prefsfile. -
adaptResourcePrefs
Allow the user to adapt the properties for the.settings/org.eclipse.core.resources.prefsfile.- Parameters:
adaptor- the adaptor- Returns:
- the eclipse configurator
-
generateRuntimePrefs
Generate the properties for the.settings/org.eclipse.core.runtime.prefsfile. -
adaptRuntimePrefs
Allow the user to adapt the properties for the.settings/org.eclipse.core.runtime.prefsfile.- Parameters:
adaptor- the adaptor- Returns:
- the eclipse configurator
-
generateJdtCorePrefs
Generate the properties for the.settings/org.eclipse.jdt.core.prefsfile. -
adaptJdtCorePrefs
Allow the user to adapt the properties for the.settings/org.eclipse.jdt.core.prefsfile.- Parameters:
adaptor- the adaptor- Returns:
- the eclipse configurator
-
adaptConfiguration
Allow the user to add additional resources.- Parameters:
adaptor- the adaptor- Returns:
- the eclipse configurator
-