eppleton commented on code in PR #9680:
URL: https://github.com/apache/netbeans/pull/9680#discussion_r4216424782
##########
ide/projectui/src/org/netbeans/modules/project/ui/OpenProjectList.java:
##########
@@ -232,7 +210,37 @@ static void preferredProject(final Project lazyP) {
}
public Future<Project[]> openProjectsAPI() {
Review Comment:
This `Future` no longer waits for an `open()`/`close()` that is in progress.
On master `get()` also waited until `entered == 0`, which is what the
`OpenProjects.openProjects()` javadoc promises ("awaits for current
modifications to finish"). `isDone()` still checks `entered`, so it can return
`false` while `get()` returns immediately, and `enteredZeroed` is now signalled
but never awaited.
With a project whose open hook blocks, master's `get(300ms)` throws
`TimeoutException`; this branch returns the list.
`OpenProjectListTest.testProjectOpenedClosed` and `testProjectClosedRace` fail
on every isolated run here and pass on master. CI won't show it, because the
class is `@RandomlyFails` and CI sets `ignore.random.failures=true`.
I see the plan to remove `enter`/`exit`. Whatever replaces them needs to
keep this contract, and dropping `@RandomlyFails` from `OpenProjectListTest`
would let CI guard it.
##########
ide/projectui/src/org/netbeans/modules/project/ui/OpenProjectList.java:
##########
@@ -898,56 +579,74 @@ public void finished(boolean success) {
return null;
}
});
-
+
final boolean recentProjectsChangedCopy = recentProjectsChanged;
-
- LogRecord[] addedRec = createRecord("UI_OPEN_PROJECTS",
projectsToOpen.toArray(new Project[0])); // NOI18N
- log(addedRec,"org.netbeans.ui.projects");
- addedRec = createRecordMetrics("USG_PROJECT_OPEN",
projectsToOpen.toArray(new Project[0])); // NOI18N
- log(addedRec,"org.netbeans.ui.metrics.projects");
-
+
+ LogRecord[] addedRec =
OpenProjectsLogging.createRecord("UI_OPEN_PROJECTS", projectsToOpen.toArray(new
Project[0])); // NOI18N
+ OpenProjectsLogging.log(addedRec,"org.netbeans.ui.projects");
+ addedRec = OpenProjectsLogging.createRecordMetrics("USG_PROJECT_OPEN",
projectsToOpen.toArray(new Project[0])); // NOI18N
+
OpenProjectsLogging.log(addedRec,"org.netbeans.ui.metrics.projects");
+
Mutex.EVENT.readAccess(new Action<Void>() {
@Override
public Void run() {
pchSupport.firePropertyChange(PROPERTY_OPEN_PROJECTS,
oldprjs.toArray(new Project[0]), newprjs.toArray(new Project[0]));
if ( recentProjectsChangedCopy ) {
pchSupport.firePropertyChange( PROPERTY_RECENT_PROJECTS,
null, null );
}
-
+
return null;
}
});
} finally {
LOAD.exit();
}
}
-
+
+ final void replaceProjects(List<LazyProject> projects, URL mainProject) {
+ MUTEX.writeAccess(() -> {
+ replaceProjectsImpl(projects, mainProject);
+ });
+ }
+
+ private final void replaceProjectsImpl(List<LazyProject> projects, URL
mainProject) {
+ if (openProjects != null) {
+ close(openProjects.toArray(Project[]::new), false);
Review Comment:
This deadlocks when `replaceProjects` is called while the startup load is
still running. `replaceProjects` holds `MUTEX.writeAccess` and calls `close()`.
`LOAD.closeBeforeOpen` returns false for a project the loader has already
dequeued, so `close()` calls `LOAD.waitFinished(0)`. The loader then blocks on
`MUTEX` (`notifyOpened` → `prepareTemplates` → `getDefault()` → `readAccess`).
I reproduced it locally: both threads hang permanently.
Independent of the deadlock, this runs `close()` (project saves, property
changes, `closeAllDocuments`) under `MUTEX`. The class comment warns against
reaching `ProjectManager.MUTEX` from there.
##########
ide/projectui/src/org/netbeans/modules/project/ui/OpenProjectList.java:
##########
@@ -191,32 +169,32 @@ public void propertyChange(PropertyChangeEvent evn) {
}
}
};
- pchSupport = new PropertyChangeSupport( this );
+ replaceProjectsImpl(loadProjectList(), main);
Review Comment:
Capturing the URLs here, in the constructor, changes behaviour when a group
is selected before projects are loaded (e.g. `--open-group` at startup).
`Group.setActiveGroup` with `projectsLoaded == false` first calls
`OpenProjects.getDefault().getOpenProjects()`, which creates `OpenProjectList`
and captures the *old* URLs. Only afterwards does it write the new group's URLs
with `setOpenProjectsURLsAsStrings`. On master `loadInBackground` read the URLs
when it ran, so it picked up the new group.
With saved settings `[a]` and a group `{b}` activated before load, master
opens `b` and this branch opens `a`.
##########
ide/projectui/src/org/netbeans/modules/project/ui/OpenProjectList.java:
##########
@@ -2037,84 +1715,78 @@ private void checkModuleInfo(ModuleInfo info) {
close(toRemove.toArray(new Project[0]), false);
}
}
-
- private static LogRecord[] createRecord(String msg, Project[] projects) {
- if (projects.length == 0) {
- return null;
+
+ private static boolean checkFirstRun() {
+ Preferences prefs =
OpenProjectListSettings.getInstance().getPreferences();
+ String prefKey = "projectListVersion"; // NOI18N
+ String build = System.getProperty("netbeans.buildnumber", "0"); //
NOI18N
+ if (!prefs.get(prefKey, "").equals(build)) {
+ prefs.put(prefKey, build);
+ return true;
+ } else {
+ return false;
}
-
- Map<String,int[]> counts = new HashMap<String,int[]>();
- for (Project p : projects) {
- String n = p.getClass().getName();
- int[] cnt = counts.get(n);
- if (cnt == null) {
- cnt = new int[1];
- counts.put(n, cnt);
- }
- cnt[0]++;
- }
-
- Logger logger = Logger.getLogger("org.netbeans.ui.projects"); // NOI18N
- LogRecord[] arr = new LogRecord[counts.size()];
- int i = 0;
- for (Map.Entry<String,int[]> entry : counts.entrySet()) {
- LogRecord rec = new LogRecord(Level.CONFIG, msg);
- rec.setParameters(new Object[] { entry.getKey(),
afterLastDot(entry.getKey()), entry.getValue()[0] });
- rec.setLoggerName(logger.getName());
- rec.setResourceBundle(NbBundle.getBundle(OpenProjectList.class));
-
rec.setResourceBundleName(OpenProjectList.class.getPackage().getName()+".Bundle");
-
- arr[i++] = rec;
- }
-
- return arr;
}
- private static LogRecord[] createRecordMetrics (String msg, Project[]
projects) {
- if (projects.length == 0) {
- return null;
- }
- Logger logger = Logger.getLogger("org.netbeans.ui.metrics.projects");
// NOI18N
- LogRecord[] arr = new LogRecord[projects.length];
- int i = 0;
- for (Project p : projects) {
- LogRecord rec = new LogRecord(Level.INFO, msg);
- rec.setParameters(new Object[] { p.getClass().getName() });
- rec.setLoggerName(logger.getName());
+ final class LoadingCallback implements OpenProjectsLoading.Callback {
+ @Override
+ public void updateGlobalState(List<Project> lazilyOpenedProjects,
Project lazyMainProject) {
+ assert MUTEX.isWriteAccess();
- arr[i++] = rec;
- }
+ List<String> recentTemplates = new
ArrayList<String>(OpenProjectListSettings.getInstance().getRecentTemplates());
- return arr;
- }
-
- private static void log(LogRecord[] arr, String loggerName) {
- if (arr == null) {
- return;
- }
- Logger logger = Logger.getLogger(loggerName); // NOI18N
- for (LogRecord r : arr) {
- logger.log(r);
- }
- }
-
- private static String afterLastDot(String s) {
- int index = s.lastIndexOf('.');
- if (index == -1) {
- return s;
+ openProjects = lazilyOpenedProjects;
+ if (lazyMainProject != null) {
+ mainProject = lazyMainProject;
+ }
+ mainProject = unwrapProject(mainProject);
+ getRecentTemplates().addAll(recentTemplates);
+
+ MUTEX.postReadRequest(() -> {
Review Comment:
`updateGlobalState` is called inside `writeAccess`, so `postReadRequest` is
delayed until the write lock is released and then runs in *read access*. As a
result, `PROPERTY_OPEN_PROJECTS` / `PROPERTY_MAIN_PROJECT` at startup are
delivered with `OpenProjectList.MUTEX` held; on master they fired with no lock.
A listener on this branch sees `MUTEX.isReadAccess() == true`; on master it is
false.
All `OpenProjects` listeners in the IDE get these events via
`OpenProjectsTrampolineImpl`, so they now run under the lock the class comment
says must never be held while reaching `ProjectManager.MUTEX`. Any listener
needing write access (e.g. `setMainProject`) hits the read→write upgrade error.
Could the callback be split into "apply state" (under the lock) and "fire"
(after `writeAccess` returns), as before?
##########
ide/projectui/test/unit/src/org/netbeans/modules/project/ui/OpenProjectListTest.java:
##########
@@ -175,16 +178,16 @@ public void testClose () throws Exception {
OpenProjectList.getDefault ().open (project2);
// close all project1's documents
- handler.openFiles.remove (f1_1_open.toURL ().toExternalForm ());
- handler.openFiles.remove (f1_2_open.toURL ().toExternalForm ());
+ handler.removeOpenFile(f1_1_open);
+ handler.removeOpenFile(f1_2_open);
ProjectUtilities.closeAllDocuments(new Project[] {project1}, false,
null);
OpenProjectList.getDefault().close(new Project[] {project1}, false,
null);
OpenProjectList.getDefault ().open (project1);
- assertFalse ("Document f1_1_open isn't loaded.",
handler.openFiles.contains (f1_1_open.toURL ().toExternalForm ()));
- assertFalse ("Document f1_2_open isn't loaded.",
handler.openFiles.contains (f1_2_open.toURL ().toExternalForm ()));
- assertTrue ("Document f2_1_open is still loaded.",
handler.openFiles.contains (f2_1_open.toURL ().toExternalForm ()));
+ handler.assertNotOpened("Document f1_1_open isn't loaded", f1_1_open);
+ handler.assertNotOpened("Document f1_2_open isn't loaded.", f1_2_open);
+ handler.assertOpened("Document f2_1_open is still loaded.",f1_1_open);
Review Comment:
The message says f2_1_open but this checks `f1_1_open`, which lines 188–189
assert is *not* open. It only passes because `assertOpened` never fails (see
above).
##########
ide/projectui/test/unit/src/org/netbeans/modules/project/ui/OpenProjectListTest.java:
##########
@@ -165,8 +168,8 @@ public void testClose () throws Exception {
if (!m.find()) {
fail("There should be TestProject\n" + log);
}
- assertFalse ("Document f1_1_open isn't loaded.",
handler.openFiles.contains (f1_1_open.toURL ().toExternalForm ()));
- assertFalse ("Document f1_2_open isn't loaded.",
handler.openFiles.contains (f1_2_open.toURL ().toExternalForm ()));
+ handler.assertNotOpened("Document f1_1_open is loaded.",f1_1_open);
Review Comment:
Nit: "is loaded." on an `assertNotOpened`. The same applies to the next line.
##########
ide/projectui/src/org/netbeans/modules/project/ui/OpenProjectsLoading.java:
##########
@@ -0,0 +1,349 @@
+/*
+ * 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.project.ui;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+import java.util.logging.Level;
+import org.netbeans.api.progress.ProgressHandle;
+import org.netbeans.api.project.FileOwnerQuery;
+import org.netbeans.api.project.Project;
+import org.netbeans.api.project.ProjectManager;
+import org.netbeans.modules.project.ui.groups.Group;
+import org.openide.ErrorManager;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.URLMapper;
+import org.openide.util.Lookup;
+import org.openide.util.LookupEvent;
+import org.openide.util.LookupListener;
+import org.openide.util.Mutex;
+import org.openide.util.NbBundle;
+import org.openide.util.RequestProcessor;
+import org.openide.util.WeakListeners;
+
+/** Helper class used while asynchronously loading projects. Primarily used
+ * when loading projects after startup. This class shall however be usable
+ * when switching list of open projects after opening a new {@link Group}.
+ * <p>
+ * <h3>How it Should Work?</h3>
+ *
+ * When there is a needed to change the list of opened projects, then let's
Review Comment:
Nit, javadoc typos: "When there is a needed to change" here, "currated"
(line 333), and a stray `}` at the end of the `finishOpening` `@return` (line
345).
##########
ide/projectui/test/unit/src/org/netbeans/modules/project/ui/OpenProjectListTest.java:
##########
@@ -443,10 +443,11 @@ public void addChangeListener
(javax.swing.event.ChangeListener changeListener)
}
- private static class TestOpenCloseProjectDocument implements
ProjectUtilities.OpenCloseProjectDocument {
- public Set<String> openFiles = new HashSet<String>();
- public Map<Project,Set<String>> urls4project = new
HashMap<Project,Set<String>>();
+ public static final class TestOpenCloseProjectDocument implements
ProjectUtilities.OpenCloseProjectDocument {
+ private final Map<String, Exception> openFiles = new HashMap<>();
Review Comment:
`openFiles` is written from `OPENING_RP` (via
`ProjectUtilities.openProjectFiles`) and read from the test thread. Maybe use a
synchronized or concurrent map?
##########
ide/projectui/test/unit/src/org/netbeans/modules/project/ui/OpenProjectListTest.java:
##########
@@ -487,6 +489,35 @@ public Map<Project,Set<String>> close(Project[] projects,
boolean notifyUI) {
return urls4project;
}
+
+ void assertOpened(String msg, FileObject fo) throws Exception {
+ assertFalse("Not on the thread",
OpenProjectList.OPENING_RP.isRequestProcessorThread());
+ OpenProjectList.OPENING_RP.post(() -> {}).waitFinished();
+ Exception who = openFiles.get(fo.toURL ().toExternalForm ());
+ for (int cnt = 0; cnt < 10; cnt++) {
+ if (who != null) {
+ if (cnt > 0) {
+ throw new AssertionError("TOO LATE: " + msg);
+ }
+ break;
+ }
+ Thread.sleep(50);
+ if (cnt == 10) {
+ assertNotNull(msg + ":" + openFiles, who);
+ }
+ }
+ }
+ void assertNotOpened(String msg, FileObject fo) {
+ Exception who = openFiles.get(fo.toURL ().toExternalForm ());
+ if (who != null) {
+ throw new AssertionError(msg, who);
+ }
+ }
+
+ void removeOpenFile(FileObject fo) {
+ var previousValue = openFiles.remove(fo.toURL().toExternalForm());
+ assertNotNull("There should be previous value for " + fo);
Review Comment:
`assertNotNull(String)` only checks the message string, so this always
passes; `previousValue` is never used.
##########
ide/projectui/src/org/netbeans/modules/project/ui/OpenProjectList.java:
##########
@@ -1408,30 +1085,32 @@ private boolean doOpenProject(final @NonNull Project p)
{
ProjectUtilities.openProjectFiles(p);
}
});
-
+
return recentProjectsChanged;
}
-
- private static List<Project> loadProjectList() {
+
+ private static List<LazyProject> loadProjectList() {
assert MUTEX.isReadAccess() || MUTEX.isWriteAccess();
+ boolean loadProjectsOnStart =
"true".equals(Bundle.LOAD_PROJECTS_ON_START());
+ if (!loadProjectsOnStart) {
+ return Collections.emptyList();
+ }
List<URL> URLs =
OpenProjectListSettings.getInstance().getOpenProjectsURLs();
List<String> names =
OpenProjectListSettings.getInstance().getOpenProjectsDisplayNames();
List<ExtIcon> icons =
OpenProjectListSettings.getInstance().getOpenProjectsIcons();
- List<Project> projects = new ArrayList<Project>();
-
+ List<LazyProject> projects = new ArrayList<>();
+
Iterator<URL> urlIt = URLs.iterator();
Iterator<String> namesIt = names.iterator();
Iterator<ExtIcon> iconIt = icons.iterator();
-
+
while(urlIt.hasNext() && namesIt.hasNext() && iconIt.hasNext()) {
Review Comment:
The projects opened at startup now come from this zip. A URL without a
matching name *and* icon is silently skipped, whereas on master the URL list
alone decided what was opened. `Group.java:187` writes only the URL list, so
the three lists can get out of step.
##########
ide/projectui/test/unit/src/org/netbeans/modules/project/ui/OpenProjectListTest.java:
##########
@@ -487,6 +489,35 @@ public Map<Project,Set<String>> close(Project[] projects,
boolean notifyUI) {
return urls4project;
}
+
+ void assertOpened(String msg, FileObject fo) throws Exception {
Review Comment:
This assertion can never fail. `who` is read once before the loop and never
re-read, and `cnt == 10` can't be reached inside `for (cnt < 10)`. If the file
was not opened, it sleeps 500 ms and passes; the "TOO LATE" branch is
unreachable too.
##########
ide/projectui/src/org/netbeans/modules/project/ui/OpenProjectsLoading.java:
##########
@@ -0,0 +1,349 @@
+/*
+ * 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.project.ui;
+
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedHashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.locks.Condition;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+import java.util.logging.Level;
+import org.netbeans.api.progress.ProgressHandle;
+import org.netbeans.api.project.FileOwnerQuery;
+import org.netbeans.api.project.Project;
+import org.netbeans.api.project.ProjectManager;
+import org.netbeans.modules.project.ui.groups.Group;
+import org.openide.ErrorManager;
+import org.openide.filesystems.FileObject;
+import org.openide.filesystems.URLMapper;
+import org.openide.util.Lookup;
+import org.openide.util.LookupEvent;
+import org.openide.util.LookupListener;
+import org.openide.util.Mutex;
+import org.openide.util.NbBundle;
+import org.openide.util.RequestProcessor;
+import org.openide.util.WeakListeners;
+
+/** Helper class used while asynchronously loading projects. Primarily used
+ * when loading projects after startup. This class shall however be usable
+ * when switching list of open projects after opening a new {@link Group}.
+ * <p>
+ * <h3>How it Should Work?</h3>
+ *
+ * When there is a needed to change the list of opened projects, then let's
+ * instantiate this class and pass instance of {@link Callback} into its
+ * constructor. Then let the class do its work via {@link #run()}.
+ * When another request to open/modify projects is needed, throw this instance
+ * away and create new one. Repeat.
+ *
+ *
+ */
+final class OpenProjectsLoading implements Runnable, LookupListener,
OpenProjectOperation {
+ static final RequestProcessor RP = new RequestProcessor("Load Open
Projects"); // NOI18N
+ private final RequestProcessor.Task TASK = RP.create(this);
+ private volatile int action;
+ /** @GuardedBy("MUTEX.writeAccess") */
+ private final LinkedList<Project> toOpenProjects = new LinkedList<>();
+ private List<Project> lazilyOpenedProjects;
+ private Project lazyMainProject;
+ private Lookup.Result<FileObject> currentFiles;
+ private int entered;
+ private final Lock enteredGuard = new ReentrantLock();
+ private final Condition enteredZeroed = enteredGuard.newCondition();
+ private final ProgressHandle progress;
+ private final Callback outer;
+ private final List<URL> urls;
+ private final URL mainProjectURL;
+
+ @NbBundle.Messages(value = "CAP_Opening_Projects=Opening Projects")
+ @SuppressWarnings(value = "LeakingThisInConstructor")
+ OpenProjectsLoading(Callback callback, Lookup.Result<FileObject>
currentFiles, List<URL> prjUrls, URL mainPrj) {
+ this.outer = callback;
+ this.currentFiles = currentFiles;
+ this.urls = prjUrls;
+ this.mainProjectURL = mainPrj;
+
currentFiles.addLookupListener(WeakListeners.create(LookupListener.class, this,
currentFiles));
+ progress = ProgressHandle.createHandle(Bundle.CAP_Opening_Projects());
+ }
+
+ @Override
+ public final boolean waitFinished(long timeout) {
+ OpenProjectsLogging.log(Level.FINER, "waitFinished, action {0}",
action); // NOI18N
+ if (action == 0) {
+ run();
+ }
+ OpenProjectsLogging.log(Level.FINER, "waitFinished, before wait"); //
NOI18N
+ if (timeout == 0) {
+ TASK.waitFinished();
+ } else {
+ try {
+ if (!TASK.waitFinished(timeout)) {
+ return false;
+ }
+ } catch (InterruptedException ex) {
+ return false;
+ }
+ }
+ OpenProjectsLogging.log(Level.FINER, "waitFinished, after wait"); //
NOI18N
+ return true;
+ }
+
+ @Override
+ public void run() {
+ OpenProjectsLogging.log(Level.FINE, "LoadOpenProjects.run: {0}",
action); // NOI18N
+ switch (action) {
+ case 0 -> {
+ action = 1;
+ TASK.schedule(0);
+ resultChanged(null);
+ return;
+ }
+ case 1 -> {
+ if (!RP.isRequestProcessorThread()) {
+ return;
+ }
+ action = 2;
+ try {
+ progress.start();
+ loadInBackground();
+ } finally {
+ progress.finish();
+ }
+ updateGlobalState();
+ ProjectsRootNode.checkNoLazyNode();
+ Group.projectsLoaded();
+ return;
+ }
+ case 2 -> {
+ // finished, oK
+ return;
+ }
+ default -> throw new IllegalStateException("unknown action: " +
action);
+ }
+ }
+
+ @Override
+ public final void preferredProject(final Set<FileObject> lazyPDirs) {
+ OpenProjectList.MUTEX.writeAccess((Mutex.Action<Void>) () -> {
+ for (Project p : new ArrayList<Project>(toOpenProjects)) {
+ FileObject dir = p.getProjectDirectory();
+ assert dir != null : "Project has real directory " + p;
+ if (lazyPDirs.contains(dir)) {
+ toOpenProjects.remove(p);
+ toOpenProjects.addFirst(p);
+ return null;
+ }
+ }
+ return null;
+ });
+ }
+
+ private void updateGlobalState() {
+ OpenProjectsLogging.log(Level.FINER, "updateGlobalState"); // NOI18N
+ OpenProjectList.MUTEX.writeAccess(new Mutex.Action<Void>() {
+ @Override
+ public Void run() {
+ OpenProjectsLogging.log(Level.FINER, "openProjects changed:
{0}", lazilyOpenedProjects); // NOI18N
+ outer.updateGlobalState(lazilyOpenedProjects, lazyMainProject);
+ OpenProjectsLogging.log(Level.FINER, "updateGlobalState,
applied"); // NOI18N
+ return null;
+ }
+ });
+ }
+
+ @Override
+ public boolean closeBeforeOpen(final Project[] arr) {
+ return OpenProjectList.MUTEX.writeAccess(new Mutex.Action<Boolean>() {
+ @Override
+ public Boolean run() {
+ NEXT:
+ for (Project p : arr) {
+ FileObject dir = p.getProjectDirectory();
+ for (Iterator<Project> it = toOpenProjects.iterator();
it.hasNext();) {
+ if (dir.equals(it.next().getProjectDirectory())) {
+ it.remove();
+ continue NEXT;
+ }
+ }
+ return false;
+ }
+ return true;
+ }
+ });
+ }
+
+ @NbBundle.Messages(value = {"#NOI18N", "LOAD_PROJECTS_ON_START=true"})
Review Comment:
Nit: `LOAD_PROJECTS_ON_START` is now used only in
`OpenProjectList.loadProjectList`, so the `@Messages` declaration could move
there.
--
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