Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpelder2009-03-26 17:37:12 -0400
committerpelder2009-03-26 17:37:12 -0400
commit2f1d06787a8236a156636887f5e7448c1bd109c2 (patch)
tree0a56bf32456239c99a7da90582bb628c8de2d60c
parente91d8fb9a33f5af66f576b0720b093fed084c2d9 (diff)
downloadorg.eclipse.jet-2f1d06787a8236a156636887f5e7448c1bd109c2.tar.gz
org.eclipse.jet-2f1d06787a8236a156636887f5e7448c1bd109c2.tar.xz
org.eclipse.jet-2f1d06787a8236a156636887f5e7448c1bd109c2.zip
[270184] JET Launch configuraitons don't check for errors or unsaved templates before launching
-rw-r--r--plugins/org.eclipse.jet/src/org/eclipse/jet/internal/launch/JET2TransformationDelegate.java81
1 files changed, 79 insertions, 2 deletions
diff --git a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/launch/JET2TransformationDelegate.java b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/launch/JET2TransformationDelegate.java
index 0d8f890..830f3c0 100644
--- a/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/launch/JET2TransformationDelegate.java
+++ b/plugins/org.eclipse.jet/src/org/eclipse/jet/internal/launch/JET2TransformationDelegate.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
+ * Copyright (c) 2005, 2009 IBM Corporation and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
@@ -17,6 +17,12 @@
package org.eclipse.jet.internal.launch;
+import java.util.HashSet;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Set;
+
+import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
@@ -29,9 +35,12 @@ import org.eclipse.core.runtime.Status;
import org.eclipse.debug.core.ILaunch;
import org.eclipse.debug.core.ILaunchConfiguration;
import org.eclipse.debug.core.model.ILaunchConfigurationDelegate;
+import org.eclipse.debug.core.model.ILaunchConfigurationDelegate2;
+import org.eclipse.debug.core.model.LaunchConfigurationDelegate;
import org.eclipse.jet.JET2Platform;
import org.eclipse.jet.internal.l10n.JET2Messages;
import org.eclipse.jet.internal.runtime.RuntimeLoggerContextExtender;
+import org.eclipse.jet.transform.IJETBundleDescriptor;
import org.eclipse.jet.transform.JETLaunchConstants;
import org.eclipse.osgi.util.NLS;
@@ -40,7 +49,7 @@ import org.eclipse.osgi.util.NLS;
* Create an Eclipse Launch delegate for JET2 Transformations
*
*/
-public class JET2TransformationDelegate implements ILaunchConfigurationDelegate
+public class JET2TransformationDelegate extends LaunchConfigurationDelegate implements ILaunchConfigurationDelegate, ILaunchConfigurationDelegate2
{
/**
@@ -66,6 +75,74 @@ public class JET2TransformationDelegate implements ILaunchConfigurationDelegate
process.run();
}
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.model.LaunchConfigurationDelegate#getBuildOrder(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String)
+ */
+ protected IProject[] getBuildOrder(ILaunchConfiguration configuration, String mode) throws CoreException
+ {
+ // Identify projects for which save and build should be done
+ return getReferencedWorkspaceProjects(configuration);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.debug.core.model.LaunchConfigurationDelegate#getProjectsForProblemSearch(org.eclipse.debug.core.ILaunchConfiguration, java.lang.String)
+ */
+ protected IProject[] getProjectsForProblemSearch(ILaunchConfiguration configuration, String mode) throws CoreException
+ {
+ // Identify projects for which save and build should be done
+ return getReferencedWorkspaceProjects(configuration);
+ }
+
+ /**
+ * @param configuration
+ * @return
+ * @throws CoreException
+ */
+ private IProject[] getReferencedWorkspaceProjects(ILaunchConfiguration configuration) throws CoreException
+ {
+ List projects = new LinkedList();
+ internalGetReferencedProjects(getId(configuration), projects, new HashSet());
+ return (IProject[])projects.toArray(new IProject[projects.size()]);
+ }
+
+ /**
+ * @param id
+ * @return
+ */
+ private IProject getJETProject(final String id)
+ {
+ final String projectName = JET2Platform.getJETBundleManager().getProjectForId(id);
+ final IProject project = projectName != null ? ResourcesPlugin.getWorkspace().getRoot().getProject(projectName) : null;
+ return project;
+ }
+
+ /**
+ * Compute the workspace projects refered to the the given JET transformation.
+ * @param id the JET transformation ID
+ * @param projects the list of IProjects to populate
+ * @param knownIds
+ */
+ private void internalGetReferencedProjects(String id, List projects, Set knownIds ) {
+ // Do a bit of recusive loop prevention...
+ if(knownIds.contains(id)) {
+ return; // already seen this ID...
+ } else {
+ knownIds.add(id);
+ }
+ final IJETBundleDescriptor descriptor = JET2Platform.getJETBundleManager().getDescriptor(id);
+ final IProject jetProject = getJETProject(id);
+ if(jetProject != null) {
+ projects.add(jetProject);
+ }
+
+ final String overridesId = descriptor.getOverridesId();
+ if(overridesId != null) {
+ internalGetReferencedProjects(overridesId, projects, knownIds);
+ }
+
+
+ }
+
private IResource getSource(ILaunchConfiguration configuration) throws CoreException
{
final String sourcePath = configuration.getAttribute(JETLaunchConstants.SOURCE, (String)null);

Back to the top