|
33 | 33 | import com.google.common.annotations.VisibleForTesting; |
34 | 34 | import com.google.common.base.Preconditions; |
35 | 35 | import com.google.common.base.Strings; |
| 36 | +import com.google.common.io.CharStreams; |
36 | 37 | import com.google.common.net.InetAddresses; |
37 | 38 | import java.io.File; |
| 39 | +import java.io.InputStreamReader; |
38 | 40 | import java.net.InetAddress; |
39 | 41 | import java.net.UnknownHostException; |
| 42 | +import java.nio.charset.StandardCharsets; |
| 43 | +import java.nio.file.Paths; |
40 | 44 | import java.text.MessageFormat; |
41 | 45 | import java.util.ArrayList; |
42 | 46 | import java.util.Arrays; |
|
48 | 52 | import java.util.Set; |
49 | 53 | import java.util.logging.Level; |
50 | 54 | import java.util.logging.Logger; |
| 55 | +import org.eclipse.core.resources.IContainer; |
| 56 | +import org.eclipse.core.resources.IFile; |
51 | 57 | import org.eclipse.core.resources.IProject; |
| 58 | +import org.eclipse.core.resources.IResource; |
52 | 59 | import org.eclipse.core.runtime.CoreException; |
53 | 60 | import org.eclipse.core.runtime.IPath; |
54 | 61 | import org.eclipse.core.runtime.IProgressMonitor; |
@@ -138,6 +145,27 @@ public ILaunch getLaunch(ILaunchConfiguration configuration, String mode) throws |
138 | 145 | return super.getLaunch(configuration, mode); |
139 | 146 | } |
140 | 147 |
|
| 148 | + private void printFileContents(IContainer container, String path) { |
| 149 | + java.nio.file.Path path = Paths.get("foo"); |
| 150 | + path.relativize(other) |
| 151 | + container.getProject().getWorkspace().getRoot(). |
| 152 | + IResource resource = container.findMember(path); |
| 153 | + if (!resource.exists()) { |
| 154 | + System.err.println("--- Path does not exist: " + path); |
| 155 | + } else if (resource.getType() != IResource.FILE) { |
| 156 | + System.err.println("--- Path is not a file: " + path); |
| 157 | + } else { |
| 158 | + try { |
| 159 | + String contents = CharStreams.toString( |
| 160 | + new InputStreamReader(((IFile) resource).getContents(), StandardCharsets.UTF_8)); |
| 161 | + System.out.printf("---- Contents of %s ----\n%s\n----------------", |
| 162 | + path, contents); |
| 163 | + } catch (Exception ex) { |
| 164 | + System.err.println("--- Exception accesing file: " + path + ": " + ex); |
| 165 | + } |
| 166 | + } |
| 167 | + } |
| 168 | + |
141 | 169 | /** |
142 | 170 | * Create a CloudSdk RunConfiguration corresponding to the launch configuration and server |
143 | 171 | * defaults. Details are pulled from {@link ILaunchConfiguration#getAttributes() launch |
@@ -459,15 +487,25 @@ static String determinePageLocation(IServer server) { |
459 | 487 | @Override |
460 | 488 | protected IProject[] getBuildOrder(ILaunchConfiguration configuration, String mode) |
461 | 489 | throws CoreException { |
462 | | - IProject[] projects = getReferencedProjects(configuration); |
463 | | - return computeBuildOrder(projects); |
| 490 | + try { |
| 491 | + IProject[] projects = getReferencedProjects(configuration); |
| 492 | + return computeBuildOrder(projects); |
| 493 | + } catch (Throwable ex) { |
| 494 | + ex.printStackTrace(); |
| 495 | + throw ex; |
| 496 | + } |
464 | 497 | } |
465 | 498 |
|
466 | 499 | @Override |
467 | 500 | protected IProject[] getProjectsForProblemSearch(ILaunchConfiguration configuration, String mode) |
468 | 501 | throws CoreException { |
469 | | - IProject[] projects = getReferencedProjects(configuration); |
470 | | - return computeReferencedBuildOrder(projects); |
| 502 | + try { |
| 503 | + IProject[] projects = getReferencedProjects(configuration); |
| 504 | + return computeReferencedBuildOrder(projects); |
| 505 | + } catch (Throwable ex) { |
| 506 | + ex.printStackTrace(); |
| 507 | + throw ex; |
| 508 | + } |
471 | 509 | } |
472 | 510 |
|
473 | 511 | private static IProject[] getReferencedProjects(ILaunchConfiguration configuration) |
|
0 commit comments