public abstract class ProjectSetCapability extends Object
RepositoryProviderType
Modifier and Type | Field and Description |
---|---|
static String |
SCHEME_SCM
Scheme constant (value "scm") indicating the SCM URI.
|
Constructor and Description |
---|
ProjectSetCapability() |
Modifier and Type | Method and Description |
---|---|
IProject[] |
addToWorkspace(String[] referenceStrings,
ProjectSetSerializationContext context,
IProgressMonitor monitor)
For every String in
referenceStrings , load the corresponding project into the workspace. |
String[] |
asReference(IProject[] providerProjects,
ProjectSetSerializationContext context,
IProgressMonitor monitor)
For every project in providerProjects, return an opaque
UTF-8 encoded String to act as a reference to that project.
|
String |
asReference(URI uri,
String projectName)
Convert the given URI and projectName to a reference string that can be
passed to the
addToWorkspace(String[], ProjectSetSerializationContext, IProgressMonitor)
method. |
protected IProject[] |
confirmOverwrite(ProjectSetSerializationContext context,
IProject[] projects)
Determine if any of the projects already exist
and confirm which of those projects are to be overwritten.
|
static void |
ensureBackwardsCompatible(RepositoryProviderType type,
ProjectSetCapability capability)
Ensure that the provider type is backwards compatible by
passing the project set serializer to the type if a serializer
is registered.
|
String |
getProject(String referenceString)
Return the name of the project that is the target of the given
reference string or
null if this capability does not
support parsing of reference strings. |
URI |
getURI(String referenceString)
Return the URI for the given reference string or
null
if this capability does not support file system schemes as defined by
the org.eclipse.core.filesystem.filesystems extension
point. |
void |
projectSetCreated(File file,
Object context,
IProgressMonitor monitor)
Deprecated.
should use or override
projectSetCreated(File, ProjectSetSerializationContext, IProgressMonitor)
instead
|
void |
projectSetCreated(File file,
ProjectSetSerializationContext context,
IProgressMonitor monitor)
Notify the provider that a project set has been created at path.
|
public static final String SCHEME_SCM
public static void ensureBackwardsCompatible(RepositoryProviderType type, ProjectSetCapability capability)
type
- the provider type instancecapability
- the capability that was obtained from the provider typepublic void projectSetCreated(File file, Object context, IProgressMonitor monitor)
file
- the project set file that was createdcontext
- a UI context object. This object will either be a
com.ibm.swt.widgets.Shell or it will be null.monitor
- a progress monitorpublic void projectSetCreated(File file, ProjectSetSerializationContext context, IProgressMonitor monitor)
file
- the project set file that was createdcontext
- the context in which the references are created
(not null
)monitor
- a progress monitorpublic String[] asReference(IProject[] providerProjects, ProjectSetSerializationContext context, IProgressMonitor monitor) throws TeamException
addToWorkspace(String[], ProjectSetSerializationContext, IProgressMonitor)
will be able to consume it and load the corresponding project.
This default implementation simply throws an exception indicating that no references can be created unless there is an IProjectSetSerializer registered for the repository provider type in which case the operation is delegated to the serializer. Subclasses are expected to override.
providerProjects
- an array of projects for which references are needed
(not null
and contains no null
s)context
- the context in which the references are created
(not null
)monitor
- a progress monitor or null
if nonenull
and contains no null
s)TeamException
- thrown if there is a reference string cannot be created for a projectpublic IProject[] addToWorkspace(String[] referenceStrings, ProjectSetSerializationContext context, IProgressMonitor monitor) throws TeamException
referenceStrings
, load the corresponding project into the workspace.
The opaque strings in referenceStrings
are guaranteed to have been previously
produced by asReference(IProject[], ProjectSetSerializationContext, IProgressMonitor)
.
The confirmOverwrite(ProjectSetSerializationContext, IProject[])
method is called with an array of projects
for which projects of the same name already exists in the workspace.
Callers from within a UI context should wrap a call to this method
inside a WorkspaceModifyOperation
so that events generated as a result
of this operation are deferred until the outermost operation
has successfully completed.
This default implementation simply throws an exception
indicating that no projects can be loaded unless there
is an IProjectSetSerializer
registered for the repository
provider type in which case the operation is delegated to the
serializer.
Subclasses are expected to override.
referenceStrings
- an array of reference strings uniquely identifying the projects
(not null
and contains no null
s)context
- the context in which the projects are loaded
(not null
)monitor
- a progress monitor or null
if nonenull
, contains no null
s)TeamException
- thrown if there is a problem loading a project into the workspace.
If an exception is thrown, then the workspace is left in an unspecified state
where some of the referenced projects may be loaded or partially loaded, and others may not.protected IProject[] confirmOverwrite(ProjectSetSerializationContext context, IProject[] projects) throws TeamException
context
- the context in which the projects are loaded
(not null
)projects
- an array of proposed projects to be loaded
(not null
, contains no null
s)null
if the operation is to be canceled.TeamException
public URI getURI(String referenceString)
null
if this capability does not support file system schemes as defined by
the org.eclipse.core.filesystem.filesystems
extension
point.referenceString
- a reference string obtained from
asReference(IProject[], ProjectSetSerializationContext, IProgressMonitor)
null
getProject(String)
public String getProject(String referenceString)
null
if this capability does not
support parsing of reference strings.referenceString
- reference string obtained from
asReference(IProject[], ProjectSetSerializationContext, IProgressMonitor)
null
getURI(String)
public String asReference(URI uri, String projectName)
addToWorkspace(String[], ProjectSetSerializationContext, IProgressMonitor)
method. The scheme of the provided URI must match the scheme of the
repository provider type from which this capability was obtained.
Since 3.7 SCM URIs are also accepted.
The default implementation returns null
. Subclasses may
override.
uri
- the URI that identifies the location of the project in the
repository.projectName
- the name of the project to use. If null
, use a
project name from the provided SCM URI. If the URI does not
contain the project name the last segment of the URI's path is
used. If this fails, null
is returned.null
, if the URI and name
cannot be translated into a reference stringSCHEME_SCM
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.