Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 113364 Details for
Bug 241400
[LinkedResources] Random errors when changing project settings
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Proposed fix
241400.txt (text/plain), 4.90 KB, created by
Jerome Lanneluc
on 2008-09-24 10:10:40 EDT
(
hide
)
Description:
Proposed fix
Filename:
MIME Type:
Creator:
Jerome Lanneluc
Created:
2008-09-24 10:10:40 EDT
Size:
4.90 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jdt.core >Index: model/org/eclipse/jdt/internal/core/ExternalFoldersManager.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jdt.core/model/org/eclipse/jdt/internal/core/ExternalFoldersManager.java,v >retrieving revision 1.10 >diff -u -r1.10 ExternalFoldersManager.java >--- model/org/eclipse/jdt/internal/core/ExternalFoldersManager.java 19 Aug 2008 15:41:13 -0000 1.10 >+++ model/org/eclipse/jdt/internal/core/ExternalFoldersManager.java 24 Sep 2008 14:09:27 -0000 >@@ -22,6 +22,7 @@ > import org.eclipse.core.resources.IProject; > import org.eclipse.core.resources.IProjectDescription; > import org.eclipse.core.resources.IResource; >+import org.eclipse.core.resources.IResourceStatus; > import org.eclipse.core.resources.ResourcesPlugin; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IPath; >@@ -160,36 +161,39 @@ > if (!project.isAccessible()) { > try { > if (!project.exists()) { >- IProjectDescription desc = project.getWorkspace().newProjectDescription(project.getName()); >- IPath stateLocation = JavaCore.getPlugin().getStateLocation(); >- desc.setLocation(stateLocation.append(EXTERNAL_PROJECT_NAME)); >- project.create(DEBUG ? null : desc, DEBUG ? IResource.NONE : IResource.HIDDEN, monitor); >+ createExternalFoldersProject(project, monitor); > } > try { > project.open(monitor); > } catch (CoreException e1) { >- // .project or folder on disk have been deleted, recreate them >- IPath stateLocation = DEBUG ? ResourcesPlugin.getWorkspace().getRoot().getLocation() : JavaCore.getPlugin().getStateLocation(); >- IPath projectPath = stateLocation.append(EXTERNAL_PROJECT_NAME); >- projectPath.toFile().mkdirs(); >- FileOutputStream output = new FileOutputStream(projectPath.append(".project").toOSString()); //$NON-NLS-1$ >- try { >- output.write(( >- "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + //$NON-NLS-1$ >- "<projectDescription>\n" + //$NON-NLS-1$ >- " <name>" + EXTERNAL_PROJECT_NAME + "</name>\n" + //$NON-NLS-1$ //$NON-NLS-2$ >- " <comment></comment>\n" + //$NON-NLS-1$ >- " <projects>\n" + //$NON-NLS-1$ >- " </projects>\n" + //$NON-NLS-1$ >- " <buildSpec>\n" + //$NON-NLS-1$ >- " </buildSpec>\n" + //$NON-NLS-1$ >- " <natures>\n" + //$NON-NLS-1$ >- " </natures>\n" + //$NON-NLS-1$ >- "</projectDescription>").getBytes()); //$NON-NLS-1$ >- } finally { >- output.close(); >- } >- project.open(null); >+ if (e1.getStatus().getCode() == IResourceStatus.FAILED_READ_METADATA) { >+ // workspace was moved (see https://bugs.eclipse.org/bugs/show_bug.cgi?id=241400) >+ project.delete(true, monitor); >+ createExternalFoldersProject(project, monitor); >+ } else { >+ // .project or folder on disk have been deleted, recreate them >+ IPath stateLocation = DEBUG ? ResourcesPlugin.getWorkspace().getRoot().getLocation() : JavaCore.getPlugin().getStateLocation(); >+ IPath projectPath = stateLocation.append(EXTERNAL_PROJECT_NAME); >+ projectPath.toFile().mkdirs(); >+ FileOutputStream output = new FileOutputStream(projectPath.append(".project").toOSString()); //$NON-NLS-1$ >+ try { >+ output.write(( >+ "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + //$NON-NLS-1$ >+ "<projectDescription>\n" + //$NON-NLS-1$ >+ " <name>" + EXTERNAL_PROJECT_NAME + "</name>\n" + //$NON-NLS-1$ //$NON-NLS-2$ >+ " <comment></comment>\n" + //$NON-NLS-1$ >+ " <projects>\n" + //$NON-NLS-1$ >+ " </projects>\n" + //$NON-NLS-1$ >+ " <buildSpec>\n" + //$NON-NLS-1$ >+ " </buildSpec>\n" + //$NON-NLS-1$ >+ " <natures>\n" + //$NON-NLS-1$ >+ " </natures>\n" + //$NON-NLS-1$ >+ "</projectDescription>").getBytes()); //$NON-NLS-1$ >+ } finally { >+ output.close(); >+ } >+ } >+ project.open(monitor); > } > } catch (CoreException e) { > Util.log(e, "Problem creating hidden project for external folders"); //$NON-NLS-1$ >@@ -202,6 +206,14 @@ > return project; > } > >+ >+ private void createExternalFoldersProject(IProject project, IProgressMonitor monitor) throws CoreException { >+ IProjectDescription desc = project.getWorkspace().newProjectDescription(project.getName()); >+ IPath stateLocation = JavaCore.getPlugin().getStateLocation(); >+ desc.setLocation(stateLocation.append(EXTERNAL_PROJECT_NAME)); >+ project.create(DEBUG ? null : desc, DEBUG ? IResource.NONE : IResource.HIDDEN, monitor); >+ } >+ > public synchronized IFolder getFolder(IPath externalFolderPath) { > return (IFolder) getFolders().get(externalFolderPath); > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 241400
: 113364