From 9640c46abb37c90f4114f35ea098833e13479474 Mon Sep 17 00:00:00 2001 From: Michael Bangas Date: Tue, 21 May 2024 11:30:32 +0200 Subject: [PATCH] Revert "revert changes in RefreshLocalVisitor" This reverts commit 241da21e96c6d4cbe4be387c999a3fd3e6e781be. --- .../internal/localstore/RefreshLocalVisitor.java | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/RefreshLocalVisitor.java b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/RefreshLocalVisitor.java index 0fb70969856..c8dec785c34 100644 --- a/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/RefreshLocalVisitor.java +++ b/resources/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/RefreshLocalVisitor.java @@ -14,6 +14,7 @@ *******************************************************************************/ package org.eclipse.core.internal.localstore; +import org.eclipse.core.filesystem.ZipFileUtil; import org.eclipse.core.internal.resources.Container; import org.eclipse.core.internal.resources.File; import org.eclipse.core.internal.resources.Folder; @@ -247,7 +248,10 @@ protected boolean synchronizeGender(UnifiedTreeNode node, Resource target) throw return false; } } else { - if (!node.isFolder()) { + // if the target is an open zip file (linked folder), gender should not be + // synchronized because the folder state is needed to access the zip file + // content. + if (!node.isFolder() && !ZipFileUtil.isInsideOpenZipFile(target.getStore())) { folderToFile(node, target); resourceChanged = true; return false; @@ -294,7 +298,12 @@ public boolean visit(UnifiedTreeNode node) throws CoreException { return true; } } else { - if (node.existsInFileSystem() && !IPath.EMPTY.isValidSegment(node.getLocalName())) { + // if opened zip files contain directories with content, the local name of the + // node contains "/" characters which are needed to properly present the + // contents in the workspace. So this check should not be done when handling zip + // files. + if (node.existsInFileSystem() && !IPath.EMPTY.isValidSegment(node.getLocalName()) + && !ZipFileUtil.isInsideOpenZipFile(target.getStore())) { String message = NLS.bind(Messages.resources_invalidResourceName, node.getLocalName()); errors.merge(new ResourceStatus(IResourceStatus.INVALID_RESOURCE_NAME, message)); return false;