1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-14 19:55:45 +02:00

[239459] Clear Cached Files action should not delete project metadata

This commit is contained in:
David McKnight 2008-07-03 16:18:24 +00:00
parent eb9d8528aa
commit 9108945965

View file

@ -18,6 +18,7 @@
* David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible * David McKnight (IBM) - [216252] [api][nls] Resource Strings specific to subsystems should be moved from rse.ui into files.ui / shells.ui / processes.ui where possible
* David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared * David McKnight (IBM) - [220547] [api][breaking] SimpleSystemMessage needs to specify a message id and some messages should be shared
* David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types * David McKnight (IBM) - [225506] [api][breaking] RSE UI leaks non-API types
* David McKnight (IBM) - [239459] Clear Cached Files action should not delete project metadata
********************************************************************************/ ********************************************************************************/
package org.eclipse.rse.internal.files.ui.propertypages; package org.eclipse.rse.internal.files.ui.propertypages;
@ -272,6 +273,22 @@ public class SystemCachePreferencePage extends PreferencePage implements IWorkbe
private class ClearTempFilesRunnable implements IRunnableWithProgress private class ClearTempFilesRunnable implements IRunnableWithProgress
{ {
/**
* Returns false if the member is a dot file under the project, otherwise true
* @param member
* @return whether to delete this file
*/
private boolean isDeletable(IResource member)
{
if (member instanceof IFile){
String name = member.getName();
if (name.startsWith(".")){ //$NON-NLS-1$
return false;
}
}
return true;
}
public void run(IProgressMonitor monitor) public void run(IProgressMonitor monitor)
{ {
SystemRemoteEditManager mgr = SystemRemoteEditManager.getInstance(); SystemRemoteEditManager mgr = SystemRemoteEditManager.getInstance();
@ -286,18 +303,13 @@ public class SystemCachePreferencePage extends PreferencePage implements IWorkbe
{ {
try try
{ {
// IWorkspace workspace = SystemBasePlugin.getWorkspace();
IResource[] members = tempFiles.members(); IResource[] members = tempFiles.members();
if (members != null) if (members != null)
{ {
for (int i = 0; i < members.length; i++) for (int i = 0; i < members.length; i++)
{ {
IResource member = members[i]; IResource member = members[i];
if ((member instanceof IFile) && if (isDeletable(member))
member.getName().equals(".project")) //$NON-NLS-1$
{
}
else
{ {
// DKM - passing true now so that out-of-synch temp files are deleted too (i.e. generated .evt files) // DKM - passing true now so that out-of-synch temp files are deleted too (i.e. generated .evt files)
// this solves the worse part of 58951 // this solves the worse part of 58951
@ -313,35 +325,6 @@ public class SystemCachePreferencePage extends PreferencePage implements IWorkbe
finally finally
{ {
mgr.getRemoteEditProject(); mgr.getRemoteEditProject();
/*
try
{
// recreate .project
IProjectDescription description = tempFiles.getDescription();
String[] natures = description.getNatureIds();
String[] newNatures = new String[natures.length + 1];
// copy all previous natures
for (int i = 0; i < natures.length; i++)
{
newNatures[i] = natures[i];
}
newNatures[newNatures.length - 1] = SystemRemoteEditManager.REMOTE_EDIT_PROJECT_NATURE_ID;
description.setNatureIds(newNatures);
tempFiles.setDescription(description, null);
mgr.addCSupport(tempFiles);
mgr.addJavaSupport(tempFiles);
}
catch (CoreException e)
{
}
*/
} }
} }