neilcsmith-net commented on code in PR #9736: URL: https://github.com/apache/netbeans/pull/9736#discussion_r4389237193
########## ide/generic.project/src/org/netbeans/modules/generic/project/GpAuxiliaryProperties.java: ########## @@ -0,0 +1,242 @@ +/* + * 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.modules.generic.project; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.util.ArrayList; +import java.util.List; +import java.util.Properties; +import java.util.logging.Level; +import java.util.logging.Logger; +import org.netbeans.spi.project.AuxiliaryProperties; +import org.openide.filesystems.FileObject; +import org.openide.filesystems.FileUtil; +import org.openide.util.NbBundle.Messages; + +/** + * The {@link AuxiliaryProperties} of a generic project, stored in a + * single {@link Properties} file per project (name brandable via the + * module bundle, defaults to {@code .nbgp}). + * + * <p>The file's location depends on the project's nature: for a + * project with the marker file the marker + * ({@link GenericProject#MARKER_FILE}) <em>is</em> the data file, so + * the data is versioned along with the project; for a local + * (marker-less) project it lives in the user configuration + * (see {@link #dataFolder}), so that nothing auxiliary is written + * into the working tree. Shared and private settings are + * distinguished by a {@code shared} / {@code private} key prefix. + * + * <p>The location is re-evaluated on every access: if the marker + * file is created or deleted while the project is open, the data is + * moved to the new location on the next access (the file at the old + * one is removed); if it is deleted while no instance of the project + * is open, the data is lost with it. + */ +final class GpAuxiliaryProperties implements AuxiliaryProperties { Review Comment: > > And non-shared properties should remain non-shared. > > Not completely sure If I understand the request but if this is about trying to merge IDE settings with project settings I don't think it is at all useful. No, it's not. I'm saying if any module has configured something via [ProjectUtils::getPreferences](https://bits.netbeans.org/32/javadoc/org-netbeans-modules-projectapi/org/netbeans/api/project/ProjectUtils.html#getPreferences(org.netbeans.api.project.Project,java.lang.Class,boolean)) with `shared == false`, then those settings should never end up in a marker/config file designed for sharing. This is about settings from other modules. Internal preferences from the generic project itself (such as display name) can be moved from userdir to the shareable file safely because the module can choose to do so. So, always having two property files might be the better approach. The private one always in the userdir, the shared one either in the userdir or in the marker file. Notwithstanding I agree with you on the merged state / custom hints, stuff. -- 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
