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 54532 Details for
Bug 165867
Open include ignores linked resources
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
Bug fix.
patch_OpenInclude.txt (text/plain), 3.84 KB, created by
Sergey Prigogin
on 2006-11-26 15:44:38 EST
(
hide
)
Description:
Bug fix.
Filename:
MIME Type:
Creator:
Sergey Prigogin
Created:
2006-11-26 15:44:38 EST
Size:
3.84 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.cdt.ui >Index: src/org/eclipse/cdt/internal/ui/editor/OpenIncludeAction.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/editor/OpenIncludeAction.java,v >retrieving revision 1.19 >diff -u -r1.19 OpenIncludeAction.java >--- src/org/eclipse/cdt/internal/ui/editor/OpenIncludeAction.java 24 Nov 2006 14:07:15 -0000 1.19 >+++ src/org/eclipse/cdt/internal/ui/editor/OpenIncludeAction.java 26 Nov 2006 20:43:21 -0000 >@@ -12,16 +12,17 @@ > package org.eclipse.cdt.internal.ui.editor; > > import java.io.File; >-import java.io.IOException; > import java.util.ArrayList; > import java.util.HashSet; > import java.util.List; > > import org.eclipse.core.resources.IContainer; >+import org.eclipse.core.resources.IFile; > import org.eclipse.core.resources.IProject; > import org.eclipse.core.resources.IResource; > import org.eclipse.core.resources.IResourceProxy; > import org.eclipse.core.resources.IResourceProxyVisitor; >+import org.eclipse.core.resources.IWorkspaceRoot; > import org.eclipse.core.resources.ResourcesPlugin; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IPath; >@@ -94,8 +95,7 @@ > } > if (info != null) { > String[] includePaths = info.getIncludePaths(); >- HashSet found = new HashSet(); >- findFile(includePaths, includeName, filesFound, found); >+ findFile(includePaths, includeName, filesFound); > } > if (filesFound.size() == 0) { > // Fall back and search the project >@@ -135,41 +135,47 @@ > } > > private boolean isInProject(IPath path) { >- return ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(path) != null; >+ return getWorkspaceRoot().getFileForLocation(path) != null; > } > >- // If 'path' is not a resource in the current workspace and >- // it is a symlink to a resource that is in the current workspace, >- // use the symlink target instead >- private IPath resolveIncludeLink(File file, IPath path) { >- if (isInProject(path)) >- return path; >- >- try { >- String canon = file.getCanonicalPath(); >- if (canon.equals(file.getAbsolutePath())) >- return path; >- >- IPath p = Path.fromOSString(canon); >- if (isInProject(p)) >- return p; >- } catch (IOException e) { >- // Do nothing; the path is not resolved >+ /** >+ * Returns the path as is, if it points to a workspace resource. If the path >+ * does not point to a workspace resource, but there are linked workspace >+ * resources pointing to it, returns the paths of these resources. >+ * Othervise, returns the path as is. >+ */ >+ private IPath[] resolveIncludeLink(IPath path) { >+ if (!isInProject(path)) { >+ IFile[] files = getWorkspaceRoot().findFilesForLocation(path); >+ if (files.length > 0) { >+ IPath[] paths = new IPath[files.length]; >+ for (int i = 0; i < files.length; i++) { >+ paths[i] = files[i].getFullPath(); >+ } >+ return paths; >+ } > } > >- return path; >+ return new IPath[] { path }; >+ } >+ >+ private IWorkspaceRoot getWorkspaceRoot() { >+ return ResourcesPlugin.getWorkspace().getRoot(); > } > >- private void findFile(String[] includePaths, String name, ArrayList list, >- HashSet foundSet) throws CoreException { >+ private void findFile(String[] includePaths, String name, ArrayList list) >+ throws CoreException { >+ HashSet foundSet = new HashSet(); > for (int i = 0; i < includePaths.length; i++) { > IPath path = new Path(includePaths[i] + "/" + name); //$NON-NLS-1$ > File file = path.toFile(); > if (file.exists()) { >- IPath p = resolveIncludeLink(file, path); >- if (!foundSet.contains(p)) { >- foundSet.add(p); >- list.add(p); >+ IPath[] paths = resolveIncludeLink(path); >+ for (int j = 0; j < paths.length; j++) { >+ IPath p = paths[j]; >+ if (foundSet.add(p)) { >+ list.add(p); >+ } > } > } > }
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 165867
:
54532
|
55379
|
55381