当前位置: 首页>>代码示例>>Java>>正文


Java ProjectConfigurationRequest.getProject方法代码示例

本文整理汇总了Java中org.eclipse.m2e.core.project.configurator.ProjectConfigurationRequest.getProject方法的典型用法代码示例。如果您正苦于以下问题:Java ProjectConfigurationRequest.getProject方法的具体用法?Java ProjectConfigurationRequest.getProject怎么用?Java ProjectConfigurationRequest.getProject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.m2e.core.project.configurator.ProjectConfigurationRequest的用法示例。


在下文中一共展示了ProjectConfigurationRequest.getProject方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: configure

import org.eclipse.m2e.core.project.configurator.ProjectConfigurationRequest; //导入方法依赖的package包/类
/**
 * {@inheritDoc} In the case of a non-GWT project, we do nothing.
 */
@Override
public void configure(ProjectConfigurationRequest request, IProgressMonitor monitor)
    throws CoreException {
  Activator.log("AbstractMavenProjectConfigurator.configure request=" + request);
  // Sometimes M2Eclipse calls this method with request == null. Why?
  if (request != null) {
    MavenProject mavenProject = request.getMavenProject();
    Activator.log("AbstractMavenProjectConfigurator.configure mavenProject=" + mavenProject
        + " getGWtMavenPlugin=" + getGwtMavenPlugin(mavenProject));

    if (mavenProject != null && getGwtMavenPlugin(mavenProject) != null) {
      IProject project = request.getProject();

      // Make sure it is a java project, GWT Maven Plugin 2 gwt-app will not auto configure as one
      NatureUtils.addNature(project, JavaCore.NATURE_ID);

      doConfigure(mavenProject, project, request, monitor);
    }
  }
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:24,代码来源:AbstracMavenProjectConfigurator.java

示例2: configure

import org.eclipse.m2e.core.project.configurator.ProjectConfigurationRequest; //导入方法依赖的package包/类
@Override
public void configure(ProjectConfigurationRequest request, IProgressMonitor monitor) throws CoreException {
  GwtWtpPlugin.logMessage("WtpMavenProjectConfigurator.doConfigure() invoked");

  // Given a pom.xml configuration
  Model pom = request.getMavenProject().getModel();

  // When the GWT plugin exists in POM
  if (isGwtProject(pom)) {
    IProject eclipseProject = request.getProject();
    IFacetedProject facetedProject = ProjectFacetsManager.create(eclipseProject);

    // Then add GWT facet
    new GwtMavenFacetManager().addGwtFacet(pom, facetedProject, monitor);
  }
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:17,代码来源:WtpMavenProjectConfigurator.java

示例3: configure

import org.eclipse.m2e.core.project.configurator.ProjectConfigurationRequest; //导入方法依赖的package包/类
@Override
public void configure(ProjectConfigurationRequest request, IProgressMonitor monitor)
    throws CoreException {
  IProject project = request.getProject();
  IFacetedProject facetedProject = ProjectFacetsManager.create(project);
  if (facetedProject == null || facetedProject.hasProjectFacet(AppEngineStandardFacet.FACET)) {
    return;
  }
  IFile appEngineWebXml = WebProjectUtil.findInWebInf(project, new Path("appengine-web.xml"));
  if (appEngineWebXml == null || !appEngineWebXml.exists()) {
    return;
  }
  AppEngineStandardFacet.installAppEngineFacet(facetedProject, true, monitor);
}
 
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-eclipse,代码行数:15,代码来源:AppEngineStandardProjectDetector.java

示例4: configure

import org.eclipse.m2e.core.project.configurator.ProjectConfigurationRequest; //导入方法依赖的package包/类
@Override
public void configure(ProjectConfigurationRequest request, IProgressMonitor monitor) throws CoreException {

	final ConfiguratorContext context = new ConfiguratorContext(maven, projectManager);

	IProject project = request.getProject();

	monitor.setTaskName(Messages.CProjectConfigurator_task_name + project.getName());

	logger.info("configure");

	ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();

	// Set the first created configuration as active.
	boolean setActive = true;
	final IMavenProjectFacade facade = request.getMavenProjectFacade();
	List<NarExecution> narExecutions = MavenUtils.buildCompileNarExecutions(context, facade, monitor);
	narExecutions.addAll(MavenUtils.buildTestCompileNarExecutions(context, facade, monitor));
	for (NarExecution narSettings : narExecutions) {
		if (!narSettings.isSkip()) {
			final String os = narSettings.getOS();
			final String linkerName = narSettings.getLinkerName();
			final AbstractSettingsSynchroniser synchro = SynchroniserFactory.getSettingsSynchroniser(os, linkerName);
			final String toolchain = synchro.getToolchain();
			for (NarBuildArtifact artifactSettings : narSettings.getArtifactSettings()) {
				final String configName = artifactSettings.getConfigName();
				final String cdtArtefactType = CdtUtils.convertArtefactType(artifactSettings.getType());
				IToolChain tc = getToolChain(toolchain, cdtArtefactType);
				ICProjectDescription desc = getCdtProject(project, tc, cdtArtefactType, monitor);
				ICConfigurationDescription cfg = getCdtMavenConfig(project, desc, tc, cdtArtefactType, configName, setActive, monitor);
				setActive = false;
				synchro.fullSync(cfg, artifactSettings);
				mngr.setProjectDescription(project, desc);
			}
		}
	}

	AbstractProjectConfigurator jConfig = LifecycleMappingFactory.createProjectConfigurator(JAVA_CONFIGURATOR_ID);
	jConfig.configure(request, monitor);

	// ensure CDT builder is after the Maven one
	boolean changed = false;
	IProjectDescription description = project.getDescription();
	ICommand cdtBuilder = null;
	ICommand mavenBuilder = null;
	ArrayList<ICommand> newSpec = new ArrayList<ICommand>();
	for (ICommand command : description.getBuildSpec()) {
		if (ManagedCProjectNature.getBuilderID().equals(command.getBuilderName()) && mavenBuilder == null) {
			cdtBuilder = command;
		} else {
			newSpec.add(command);
		}
		if (IMavenConstants.BUILDER_ID.equals(command.getBuilderName())) {
			mavenBuilder = command;
			if (cdtBuilder != null) {
				newSpec.add(cdtBuilder);
				changed = true;
			}
		}
	}
	if (changed) {
		description.setBuildSpec(newSpec.toArray(new ICommand[newSpec.size()]));
		project.setDescription(description, monitor);
	}
}
 
开发者ID:maven-nar,项目名称:m2e-nar,代码行数:66,代码来源:CProjectConfigurator.java

示例5: configure

import org.eclipse.m2e.core.project.configurator.ProjectConfigurationRequest; //导入方法依赖的package包/类
@Override
public void configure(ProjectConfigurationRequest request,
		IProgressMonitor monitor) throws CoreException {
	IProject eclipseProject = request.getProject();

	if (eclipseProject.hasNature(JavaCore.NATURE_ID)) {
		IJavaProject javaProject = JavaCore.create(eclipseProject);

		IMavenProjectFacade mavenProject = request.getMavenProjectFacade();
		List<MojoExecution> executions = mavenProject.getMojoExecutions(
				"com.marvinformatics.formatter", "formatter-maven-plugin",
				monitor, "validate");

		MojoExecution execution = executions.get(0);
		Xpp3Dom cfg = execution.getConfiguration();
		String javaConfigFile = cfg.getChild("configFile").getValue();
		if (javaConfigFile == null
				|| "${configfile}".equals(javaConfigFile))
			javaConfigFile = "src/config/eclipse/formatter/java.xml";

		IFile cfgFile = eclipseProject.getFile(javaConfigFile);

		if (!cfgFile.exists())
			return;

		InputStream content = cfgFile.getContents();
		BufferedReader reader = new BufferedReader(new InputStreamReader(
				content));
		String line = null;
		Map<String, String> opts = javaProject.getOptions(false);
		try {
			while ((line = reader.readLine()) != null) {
				// <setting
				// id="org.eclipse.jdt.core.formatter.comment.insert_new_line_before_root_tags"
				// value="insert" />
				if (!line.contains("<setting "))
					continue;

				int first = line.indexOf("id=\"") + 4;
				String id = line.substring(first, line.indexOf('"', first));
				first = line.indexOf("value=\"") + 7;
				String value = line.substring(first,
						line.indexOf('"', first));
				opts.put(id, value);
			}
		} catch (IOException e) {
		}

		javaProject.setOptions(opts);
	}
	// jsdtConfigFile = cfg.getChild("configJsFile").getValue();
	// src/config/eclipse/formatter/javascript.xml
}
 
开发者ID:ContaAzul,项目名称:maven-formatter-plugin-old,代码行数:54,代码来源:FormatterProjectConfigurator.java


注:本文中的org.eclipse.m2e.core.project.configurator.ProjectConfigurationRequest.getProject方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。