use of org.eclipse.wst.common.project.facet.core.IFacetedProject in project liferay-ide by liferay.
the class LiferayTomcatUtil method canAddModule.
public static IStatus canAddModule(IModule module, IServer currentServer) {
IProject project = module.getProject();
if (project != null) {
IFacetedProject facetedProject = ProjectUtil.getFacetedProject(project);
if (facetedProject != null) {
IProjectFacet liferayFacet = ProjectUtil.getLiferayFacet(facetedProject);
if (liferayFacet != null) {
String facetId = liferayFacet.getId();
IRuntime runtime = null;
try {
runtime = ServerUtil.getRuntime(project);
} catch (CoreException e) {
}
if (runtime != null) {
IPluginPublisher pluginPublisher = LiferayServerCore.getPluginPublisher(facetId, runtime.getRuntimeType().getId());
if (pluginPublisher != null) {
IStatus status = pluginPublisher.canPublishModule(currentServer, module);
if (!status.isOK()) {
return status;
}
}
}
}
}
}
return Status.OK_STATUS;
}
use of org.eclipse.wst.common.project.facet.core.IFacetedProject in project mdw-designer by CenturyLinkCloud.
the class ConvertProjectAction method run.
@SuppressWarnings("restriction")
public void run(IAction action) {
if (selection != null) {
Object element = selection.getFirstElement();
try {
IProject project = (element instanceof IJavaProject) ? ((IJavaProject) element).getProject() : (IProject) element;
IFacetedProject facetedProject = ProjectFacetsManager.create(project);
if (facetedProject == null) {
org.eclipse.wst.common.project.facet.ui.internal.ConvertProjectToFacetedFormRunnable.runInProgressDialog(shell, project);
facetedProject = ProjectFacetsManager.create(project);
}
IFacetedProjectWorkingCopy workingCopy = org.eclipse.wst.common.project.facet.ui.internal.SharedWorkingCopyManager.getWorkingCopy(facetedProject);
workingCopy.addProjectFacet(ProjectFacetsManager.getProjectFacet("mdw.workflow").getDefaultVersion());
if (!facetedProject.hasProjectFacet(ProjectFacetsManager.getProjectFacet("jst.ear")) && !facetedProject.hasProjectFacet(ProjectFacetsManager.getProjectFacet("jst.web")) && !facetedProject.hasProjectFacet(ProjectFacetsManager.getProjectFacet("jst.utility"))) {
workingCopy.addProjectFacet(ProjectFacetsManager.getProjectFacet("jst.utility").getDefaultVersion());
}
PreferenceDialog dialog = PreferencesUtil.createPropertyDialogOn(shell, element, FACETS_PROP_PAGE_ID, null, null, PreferencesUtil.OPTION_NONE);
if (dialog != null) {
dialog.open();
}
} catch (Exception ex) {
PluginMessages.uiError(shell, ex, "Convert Workflow Project");
}
}
}
Aggregations