use of org.eclipse.m2e.core.internal.project.ProjectConfigurationManager in project m2e-core-tests by tesla.
the class ImportSortOrderTestCase method testCollectionSortProject.
@Test
public void testCollectionSortProject() throws Exception {
ProjectConfigurationManager manager = (ProjectConfigurationManager) MavenPlugin.getProjectConfigurationManager();
List<IMavenProjectFacade> facades = createFacades();
manager.sortProjects(facades, monitor);
Map<String, Integer> aMap = new HashMap<>();
for (int i = 0; i < facades.size(); i++) {
aMap.put(facades.get(i).getArtifactKey().getArtifactId(), Integer.valueOf(i));
}
assertResultMap(aMap);
}
use of org.eclipse.m2e.core.internal.project.ProjectConfigurationManager in project tesb-studio-se by Talend.
the class ExportServiceAction method createSimpleProject.
private ITalendProcessJavaProject createSimpleProject(IProgressMonitor monitor, IProject p, Model model, ProjectImportConfiguration importConfiguration) throws CoreException {
final String[] directories = getFolders();
ProjectConfigurationManager projectConfigurationManager = (ProjectConfigurationManager) MavenPlugin.getProjectConfigurationManager();
String projectName = p.getName();
monitor.beginTask(NLS.bind(Messages.ProjectConfigurationManager_task_creating, projectName), 5);
monitor.subTask(Messages.ProjectConfigurationManager_task_creating_workspace);
ITalendProcessJavaProject javaProject = TalendJavaProjectManager.getTalendJobJavaProject(serviceItem.getProperty());
// ITalendProcessJavaProject javaProject =
// TalendJavaProjectManager.getTalendCodeJavaProject(ERepositoryObjectType.PROCESS);
p.open(monitor);
monitor.worked(1);
// hideNestedProjectsFromParents(Collections.singletonList(p));
monitor.worked(1);
monitor.subTask(Messages.ProjectConfigurationManager_task_creating_pom);
IFile pomFile = p.getFile(TalendMavenConstants.POM_FILE_NAME);
if (!pomFile.exists()) {
MavenPlugin.getMavenModelManager().createMavenModel(pomFile, model);
}
monitor.worked(1);
monitor.subTask(Messages.ProjectConfigurationManager_task_creating_folders);
for (int i = 0; i < directories.length; i++) {
ProjectConfigurationManager.createFolder(p.getFolder(directories[i]), false);
}
monitor.worked(1);
monitor.subTask(Messages.ProjectConfigurationManager_task_creating_project);
projectConfigurationManager.enableMavenNature(p, importConfiguration.getResolverConfiguration(), monitor);
monitor.worked(1);
return javaProject;
}
use of org.eclipse.m2e.core.internal.project.ProjectConfigurationManager in project m2e-core by eclipse-m2e.
the class UpdateMavenProjectJob method runInWorkspace.
@Override
public IStatus runInWorkspace(IProgressMonitor monitor) {
ProjectConfigurationManager configurationManager = (ProjectConfigurationManager) MavenPlugin.getProjectConfigurationManager();
setProperty(IProgressConstants.ACTION_PROPERTY, new OpenMavenConsoleAction());
MavenUpdateRequest request = new MavenUpdateRequest(projects, offline, forceUpdateDependencies);
Map<String, IStatus> updateStatus = configurationManager.updateProjectConfiguration(request, updateConfiguration, cleanProjects, refreshFromLocal, monitor);
Map<String, Throwable> errorMap = new LinkedHashMap<>();
ArrayList<IStatus> errors = new ArrayList<>();
for (Map.Entry<String, IStatus> entry : updateStatus.entrySet()) {
if (!entry.getValue().isOK()) {
errors.add(entry.getValue());
errorMap.put(entry.getKey(), new CoreException(entry.getValue()));
}
}
if (errorMap.size() > 0) {
handleErrors(errorMap);
}
IStatus status = Status.OK_STATUS;
if (errors.size() == 1) {
status = errors.get(0);
} else {
status = new MultiStatus(M2EUIPluginActivator.PLUGIN_ID, -1, errors.toArray(new IStatus[errors.size()]), Messages.UpdateSourcesAction_error_cannot_update, null);
}
return status;
}
use of org.eclipse.m2e.core.internal.project.ProjectConfigurationManager in project eclipse.jdt.ls by eclipse.
the class MavenBuildSupport method update.
@Override
public void update(IProject project, boolean force, IProgressMonitor monitor) throws CoreException {
if (!applies(project)) {
return;
}
Path pomPath = project.getFile("pom.xml").getLocation().toFile().toPath();
if (digestStore.updateDigest(pomPath) || force) {
JavaLanguageServerPlugin.logInfo("Starting Maven update for " + project.getName());
boolean updateSnapshots = JavaLanguageServerPlugin.getPreferencesManager() == null ? false : JavaLanguageServerPlugin.getPreferencesManager().getPreferences().isMavenUpdateSnapshots();
if (shouldCollectProjects()) {
Set<IProject> projectSet = new LinkedHashSet<>();
collectProjects(projectSet, project, monitor);
IProject[] projects = projectSet.toArray(new IProject[0]);
MavenUpdateRequest request = new MavenUpdateRequest(projects, MavenPlugin.getMavenConfiguration().isOffline(), updateSnapshots);
((ProjectConfigurationManager) configurationManager).updateProjectConfiguration(request, true, true, monitor);
} else {
MavenUpdateRequest request = new MavenUpdateRequest(project, MavenPlugin.getMavenConfiguration().isOffline(), updateSnapshots);
configurationManager.updateProjectConfiguration(request, monitor);
}
}
}
Aggregations