org.eclipse.m2e.core.project.configurator.ProjectConfigurationRequest Java Examples
The following examples show how to use
org.eclipse.m2e.core.project.configurator.ProjectConfigurationRequest.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AppEngineStandardProjectDetector.java From google-cloud-eclipse with Apache License 2.0 | 6 votes |
@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 = AppEngineConfigurationUtil.findConfigurationFile( project, new Path("appengine-web.xml")); // $NON-NLS-1$ if (appEngineWebXml == null || !appEngineWebXml.exists()) { return; } AppEngineStandardFacet.installAppEngineFacet(facetedProject, true, monitor); }
Example #2
Source File: BinFolderConfigurator.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
@Override public void configure(ProjectConfigurationRequest request, IProgressMonitor monitor) throws CoreException { IProject project = request.getProject(); if (compileToBin(project)) { IPath projectRoot = project.getFullPath(); IPath binPath = projectRoot.append("bin"); IPath binTestPath = projectRoot.append("bin-test"); IJavaProject javaProject = JavaCore.create(project); javaProject.setOutputLocation(binPath, monitor); IClasspathEntry[] rawClasspath = javaProject.getRawClasspath(); for(int i = 0; i < rawClasspath.length; i++) { IClasspathEntry entry = rawClasspath[i]; if (entry.getEntryKind() == IClasspathEntry.CPE_SOURCE) { if (isTest(entry)) { rawClasspath[i] = copyWithOutput(entry, binTestPath); } else { rawClasspath[i] = copyWithOutput(entry, binPath); } } } javaProject.setRawClasspath(rawClasspath, monitor); } }
Example #3
Source File: XtextProjectConfigurator.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
private void configureOutlet(IEclipsePreferences languagePreferences, OutputConfiguration mavenConfiguration, ProjectConfigurationRequest request) { org.eclipse.xtext.generator.OutputConfiguration configuration = mavenConfiguration.toGeneratorConfiguration(); languagePreferences.put(getKey(configuration, OUTPUT_NAME), configuration.getName()); languagePreferences.put(getKey(configuration, OUTPUT_DESCRIPTION), configuration.getDescription()); languagePreferences.put(getKey(configuration, OUTPUT_DIRECTORY), makeProjectRelative(configuration.getOutputDirectory(), request)); languagePreferences.putBoolean(getKey(configuration, OUTPUT_DERIVED), configuration.isSetDerivedProperty()); languagePreferences.putBoolean(getKey(configuration, OUTPUT_CREATE_DIRECTORY), configuration.isCreateOutputDirectory()); languagePreferences.putBoolean(getKey(configuration, OUTPUT_CLEAN_DIRECTORY), configuration.isCanClearOutputDirectory()); languagePreferences.putBoolean(getKey(configuration, OUTPUT_OVERRIDE), configuration.isOverrideExistingResources()); languagePreferences.putBoolean(getKey(configuration, OUTPUT_CLEANUP_DERIVED), configuration.isCleanUpDerivedResources()); languagePreferences.putBoolean(getKey(configuration, INSTALL_DSL_AS_PRIMARY_SOURCE), configuration.isInstallDslAsPrimarySource()); languagePreferences.putBoolean(getKey(configuration, HIDE_LOCAL_SYNTHETIC_VARIABLES), configuration.isHideSyntheticLocalVariables()); languagePreferences.putBoolean(getKey(configuration, OUTPUT_KEEP_LOCAL_HISTORY), configuration.isKeepLocalHistory()); languagePreferences.putBoolean(getKey(configuration, USE_OUTPUT_PER_SOURCE_FOLDER), configuration.isUseOutputPerSourceFolder()); for (SourceMapping sourceMapping : configuration.getSourceMappings()) { languagePreferences.put(getOutputForSourceFolderKey(configuration, makeProjectRelative(sourceMapping.getSourceFolder(), request)), makeProjectRelative(Strings.nullToEmpty(sourceMapping.getOutputDirectory()), request)); languagePreferences.putBoolean(getIgnoreSourceFolderKey(configuration, makeProjectRelative(sourceMapping.getSourceFolder(), request)), sourceMapping.isIgnore()); } }
Example #4
Source File: XtendProjectConfigurator.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
@Override public void configure(ProjectConfigurationRequest request, IProgressMonitor monitor) throws CoreException { addNature(request.getProject(), XtextProjectHelper.NATURE_ID, monitor); OutputConfiguration config = new XtendOutputConfigurationProvider() .getOutputConfigurations().iterator().next(); List<MojoExecution> executions = getMojoExecutions(request, monitor); SubMonitor progress = SubMonitor.convert(monitor, executions.size()); for (MojoExecution execution : executions) { String goal = execution.getGoal(); if (goal.equals("compile")) { readCompileConfig(config, request, execution, progress.split(1)); } else if (goal.equals("testCompile")) { readTestCompileConfig(config, request, execution, progress.split(1)); } else if (goal.equals("xtend-install-debug-info")) { readDebugInfoConfig(config, request, execution, progress.split(1)); } else if (goal.equals("xtend-test-install-debug-info")) { readTestDebugInfoConfig(config, request, execution, progress.split(1)); } } writePreferences(config, request.getProject()); }
Example #5
Source File: WtpMavenProjectConfigurator.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 6 votes |
@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); } }
Example #6
Source File: AbstracMavenProjectConfigurator.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 6 votes |
/** * {@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); } } }
Example #7
Source File: MavenProjectSettingsConfigurator.java From spring-javaformat with Apache License 2.0 | 5 votes |
private List<File> getSearchFolders(ProjectConfigurationRequest request) { List<File> files = new ArrayList<>(); MavenProject project = request.getMavenProject(); while (project != null && project.getBasedir() != null) { files.add(project.getBasedir()); project = project.getParent(); } return files; }
Example #8
Source File: SARLProjectConfigurator.java From sarl with Apache License 2.0 | 5 votes |
@Override public void configureRawClasspath(ProjectConfigurationRequest request, IClasspathDescriptor classpath, IProgressMonitor monitor) throws CoreException { final SubMonitor subm = SubMonitor.convert(monitor, 4); final IMavenProjectFacade facade = request.getMavenProjectFacade(); final SARLConfiguration config = readConfiguration(request, subm.newChild(1)); subm.worked(1); removeSarlLibraries(classpath); subm.worked(2); configureSarlProject(facade, config, classpath, true, subm); }
Example #9
Source File: SARLProjectConfigurator.java From sarl with Apache License 2.0 | 5 votes |
@Override public void unconfigure(ProjectConfigurationRequest request, IProgressMonitor monitor) throws CoreException { final IJavaProject javaProject = JavaCore.create(request.getProject()); final IClasspathDescriptor classpath = new ClasspathDescriptor(javaProject); addSarlLibraries(classpath); }
Example #10
Source File: SARLProjectConfigurator.java From sarl with Apache License 2.0 | 5 votes |
@Override @SuppressWarnings("checkstyle:magicnumber") public void configure(ProjectConfigurationRequest request, IProgressMonitor monitor) throws CoreException { final IMavenProjectFacade facade = request.getMavenProjectFacade(); // --- ECLIPSE PLUGIN --------------------------------------------------------------- // Special case of tycho plugins, for which the {@link #configureRawClasspath} // and {@link #configureClasspath} were not invoked. // ---------------------------------------------------------------------------------- final boolean isEclipsePlugin = isEclipsePluginPackaging(facade); final SubMonitor subMonitor; subMonitor = SubMonitor.convert(monitor, 3); final IProject project = request.getProject(); final SARLConfiguration config = readConfiguration(request, subMonitor.newChild(1)); subMonitor.worked(1); forceMavenCompilerConfiguration(facade, config); subMonitor.worked(1); // --- ECLIPSE PLUGIN --------------------------------------------------------------- if (isEclipsePlugin) { // In the case of Eclipse bundle, the face to the Java project must be created by hand. final IJavaProject javaProject = JavaCore.create(project); final IClasspathDescriptor classpath = new ClasspathDescriptor(javaProject); configureSarlProject(facade, config, classpath, false, subMonitor.newChild(1)); subMonitor.worked(1); } // ---------------------------------------------------------------------------------- io.sarl.eclipse.natures.SARLProjectConfigurator.addSarlNatures( project, subMonitor.newChild(1)); subMonitor.worked(1); }
Example #11
Source File: SARLProjectConfigurator.java From sarl with Apache License 2.0 | 5 votes |
/** Read the configuration for the Compilation mojo. * * @param request the request. * @param mojo the mojo execution. * @param monitor the monitor. * @return the configuration. * @throws CoreException error in the eCore configuration. */ private SARLConfiguration readCompileConfiguration( ProjectConfigurationRequest request, MojoExecution mojo, IProgressMonitor monitor) throws CoreException { final SARLConfiguration config = new SARLConfiguration(); final MavenProject project = request.getMavenProject(); final File input = getParameterValue(project, "input", File.class, mojo, monitor); //$NON-NLS-1$ final File output = getParameterValue(project, "output", File.class, mojo, monitor); //$NON-NLS-1$ final File binOutput = getParameterValue(project, "binOutput", File.class, mojo, monitor); //$NON-NLS-1$ final File testInput = getParameterValue(project, "testInput", File.class, mojo, monitor); //$NON-NLS-1$ final File testOutput = getParameterValue(project, "testOutput", File.class, mojo, monitor); //$NON-NLS-1$ final File testBinOutput = getParameterValue(project, "testBinOutput", File.class, mojo, monitor); //$NON-NLS-1$ config.setInput(input); config.setOutput(output); config.setBinOutput(binOutput); config.setTestInput(testInput); config.setTestOutput(testOutput); config.setTestBinOutput(testBinOutput); final String inputCompliance = getParameterValue(project, "source", String.class, mojo, monitor); //$NON-NLS-1$ final String outputCompliance = getParameterValue(project, "target", String.class, mojo, monitor); //$NON-NLS-1$ config.setInputCompliance(inputCompliance); config.setOutputCompliance(outputCompliance); final String encoding = getParameterValue(project, "encoding", String.class, mojo, monitor); //$NON-NLS-1$ config.setEncoding(encoding); return config; }
Example #12
Source File: SARLProjectConfigurator.java From sarl with Apache License 2.0 | 5 votes |
/** Read the configuration for the Initialize mojo. * * @param request the request. * @param mojo the mojo execution. * @param monitor the monitor. * @return the configuration. * @throws CoreException error in the eCore configuration. */ private SARLConfiguration readInitializeConfiguration( ProjectConfigurationRequest request, MojoExecution mojo, IProgressMonitor monitor) throws CoreException { final SARLConfiguration config = new SARLConfiguration(); final MavenProject project = request.getMavenProject(); final File input = getParameterValue(project, "input", File.class, mojo, monitor, //$NON-NLS-1$ new File(SARLConfig.FOLDER_SOURCE_SARL)); final File output = getParameterValue(project, "output", File.class, mojo, monitor, //$NON-NLS-1$ new File(SARLConfig.FOLDER_SOURCE_GENERATED)); final File binOutput = getParameterValue(project, "binOutput", File.class, mojo, monitor, //$NON-NLS-1$ new File(SARLConfig.FOLDER_BIN)); final File testInput = getParameterValue(project, "testInput", File.class, mojo, monitor, //$NON-NLS-1$ new File(SARLConfig.FOLDER_TEST_SOURCE_SARL)); final File testOutput = getParameterValue(project, "testOutput", File.class, mojo, monitor, //$NON-NLS-1$ new File(SARLConfig.FOLDER_TEST_SOURCE_GENERATED)); final File testBinOutput = getParameterValue(project, "testBinOutput", File.class, mojo, monitor, //$NON-NLS-1$ new File(SARLConfig.FOLDER_TEST_BIN)); config.setInput(input); config.setOutput(output); config.setBinOutput(binOutput); config.setTestInput(testInput); config.setTestOutput(testOutput); config.setTestBinOutput(testBinOutput); return config; }
Example #13
Source File: SARLProjectConfigurator.java From sarl with Apache License 2.0 | 5 votes |
/** Read the SARL configuration. * * @param request the configuration request. * @param monitor the monitor. * @return the SARL configuration. * @throws CoreException if something wrong appends. */ protected SARLConfiguration readConfiguration(ProjectConfigurationRequest request, IProgressMonitor monitor) throws CoreException { SARLConfiguration initConfig = null; SARLConfiguration compileConfig = null; final List<MojoExecution> mojos = getMojoExecutions(request, monitor); for (final MojoExecution mojo : mojos) { final String goal = mojo.getGoal(); switch (goal) { case "initialize": //$NON-NLS-1$ initConfig = readInitializeConfiguration(request, mojo, monitor); break; case "compile": //$NON-NLS-1$ case "testCompile": //$NON-NLS-1$ compileConfig = readCompileConfiguration(request, mojo, monitor); break; default: } } if (compileConfig != null && initConfig != null) { compileConfig.setFrom(initConfig); } return compileConfig; }
Example #14
Source File: MavenProjectConfigurator.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 5 votes |
@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); } }
Example #15
Source File: XtendProjectConfigurator.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
private void readTestDebugInfoConfig(OutputConfiguration config, ProjectConfigurationRequest request, MojoExecution execution, SubMonitor progress) throws CoreException { progress = SubMonitor.convert(progress, 2); config.setHideSyntheticLocalVariables( mojoParameterValue("hideSyntheticVariables", Boolean.class, request, execution, progress)); config.setInstallDslAsPrimarySource( mojoParameterValue("xtendAsPrimaryDebugSource", Boolean.class, request, execution, progress)); }
Example #16
Source File: XtendProjectConfigurator.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
private void readDebugInfoConfig(OutputConfiguration config, ProjectConfigurationRequest request, MojoExecution execution, SubMonitor progress) throws CoreException { progress = SubMonitor.convert(progress, 2); config.setHideSyntheticLocalVariables( mojoParameterValue("hideSyntheticVariables", Boolean.class, request, execution, progress)); config.setInstallDslAsPrimarySource( mojoParameterValue("xtendAsPrimaryDebugSource", Boolean.class, request, execution, progress)); }
Example #17
Source File: XtendProjectConfigurator.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
private String makeProjectRelative(String fileName, ProjectConfigurationRequest request) { File baseDir = request.getMavenProject().getBasedir(); File file = new File(fileName); String relativePath; if (file.isAbsolute()) { relativePath = baseDir.toURI().relativize(file.toURI()).getPath(); } else { relativePath = file.getPath(); } String unixDelimited = relativePath.replaceAll("\\\\", "/"); return CharMatcher.is('/').trimFrom(unixDelimited); }
Example #18
Source File: XtendProjectConfigurator.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
private void readTestCompileConfig(OutputConfiguration config, ProjectConfigurationRequest request, MojoExecution execution, SubMonitor progress) throws CoreException { List<String> roots = request.getMavenProject().getTestCompileSourceRoots(); progress = SubMonitor.convert(progress, roots.size()); for (String source : roots) { SourceMapping mapping = new SourceMapping(makeProjectRelative(source, request)); String testOutputDirectory = mojoParameterValue("testOutputDirectory", String.class, request, execution, progress); mapping.setOutputDirectory(makeProjectRelative(testOutputDirectory, request)); config.getSourceMappings().add(mapping); } }
Example #19
Source File: XtendProjectConfigurator.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
private void readCompileConfig(OutputConfiguration config, ProjectConfigurationRequest request, MojoExecution execution, SubMonitor progress) throws CoreException { List<String> roots = request.getMavenProject().getCompileSourceRoots(); progress = SubMonitor.convert(progress, roots.size()); for (String source : roots) { SourceMapping mapping = new SourceMapping(makeProjectRelative(source, request)); String outputDirectory = mojoParameterValue("outputDirectory", String.class, request, execution, progress); mapping.setOutputDirectory(makeProjectRelative(outputDirectory, request)); config.getSourceMappings().add(mapping); } }
Example #20
Source File: XtextProjectConfigurator.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
private String makeProjectRelative(String fileName, ProjectConfigurationRequest request) { File baseDir = request.getMavenProject().getBasedir(); File file = new File(fileName); String relativePath; if (file.isAbsolute()) { relativePath = baseDir.toURI().relativize(file.toURI()).getPath(); } else { relativePath = file.getPath(); } String unixDelimited = relativePath.replaceAll("\\\\", "/"); return CharMatcher.is('/').trimFrom(unixDelimited); }
Example #21
Source File: XtextProjectConfigurator.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
private void configureLanguage(ProjectScope projectPreferences, Language language, ProjectConfigurationRequest request) throws CoreException { if (language.getOutputConfigurations().isEmpty()) return; IEclipsePreferences languagePreferences = projectPreferences.getNode(language.name()); languagePreferences.putBoolean(OptionsConfigurationBlock.isProjectSpecificPropertyKey(BuilderConfigurationBlock.PROPERTY_PREFIX), true); languagePreferences.putBoolean(PREF_AUTO_BUILDING, true); for (OutputConfiguration outputConfiguration : language.getOutputConfigurations()) { configureOutlet(languagePreferences, outputConfiguration, request); } try { languagePreferences.flush(); } catch (BackingStoreException e) { throw new RuntimeException(e); } }
Example #22
Source File: XtextProjectConfigurator.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
private void configureLanguages(ProjectConfigurationRequest request, IProgressMonitor monitor) throws CoreException { List<MojoExecution> executions = getMojoExecutions(request, monitor); SubMonitor progress = SubMonitor.convert(monitor, executions.size()); for (MojoExecution execution : executions) { Languages languages = maven.getMojoParameterValue(request.getMavenProject(), execution, "languages", Languages.class, progress.split(1)); if(languages!=null) { ProjectScope projectPreferences = new ProjectScope(request.getProject()); for (Language language : languages) { configureLanguage(projectPreferences, language, request); } } } }
Example #23
Source File: MavenProjectSettingsConfigurator.java From spring-javaformat with Apache License 2.0 | 5 votes |
@Override public void configure(ProjectConfigurationRequest request, IProgressMonitor monitor) throws CoreException { new Executor(Messages.springFormatSettingsImportError).run(() -> { List<File> searchFolders = getSearchFolders(request); ProjectSettingsFiles settingsFiles = new ProjectSettingsFilesLocator(searchFolders).locateSettingsFiles(); settingsFiles.applyToProject(request.getProject(), monitor); }); }
Example #24
Source File: XtendProjectConfigurator.java From xtext-xtend with Eclipse Public License 2.0 | 4 votes |
private <T> T mojoParameterValue(String paramName, Class<T> paramType, ProjectConfigurationRequest request, MojoExecution execution, SubMonitor progress) throws CoreException { return maven.getMojoParameterValue(request.getMavenProject(), execution, paramName, paramType, progress.split(1)); }
Example #25
Source File: MavenProjectConfigurator.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 4 votes |
@Override public void configure(ProjectConfigurationRequest request, IProgressMonitor monitor) throws CoreException { Activator.log("MavenProjectConfigurator.configure invoked"); super.configure(request, monitor); }
Example #26
Source File: XtextProjectConfigurator.java From xtext-eclipse with Eclipse Public License 2.0 | 4 votes |
@Override public void configure(ProjectConfigurationRequest request, IProgressMonitor monitor) throws CoreException { addNature(request.getProject(), XtextProjectHelper.NATURE_ID, monitor); configureLanguages(request, monitor); }
Example #27
Source File: QuickstartProjectConfigurator.java From aem-eclipse-developer-tools with Apache License 2.0 | 4 votes |
@Override public void configure(ProjectConfigurationRequest request, IProgressMonitor monitor) throws CoreException { ConfigurationHelper.convertToLaunchpadProject(request.getProject(), Path.fromPortableString("src/main/provisioning")); }
Example #28
Source File: AbstracMavenProjectConfigurator.java From gwt-eclipse-plugin with Eclipse Public License 1.0 | 2 votes |
/** * Configures a given Eclipse project from a Maven project description. * * @param project the Eclipse project * @param mavenProject the Maven project's description * @param request the project configuration request * @param monitor a progress monitor * @throws CoreException on project update errors */ protected abstract void doConfigure(MavenProject mavenProject, IProject project, ProjectConfigurationRequest request, IProgressMonitor monitor) throws CoreException;