| /****************************************************************************** |
| * Copyright (c) 2005 BEA Systems, Inc. |
| * 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 |
| * http://www.eclipse.org/legal/epl-v10.html |
| * |
| * Contributors: |
| * Konstantin Komissarchik - initial API and implementation |
| ******************************************************************************/ |
| |
| package org.eclipse.jst.j2ee.internal.web.classpath; |
| |
| import org.eclipse.core.resources.ResourcesPlugin; |
| import org.eclipse.core.resources.WorkspaceJob; |
| import org.eclipse.core.runtime.CoreException; |
| import org.eclipse.core.runtime.IPath; |
| import org.eclipse.core.runtime.IProgressMonitor; |
| import org.eclipse.core.runtime.IStatus; |
| import org.eclipse.core.runtime.Status; |
| import org.eclipse.jdt.core.IJavaProject; |
| import org.eclipse.jst.common.jdt.internal.classpath.FlexibleProjectContainerInitializer; |
| |
| /** |
| * @author <a href="mailto:kosta@bea.com">Konstantin Komissarchik</a> |
| */ |
| |
| public final class WebAppContainerInitializer |
| |
| extends FlexibleProjectContainerInitializer |
| |
| { |
| public void initialize(final IPath path, final IJavaProject jproj) |
| |
| throws CoreException |
| |
| { |
| WorkspaceJob job = new WorkspaceJob("Initializing Web Container") { |
| |
| public IStatus runInWorkspace(IProgressMonitor monitor) { |
| try { |
| new WebAppContainer(path, jproj).install(); |
| } |
| |
| catch (Exception e) { |
| return Status.CANCEL_STATUS; |
| } |
| return Status.OK_STATUS; |
| } |
| }; |
| job.setRule(ResourcesPlugin.getWorkspace().getRuleFactory().buildRule()); |
| job.schedule(); |
| } |
| |
| } |