public final class NbGradleProject extends Object
Modifier and Type | Class and Description |
---|---|
static class |
NbGradleProject.LoadOptions
Describes options for loading a Gradle project.
|
static class |
NbGradleProject.Quality
As loading a Gradle project information into the memory could be a time
consuming task each the Gradle Plugin uses heuristics and offline
evaluation of a project in order to provide optimal responsiveness.
|
Modifier and Type | Field and Description |
---|---|
static String |
CODENAME_BASE |
static String |
GRADLE_PLUGIN_TYPE |
static String |
GRADLE_PROJECT_TYPE |
static String |
PROP_PROJECT_INFO
This property is fired to change on every project reload.
|
static String |
PROP_RESOURCES
This property is fired when a project watched resource is changed.
|
Modifier and Type | Method and Description |
---|---|
static void |
addPropertyChangeListener(Project project,
PropertyChangeListener l)
Convenient method to add a Property Listener to a Gradle project.
|
void |
addPropertyChangeListener(PropertyChangeListener propertyChangeListener) |
Lookup |
curretLookup()
Provides full lookup of the currently loaded project state.
|
static void |
fireGradleProjectReload(Project prj) |
static NbGradleProject |
get(Project project)
Retrieves the watcher for the given project.
|
NbGradleProject.Quality |
getAimedQuality()
The requested information on this project.
|
long |
getEvaluateTime()
Returns the time the project was evaluated.
|
GradleFiles |
getGradleFiles()
Returns accessor for Gradle project files.
|
static ImageIcon |
getIcon() |
Preferences |
getPreferences(boolean shared) |
static Preferences |
getPreferences(Project project,
boolean shared) |
NbGradleProject.Quality |
getQuality()
Return the actual Quality information on the currently loaded Project.
|
static Icon |
getWarningIcon() |
boolean |
isGradleProjectLoaded() |
boolean |
isUnloadable()
The project is unloadable if it's actual quality is worse than
NbGradleProject.Quality.SIMPLE . |
static NbGradleProject.LoadOptions |
loadOptions(NbGradleProject.Quality aim)
Creates a
NbGradleProject.LoadOptions object to be used with NbGradleProject.toQuality(org.netbeans.modules.gradle.api.NbGradleProject.LoadOptions) . |
<T> T |
projectLookup(Class<T> clazz) |
Lookup |
refreshableProjectLookup()
Returns a Lookup that tracks potential project reloads.
|
static void |
removePropertyChangeListener(Project project,
PropertyChangeListener l)
Convenient method to remove a Property Listener from a Gradle project.
|
void |
removePropertyChangeListener(PropertyChangeListener propertyChangeListener) |
CompletionStage<NbGradleProject> |
toQuality(NbGradleProject.LoadOptions options)
Unlike
NbGradleProject.toQuality(java.lang.String, org.netbeans.modules.gradle.api.NbGradleProject.Quality, boolean) , this method loads the project, if the project files have changed since the last load. |
CompletionStage<NbGradleProject> |
toQuality(String reason,
NbGradleProject.Quality q,
boolean forceLoad)
Attempts to refresh the project to at least the desired quality.
|
String |
toString() |
public static final String GRADLE_PROJECT_TYPE
public static final String GRADLE_PLUGIN_TYPE
public static final String PROP_PROJECT_INFO
public static final String PROP_RESOURCES
public static final String CODENAME_BASE
public boolean isGradleProjectLoaded()
public Lookup curretLookup()
NbGradleProject.PROP_PROJECT_INFO
property change and obtain a fresh lookup.public <T> T projectLookup(Class<T> clazz)
public Lookup refreshableProjectLookup()
Use this Lookup in preference to NbGradleProject.projectLookup(java.lang.Class<T>)
, if you need to adapt for changes
e.g. after script reload.
public NbGradleProject.Quality getQuality()
public NbGradleProject.Quality getAimedQuality()
public boolean isUnloadable()
NbGradleProject.Quality.SIMPLE
.public long getEvaluateTime()
@NonNull public CompletionStage<NbGradleProject> toQuality(@NullAllowed String reason, @NonNull NbGradleProject.Quality q, boolean forceLoad)
NbGradleProject.Quality
than q
.
If forceLoad
is true, the project reloads even if the q
is worse quality than
the current NbGradleProject.getQuality()
level. Reason for the reload may be specified: if the reload
takes some time (i.e. executing Gradle build), the IDE may use the reason
text to annotate
the ongoing progress.
The returned CompletionStage
may complete in this thread, or asynchronously in an unspecified thread.
Note that the loading may fail, so the returned Quality may be less than requested. For example
if the project is not trusted, its Gradle build will not be executed, so the returned quality can be NbGradleProject.Quality.EVALUATED
.
reason
- reason for reload, may be null
.q
- the desired quality of project informationforceLoad
- force load even though the current info quality is sufficient.CompletionStage
with the reloaded project. Use CompletionStage.toCompletableFuture()
.get()
to block waiting for the result.public static NbGradleProject.LoadOptions loadOptions(NbGradleProject.Quality aim)
NbGradleProject.LoadOptions
object to be used with NbGradleProject.toQuality(org.netbeans.modules.gradle.api.NbGradleProject.LoadOptions)
.aim
- the target quality@NonNull public CompletionStage<NbGradleProject> toQuality(NbGradleProject.LoadOptions options)
NbGradleProject.toQuality(java.lang.String, org.netbeans.modules.gradle.api.NbGradleProject.Quality, boolean)
, this method loads the project, if the project files have changed since the last load. If project definition
files did not change,options
- load options and requiremens.public Preferences getPreferences(boolean shared)
public void addPropertyChangeListener(PropertyChangeListener propertyChangeListener)
public void removePropertyChangeListener(PropertyChangeListener propertyChangeListener)
public static NbGradleProject get(Project project)
project
- the project to querynull
if the given project
is not a Gradle project.public GradleFiles getGradleFiles()
GradleFiles
instance, but this method
may return a new instance.public static ImageIcon getIcon()
public static final Icon getWarningIcon()
public static void addPropertyChangeListener(Project project, PropertyChangeListener l)
project
- l
- public static void removePropertyChangeListener(Project project, PropertyChangeListener l)
project
- l
- public static void fireGradleProjectReload(Project prj)
public static Preferences getPreferences(Project project, boolean shared)