sdedic commented on code in PR #4495:
URL: https://github.com/apache/netbeans/pull/4495#discussion_r948044818


##########
ide/projectapi/src/org/netbeans/api/project/ProjectActionContext.java:
##########
@@ -0,0 +1,402 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.api.project;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import org.netbeans.api.annotations.common.CheckForNull;
+import org.netbeans.api.annotations.common.NonNull;
+import org.netbeans.api.project.Project;
+import org.netbeans.spi.project.ProjectConfiguration;
+import org.openide.util.Lookup;
+import org.openide.util.lookup.Lookups;
+import org.openide.util.lookup.ProxyLookup;
+
+/**
+ * This represents context for a project model query. The context describe a 
project action
+ * for which the query should be evaluated, project configuration (if not the 
active one), 
+ * and possible custom overrides.
+ * {@link ProjectConfiguration} or the IDE-supported project action and the 
associated properties, profiles, or Lookup may
+ * affect behaviour of queries across the IDE.
+ * <p>
+ * Properties map to user-settable properties of the build system, such as 
system properties in Maven
+ * or project properties in Gradle.
+ * <p>
+ * Profiles map to profiles in Maven, but do not have any effect in Gradle at 
the moment; this might change.
+ * <p>
+ * Instances of {@link ProjectActionContext} may be passed to some queries as 
(part of the) parameters explicitly. In case
+ * the API does not support such flexibility directly, the implementation(s) 
may - the context may be published for the
+ * query computation using {@link #apply}; the implementation may then use 
{@link #find} to obtain a {@link ProjectActionContext}
+ * effective for that project.
+ * <p>
+ * <b>Important note:</b> Not all project queries support {@link 
ProjectActionContext}. Queries which do should mention that
+ * fact in their documentation, or expose it in their APIs.
+ * 
+ * @author sdedic
+ * @since 1.89
+ */
+public final class ProjectActionContext {
+    private final Project project;
+
+    ProjectActionContext(Project project) {
+        this.project = project;
+    }
+   
+    /**
+     * The project action.
+     */
+    private String projectAction;
+    
+    /**
+     * The desired project configuration
+     */
+    private ProjectConfiguration configuration;
+    private Map<String, String> properties;
+    private Set<String> profiles;
+    private Lookup lookup;
+
+    /**
+     * Returns the project this context applies to. Having {@link Project} as 
a property allows multiple
+     * contexts, individually for each project, to be active.
+     * @return the target project.
+     */
+    public @NonNull Project getProject() {
+        return project;
+    }
+
+    /**
+     * Additional information for the underlying project implementation, 
similar to 
+     * context lookup in {@link 
org.netbeans.spi.project.ActionProvider#invokeAction}.
+     * Null if no specific info is present.
+     * 
+     * @return Lookup with additional information or {@code null}.
+     */
+    public @CheckForNull Lookup getLookup() {
+        return lookup;
+    }
+
+    /**
+     * The project action in whose context the project queries are performed. 
May be
+     * left unspecified, so the implementation can choose an appropriate 
default behaviour.
+     * 
+     * @return project aciton or {@code null} for unspecified.
+     */
+    public @CheckForNull String getProjectAction() {
+        return projectAction;
+    }
+
+    /**
+     * The project configuration to use for the project query. Can be {@code 
null} to 
+     * indicate the project's default Configuration should be used.
+     * 
+     * @return the project's configuration or {@code null}.
+     */
+    public @CheckForNull ProjectConfiguration getConfiguration() {
+        return configuration;
+    }
+    
+    /**
+     * User-customized properties that should be effective during the 
computation. The same
+     * customization should be made during project action execution to obtain 
the same results as 
+     * evaluated by the query.
+     * 
+     * @return user properties, or {@code null} if unspecified.
+     */
+    public @CheckForNull Map<String, String> getProperties() {
+        return properties == null ? null : 
Collections.unmodifiableMap(properties);
+    }
+
+    /**
+     * Profiles or some project system features/tags that should be applied 
for the evaluation.
+     * @return applied profiles or {@code null} if unspecified.
+     */
+    public @CheckForNull Set<String> getProfiles() {
+        return profiles == null ? null : Collections.unmodifiableSet(profiles);

Review Comment:
   Addressed in a1c2f1b8c6b2



##########
ide/projectapi/src/org/netbeans/api/project/ProjectActionContext.java:
##########
@@ -0,0 +1,402 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.api.project;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import org.netbeans.api.annotations.common.CheckForNull;
+import org.netbeans.api.annotations.common.NonNull;
+import org.netbeans.api.project.Project;
+import org.netbeans.spi.project.ProjectConfiguration;
+import org.openide.util.Lookup;
+import org.openide.util.lookup.Lookups;
+import org.openide.util.lookup.ProxyLookup;
+
+/**
+ * This represents context for a project model query. The context describe a 
project action
+ * for which the query should be evaluated, project configuration (if not the 
active one), 
+ * and possible custom overrides.
+ * {@link ProjectConfiguration} or the IDE-supported project action and the 
associated properties, profiles, or Lookup may
+ * affect behaviour of queries across the IDE.
+ * <p>
+ * Properties map to user-settable properties of the build system, such as 
system properties in Maven
+ * or project properties in Gradle.
+ * <p>
+ * Profiles map to profiles in Maven, but do not have any effect in Gradle at 
the moment; this might change.
+ * <p>
+ * Instances of {@link ProjectActionContext} may be passed to some queries as 
(part of the) parameters explicitly. In case
+ * the API does not support such flexibility directly, the implementation(s) 
may - the context may be published for the
+ * query computation using {@link #apply}; the implementation may then use 
{@link #find} to obtain a {@link ProjectActionContext}
+ * effective for that project.
+ * <p>
+ * <b>Important note:</b> Not all project queries support {@link 
ProjectActionContext}. Queries which do should mention that
+ * fact in their documentation, or expose it in their APIs.
+ * 
+ * @author sdedic
+ * @since 1.89
+ */
+public final class ProjectActionContext {
+    private final Project project;
+
+    ProjectActionContext(Project project) {
+        this.project = project;
+    }
+   
+    /**
+     * The project action.
+     */
+    private String projectAction;
+    
+    /**
+     * The desired project configuration
+     */
+    private ProjectConfiguration configuration;
+    private Map<String, String> properties;
+    private Set<String> profiles;
+    private Lookup lookup;
+
+    /**
+     * Returns the project this context applies to. Having {@link Project} as 
a property allows multiple
+     * contexts, individually for each project, to be active.
+     * @return the target project.
+     */
+    public @NonNull Project getProject() {
+        return project;
+    }
+
+    /**
+     * Additional information for the underlying project implementation, 
similar to 
+     * context lookup in {@link 
org.netbeans.spi.project.ActionProvider#invokeAction}.
+     * Null if no specific info is present.
+     * 
+     * @return Lookup with additional information or {@code null}.
+     */
+    public @CheckForNull Lookup getLookup() {
+        return lookup;
+    }
+
+    /**
+     * The project action in whose context the project queries are performed. 
May be
+     * left unspecified, so the implementation can choose an appropriate 
default behaviour.
+     * 
+     * @return project aciton or {@code null} for unspecified.
+     */
+    public @CheckForNull String getProjectAction() {
+        return projectAction;
+    }
+
+    /**
+     * The project configuration to use for the project query. Can be {@code 
null} to 
+     * indicate the project's default Configuration should be used.
+     * 
+     * @return the project's configuration or {@code null}.
+     */
+    public @CheckForNull ProjectConfiguration getConfiguration() {
+        return configuration;
+    }
+    
+    /**
+     * User-customized properties that should be effective during the 
computation. The same
+     * customization should be made during project action execution to obtain 
the same results as 
+     * evaluated by the query.
+     * 
+     * @return user properties, or {@code null} if unspecified.
+     */
+    public @CheckForNull Map<String, String> getProperties() {
+        return properties == null ? null : 
Collections.unmodifiableMap(properties);

Review Comment:
   Addressed in a1c2f1b8c6b2



##########
ide/projectapi/src/org/netbeans/api/project/ProjectActionContext.java:
##########
@@ -0,0 +1,402 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.netbeans.api.project;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Objects;
+import java.util.Set;
+import java.util.concurrent.Callable;
+import org.netbeans.api.annotations.common.CheckForNull;
+import org.netbeans.api.annotations.common.NonNull;
+import org.netbeans.api.project.Project;
+import org.netbeans.spi.project.ProjectConfiguration;
+import org.openide.util.Lookup;
+import org.openide.util.lookup.Lookups;
+import org.openide.util.lookup.ProxyLookup;
+
+/**
+ * This represents context for a project model query. The context describe a 
project action
+ * for which the query should be evaluated, project configuration (if not the 
active one), 
+ * and possible custom overrides.
+ * {@link ProjectConfiguration} or the IDE-supported project action and the 
associated properties, profiles, or Lookup may
+ * affect behaviour of queries across the IDE.
+ * <p>
+ * Properties map to user-settable properties of the build system, such as 
system properties in Maven
+ * or project properties in Gradle.
+ * <p>
+ * Profiles map to profiles in Maven, but do not have any effect in Gradle at 
the moment; this might change.
+ * <p>
+ * Instances of {@link ProjectActionContext} may be passed to some queries as 
(part of the) parameters explicitly. In case
+ * the API does not support such flexibility directly, the implementation(s) 
may - the context may be published for the
+ * query computation using {@link #apply}; the implementation may then use 
{@link #find} to obtain a {@link ProjectActionContext}
+ * effective for that project.
+ * <p>
+ * <b>Important note:</b> Not all project queries support {@link 
ProjectActionContext}. Queries which do should mention that
+ * fact in their documentation, or expose it in their APIs.
+ * 
+ * @author sdedic
+ * @since 1.89
+ */
+public final class ProjectActionContext {
+    private final Project project;
+
+    ProjectActionContext(Project project) {
+        this.project = project;
+    }
+   
+    /**
+     * The project action.
+     */
+    private String projectAction;
+    
+    /**
+     * The desired project configuration
+     */
+    private ProjectConfiguration configuration;
+    private Map<String, String> properties;
+    private Set<String> profiles;
+    private Lookup lookup;
+
+    /**
+     * Returns the project this context applies to. Having {@link Project} as 
a property allows multiple
+     * contexts, individually for each project, to be active.
+     * @return the target project.
+     */
+    public @NonNull Project getProject() {
+        return project;
+    }
+
+    /**
+     * Additional information for the underlying project implementation, 
similar to 
+     * context lookup in {@link 
org.netbeans.spi.project.ActionProvider#invokeAction}.
+     * Null if no specific info is present.
+     * 
+     * @return Lookup with additional information or {@code null}.
+     */
+    public @CheckForNull Lookup getLookup() {
+        return lookup;

Review Comment:
   Addressed in a1c2f1b8c6b2



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists

Reply via email to