mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-07-27 02:45:32 +02:00
[172437] incorporated patch
This commit is contained in:
parent
d6df8489b5
commit
9710d904bf
1 changed files with 44 additions and 41 deletions
|
@ -27,6 +27,7 @@ import org.eclipse.core.resources.IResource;
|
||||||
import org.eclipse.core.resources.IResourceChangeEvent;
|
import org.eclipse.core.resources.IResourceChangeEvent;
|
||||||
import org.eclipse.core.resources.IResourceChangeListener;
|
import org.eclipse.core.resources.IResourceChangeListener;
|
||||||
import org.eclipse.core.resources.IWorkspace;
|
import org.eclipse.core.resources.IWorkspace;
|
||||||
|
import org.eclipse.core.runtime.CoreException;
|
||||||
import org.eclipse.rse.core.filters.ISystemFilterPool;
|
import org.eclipse.rse.core.filters.ISystemFilterPool;
|
||||||
import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
|
import org.eclipse.rse.core.filters.ISystemFilterPoolManager;
|
||||||
import org.eclipse.rse.core.model.IHost;
|
import org.eclipse.rse.core.model.IHost;
|
||||||
|
@ -152,7 +153,7 @@ public class SystemResourceManager implements SystemResourceConstants
|
||||||
if (remoteSystemsProject == null)
|
if (remoteSystemsProject == null)
|
||||||
{
|
{
|
||||||
remoteSystemsProject = SystemBasePlugin.getWorkspaceRoot().getProject(RESOURCE_PROJECT_NAME);
|
remoteSystemsProject = SystemBasePlugin.getWorkspaceRoot().getProject(RESOURCE_PROJECT_NAME);
|
||||||
if (!initDone)
|
if (!initDone || !remoteSystemsProject.isAccessible())
|
||||||
remoteSystemsProject = createRemoteSystemsProjectInternal(remoteSystemsProject);
|
remoteSystemsProject = createRemoteSystemsProjectInternal(remoteSystemsProject);
|
||||||
}
|
}
|
||||||
return remoteSystemsProject;
|
return remoteSystemsProject;
|
||||||
|
@ -172,47 +173,49 @@ public class SystemResourceManager implements SystemResourceConstants
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Create a remote systems project, plus the core subfolders required.
|
* Create a remote systems project, plus the core subfolders required.
|
||||||
* @return IProject handle of the project.
|
* @param proj the handle for the remote systems project
|
||||||
|
* @return the IProject handle of the project (the argument)
|
||||||
*/
|
*/
|
||||||
protected static IProject createRemoteSystemsProjectInternal(IProject proj)
|
protected static IProject createRemoteSystemsProjectInternal(IProject proj) {
|
||||||
//throws Exception
|
// Check first for the project to be closed. If yes, try to open it and if this fails,
|
||||||
{
|
// try to delete if first before failing here. The case is that the user removed the
|
||||||
if (!proj.exists())
|
// directory in the workspace and we must be able to recover from it.
|
||||||
{
|
// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=172437.
|
||||||
try {
|
if (!proj.isOpen()) {
|
||||||
proj.create(null);
|
try {
|
||||||
proj.open(null);
|
proj.open(null);
|
||||||
IProjectDescription description = proj.getDescription();
|
} catch (Exception e) {
|
||||||
String newNatures[] = {RemoteSystemsProject.ID};
|
try {
|
||||||
description.setNatureIds(newNatures);
|
proj.delete(false, true, null);
|
||||||
proj.setDescription(description, null);
|
SystemBasePlugin.logWarning("Removed stale remote systems project reference. Re-creating remote system project to recover."); //$NON-NLS-1$
|
||||||
firstTime = true;
|
} catch (CoreException exc) {
|
||||||
} catch (Exception e)
|
// If the delete fails, the original opening error will be passed to the error log.
|
||||||
{
|
SystemBasePlugin.logError("error opening remote systems project", e); //$NON-NLS-1$
|
||||||
SystemBasePlugin.logError("error creating remote systems project",e); //$NON-NLS-1$
|
}
|
||||||
//throw e;
|
}
|
||||||
}
|
}
|
||||||
}
|
if (!proj.exists()) {
|
||||||
else if (!proj.isOpen())
|
try {
|
||||||
{
|
proj.create(null);
|
||||||
try {
|
proj.open(null);
|
||||||
proj.open(null);
|
IProjectDescription description = proj.getDescription();
|
||||||
} catch (Exception e)
|
String newNatures[] = { RemoteSystemsProject.ID };
|
||||||
{
|
description.setNatureIds(newNatures);
|
||||||
SystemBasePlugin.logError("error opening remote systems project",e); //$NON-NLS-1$
|
proj.setDescription(description, null);
|
||||||
//throw e;
|
firstTime = true;
|
||||||
}
|
} catch (Exception e) {
|
||||||
}
|
SystemBasePlugin.logError("error creating remote systems project", e); //$NON-NLS-1$
|
||||||
try{
|
}
|
||||||
// create types folder...
|
}
|
||||||
getResourceHelpers().getOrCreateFolder(proj,RESOURCE_TYPE_FILTERS_FOLDER_NAME);
|
try {
|
||||||
} catch (Exception e)
|
// create types folder...
|
||||||
{
|
// getResourceHelpers().getOrCreateFolder(proj, RESOURCE_TYPE_FILTERS_FOLDER_NAME);
|
||||||
SystemBasePlugin.logError("error opening/creating types folder",e); //$NON-NLS-1$
|
} catch (Exception e) {
|
||||||
}
|
SystemBasePlugin.logError("error opening/creating types folder", e); //$NON-NLS-1$
|
||||||
initDone = true;
|
}
|
||||||
return proj;
|
initDone = true;
|
||||||
}
|
return proj;
|
||||||
|
}
|
||||||
/**
|
/**
|
||||||
* Return true if we just created the remote systems project for the first time.
|
* Return true if we just created the remote systems project for the first time.
|
||||||
* This call has the side effect of resetting the flag to false so it doesn't return
|
* This call has the side effect of resetting the flag to false so it doesn't return
|
||||||
|
|
Loading…
Add table
Reference in a new issue