diff options
-rw-r--r-- | sandbox/rfeng/eclipse-workspace/src/main/java/org/apache/tuscany/eclipse/workspace/WorkspaceConfigurator.java | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/sandbox/rfeng/eclipse-workspace/src/main/java/org/apache/tuscany/eclipse/workspace/WorkspaceConfigurator.java b/sandbox/rfeng/eclipse-workspace/src/main/java/org/apache/tuscany/eclipse/workspace/WorkspaceConfigurator.java index ca1fbfa412..54f2ae9cbe 100644 --- a/sandbox/rfeng/eclipse-workspace/src/main/java/org/apache/tuscany/eclipse/workspace/WorkspaceConfigurator.java +++ b/sandbox/rfeng/eclipse-workspace/src/main/java/org/apache/tuscany/eclipse/workspace/WorkspaceConfigurator.java @@ -71,21 +71,35 @@ public class WorkspaceConfigurator implements IApplication { private final Object lock = new Object(); public Object start(final IApplicationContext appcontext) throws Exception { - IProgressMonitor monitor = createMonitor(); final String[] args = (String[])appcontext.getArguments().get(IApplicationContext.APPLICATION_ARGS); + configure(args); + return EXIT_OK; + } + private void configure(final String[] args) throws JavaModelException, InterruptedException, Exception, + CoreException, FileNotFoundException, ParserConfigurationException, SAXException, IOException { + IProgressMonitor monitor = createMonitor(); + + // Configure JDT configureJDT(); - setM2REPOClassPathVariable(args, monitor); + + // Set M2_REPO classpath variable + configureMavenClassPathVariable(args, monitor); + + // Schedule a job to set target platform setTargetPlatform(args, monitor); - synchronized (lock) { - lock.wait(60000); - } + + // Import/refresh projects configureWorkspace(args, monitor); - return EXIT_OK; + + // Start a clean/full build + buildWorkspace(monitor); + + // Save the workspace + workspace.save(true, monitor); } - private void setTargetPlatform(String args[], IProgressMonitor monitor) throws FileNotFoundException, - CoreException, ParserConfigurationException, SAXException, IOException { + private void setTargetPlatform(String args[], IProgressMonitor monitor) throws Exception { String targetFile = getOptionValue(args, TARGET_DEFINITION); if (targetFile == null) { return; @@ -135,6 +149,11 @@ public class WorkspaceConfigurator implements IApplication { } }); job.schedule(); + // Wait for the target platform to be set + synchronized (lock) { + lock.wait(60000); + } + } private IProgressMonitor createMonitor() { @@ -156,7 +175,7 @@ public class WorkspaceConfigurator implements IApplication { }; } - private IPath setM2REPOClassPathVariable(String args[], IProgressMonitor monitor) throws JavaModelException { + private IPath configureMavenClassPathVariable(String args[], IProgressMonitor monitor) throws JavaModelException { IPath var = JavaCore.getClasspathVariable(M2_REPO); if (var == null) { String localRepo = getOptionValue(args, MAVEN_LOCAL_REPO); @@ -183,10 +202,6 @@ public class WorkspaceConfigurator implements IApplication { configureProjects(sourceRoot, monitor); - // cleanProjects(monitor); - buildWorkspace(monitor); - - workspace.save(true, monitor); } private String getOptionValue(final String[] args, String option) { |