1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-07-04 15:45:25 +02:00

[200417] fix: [regression][dstore] Rename an expanded folder in an Archive displays no children

This commit is contained in:
Xuan Chen 2008-01-11 02:49:58 +00:00
parent 7c91b19339
commit aaaebe4d91
3 changed files with 73 additions and 26 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2002, 2007 IBM Corporation and others.
* Copyright (c) 2002, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@ -28,6 +28,7 @@
* David McKnight (IBM) - [196624] dstore miner IDs should be String constants rather than dynamic lookup
* Xuan Chen (IBM) - [209827] Update DStore command implementation to enable cancelation of archive operations
* Xuan Chen (IBM) - [194481] [dstore][Archive] Save Conflict After Renaming a File that is Open
* Xuan Chen (IBM) - [200417] [regression][dstore] Rename an expanded folder in an Archive displays no children
*******************************************************************************/
package org.eclipse.rse.dstore.universal.miners;
@ -319,9 +320,28 @@ public class UniversalFileSystemMiner extends Miner {
public DataElement handleQueryAll(DataElement subject, DataElement attributes, DataElement status,
String queryType, boolean caseSensitive)
{
if (queryType.equals(IUniversalDataStoreConstants.UNIVERSAL_ARCHIVE_FILE_DESCRIPTOR)
boolean isArchive = false;
String fullName = subject.getValue();
if (queryType.equals(IUniversalDataStoreConstants.UNIVERSAL_FILTER_DESCRIPTOR))
{
//check if it is a archive file
if (ArchiveHandlerManager.getInstance().isArchive(new File(fullName)))
{
isArchive = true;
}
else
{
isArchive = ArchiveHandlerManager.isVirtual(fullName);
}
}
else if (queryType.equals(IUniversalDataStoreConstants.UNIVERSAL_ARCHIVE_FILE_DESCRIPTOR)
|| queryType.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FILE_DESCRIPTOR)
|| queryType.equals(IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR)) {
isArchive = true;
}
if (isArchive)
{
return handleQueryAllArchive(subject, attributes, status, caseSensitive, false);
}
@ -989,15 +1009,12 @@ public class UniversalFileSystemMiner extends Miner {
subject.setAttribute(DE.A_TYPE,
IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR);
subject.setAttribute(DE.A_NAME, child.name);
if (child.path.equals("")) { //$NON-NLS-1$
subject.setAttribute(DE.A_VALUE, avp
.getContainingArchiveString());
} else {
subject.setAttribute(DE.A_VALUE, avp
subject.setAttribute(DE.A_VALUE, avp
.getContainingArchiveString()
+ ArchiveHandlerManager.VIRTUAL_SEPARATOR
+ child.path);
}
} else {
subject.setAttribute(DE.A_TYPE,

View file

@ -1,5 +1,5 @@
/********************************************************************************
* Copyright (c) 2007 IBM Corporation. All rights reserved.
* Copyright (c) 2007, 2008 IBM Corporation. All rights reserved.
* This program and the accompanying materials are made available under the terms
* of the Eclipse Public License v1.0 which accompanies this distribution, and is
* available at http://www.eclipse.org/legal/epl-v10.html
@ -11,6 +11,7 @@
* Contributors:
* {Name} (company) - description of contribution.
* Kevin Doyle (IBM) - [191548] Deleting Read-Only directory removes it from view and displays no error
* Xuan Chen (IBM) - [200417] [regression][dstore] Rename an expanded folder in an Archive displays no children
********************************************************************************/
package org.eclipse.rse.internal.dstore.universal.miners.filesystem;
@ -65,26 +66,42 @@ public class ArchiveQueryThread extends QueryThread {
protected void doQueryAll() {
{
File fileobj = null;
String queryType = _subject.getType();
boolean isTypeFilter = queryType.equals(IUniversalDataStoreConstants.UNIVERSAL_FILTER_DESCRIPTOR);
boolean isArchiveFile = false;
String pathValue = _subject.getValue();
String path = pathValue;
if (isTypeFilter)
{
if (ArchiveHandlerManager.getInstance().isArchive(new File(pathValue.toString())))
{
isArchiveFile = true;
}
}
else
{
if (queryType.equals(IUniversalDataStoreConstants.UNIVERSAL_ARCHIVE_FILE_DESCRIPTOR))
{
isArchiveFile = true;
}
}
try {
ArchiveHandlerManager mgr = ArchiveHandlerManager.getInstance();
char separatorChar = File.separatorChar;
if (ArchiveHandlerManager.isVirtual(_subject
.getAttribute(DE.A_VALUE))) {
separatorChar = '/';
}
String path = _subject.getAttribute(DE.A_VALUE) + separatorChar
+ _subject.getName();
String rootPath = path;
String virtualPath = ""; //$NON-NLS-1$
VirtualChild[] children = null;
if (_subject
.getType()
.equals(
IUniversalDataStoreConstants.UNIVERSAL_ARCHIVE_FILE_DESCRIPTOR)) {
if (isArchiveFile) {
// it's an archive file (i.e. file.zip)
if (!isTypeFilter)
{
char separatorChar = File.separatorChar;
path = pathValue + separatorChar + _subject.getName();
rootPath = path;
}
fileobj = new File(rootPath);
_subject.setAttribute(DE.A_SOURCE, setProperties(fileobj,
true));
@ -97,10 +114,23 @@ public class ArchiveQueryThread extends QueryThread {
if (isCancelled())
return;
} else if (_subject
.getType()
.equals(
IUniversalDataStoreConstants.UNIVERSAL_VIRTUAL_FOLDER_DESCRIPTOR)) {
}
else //This method could only be called because the subject is a filter (which can be interpreted as archive file or virtual folder,
//a virtual file/folder object.
{
if (!isTypeFilter)
{
//if it is not a filter, then must be a virtual file or folder.
char separatorChar = File.separatorChar;
if (ArchiveHandlerManager.isVirtual(_subject
.getAttribute(DE.A_VALUE))) {
separatorChar = '/';
}
path = pathValue + separatorChar
+ _subject.getName();
}
// it's a virtual folder (i.e. a folder within zip)
// need to determine the associate File object
AbsoluteVirtualPath avp = new AbsoluteVirtualPath(path);

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2003, 2007 IBM Corporation and others.
* Copyright (c) 2003, 2008 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at