本文整理汇总了Java中org.eclipse.m2e.core.project.IProjectConfigurationManager类的典型用法代码示例。如果您正苦于以下问题:Java IProjectConfigurationManager类的具体用法?Java IProjectConfigurationManager怎么用?Java IProjectConfigurationManager使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IProjectConfigurationManager类属于org.eclipse.m2e.core.project包,在下文中一共展示了IProjectConfigurationManager类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: update
import org.eclipse.m2e.core.project.IProjectConfigurationManager; //导入依赖的package包/类
@Override
public void update(IProject project, IProgressMonitor monitor) throws CoreException {
if (!applies(project)) {
return;
}
JavaLanguageServerPlugin.logInfo("Starting Maven update for "+project.getName());
//TODO collect dependent projects and update them as well? i.e in case a parent project was modified
IProjectConfigurationManager configurationManager = MavenPlugin.getProjectConfigurationManager();
MavenUpdateRequest request = new MavenUpdateRequest(project, MavenPlugin.getMavenConfiguration().isOffline(), true);
configurationManager.updateProjectConfiguration(request, monitor);
}
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:12,代码来源:MavenBuildSupport.java
示例2: createMavenProject
import org.eclipse.m2e.core.project.IProjectConfigurationManager; //导入依赖的package包/类
/**
* Convert the standard Java project to a Maven project. This will remove the Default GWT sdk and
* instead use a GWT Maven sdk distribution. Using the Maven classpath container will allow for
* adding a specific GWT version easily.
*
* TODO Embue the WebAppCreator factory or create a Maven web app factory with Maven creation
* options.
*/
public static void createMavenProject(IProject project, String withGwtSdkVersion) throws Exception {
// Remove the default GWT sdk container from classpath, instead use Maven
IJavaProject javaProject = JavaCore.create(project);
IClasspathEntry[] entriesWithGwtContainer = javaProject.getRawClasspath();
IClasspathEntry[] entriesWithOutGwtContainer =
new IClasspathEntry[entriesWithGwtContainer.length - 1];
int b = 0;
for (int a = 0; a < entriesWithGwtContainer.length; a++) {
String path = entriesWithGwtContainer[a].getPath().toString();
if (!path.contains(GWTRuntimeContainer.CONTAINER_ID)) {
entriesWithOutGwtContainer[b] = entriesWithGwtContainer[a];
b++;
}
}
// Removing the GWT SDK classpath entry from project
javaProject.setRawClasspath(entriesWithOutGwtContainer, new NullProgressMonitor());
JobsUtilities.waitForIdle();
// Provide a pom.xml for a bare-bones configuration to convert standard project to Maven nature
URL url = GwtTestingPlugin.getDefault().getBundle().getResource("resources/pom.xml");
InputStream pomxmlStream = url.openStream();
pomxmlStream = changeGwtSdkVersionInPom(pomxmlStream, withGwtSdkVersion);
ResourceUtils.createFile(project.getFullPath().append("pom.xml"), pomxmlStream);
// Turn on the Maven nature
NatureUtils.addNature(project, MAVEN2_NATURE_ID);
JobsUtilities.waitForIdle();
// Maven update project will add the Maven dependencies to the classpath
IProjectConfigurationManager projectConfig = MavenPlugin.getProjectConfigurationManager();
projectConfig.updateProjectConfiguration(project, new NullProgressMonitor());
JobsUtilities.waitForIdle();
}
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:42,代码来源:GwtMavenTestingUtilities.java
示例3: runJob
import org.eclipse.m2e.core.project.IProjectConfigurationManager; //导入依赖的package包/类
private void runJob() {
Job job = new Job("Importing Maven Project") {
@Override
protected IStatus run(IProgressMonitor monitor) {
// Turn on the Maven nature
try {
NatureUtils.addNature(javaProject.getProject(), MavenUtils.MAVEN2_NATURE_ID);
} catch (CoreException e1) {
e1.printStackTrace();
return Status.CANCEL_STATUS;
}
Activator.log("MavenEnablingWebAppCreatorParicipant: Turning on Maven Nature");
// Maven update project will add the Maven dependencies to the classpath
IProjectConfigurationManager projectConfig = MavenPlugin.getProjectConfigurationManager();
try {
projectConfig.updateProjectConfiguration(javaProject.getProject(), monitor);
} catch (CoreException e) {
// TODO(${user}): Auto-generated catch block
e.printStackTrace();
}
return Status.OK_STATUS;
}
};
job.schedule();
}
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:28,代码来源:MavenEnablingWebAppCreatorParicipant.java
示例4: importMSF4JProject
import org.eclipse.m2e.core.project.IProjectConfigurationManager; //导入依赖的package包/类
public void importMSF4JProject(MSF4JProjectModel msf4jProjectModel, String projectName, File pomFile,
IProgressMonitor monitor) throws CoreException {
String operationText;
Set<MavenProjectInfo> projectSet = null;
if (pomFile.exists()) {
IProjectConfigurationManager configurationManager = MavenPlugin.getProjectConfigurationManager();
MavenModelManager mavenModelManager = MavenPlugin.getMavenModelManager();
LocalProjectScanner scanner = new LocalProjectScanner(
ResourcesPlugin.getWorkspace().getRoot().getLocation().toFile(), //
projectName, false, mavenModelManager);
operationText = "Scanning maven project.";
monitor.subTask(operationText);
try {
scanner.run(new SubProgressMonitor(monitor, 15));
projectSet = configurationManager.collectProjects(scanner.getProjects());
for (MavenProjectInfo projectInfo : projectSet) {
if (projectInfo != null) {
saveMavenParentInfo(projectInfo);
}
}
ProjectImportConfiguration configuration = new ProjectImportConfiguration();
operationText = "importing maven project.";
monitor.subTask(operationText);
if (projectSet != null && !projectSet.isEmpty()) {
List<IMavenProjectImportResult> importResults = configurationManager.importProjects(projectSet,
configuration, new SubProgressMonitor(monitor, 60));
}
} catch (InterruptedException | IOException | XmlPullParserException e) {
Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell();
MessageDialog errorDialog = new MessageDialog(shell, ERROR_TAG, null,
"Unable to import the project, Error occurred while importing the generated project.",
MessageDialog.ERROR, new String[] { OK_BUTTON }, 0);
errorDialog.open();
}
} else {
}
}
开发者ID:wso2,项目名称:msf4j,代码行数:40,代码来源:MSF4JProjectImporter.java
示例5: DataflowProjectCreator
import org.eclipse.m2e.core.project.IProjectConfigurationManager; //导入依赖的package包/类
private DataflowProjectCreator(IProjectConfigurationManager projectConfigurationManager) {
this.projectConfigurationManager = projectConfigurationManager;
template = DataflowProjectArchetype.STARTER_POM_WITH_PIPELINE;
}
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:6,代码来源:DataflowProjectCreator.java
示例6: MavenProjectImporter
import org.eclipse.m2e.core.project.IProjectConfigurationManager; //导入依赖的package包/类
public MavenProjectImporter(IProjectConfigurationManager configurationManager) {
this.configurationManager = configurationManager;
}
开发者ID:eclipse,项目名称:eclipse.jdt.ls,代码行数:4,代码来源:MavenProjectImporter.java
示例7: configure
import org.eclipse.m2e.core.project.IProjectConfigurationManager; //导入依赖的package包/类
@Override
public void configure() throws CoreException {
new Job("Configure project") {
@Override
protected IStatus run(IProgressMonitor monitor) {
monitor.beginTask("Configure project natures and builders", IProgressMonitor.UNKNOWN);
try {
final IProjectDescription projectDescription = project.getDescription();
final CodenvyProjectDescriptor projectDescriptor = CodenvyProjectDescriptor.load(getProject());
final String eclipseNature = ECLIPSE_NATURE_MAPPINGS.get(projectDescriptor.type);
if (eclipseNature != null && isNatureWithId(eclipseNature)) {
projectDescription.setNatureIds(concat(projectDescription.getNatureIds(), eclipseNature));
}
final String eclipseBuilder = ECLIPSE_BUILDER_MAPPINGS.get(projectDescriptor.type);
if (eclipseBuilder != null) {
final List<ICommand> builders = new ArrayList<>();
final ICommand command = projectDescription.newCommand();
command.setBuilderName(eclipseBuilder);
builders.add(command);
projectDescription.setBuildSpec(builders.toArray(new ICommand[0]));
}
// save nature and builders added to the project
project.setDescription(projectDescription, monitor);
final String codenvyBuilder = projectDescriptor.builders.get(DEFAULT_PROJECT_BUILDER);
if (MAVEN_BUILDER_NAME.equals(codenvyBuilder)) {
projectDescription.setNatureIds(concat(projectDescription.getNatureIds(), MAVEN_NATURE_ID));
project.setDescription(projectDescription, monitor);
final IProjectConfigurationManager projectConfigurationManager = MavenPlugin.getProjectConfigurationManager();
projectConfigurationManager.updateProjectConfiguration(project, monitor);
}
} catch (CoreException e) {
throw new RuntimeException(e);
} finally {
monitor.done();
}
return Status.OK_STATUS;
}
@Override
public boolean belongsTo(Object family) {
return FAMILY_CODENVY.equals(family);
}
}.schedule();
}
开发者ID:codenvy-legacy,项目名称:eclipse-plugin,代码行数:56,代码来源:CodenvyNature.java
注:本文中的org.eclipse.m2e.core.project.IProjectConfigurationManager类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论