public class ContentSetHelper
extends java.lang.Object
Note: Because ContentSetHelper methods can be called off the UI thread, subclasses must not invoke any UI during method processing.
Modifier and Type | Field and Description |
---|---|
protected ApplicationContent |
_applicationContent |
protected ProjectContent |
_projectContent |
Constructor and Description |
---|
ContentSetHelper(java.lang.String key)
Constructs a new
ContentSetHelper . |
Modifier and Type | Method and Description |
---|---|
void |
addApplicationContent(java.net.URL url,
ApplicationContent applicationContent,
boolean includeSubFolders,
ProgressBar progressBar)
Adds the URL to the ApplicationContent.
|
void |
addContent(java.net.URL url,
ProjectContent projectContent,
boolean includeSubFolders,
ProgressBar progressBar)
Adds the URL to the ProjectContent.
|
protected void |
addContentImpl(java.net.URL url,
ContentSet contentSet,
boolean includeSubFolders,
ProgressBar progressBar)
Adds the URL to the content set.
|
boolean |
canAddApplicationContent(java.net.URL url,
ApplicationContent applicationContent)
Determines whether or not the URL can be added to the application.
|
boolean |
canAddContent(java.net.URL url,
ProjectContent projectContent)
Determines whether or not the URL can be added to the project.
|
protected ContentSet |
getApplicationBaseContentSet(ApplicationContent applicationContent)
Gets the top-level content set for this application-level ContentSetHelper.
|
protected ContentSet |
getBaseContentSet(ProjectContent projectContent)
Gets the top-level content set for this ContentSetHelper.
|
protected ContentSet |
newApplicationContentSet()
Creates a new constituent content set
|
protected ContentSet |
newContentSet()
Creates a new constituent content set.
|
void |
removeContent(java.net.URL url,
ProjectContent projectContent)
Removes the URL from the project.
|
protected void |
removeContentImpl(java.net.URL url,
ContentSet contentSet)
Creates an exclude filter to exclude the URL from the content set.
|
boolean |
restoreApplicationContent(java.net.URL url,
ApplicationContent applicationContent)
Restores a URL which has been excluded from the project.
|
boolean |
restoreContent(java.net.URL url,
ProjectContent projectContent)
Restores a URL which has been excluded from the project.
|
protected boolean |
restoreContentImpl(java.net.URL url,
ContentSet contentSet)
Restores a URL which has been excluded from a content set.
|
protected boolean |
unExclude(java.lang.String pattern,
ContentSet contentSet)
Adjusts the filters in the supplied content set to include
the relative path described by
pattern . |
protected ProjectContent _projectContent
protected ApplicationContent _applicationContent
public ContentSetHelper(java.lang.String key)
ContentSetHelper
.key
- the data key for the content set which is modified
by this helperpublic boolean canAddContent(java.net.URL url, ProjectContent projectContent)
true
as long as both the URL and
the ProjectContent objects are non-null.
Note: Subclasses that override this method must not invoke any UI during its processing because it may be called off the event thread.
url
- the url you want to addprojectContent
- the ProjectContent you're adding totrue
if the url can be added to the project,
false
otherwisepublic boolean canAddApplicationContent(java.net.URL url, ApplicationContent applicationContent)
true
as long as both the URL and
the ApplicationContent objects are non-null.
Note: Subclasses that override this method must not invoke any UI during its processing because it may be called off the event thread.
url
- the url you want to addapplicationContent
- the ApplicationContent you're adding totrue
if the url can be added to the application,
false
otherwisepublic final void addContent(java.net.URL url, ProjectContent projectContent, boolean includeSubFolders, ProgressBar progressBar)
url
- a file or folder URLprojectContent
- the target ProjectContent objectincludeSubFolders
- indicates whether or not subfolders are
added (ignored if the supplied URL is not a directory)progressBar
- when non-null, use the supplied progressBar
to show progress during a long-running
process. If progressBar
is null, this method is being
called off the event thread, so no UI should be shown.public final void addApplicationContent(java.net.URL url, ApplicationContent applicationContent, boolean includeSubFolders, ProgressBar progressBar)
url
- a file or folder URLapplicationContent
- the target ApplicationContent objectincludeSubFolders
- indicates whether or not subfolders are
added (ignored if the supplied URL is not a directory)progressBar
- when non-null, use the supplied progressBar
to show progress during a long-running
process. If progressBar
is null, this method is being
called off the event thread, so no UI should be shown.protected void addContentImpl(java.net.URL url, ContentSet contentSet, boolean includeSubFolders, ProgressBar progressBar)
Note: Subclasses that override this method must not invoke any UI during its processing because it may be called off the event thread.
url
- a file or folder URLcontentSet
- the target content setincludeSubFolders
- indicates whether or not subfolders are added
(ignored if the supplied url is a file)progressBar
- when non-null, the supplied progressBar
can be used to show progress during a long-running process. If
progressBar
is null, this method is being called off the
event thread, so no UI should be shown.public final boolean restoreContent(java.net.URL url, ProjectContent projectContent)
false
.url
- the URL to "unexclude" from the content setprojectContent
- the target projecttrue
if the URL was "unexcluded"
from this content set. If the ContentSet
cannot
contain this URL, false
is returned.#addContent(URL, ProjectContent, boolean, IndeterminateProgressMonitor)
public final boolean restoreApplicationContent(java.net.URL url, ApplicationContent applicationContent)
false
.url
- the URL to "unexclude" from the content setprojectContent
- the target projecttrue
if the URL was "unexcluded"
from this content set. If the ContentSet
cannot
contain this URL, false
is returned.#addContent(URL, ProjectContent, boolean, IndeterminateProgressMonitor)
protected boolean restoreContentImpl(java.net.URL url, ContentSet contentSet)
false
if contentSet
cannot contain
the supplied URL.
Note: Subclasses that override this method must not invoke any UI during its processing because it may be called off the event thread.
url
- the URL to "unexclude" from the content setcontentSet
- the content set to updatetrue
if the URL was "unexcluded"
from this content set. If the ContentSet
cannot
contain this URL, false
is returned.protected final boolean unExclude(java.lang.String pattern, ContentSet contentSet)
pattern
.pattern
- a path relative to the content set's URLPathcontentSet
- the content set to updatetrue
if the filters were modified to
include the content, false
if the filters were
not modifiedpublic final void removeContent(java.net.URL url, ProjectContent projectContent)
url
- the URL to removeprojectContent
- the target ProjectContent objectprotected void removeContentImpl(java.net.URL url, ContentSet contentSet)
Note: Subclasses that override this method must not invoke any UI during its processing because it may be called off the event thread.
url
- the URL to excludecontentSet
- the target projectprotected final ContentSet newContentSet()
protected final ContentSet newApplicationContentSet()
protected final ContentSet getBaseContentSet(ProjectContent projectContent)
protected final ContentSet getApplicationBaseContentSet(ApplicationContent applicationContent)