T
- the type of source of the discoverypublic abstract class AbstractDiscoverer<T> extends java.lang.Object implements IDiscoverer<T>
Constructor and Description |
---|
AbstractDiscoverer() |
Modifier and Type | Method and Description |
---|---|
void |
discoverElement(T source,
IProgressMonitor monitor)
Generic method to launch a discovery from a source element.
|
static boolean |
isAFolder(java.lang.Object source)
Utility service for usual isApplicableTo test.
|
static boolean |
isAJavaProject(java.lang.Object source)
Utility service for usual isApplicableTo test.
|
static boolean |
isAnIFileWithExtension(java.lang.Object source,
java.lang.String fileExtension)
Utility service for usual isApplicableTo test.
|
static boolean |
isAProject(java.lang.Object source)
Utility service for usual isApplicableTo test.
|
void |
setRefreshSourceBeforeDiscovery(boolean value) |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
isApplicableTo
@Parameter(name="REFRESH_SOURCE_BEFORE", description="Whether to refresh the source at the beginning of the discovery. Refresh behavior depends on the Discoverer implementation. The standard refresh behavior is to test if the source is an org.eclipse.core.resources.IResource and call its refreshLocal() method.") public void setRefreshSourceBeforeDiscovery(boolean value)
public void discoverElement(T source, IProgressMonitor monitor) throws DiscoveryException
IDiscoverer
Additional discovery parameters values (input or output) should be
managed using fields and methods annotated with a Parameter
annotation. See the class AbstractDiscoverer
as an example.
discoverElement
in interface IDiscoverer<T>
source
- the selected object.monitor
- a progress monitor used to report progress and respond to
cancellation. May be a NullProgressMonitor
if no
monitor is to be used.DiscoveryException
- abnormal discovery process terminationpublic static boolean isAJavaProject(java.lang.Object source)
IJavaProject
or IProject
with java nature.public static boolean isAFolder(java.lang.Object source)
IFolder
public static boolean isAProject(java.lang.Object source)
IProject
.public static boolean isAnIFileWithExtension(java.lang.Object source, java.lang.String fileExtension)
source
- fileExtension
- the file extension to test. May be null
to test
if there is no extension. May be empty to test if a file name
ends with a dot character.true
if the source is an instance of IFile
with the given extension.