Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project (re)load API, initial implementation #7651

Merged
merged 1 commit into from
Aug 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions ide/project.dependency/nbproject/project.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
# under the License.

is.autoload=true
javac.source=11
javac.target=11
javac.release=17
javac.compilerargs=-Xlint -Xlint:-serial
spec.version.base=1.10.0
spec.version.base=1.11.0
test-unit-sys-prop.org.netbeans.modules.project.dependency.impl.ProjectReloadInternal.level=400
8 changes: 8 additions & 0 deletions ide/project.dependency/nbproject/project.xml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,14 @@
<specification-version>7.91</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.dialogs</code-name-base>
<build-prerequisite/>
<compile-dependency/>
<run-dependency>
<specification-version>7.72</specification-version>
</run-dependency>
</dependency>
<dependency>
<code-name-base>org.openide.filesystems</code-name-base>
<build-prerequisite/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,15 @@
/**
* The exception is thrown when an error happens during project operation because
* of limited or refused access to the project metadata / structure.
* <p/>
* <p>
* It may wrap underlying build system error, such as maven not able to parse the
* POM.
* @author sdedic
*/
public final class ProjectOperationException extends IllegalStateException {
/**
* An overall status of the operation.
*/
public enum State {
/**
* Unexpected project system error, see the exception cause for details.
Expand Down Expand Up @@ -73,39 +76,77 @@ public enum State {
* @since 1.7
*/
UNSUPPORTED,

/**
* The operation was cancelled. Individual operations throw either CancellationException
* from their Futures, or ProjectOperationException with CANCELLED status.
* @since 1.7
*/
CANCELLED,
}

private final Project project;
private final State state;
private Set<FileObject> files;

/**
* Constructs an exception
* @param project the project
* @param state state
* @param s message
*/
public ProjectOperationException(Project project, State state, String s) {
this(project, state, s, Collections.emptySet());
}

/**
* Constructs an exception reporting a set of files.
* @param project the project
* @param state error state
* @param s message
* @param files files
*/
public ProjectOperationException(Project project, State state, String s, Set<FileObject> files) {
super(s);
this.files = files;
this.project = project;
this.state = state;
}


/**
* Wraps an underlying exception.
* @param project the project
* @param state error state
* @param message message
* @param cause underlying exception
*/
public ProjectOperationException(Project project, State state, String message, Throwable cause) {
super(message, cause);
this.state = state;
this.project = project;
this.files = Collections.emptySet();
}

/**
* @return the project
*/
public Project getProject() {
return project;
}

/**
* State of the operation.
* @return outcome state
*/
public State getState() {
return state;
}

/**
* Returns set of files reported by this exception
* @return set of files.
*/
public Set<FileObject> getFiles() {
return files;
return Collections.unmodifiableSet(files);
}
}
Loading
Loading