Interface ProjectConfigurator
public interface ProjectConfigurator
This interface contains a set of methods that allow to configure an existing
or future project, for example to add and configure natures when creating a
new project.
It is typically used as:
- a filter to check whether the current
ProjectConfigurator
can apply - a bean to store user configuration while showing wizard page
Project configurators can be contributed via the
org.eclipse.ui.ide.projectConfigurators
extension point. The
lifecycle of project configurators is not specified, so implementing classes
must be stateless (i.e. their methods cannot keep any state inside or outside
this class). The framework may create multiple instances of those classes for
a single import session, or it may reuse the same instances for multiple
sessions.
- Since:
- 3.12
-
Method Summary
Modifier and TypeMethodDescriptionboolean
canConfigure
(IProject project, Set<IPath> ignoredPaths, IProgressMonitor monitor) Checks whether this configurator can contribute to the configuration of the given project.void
configure
(IProject project, Set<IPath> ignoredPaths, IProgressMonitor monitor) Configures a project.findConfigurableLocations
(File root, IProgressMonitor monitor) From a givenFile
, detects which directories can/should be imported as projects into the workspace and configured by this configurator.getFoldersToIgnore
(IProject project, IProgressMonitor monitor) Returns the folders to exclude from the analysis that happens on anIProject
.default void
removeDirtyDirectories
(Map<File, List<ProjectConfigurator>> proposals) Removes from the set of directories those that should not be proposed to the user for import.boolean
shouldBeAnEclipseProject
(IContainer container, IProgressMonitor monitor) Tells whether this configurator thinks that a givenIContainer
should be also imported as a project into the workspace.
-
Method Details
-
findConfigurableLocations
From a givenFile
, detects which directories can/should be imported as projects into the workspace and configured by this configurator. This first set of directories is then presented to the user as import proposals.This method must be stateless.
- Parameters:
root
- the root directory on which to start the discoverymonitor
- the progress monitor- Returns:
- the children (at any depth) that this configurator suggests to import as project
-
removeDirtyDirectories
Removes from the set of directories those that should not be proposed to the user for import. Those are typically dirty volatile directories such as build output directories.This method must be stateless.
- Parameters:
proposals
- the existing import proposals (key is file and value is the list of configurators that have identified the key as a location they can configure for import). Those can be modified and current method is expected to remove some entries from this map.
-
shouldBeAnEclipseProject
Tells whether this configurator thinks that a givenIContainer
should be also imported as a project into the workspace.This method must be stateless (ideally static) and cannot rely on any class state.
- Parameters:
container
- the container to analyzemonitor
- the progress monitor- Returns:
- true if the given folder is for sure to be considered as a project
-
getFoldersToIgnore
Returns the folders to exclude from the analysis that happens on anIProject
.This method must be stateless.
- Parameters:
project
- the project to check for content to ignoremonitor
- the progress monitor- Returns:
- the set of child folders to ignore in import operation. Typically output directories such as bin/ or target/.
-
canConfigure
Checks whether this configurator can contribute to the configuration of the given project.This method must be stateless.
- Parameters:
project
- the project to check for potential configurationignoredPaths
- paths that have to be ignored when checking whether this configurator applies. Those will typically be nested projects (handled separately), or output directories (bin/, target/, ...).monitor
- the progress monitor- Returns:
true
iff this configurator can configure the given project
-
configure
Configures a project. This method will only be called ifcanConfigure(IProject, Set, IProgressMonitor)
returnedtrue
for the given project.This method must be stateless.
- Parameters:
project
- the project to configureignoredPaths
- paths that have to be ignored when configuring the project. Those will typically be nested projects, output directories (bin/, target/, ...)monitor
- the progress monitor
-