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


Java ProjectConfigurationRequest类代码示例

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


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

示例1: updateProjectConfiguration

import org.eclipse.m2e.core.project.configurator.ProjectConfigurationRequest; //导入依赖的package包/类
/**
 * Update the new created project
 */
private void updateProjectConfiguration(IMavenProjectFacade facade) {
	ProjectRegistryManager projectManager = MavenPluginActivator.getDefault().getMavenProjectManagerImpl();
	try {
		MavenProject mavenProject = facade.getMavenProject(new NullProgressMonitor());
		ProjectConfigurationRequest request = new ProjectConfigurationRequest(facade, mavenProject);
		MavenExecutionContext executionContext = projectManager.createExecutionContext(facade.getPom(),
				facade.getResolverConfiguration());

		executionContext.execute(mavenProject, new ICallable<Void>() {
			public Void call(IMavenExecutionContext context, IProgressMonitor monitor) throws CoreException {
				ILifecycleMapping lifecycleMapping = LifecycleMappingFactory.getLifecycleMapping(facade);

				if (lifecycleMapping != null) {
					lifecycleMapping.configure(request, monitor);

					LifecycleMappingConfiguration.persist(request.getMavenProjectFacade(), monitor);
				}
				return null;
			}
		}, new NullProgressMonitor());
	} catch (CoreException e) {
		e.printStackTrace();
	}
}
 
开发者ID:dice-project,项目名称:DICE-Platform,代码行数:28,代码来源:QualityTestingNewProjectWizard.java

示例2: 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

示例3: 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

示例4: 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

示例5: doConfigure

import org.eclipse.m2e.core.project.configurator.ProjectConfigurationRequest; //导入依赖的package包/类
@Override
protected void doConfigure(final MavenProject mavenProject, IProject project, ProjectConfigurationRequest unused,
    final IProgressMonitor monitor) throws CoreException {
  Activator.log("MavenProjectConfigurator.doConfigure() invoked");

  // configure the GWT Nature
  boolean hasGwtNature = configureNature(project, mavenProject, GWTNature.NATURE_ID, true, new NatureCallback() {
    @Override
    protected void beforeAddingNature() {
      configureGwtProject(mavenProject, monitor);
    }
  }, monitor);

  // retrieve gwt-maven-plugin configuration if it exists
  Plugin gwtMavenPlugin = getGwtMavenPlugin(mavenProject);
  Xpp3Dom mavenConfig = gwtMavenPlugin == null ? null : (Xpp3Dom) gwtMavenPlugin.getConfiguration();

  // Persist GWT nature settings
  if (!hasGwtNature) {
    Activator.log("MavenProjectConfigurator: Skipping Maven configuration because GWT nature is false. hasGWTNature="
        + hasGwtNature);
    // Exit no maven plugin found
    return;
  }

  try {
    persistGwtNatureSettings(project, mavenProject, mavenConfig);
  } catch (BackingStoreException exception) {
    Activator.logError("MavenProjectConfigurator: Problem configuring maven project.", exception);
  }
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:32,代码来源:MavenProjectConfigurator.java

示例6: executeNativeDependenciesCopy

import org.eclipse.m2e.core.project.configurator.ProjectConfigurationRequest; //导入依赖的package包/类
private void executeNativeDependenciesCopy(ProjectConfigurationRequest request, IProgressMonitor progressMonitor) throws CoreException {
	List<MojoExecution> executions = getMojoExecutions(request, progressMonitor);

	if (executions.size() != 1) {
		throw new IllegalArgumentException();
	}

	MojoExecution execution = executions.get(0);

	maven.execute(request.getMavenSession(), execution, progressMonitor);
}
 
开发者ID:virtuoushub,项目名称:mavennatives,代码行数:12,代码来源:NativesConfigurator.java

示例7: configureRawClasspath

import org.eclipse.m2e.core.project.configurator.ProjectConfigurationRequest; //导入依赖的package包/类
public void configureRawClasspath(ProjectConfigurationRequest request, IClasspathDescriptor classpath, IProgressMonitor monitor) throws CoreException {
	logger.info("Configuring Raw Classpath");
	MavenProject mavenProject = request.getMavenProject();
	String relativeNativesPath = NativesConfigExtractor.getNativesPath(mavenProject);

	String nativesPath = request.getProject().getFullPath().makeRelative().append(relativeNativesPath).toOSString();
	
	addNativesPathToMavenContainer(classpath.getEntryDescriptors(),nativesPath);
}
 
开发者ID:virtuoushub,项目名称:mavennatives,代码行数:10,代码来源:NativesConfigurator.java

示例8: configureRawClasspath

import org.eclipse.m2e.core.project.configurator.ProjectConfigurationRequest; //导入依赖的package包/类
@Override
public void configureRawClasspath(final ProjectConfigurationRequest request, final IClasspathDescriptor classpath,
        final IProgressMonitor monitor) throws CoreException {
    final IMavenProjectFacade mavenProjectFacade = request.getMavenProjectFacade();

    /*
     * First check for the property for one global path for all classpaths.
     */

    if (setContainerClasspathEeaPath(classpath, mavenProjectFacade, M2E_JDT_ANNOTATIONPATH, Optional.empty())) {
        return;
    }

    /*
     * If the above has not been set, check if there are properties for specific classpaths.
     */

    boolean hasProp = false;
    hasProp |= setContainerClasspathEeaPath(classpath, mavenProjectFacade, M2E_EEA_ANNOTATIONPATH_JRE,
            Optional.of(JRE_CONTAINER));
    hasProp |= setContainerClasspathEeaPath(classpath, mavenProjectFacade, M2E_EEA_ANNOTATIONPATH_MVN,
            Optional.of(MAVEN_CLASSPATH_CONTAINER));
    hasProp |= setContainerClasspathEeaPath(classpath, mavenProjectFacade, M2E_EEA_ANNOTATIONPATH_PDE,
            Optional.of(PDE_REQUIRED_PLUGINS));
    if (hasProp) {
        return;
    }

    /*
     * If the above has not been set, check the dependencies.
     */

    // Find the JRE's EEA among the dependencies to set it....
    // Note that at this stage of M2E we have to use the Maven project dependencies,
    // and cannot rely on the dependencies already being on the IClasspathDescriptor
    // (that happens in configureClasspath() not here in configureRawClasspath())
    //

    final Optional<String> cpe = Optional.of(JRE_CONTAINER);

    final MavenProject mavenProject = request.getMavenProject();
    for (final Dependency dependency : mavenProject.getDependencies()) {
        // Filter by "*-eea" artifactId naming convention, just for performance
        if (!dependency.getArtifactId().endsWith("-eea")) {
            continue;
        }
        final Artifact artifact = maven.resolve(dependency.getGroupId(), dependency.getArtifactId(),
                dependency.getVersion(), dependency.getType(), dependency.getClassifier(),
                mavenProject.getRemoteArtifactRepositories(), monitor);
        if (artifact != null && artifact.isResolved()) {
            final File eeaProjectOrJarFile = artifact.getFile();
            if (getExternalAnnotationMapping(eeaProjectOrJarFile).contains(JAVA_GAV)) {
                final IPath iPath = getProjectPathFromAbsoluteLocationIfPossible(eeaProjectOrJarFile);
                setContainerClasspathExternalAnnotationsPath(classpath, iPath.toString(), cpe);
                return;
            }
        }
    }
}
 
开发者ID:lastnpe,项目名称:eclipse-external-annotations-m2e-plugin,代码行数:60,代码来源:ClasspathConfigurator.java

示例9: configure

import org.eclipse.m2e.core.project.configurator.ProjectConfigurationRequest; //导入依赖的package包/类
@Override
public void configure(ProjectConfigurationRequest request, IProgressMonitor monitor) throws CoreException {
  Activator.log("MavenProjectConfigurator.configure invoked");
  super.configure(request, monitor);
}
 
开发者ID:gwt-plugins,项目名称:gwt-eclipse-plugin,代码行数:6,代码来源:MavenProjectConfigurator.java

示例10: 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

示例11: unconfigure

import org.eclipse.m2e.core.project.configurator.ProjectConfigurationRequest; //导入依赖的package包/类
@Override
public void unconfigure(ProjectConfigurationRequest request, IProgressMonitor monitor) throws CoreException {
	super.unconfigure(request, monitor);
	// removeMavenClasspathContainer(request.getProject());
}
 
开发者ID:maven-nar,项目名称:m2e-nar,代码行数:6,代码来源:CProjectConfigurator.java

示例12: configure

import org.eclipse.m2e.core.project.configurator.ProjectConfigurationRequest; //导入依赖的package包/类
@Override
public void configure(ProjectConfigurationRequest request, IProgressMonitor progressMonitor) throws CoreException {
	
	logger.info("Configuring mvn natives");

	MavenProject mavenProject = request.getMavenProject();

	if (NativesConfigExtractor.isMavenNativesProject(mavenProject)) {

		String relativeNativesPath = NativesConfigExtractor.getNativesPath(mavenProject);

		IPath nativesPath = request.getProject().getFullPath().makeRelative().append(relativeNativesPath);

		logger.info("MavenNatives - Setting nativesPath: " + nativesPath.toString());

		executeNativeDependenciesCopy(request, progressMonitor);

		request.getProject().getFolder(relativeNativesPath).refreshLocal(IResource.DEPTH_INFINITE, progressMonitor);

		logger.info("MavenNatives - Done");

	} else {
		logger.info("MavenNatives - Is not a MavenNatives project");
	}

}
 
开发者ID:virtuoushub,项目名称:mavennatives,代码行数:27,代码来源:NativesConfigurator.java

示例13: 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

示例14: configure

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

}
 
开发者ID:dashie,项目名称:m2e-plugins,代码行数:6,代码来源:Configurator.java

示例15: configure

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

	final IMavenProjectFacade mavenProjectFacade = request.getMavenProjectFacade();
	final IProject project = mavenProjectFacade.getProject();
	final IMavenProjectRegistry projectRegistry = MavenPlugin.getMavenProjectRegistry();

	Set<String> bundleSet = getResourceBundles(mavenProjectFacade, monitor);
	if (bundleSet.isEmpty()) {
		return;
	}

	IProjectDescription description = project.getDescription();

	IProject[] oldRefs = description.getReferencedProjects();
	Set<IProject> refs = new HashSet<IProject>();
	if (oldRefs != null) {
		refs.addAll(Arrays.asList(oldRefs));
	}

	IMavenProjectFacade[] mavenProjectFacades = projectRegistry.getProjects();
	for (IMavenProjectFacade facade : mavenProjectFacades) {
		IProject pi = facade.getProject();
		if (pi.equals(project)) {
			continue;
		}
		MavenProject mp = facade.getMavenProject(null);
		if (mp == null) {
			log.error("configure: [" + project + "] maven project reference is null " + pi);
		} else {
			if (addToReferences(mp, bundleSet)) {
				log.info("configure: [" + project + "] add maven project reference to " + pi);
				refs.add(pi);
			}
		}
	}

	IProject[] array = refs.toArray(new IProject[refs.size()]);
	description.setReferencedProjects(array);
	project.setDescription(description, monitor);
}
 
开发者ID:dashie,项目名称:m2e-plugins,代码行数:42,代码来源:Configurator.java


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