public static final Status execute(final NewLiferayPluginProjectOp op, final ProgressMonitor pm) { final IProgressMonitor monitor = ProgressMonitorBridge.create(pm); monitor.beginTask( "Creating Liferay plugin project (this process may take several minutes)", 100); //$NON-NLS-1$ Status retval = null; try { final NewLiferayProjectProvider<NewLiferayPluginProjectOp> projectProvider = op.getProjectProvider().content(true); // IDE-1306 If the user types too quickly all the model changes may not have propagated final Path projectLocation = op.getLocation().content(); updateLocation(op, projectLocation); final IStatus status = projectProvider.createNewProject(op, monitor); if (status.isOK()) { updateProjectPrefs(op); removeSampleCodeAndFiles(op); } retval = StatusBridge.create(status); } catch (Exception e) { final String msg = "Error creating Liferay plugin project."; // $NON-NLS-1$ ProjectCore.logError(msg, e); return Status.createErrorStatus(msg + " Please see Eclipse error log for more details.", e); } return retval; }
public static Set<String> getPossibleProfileIds( NewLiferayPluginProjectOp op, boolean includeNewProfiles) { final String activeProfilesValue = op.getActiveProfilesValue().content(); final Path currentLocation = op.getLocation().content(); final File param = currentLocation != null ? currentLocation.toFile() : null; final List<String> systemProfileIds = op.getProjectProvider().content().getData("profileIds", String.class, param); final ElementList<NewLiferayProfile> newLiferayProfiles = op.getNewLiferayProfiles(); final Set<String> possibleProfileIds = new HashSet<String>(); if (!CoreUtil.isNullOrEmpty(activeProfilesValue)) { final String[] vals = activeProfilesValue.split(","); if (!CoreUtil.isNullOrEmpty(vals)) { for (String val : vals) { if (!possibleProfileIds.contains(val) && !val.contains(StringPool.SPACE)) { possibleProfileIds.add(val); } } } } if (!CoreUtil.isNullOrEmpty(systemProfileIds)) { for (Object systemProfileId : systemProfileIds) { if (systemProfileId != null) { final String val = systemProfileId.toString(); if (!possibleProfileIds.contains(val) && !val.contains(StringPool.SPACE)) { possibleProfileIds.add(val); } } } } if (includeNewProfiles) { for (NewLiferayProfile newLiferayProfile : newLiferayProfiles) { final String newId = newLiferayProfile.getId().content(); if ((!CoreUtil.isNullOrEmpty(newId)) && (!possibleProfileIds.contains(newId)) && (!newId.contains(StringPool.SPACE))) { possibleProfileIds.add(newId); } } } return possibleProfileIds; }