Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(80)

Side by Side Diff: editor/tools/plugins/com.google.dart.tools.debug.core/src/com/google/dart/tools/debug/core/source/WorkspaceSourceContainer.java

Issue 611473005: Issue 16417. Use better implemention for converting paths to resources. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2012, the Dart project authors. 2 * Copyright (c) 2012, the Dart project authors.
3 * 3 *
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except
5 * in compliance with the License. You may obtain a copy of the License at 5 * in compliance with the License. You may obtain a copy of the License at
6 * 6 *
7 * http://www.eclipse.org/legal/epl-v10.html 7 * http://www.eclipse.org/legal/epl-v10.html
8 * 8 *
9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License 9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
43 return (IFile) resource; 43 return (IFile) resource;
44 } else { 44 } else {
45 return null; 45 return null;
46 } 46 }
47 } 47 }
48 48
49 public static IResource locatePathAsResource(String path) { 49 public static IResource locatePathAsResource(String path) {
50 if (path == null) { 50 if (path == null) {
51 return null; 51 return null;
52 } 52 }
53 File file = new File(path);
53 54
54 // Look for a resource reference (/project/directory/file.dart). 55 // Look for a resource reference (/project/directory/file.dart).
55 IResource resource = ResourcesPlugin.getWorkspace().getRoot().findMember(pat h); 56 IResource resource = ResourceUtil.getResource(file);
56
57 if (resource != null) { 57 if (resource != null) {
58 return resource; 58 return resource;
59 } 59 }
60 60
61 // Look for something which could potentially resolve to a resource in the w orkspace. 61 // Look for something which could potentially resolve to a resource in the w orkspace.
62 resource = findPotentialWorkspaceMatch(path); 62 resource = findPotentialWorkspaceMatch(path);
63
64 if (resource != null) { 63 if (resource != null) {
65 return resource; 64 return resource;
66 } 65 }
67 66
68 // Look for a file system reference. 67 // Look for a file system reference.
69 File file = new File(path);
70
71 if (file.exists() && !file.isDirectory()) { 68 if (file.exists() && !file.isDirectory()) {
72 IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocat ionURI(file.toURI()); 69 IFile[] files = ResourcesPlugin.getWorkspace().getRoot().findFilesForLocat ionURI(file.toURI());
73 70
74 if (files.length > 0) { 71 if (files.length > 0) {
75 return files[0]; 72 return files[0];
76 } 73 }
77 74
78 // look for file among all resources, no filtering 75 // look for file among all resources, no filtering
79 resource = ResourceUtil.getFile(file); 76 resource = ResourceUtil.getFile(file);
80 77
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 public String getName() { 120 public String getName() {
124 return "Workspace"; 121 return "Workspace";
125 } 122 }
126 123
127 @Override 124 @Override
128 public ISourceContainerType getType() { 125 public ISourceContainerType getType() {
129 return getSourceContainerType(TYPE_ID); 126 return getSourceContainerType(TYPE_ID);
130 } 127 }
131 128
132 } 129 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698