Skip to main content
summaryrefslogtreecommitdiffstats
blob: a15dba8220804b1e086171c9b68f431481cd583d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*******************************************************************************
 * Copyright (c) 2009, 2012 Oracle. 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:
 *     Oracle - initial API and implementation
 ******************************************************************************/
package org.eclipse.jpt.jpa.core.internal.facet;

import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.jpt.jpa.core.JpaProject;
import org.eclipse.jpt.jpa.core.internal.plugin.JptJpaCorePlugin;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;

public class JpaFacetVersionChangeDelegate
	extends JpaFacetActionDelegate
{
	@Override
	protected void execute_(
			IProject project, IProjectFacetVersion fv, 
			Object config, IProgressMonitor monitor) throws CoreException
	{
		SubMonitor sm = SubMonitor.convert(monitor, 2);
		super.execute_(project, fv, config, sm.newChild(1));
		this.rebuildJpaProject(project);
		sm.worked(1);
		// nothing further to do here *just* yet
	}

	protected void rebuildJpaProject(IProject project) throws CoreException {
		try {
			this.rebuildJpaProject_(project);
		} catch (InterruptedException ex) {
			Thread.currentThread().interrupt();
			throw new CoreException(JptJpaCorePlugin.instance().buildStatus(IStatus.CANCEL, ex));
		}
	}

	protected void rebuildJpaProject_(IProject project) throws InterruptedException {
		((JpaProject.Reference) project.getAdapter(JpaProject.Reference.class)).rebuild();
	}
}

Back to the top