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 154471
Collapse All | Expand All

(-)src-validation/org/eclipse/wst/xml/core/internal/validation/core/AbstractNestedValidator.java (-28 / +2 lines)
Lines 21-27 Link Here
21
import org.eclipse.core.resources.IMarker;
21
import org.eclipse.core.resources.IMarker;
22
import org.eclipse.core.resources.IResource;
22
import org.eclipse.core.resources.IResource;
23
import org.eclipse.core.runtime.CoreException;
23
import org.eclipse.core.runtime.CoreException;
24
import org.eclipse.core.runtime.IPath;
25
import org.eclipse.core.runtime.IStatus;
24
import org.eclipse.core.runtime.IStatus;
26
import org.eclipse.core.runtime.Status;
25
import org.eclipse.core.runtime.Status;
27
import org.eclipse.core.runtime.jobs.ISchedulingRule;
26
import org.eclipse.core.runtime.jobs.ISchedulingRule;
Lines 47-54 Link Here
47
  private static final String REFERENCED_FILE_ERROR_OPEN = "referencedFileError("; //$NON-NLS-1$
46
  private static final String REFERENCED_FILE_ERROR_OPEN = "referencedFileError("; //$NON-NLS-1$
48
  private static final String REFERENCED_FILE_ERROR_CLOSE = ")"; //$NON-NLS-1$
47
  private static final String REFERENCED_FILE_ERROR_CLOSE = ")"; //$NON-NLS-1$
49
  private static final String REFERENCED_FILE_ERROR = "referencedFileError"; //$NON-NLS-1$
48
  private static final String REFERENCED_FILE_ERROR = "referencedFileError"; //$NON-NLS-1$
50
  private static final String FILE_PROTOCOL_NO_SLASH = "file:"; //$NON-NLS-1$
51
  private static final String FILE_PROTOCOL = "file:///"; //$NON-NLS-1$
52
  private static final String GROUP_NAME = "groupName"; //$NON-NLS-1$
49
  private static final String GROUP_NAME = "groupName"; //$NON-NLS-1$
53
  private final String GET_FILE = "getFile"; //$NON-NLS-1$
50
  private final String GET_FILE = "getFile"; //$NON-NLS-1$
54
  private final String GET_PROJECT_FILES = "getAllFiles"; //$NON-NLS-1$
51
  private final String GET_PROJECT_FILES = "getAllFiles"; //$NON-NLS-1$
Lines 235-242 Link Here
235
	Message message = new LocalizedMessage(IMessage.LOW_SEVERITY, NLS.bind(getValidatorName(), new String[]{file.getFullPath().toString()}));
232
	Message message = new LocalizedMessage(IMessage.LOW_SEVERITY, NLS.bind(getValidatorName(), new String[]{file.getFullPath().toString()}));
236
    reporter.displaySubtask(this, message);
233
    reporter.displaySubtask(this, message);
237
    
234
    
238
	IPath path = file.getLocation();
235
	String uri = file.getLocationURI().toString();
239
	String uri = createURIForFilePath(path.toString());
240
236
241
	clearMarkers(file, this, reporter);
237
	clearMarkers(file, this, reporter);
242
	ValidationReport valreport = validate(uri, inputstream, context);
238
	ValidationReport valreport = validate(uri, inputstream, context);
Lines 310-338 Link Here
310
	return false;
306
	return false;
311
  }
307
  }
312
	  
308
	  
313
  /**
309
314
   * Format a file name into a correct URI. 
315
   * This is a convenience method for subclasses.
316
   * 
317
   * @param filename 
318
   * 		The file name to format.
319
   * @return 
320
   * 		
321
   * The formatted URI.
322
   */
323
  private String createURIForFilePath(String filename)
324
  {
325
	if(!filename.startsWith(FILE_PROTOCOL_NO_SLASH))
326
	{
327
	  while(filename.startsWith("/")) //$NON-NLS-1$
328
	  {
329
	    filename = filename.substring(1);
330
	  }
331
	  filename = FILE_PROTOCOL + filename;
332
	}
333
	return filename;
334
  }
335
	  
336
  /**
310
  /**
337
   * Create markers for the valiation messages generated from the validation.
311
   * Create markers for the valiation messages generated from the validation.
338
   * 
312
   * 
(-)src/org/eclipse/wst/sse/core/internal/FileBufferModelManager.java (-23 / +9 lines)
Lines 18-23 Link Here
18
import java.io.IOException;
18
import java.io.IOException;
19
import java.io.InputStream;
19
import java.io.InputStream;
20
import java.net.MalformedURLException;
20
import java.net.MalformedURLException;
21
import java.net.URI;
21
import java.net.URL;
22
import java.net.URL;
22
import java.util.Hashtable;
23
import java.util.Hashtable;
23
import java.util.Map;
24
import java.util.Map;
Lines 149-160 Link Here
149
	 * resolver
150
	 * resolver
150
	 */
151
	 */
151
	class CommonURIResolver implements URIResolver {
152
	class CommonURIResolver implements URIResolver {
152
		IPath fLocation;
153
		URI fLocation;
153
		IPath fPath;
154
		IPath fPath;
154
		final static String SEPARATOR = "/"; //$NON-NLS-1$ 
155
		final static String SEPARATOR = "/"; //$NON-NLS-1$ 
155
		final static String FILE_PREFIX = "file://"; //$NON-NLS-1$
156
		//final static String FILE_PREFIX = "file://"; //$NON-NLS-1$
156
157
157
		CommonURIResolver(IPath path, IPath location) {
158
		CommonURIResolver(IPath path, URI location) {
158
			fLocation = location;
159
			fLocation = location;
159
			fPath = path;
160
			fPath = path;
160
		}
161
		}
Lines 175-196 Link Here
175
			return getLocationByURI(uri, baseReference, false);
176
			return getLocationByURI(uri, baseReference, false);
176
		}
177
		}
177
178
178
		public String getLocationByURI(String uri, String baseReference, boolean resolveCrossProjectLinks) {
179
		public String getLocationByURI(String uri, String baseReference, boolean resolveCrossProjectLinks) {		
179
			boolean baseHasPrefix = baseReference != null && baseReference.startsWith(FILE_PREFIX);
180
			String result = URIResolverPlugin.createResolver().resolve(baseReference, null, uri);
180
			String reference = null;
181
			if (baseHasPrefix) {
182
				reference = baseReference;
183
			}
184
			else {
185
				reference = FILE_PREFIX + baseReference;
186
			}
187
			String result = URIResolverPlugin.createResolver().resolve(reference, null, uri);
188
			// Logger.log(Logger.INFO_DEBUG,
189
			// "URIResolverPlugin.createResolver().resolve("
190
			// + reference + ", null, " +uri+") = " + result);
191
			if (!baseHasPrefix && result.startsWith(FILE_PREFIX) && result.length() > FILE_PREFIX.length()) {
192
				result = result.substring(FILE_PREFIX.length());
193
			}
194
			return result;
181
			return result;
195
		}
182
		}
196
183
Lines 199-205 Link Here
199
		}
186
		}
200
187
201
		public IContainer getRootLocation() {
188
		public IContainer getRootLocation() {
202
			String root = URIResolverPlugin.createResolver().resolve(FILE_PREFIX + getFileBaseLocation(), null, SEPARATOR);
189
			String root = URIResolverPlugin.createResolver().resolve(getFileBaseLocation(), null, SEPARATOR);
203
			IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(new Path(root));
190
			IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocation(new Path(root));
204
			for (int i = 0; i < files.length; i++) {
191
			for (int i = 0; i < files.length; i++) {
205
				if ((files[i].getType() & IResource.FOLDER) == IResource.FOLDER) {
192
				if ((files[i].getType() & IResource.FOLDER) == IResource.FOLDER) {
Lines 406-414 Link Here
406
			IProject project = workspaceFile.getProject();
393
			IProject project = workspaceFile.getProject();
407
			resolver = (URIResolver) project.getAdapter(URIResolver.class);
394
			resolver = (URIResolver) project.getAdapter(URIResolver.class);
408
			if (resolver == null) {
395
			if (resolver == null) {
409
				resolver = new CommonURIResolver(workspaceFile.getFullPath(), workspaceFile.getLocation());
396
				resolver = new CommonURIResolver(workspaceFile.getFullPath(), workspaceFile.getLocationURI());
410
			}
397
			}			
411
			resolver.setFileBaseLocation(workspaceFile.getLocation().toString());
412
		}
398
		}
413
		else {
399
		else {
414
			resolver = new ExternalURIResolver(location);
400
			resolver = new ExternalURIResolver(location);
(-)src/org/eclipse/wst/sse/core/internal/model/ModelManagerImpl.java (-1 / +1 lines)
Lines 483-489 Link Here
483
		URIResolver resolver = (URIResolver) project.getAdapter(URIResolver.class);
483
		URIResolver resolver = (URIResolver) project.getAdapter(URIResolver.class);
484
		if (resolver == null)
484
		if (resolver == null)
485
			resolver = new ProjectResolver(project);
485
			resolver = new ProjectResolver(project);
486
		resolver.setFileBaseLocation(file.getLocation().toString());
486
		resolver.setFileBaseLocation(file.getLocationURI().toString());
487
		return resolver;
487
		return resolver;
488
	}
488
	}
489
489
(-)src/org/eclipse/wst/xml/ui/internal/hyperlink/XMLHyperlinkDetector.java (-1 / +1 lines)
Lines 155-161 Link Here
155
				}
155
				}
156
				else {
156
				else {
157
					if (location.segmentCount() > 1)
157
					if (location.segmentCount() > 1)
158
						baseLoc = ResourcesPlugin.getWorkspace().getRoot().getFile(location).getLocation().toString();
158
						baseLoc = ResourcesPlugin.getWorkspace().getRoot().getFile(location).getLocationURI().toString();
159
					else
159
					else
160
						baseLoc = ResourcesPlugin.getWorkspace().getRoot().getLocation().append(location).toString();
160
						baseLoc = ResourcesPlugin.getWorkspace().getRoot().getLocation().append(location).toString();
161
				}
161
				}

Return to bug 154471