use of org.eclipse.wst.common.project.facet.core.IFacetedProject in project sling by apache.
the class ConfigurationHelper method convertToLaunchpadProject.
public static void convertToLaunchpadProject(IProject project, IPath modelsDirectoryPath) throws CoreException {
IProjectFacet facet = ProjectFacetsManager.getProjectFacet("sling.launchpad");
IFacetedProject fp2 = ProjectFacetsManager.create(project, true, null);
fp2.installProjectFacet(facet.getLatestVersion(), null, null);
project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
if (modelsDirectoryPath != null) {
ProjectUtil.setProvisioningModelPath(project, modelsDirectoryPath);
}
}
use of org.eclipse.wst.common.project.facet.core.IFacetedProject in project sling by apache.
the class ConfigurationHelper method convertToBundleProject.
public static void convertToBundleProject(IProject aBundleProject) throws CoreException {
IProjectFacet slingContentFacet = ProjectFacetsManager.getProjectFacet("sling.bundle");
IFacetedProject fp2 = ProjectFacetsManager.create(aBundleProject, true, null);
fp2.installProjectFacet(slingContentFacet.getLatestVersion(), null, null);
aBundleProject.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
}
use of org.eclipse.wst.common.project.facet.core.IFacetedProject in project liferay-ide by liferay.
the class LiferayProjectPropertyPage method performOk.
@Override
public boolean performOk() {
final IProject proj = getProject();
if (SDKUtil.isSDKProject(proj)) {
if (_runtimeCombo != null) {
final String selectedRuntimeName = this._runtimeCombo.getText();
if (!CoreUtil.isNullOrEmpty(selectedRuntimeName)) {
final org.eclipse.wst.common.project.facet.core.runtime.IRuntime runtime = RuntimeManager.getRuntime(selectedRuntimeName);
if (runtime != null) {
final IFacetedProject fProject = ProjectUtil.getFacetedProject(getProject());
final org.eclipse.wst.common.project.facet.core.runtime.IRuntime primaryRuntime = fProject.getPrimaryRuntime();
if (!runtime.equals(primaryRuntime)) {
Job job = new WorkspaceJob("Setting targeted runtime for project.") {
@Override
public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
IStatus retval = Status.OK_STATUS;
try {
fProject.setTargetedRuntimes(Collections.singleton(runtime), monitor);
fProject.setPrimaryRuntime(runtime, monitor);
} catch (Exception e) {
retval = ProjectUI.createErrorStatus("Could not set targeted runtime", e);
}
return retval;
}
};
job.schedule();
}
} else {
return false;
}
}
}
final String sdkName = this._sdkLabel.getText();
if (!CoreUtil.isNullOrEmpty(sdkName)) {
try {
final IEclipsePreferences prefs = new ProjectScope(getProject()).getNode(SDKCorePlugin.PLUGIN_ID);
prefs.put(SDKCorePlugin.PREF_KEY_SDK_NAME, sdkName);
prefs.flush();
} catch (BackingStoreException bse) {
ProjectCore.logError("Unable to persist sdk name to project " + getProject(), bse);
}
}
}
return true;
}
use of org.eclipse.wst.common.project.facet.core.IFacetedProject in project liferay-ide by liferay.
the class LiferayProjectPropertyPage method getFacetedProject.
protected IFacetedProject getFacetedProject() {
IFacetedProject retval = null;
IProject project = getProject();
if (project != null) {
retval = ProjectUtil.getFacetedProject(project);
}
return retval;
}
use of org.eclipse.wst.common.project.facet.core.IFacetedProject in project liferay-ide by liferay.
the class SDKProjectConvertOperation method convertExistingProject.
protected IProject convertExistingProject(ProjectRecord record, IProgressMonitor monitor) throws CoreException {
String projectName = record.getProjectName();
IWorkspace workspace = ResourcesPlugin.getWorkspace();
IProject project = workspace.getRoot().getProject(projectName);
if (record.description == null) {
// error case
record.description = workspace.newProjectDescription(projectName);
IPath locationPath = new Path(record.projectSystemFile.getAbsolutePath());
if (Platform.getLocation().isPrefixOf(locationPath)) {
record.description.setLocation(null);
} else {
record.description.setLocation(locationPath);
}
} else {
record.description.setName(projectName);
}
monitor.beginTask(Msgs.importingProject, 100);
project.open(IResource.FORCE, CoreUtil.newSubMonitor(monitor, 70));
IFacetedProject fProject = ProjectFacetsManager.create(project, true, monitor);
FacetedProjectWorkingCopy fpwc = new FacetedProjectWorkingCopy(fProject);
String sdkLocation = getDataModel().getStringProperty(SDK_LOCATION);
IRuntime runtime = (IRuntime) model.getProperty(IFacetProjectCreationDataModelProperties.FACET_RUNTIME);
String pluginType = ProjectUtil.guessPluginType(fpwc);
SDKPluginFacetUtil.configureProjectAsRuntimeProject(fpwc, runtime, pluginType, sdkLocation, record);
fpwc.commitChanges(monitor);
monitor.done();
return project;
}
Aggregations