Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 100807 | Differences between
and this patch

Collapse All | Expand All

(-)ContainerSourceContainer.java (-27 / +32 lines)
Lines 95-132 Link Here
95
		// To prevent the interruption of the search procedure we check 
95
		// To prevent the interruption of the search procedure we check 
96
		// if the path is valid before passing it to "getFile".		
96
		// if the path is valid before passing it to "getFile".		
97
		if ( validateFile(name) ) {
97
		if ( validateFile(name) ) {
98
			File osFile = new File(fRootFile, name);
98
			IFile file = fContainer.getFile(new Path(name));
99
			if (osFile.exists()) {
99
			if (file.exists()) {
100
				try {
100
				sources.add(file);
101
					// See bug 82627 and bug 95679 - we have to append the container path in the case
101
			} else {
102
					// that Eclipse thinks it is, with the file system case of the file in order to
102
				File osFile = new File(fRootFile, name);
103
					// be successful when finding the IFile for a location.
103
				if (osFile.exists()) {
104
					// See bug 98090 - we need to handle relative path names
104
					try {
105
					Path canonicalPath = new Path(osFile.getCanonicalPath());
105
						// See bug 82627 and bug 95679 - we have to append the container path in the case
106
					String[] canonicalSegments = canonicalPath.segments();
106
						// that Eclipse thinks it is, with the file system case of the file in order to
107
					IPath workspacePath = new Path(""); //$NON-NLS-1$
107
						// be successful when finding the IFile for a location.
108
					workspacePath = workspacePath.setDevice(canonicalPath.getDevice());
108
						// See bug 98090 - we need to handle relative path names
109
					for (int i = 0; i < canonicalSegments.length; i++) {
109
						Path canonicalPath = new Path(osFile.getCanonicalPath());
110
						String segment = canonicalSegments[i];
110
						String[] canonicalSegments = canonicalPath.segments();
111
						if (i < fRootSegments.length) {
111
						IPath workspacePath = new Path(""); //$NON-NLS-1$
112
							if (fRootSegments[i].equalsIgnoreCase(segment)) {
112
						workspacePath = workspacePath.setDevice(canonicalPath.getDevice());
113
								workspacePath = workspacePath.append(fRootSegments[i]);
113
						for (int i = 0; i < canonicalSegments.length; i++) {
114
							String segment = canonicalSegments[i];
115
							if (i < fRootSegments.length) {
116
								if (fRootSegments[i].equalsIgnoreCase(segment)) {
117
									workspacePath = workspacePath.append(fRootSegments[i]);
118
								} else {
119
									workspacePath = workspacePath.append(segment);
120
								}
114
							} else {
121
							} else {
115
								workspacePath = workspacePath.append(segment);
122
								workspacePath = workspacePath.append(segment);
116
							}
123
							}
117
						} else {
118
							workspacePath = workspacePath.append(segment);
119
						}
124
						}
125
						IFile[] files = fRoot.findFilesForLocation(workspacePath);
126
						if (isFindDuplicates() && files.length > 1) {
127
							for (int i = 0; i < files.length; i++) {
128
								sources.add(files[i]);
129
							}
130
						} else if (files.length > 0) {
131
							sources.add(files[0]);
132
						}					
133
					} catch (IOException e) {
120
					}
134
					}
121
					IFile[] files = fRoot.findFilesForLocation(workspacePath);
122
					if (isFindDuplicates() && files.length > 1) {
123
						for (int i = 0; i < files.length; i++) {
124
							sources.add(files[i]);
125
						}
126
					} else if (files.length > 0) {
127
						sources.add(files[0]);
128
					}					
129
				} catch (IOException e) {
130
				}
135
				}
131
			}
136
			}
132
		}
137
		}

Return to bug 100807