From 9c466c78b19347797d294f66faf7db91596c40de Mon Sep 17 00:00:00 2001 From: rfeng Date: Tue, 23 Mar 2010 22:03:55 +0000 Subject: Reorder the methods git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@926811 13f79535-47bb-0310-9956-ffa450edef68 --- .../eclipse/workspace/WorkspaceConfigurator.java | 41 +++++++++++++++------- 1 file changed, 28 insertions(+), 13 deletions(-) (limited to 'sandbox/rfeng') 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) { -- cgit v1.2.3