org.eclipse.xtext.generator.OutputConfiguration Java Examples
The following examples show how to use
org.eclipse.xtext.generator.OutputConfiguration.
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: IncrementalBuilder.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
public URIBasedFileSystemAccess newFileSystemAccess(Resource resource, BuildRequest request) { URIBasedFileSystemAccess uriBasedFileSystemAccess = new URIBasedFileSystemAccess(); uriBasedFileSystemAccess.setOutputConfigurations(IterableExtensions.toMap( outputConfigurationProvider.getOutputConfigurations(resource), OutputConfiguration::getName)); uriBasedFileSystemAccess.setPostProcessor(postProcessor); if (encodingProvider != null) { uriBasedFileSystemAccess.setEncodingProvider(encodingProvider); } uriBasedFileSystemAccess.setTraceFileNameProvider(traceFileNameProvider); uriBasedFileSystemAccess.setTraceRegionSerializer(traceRegionSerializer); uriBasedFileSystemAccess.setGenerateTraces(true); uriBasedFileSystemAccess.setBaseDir(request.getBaseDir()); if (projectConfigProvider != null) { IProjectConfig projectConfig = projectConfigProvider.getProjectConfig(resource.getResourceSet()); if (projectConfig != null) { ISourceFolder sourceFolder = projectConfig.findSourceFolderContaining(resource.getURI()); if (sourceFolder != null) { uriBasedFileSystemAccess.setCurrentSource(sourceFolder.getName()); } } } uriBasedFileSystemAccess.setConverter(resource.getResourceSet().getURIConverter()); return uriBasedFileSystemAccess; }
Example #2
Source File: N4JSBuilderParticipant.java From n4js with Eclipse Public License 1.0 | 6 votes |
@Override protected Map<OutputConfiguration, Iterable<IMarker>> getGeneratorMarkers(IProject builtProject, Collection<OutputConfiguration> outputConfigurations) throws CoreException { if (builtProject instanceof ExternalProject) { return emptyMap(); } Map<OutputConfiguration, Iterable<IMarker>> generatorMarkers = newHashMap(); for (OutputConfiguration config : outputConfigurations) { if (config.isCleanUpDerivedResources()) { List<IMarker> markers = Lists.newArrayList(); for (IContainer container : getOutputs(builtProject, config)) { Iterables.addAll( markers, getDerivedResourceMarkers().findDerivedResourceMarkers(container, getGeneratorIdProvider().getGeneratorIdentifier())); } generatorMarkers.put(config, markers); } } return generatorMarkers; }
Example #3
Source File: XStatefulIncrementalBuilder.java From n4js with Eclipse Public License 1.0 | 6 votes |
private boolean isResourceInOutputDirectory(Resource resource, IResourceServiceProvider serviceProvider) { XWorkspaceManager workspaceManager = serviceProvider.get(XWorkspaceManager.class); if (workspaceManager == null) { return false; } OutputConfigurationProvider outputConfProvider = serviceProvider.get(OutputConfigurationProvider.class); URI resourceUri = resource.getURI(); IProjectConfig projectConfig = workspaceManager.getProjectConfig(resourceUri); Set<OutputConfiguration> outputConfigurations = outputConfProvider.getOutputConfigurations(resource); URI projectBaseUri = projectConfig.getPath(); Path resourcePath = URIUtils.toPath(resourceUri); for (OutputConfiguration outputConf : outputConfigurations) { for (String outputDir : outputConf.getOutputDirectories()) { URI outputUri = projectBaseUri.appendSegment(outputDir); Path outputPath = URIUtils.toPath(outputUri); if (resourcePath.startsWith(outputPath)) { return true; } } } return false; }
Example #4
Source File: CleanInstruction.java From n4js with Eclipse Public License 1.0 | 6 votes |
private void cleanOutput(IProject aProject, OutputConfiguration config, IProgressMonitor monitor) throws CoreException { IContainer container = getContainer(aProject, config.getOutputDirectory()); if (!container.exists()) { return; } if (config.isCanClearOutputDirectory()) { for (IResource resource : container.members()) { resource.delete(IResource.KEEP_HISTORY, monitor); } } else if (config.isCleanUpDerivedResources()) { List<IFile> resources = derivedResourceMarkers.findDerivedResources(container, null); for (IFile iFile : resources) { iFile.delete(IResource.KEEP_HISTORY, monitor); } } }
Example #5
Source File: FileLocationsImpl.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
@Override public Path getTargetFolder(final Path path) { Path _xblockexpression = null; { final Path projectFolder = this.getProjectFolder(path); if ((projectFolder == null)) { return null; } final OutputConfiguration outputConfiguration = IterableExtensions.<OutputConfiguration>head(this.outputConfigurationProvider.getOutputConfigurations(this.context)); final Path sourceFolder = this.getSourceFolder(path); String _xifexpression = null; if ((sourceFolder == null)) { _xifexpression = outputConfiguration.getOutputDirectory(); } else { String _xblockexpression_1 = null; { final String projectRelativeSourceFolder = IterableExtensions.join(IterableExtensions.<String>tail(sourceFolder.getSegments()), "/"); _xblockexpression_1 = outputConfiguration.getOutputDirectory(projectRelativeSourceFolder); } _xifexpression = _xblockexpression_1; } final String outputFolder = _xifexpression; _xblockexpression = projectFolder.append(outputFolder); } return _xblockexpression; }
Example #6
Source File: BuilderParticipant.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
protected Map<String, OutputConfiguration> getOutputConfigurations(IBuildContext context) { IProject builtProject = context.getBuiltProject(); Map<String, OutputConfiguration> result = outputConfigurationCache.get(builtProject.getName()); if (result != null) { return result; } Set<OutputConfiguration> configurations = outputConfigurationProvider.getOutputConfigurations(builtProject); result = uniqueIndex(configurations, new Function<OutputConfiguration, String>() { @Override public String apply(OutputConfiguration from) { return from.getName(); } }); outputConfigurationCache.put(builtProject.getName(), result); return result; }
Example #7
Source File: BuilderParticipant.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
/** * @since 2.7 */ protected String getCurrentSourceFolder(IBuildContext context, Delta delta) { Iterable<org.eclipse.xtext.util.Pair<IStorage, IProject>> storages = storage2UriMapper.getStorages(delta.getUri()); for (org.eclipse.xtext.util.Pair<IStorage, IProject> pair : storages) { if (pair.getFirst() instanceof IResource) { final IResource resource = (IResource) pair.getFirst(); IProject project = pair.getSecond(); for (OutputConfiguration output : getOutputConfigurations(context).values()) { for (SourceMapping sourceMapping : output.getSourceMappings()) { IContainer folder = ResourceUtil.getContainer(project, sourceMapping.getSourceFolder()); if (folder.contains(resource)) { return sourceMapping.getSourceFolder(); } } } } } return null; }
Example #8
Source File: BuilderParticipant.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
private void delete(IResource resource, OutputConfiguration config, EclipseResourceFileSystemAccess2 access, IProgressMonitor monitor) throws CoreException { if (monitor.isCanceled()) { throw new OperationCanceledException(); } if (resource instanceof IContainer) { IContainer container = (IContainer) resource; for (IResource child : container.members()) { delete(child, config, access, monitor); } container.delete(IResource.FORCE | IResource.KEEP_HISTORY, monitor); } else if (resource instanceof IFile) { IFile file = (IFile) resource; access.deleteFile(file, config.getName(), monitor); } else { resource.delete(IResource.FORCE | IResource.KEEP_HISTORY, monitor); } }
Example #9
Source File: N4IDLSubGenerator.java From n4js with Eclipse Public License 1.0 | 6 votes |
private static CompilerDescriptor createDescriptor() { final CompilerDescriptor result = new CompilerDescriptor(); result.setIdentifier(COMPILER_ID); result.setName("N4IDL to ECMAScript transpiler"); result.setDescription( "Transpiles N4IDL to ECMAScript, currently ES5 plus some selected ES6 features supported by V8."); result.setActive(true); result.setCompiledFileExtension("js"); result.setCompiledFileSourceMapExtension("map"); final OutputConfiguration outCfg = new OutputConfiguration(COMPILER_ID); outCfg.setDescription("N4IDL to ECMAScript transpiler"); outCfg.setOutputDirectory(N4JSLanguageConstants.DEFAULT_PROJECT_OUTPUT); outCfg.setOverrideExistingResources(true); outCfg.setCreateOutputDirectory(true); outCfg.setCleanUpDerivedResources(true); outCfg.setSetDerivedProperty(true); outCfg.setKeepLocalHistory(true); outCfg.setCanClearOutputDirectory(true); result.setOutputConfiguration(outCfg); return result; }
Example #10
Source File: XURIBasedFileSystemAccessFactory.java From n4js with Eclipse Public License 1.0 | 6 votes |
/** Create a new URIBasedFileSystemAccess. */ public URIBasedFileSystemAccess newFileSystemAccess(Resource resource, XBuildRequest request) { URIBasedFileSystemAccess uriBasedFileSystemAccess = new URIBasedFileSystemAccess(); uriBasedFileSystemAccess.setOutputConfigurations(IterableExtensions.toMap( this.outputConfigurationProvider.getOutputConfigurations(resource), OutputConfiguration::getName)); uriBasedFileSystemAccess.setPostProcessor(this.postProcessor); if (this.encodingProvider != null) { uriBasedFileSystemAccess.setEncodingProvider(this.encodingProvider); } uriBasedFileSystemAccess.setTraceFileNameProvider(this.traceFileNameProvider); uriBasedFileSystemAccess.setTraceRegionSerializer(this.traceRegionSerializer); uriBasedFileSystemAccess.setGenerateTraces(true); uriBasedFileSystemAccess.setBaseDir(request.getBaseDir()); if (this.projectConfigProvider != null) { IProjectConfig projectConfig = this.projectConfigProvider.getProjectConfig(resource.getResourceSet()); if (projectConfig != null) { ISourceFolder sourceFolder = projectConfig.findSourceFolderContaining(resource.getURI()); if (sourceFolder != null) { uriBasedFileSystemAccess.setCurrentSource(sourceFolder.getName()); } } } uriBasedFileSystemAccess.setConverter(resource.getResourceSet().getURIConverter()); return uriBasedFileSystemAccess; }
Example #11
Source File: XStatefulIncrementalBuilder.java From n4js with Eclipse Public License 1.0 | 6 votes |
private void removeGeneratedFiles(URI source, XSource2GeneratedMapping source2GeneratedMapping) { Map<URI, String> outputConfigMap = source2GeneratedMapping.deleteSourceAndGetOutputConfigs(source); IResourceServiceProvider serviceProvider = context.getResourceServiceProvider(source); IContextualOutputConfigurationProvider2 outputConfigurationProvider = serviceProvider .get(IContextualOutputConfigurationProvider2.class); XtextResourceSet resourceSet = request.getResourceSet(); Set<OutputConfiguration> outputConfigs = outputConfigurationProvider.getOutputConfigurations(resourceSet); Map<String, OutputConfiguration> outputConfigsMap = Maps.uniqueIndex(outputConfigs, OutputConfiguration::getName); URIConverter uriConverter = resourceSet.getURIConverter(); for (URI generated : outputConfigMap.keySet()) { OutputConfiguration config = outputConfigsMap.get(outputConfigMap.get(generated)); if (config != null && config.isCleanUpDerivedResources()) { try { uriConverter.delete(generated, CollectionLiterals.emptyMap()); request.setResultDeleteFile(generated); } catch (IOException e) { Exceptions.sneakyThrow(e); } } } }
Example #12
Source File: TestBatchCompiler.java From xtext-xtend with Eclipse Public License 2.0 | 6 votes |
@Test public void testProjectConfig() { try { this.batchCompiler.compile(); final FileProjectConfig project = this.batchCompiler.getProjectConfig(); final String projectPath = new File(".").getCanonicalFile().getName(); Assert.assertEquals(projectPath, project.getName()); final OutputConfiguration output = this.batchCompiler.getOutputConfiguration(); final String src = IterableExtensions.<FileSourceFolder>head(project.getSourceFolders()).getName(); Assert.assertEquals("batch-compiler-data/test data", src.toString()); final String target = output.getOutputDirectory(src); Assert.assertEquals("test-result", target.toString()); } catch (Throwable _e) { throw Exceptions.sneakyThrow(_e); } }
Example #13
Source File: BuilderParticipant.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
/** * @since 2.12 */ protected Map<OutputConfiguration, Iterable<IMarker>> buildGeneratorMarkersReverseLookupMap(Map<OutputConfiguration, Iterable<IMarker>> generatorMarkers) { SetMultimap<String, IFile> reverseLookupMap = HashMultimap.create(); for (java.util.Map.Entry<OutputConfiguration, Iterable<IMarker>> entry : generatorMarkers.entrySet()) { OutputConfiguration outputConfiguration = entry.getKey(); if (outputConfiguration.isCleanUpDerivedResources()) { for (IMarker marker : entry.getValue()) { String source = derivedResourceMarkers.getSource(marker); if (source != null) { reverseLookupMap.put(source, (IFile) marker.getResource()); } } } } return new DerivedResourcesLookupMap(generatorMarkers, reverseLookupMap); }
Example #14
Source File: BuilderParticipant.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
/** * @since 2.4 */ protected Map<OutputConfiguration, Iterable<IMarker>> getGeneratorMarkers(IProject builtProject, Collection<OutputConfiguration> outputConfigurations) throws CoreException { Map<OutputConfiguration, Iterable<IMarker>> generatorMarkers = newHashMap(); for (OutputConfiguration config : outputConfigurations) { if (config.isCleanUpDerivedResources()) { List<IMarker> markers = Lists.newArrayList(); for (IContainer container : getOutputs(builtProject, config)) { Iterables.addAll( markers, derivedResourceMarkers.findDerivedResourceMarkers(container, generatorIdProvider.getGeneratorIdentifier())); } generatorMarkers.put(config, markers); } } return buildGeneratorMarkersReverseLookupMap(generatorMarkers); }
Example #15
Source File: EclipseResourceFileSystemAccess2.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
/** * @since 2.4 */ protected boolean ensureOutputConfigurationDirectoryExists(OutputConfiguration outputConfig) { IContainer container = getContainer(outputConfig); if (container == null) { return false; } if (!container.exists()) { if (outputConfig.isCreateOutputDirectory()) { try { createContainer(container); return true; } catch (CoreException e) { throw new RuntimeIOException(e); } } else { return false; } } return true; }
Example #16
Source File: DebugSourceInstallingCompilationParticipant.java From xtext-eclipse with Eclipse Public License 2.0 | 6 votes |
protected OutputConfiguration findOutputConfiguration(SourceRelativeURI dslSourceFile, IFile generatedJavaFile) { IResourceServiceProvider serviceProvider = serviceProviderRegistry.getResourceServiceProvider(dslSourceFile.getURI()); if (serviceProvider == null) return null; EclipseOutputConfigurationProvider cfgProvider = serviceProvider.get(EclipseOutputConfigurationProvider.class); IProject project = generatedJavaFile.getProject(); Set<OutputConfiguration> configurations = cfgProvider.getOutputConfigurations(project); if (!configurations.isEmpty()) { if (configurations.size() == 1) return configurations.iterator().next(); for (OutputConfiguration out : configurations) { for (String source : out.getSourceFolders()) { IContainer container = ResourceUtil.getContainer(project, out.getOutputDirectory(source)); if (container != null && container.getFullPath().isPrefixOf(generatedJavaFile.getFullPath())) return out; } } } log.error("Could not find output configuration for file " + generatedJavaFile.getFullPath()); return null; }
Example #17
Source File: BuildInstruction.java From n4js with Eclipse Public License 1.0 | 5 votes |
/** * Create a build instruction for the given project. */ public BuildInstruction(IProject project, Map<String, OutputConfiguration> outputConfigurations, IDerivedResourceMarkers derivedResourceMarkers, EclipseResourceFileSystemAccess2 access, Map<OutputConfiguration, Iterable<IMarker>> generatorMarkers, IStorage2UriMapper storage2UriMapper, ICompositeGenerator compositeGenerator, Injector injector) { super(project, outputConfigurations, derivedResourceMarkers); this.access = access; this.generatorMarkers = generatorMarkers; this.storage2UriMapper = storage2UriMapper; this.compositeGenerator = compositeGenerator; this.injector = injector; }
Example #18
Source File: BuilderParticipant.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
protected void refreshOutputFolders(IBuildContext ctx, Map<String, OutputConfiguration> outputConfigurations, IProgressMonitor monitor) throws CoreException { SubMonitor subMonitor = SubMonitor.convert(monitor, outputConfigurations.size()); for (OutputConfiguration config : outputConfigurations.values()) { SubMonitor split = subMonitor.split(1); final IProject project = ctx.getBuiltProject(); for (IContainer container : getOutputs(project, config)) { if (monitor.isCanceled()) { throw new OperationCanceledException(); } sync(container, IResource.DEPTH_INFINITE, split); } } }
Example #19
Source File: EclipseOutputConfigurationProvider.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
/** * @since 2.6 */ protected OutputConfiguration createAndOverlayOutputConfiguration(IProject project, IPreferenceStore store, OutputConfiguration output) { OutputConfiguration result = createAndOverlayOutputConfiguration(store, output); if (project != null && sourceFolderProvider != null) { for (IContainer sourceContainer : sourceFolderProvider.getSourceFolders(project)) { String sourceFolder = toProjectRelativePath(sourceContainer).toString(); SourceMapping mapping = new SourceMapping(sourceFolder); mapping.setOutputDirectory(getOutputForSourceFolder(store, output, sourceFolder)); mapping.setIgnore(isIgnoreSourceFolder(store, output, sourceFolder)); result.getSourceMappings().add(mapping); } } return result; }
Example #20
Source File: DefaultFileSystemAccessFactory.java From statecharts with Eclipse Public License 1.0 | 5 votes |
protected void initLibraryTargetFolder(ISCTFileSystemAccess access, GeneratorEntry entry) { FeatureParameterValue libraryTargetFolderValue = helper.getLibraryTargetFolderValue(entry); if (libraryTargetFolderValue != null) { String folderName = libraryTargetFolderValue.getStringValue(); access.setOutputPath(LIBRARY_TARGET_FOLDER_OUTPUT, folderName); OutputConfiguration output = access.getOutputConfigurations().get(LIBRARY_TARGET_FOLDER_OUTPUT); checkWriteAccess(access, LIBRARY_TARGET_FOLDER_OUTPUT, folderName); output.setCreateOutputDirectory(true); output.setCanClearOutputDirectory(false); output.setOverrideExistingResources(false); } }
Example #21
Source File: ProjectRelativeFileSystemAccess.java From sarl with Apache License 2.0 | 5 votes |
@Override protected boolean ensureOutputConfigurationDirectoryExists(OutputConfiguration outputConfig) { try { if (super.ensureOutputConfigurationDirectoryExists(outputConfig)) { final IContainer container = getContainer(outputConfig); addToSourceFolders(container); return true; } return false; } catch (CoreException e) { throw new RuntimeIOException(e); } }
Example #22
Source File: FormatOutputConfigurationProvider.java From dsl-devkit with Eclipse Public License 1.0 | 5 votes |
/** * Creates output configuration for a Formatter. * * @return output configuration */ private OutputConfiguration getFormatterConfig() { OutputConfiguration config = new OutputConfiguration(FormatConstants.FORMATTER); config.setDescription("Output configuration for a formatter"); config.setOverrideExistingResources(false); config.setCanClearOutputDirectory(false); config.setCleanUpDerivedResources(false); config.setOutputDirectory("src"); return config; }
Example #23
Source File: ProjectAwareUniqueClassNameValidatorTest.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Test public void testIfDerived_Plain() { OutputConfiguration output = new OutputConfiguration("TEST"); output.setOutputDirectory("xtend_gen"); OutputConfiguration.SourceMapping sourceMapping = new OutputConfiguration.SourceMapping("xtend_gen"); output.getSourceMappings().add(sourceMapping); classNameValidator.getContext().put("ProjectAwareUniqueClassNameValidator.outputConfigs", Lists.newArrayList(output)); MockedFile file = new MockedFile(new Path("foo/xtend_gen/org/eclipse/test/foo.bar"), null); Assert.assertTrue(classNameValidator.isDerived(file)); }
Example #24
Source File: ProjectAwareUniqueClassNameValidatorTest.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Test public void testIfDerived_MavenPath_4() { OutputConfiguration output = new OutputConfiguration("TEST"); output.setOutputDirectory("xtend_gen"); OutputConfiguration.SourceMapping sourceMapping = new OutputConfiguration.SourceMapping("src/main/xtend_gen"); output.getSourceMappings().add(sourceMapping); OutputConfiguration.SourceMapping sourceMapping2 = new OutputConfiguration.SourceMapping("src/test/xtend_gen"); output.getSourceMappings().add(sourceMapping2); classNameValidator.getContext().put("ProjectAwareUniqueClassNameValidator.outputConfigs", Lists.newArrayList(output)); MockedFile file = new MockedFile(new Path("foo/src/test/xtend_gen/org/eclipse/test/foo.bar"), null); Assert.assertTrue(classNameValidator.isDerived(file)); }
Example #25
Source File: ProjectAwareUniqueClassNameValidatorTest.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Test public void testIfDerived_MavenPath_3() { OutputConfiguration output = new OutputConfiguration("TEST"); output.setOutputDirectory("xtend_gen"); OutputConfiguration.SourceMapping sourceMapping = new OutputConfiguration.SourceMapping("src/main/xtend_gen"); output.getSourceMappings().add(sourceMapping); classNameValidator.getContext().put("ProjectAwareUniqueClassNameValidator.outputConfigs", Lists.newArrayList(output)); MockedFile file = new MockedFile(new Path("foo/src/main/src/org/eclipse/test/foo.bar"), null); Assert.assertFalse(classNameValidator.isDerived(file)); }
Example #26
Source File: ProjectAwareUniqueClassNameValidatorTest.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@Test public void testIfDerived_MavenPath_2() { OutputConfiguration output = new OutputConfiguration("TEST"); output.setOutputDirectory("xtend_gen"); classNameValidator.getContext().put("ProjectAwareUniqueClassNameValidator.outputConfigs", Lists.newArrayList(output)); MockedFile file = new MockedFile(new Path("foo/src/main/xtend_gen/org/eclipse/test/foo.bar"), null); Assert.assertFalse(classNameValidator.isDerived(file)); }
Example #27
Source File: SarlOutputConfigurationProvider.java From sarl with Apache License 2.0 | 5 votes |
/** Create the standard output configuration. * * @return the configuration, never {@code null}. * @since 0.8 */ @SuppressWarnings("static-method") protected OutputConfiguration createStandardOutputConfiguration() { final OutputConfiguration defaultOutput = new OutputConfiguration(IFileSystemAccess.DEFAULT_OUTPUT); defaultOutput.setDescription(Messages.SarlOutputConfigurationProvider_0); defaultOutput.setOutputDirectory(SARLConfig.FOLDER_SOURCE_GENERATED); defaultOutput.setOverrideExistingResources(true); defaultOutput.setCreateOutputDirectory(true); defaultOutput.setCanClearOutputDirectory(false); defaultOutput.setCleanUpDerivedResources(true); defaultOutput.setSetDerivedProperty(true); defaultOutput.setKeepLocalHistory(false); return defaultOutput; }
Example #28
Source File: XbaseEditor.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
protected boolean isCompiledWithJSR45() { //TODO the information whether this was compiled with JSR-45, needs to be done on a per resource base, since a project might // have a different configuration than its jars. Storing it in the trace file (together with other compilation options and version information) seems appropriate. // is this editor is not based on a resource it doesn't live in a project. We don't know whether it was compiled with JSR-45. if (getResource() == null) return true; Set<OutputConfiguration> configurations = outputConfigurationProvider.getOutputConfigurations(getResource() .getProject()); for (OutputConfiguration config : configurations) { if (config.isInstallDslAsPrimarySource()) { return false; } } return true; }
Example #29
Source File: ProjectAwareUniqueClassNameValidator.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
@SuppressWarnings("unchecked") protected boolean isDerived(IResource resource) { try { // Nullcheck for test org.eclipse.xtext.xbase.ui.tests.validation.ProjectAwareUniqueClassNameValidatorTest if (derivedResourceMarkers != null && derivedResourceMarkers.findDerivedResourceMarkers(resource).length >= 1) { return true; } } catch (CoreException e) { LOG.error(e.getMessage(), e); return false; } Collection<OutputConfiguration> outputConfigurations = (Collection<OutputConfiguration>) getContext() .get(ProjectAwareUniqueClassNameValidator.OUTPUT_CONFIGS); if (outputConfigurations != null) { IPath projectRelativePath = resource.getProjectRelativePath(); for (OutputConfiguration outputConfiguration : outputConfigurations) { for (String dir : outputConfiguration.getOutputDirectories()) { for (SourceMapping sourceMapping : outputConfiguration.getSourceMappings()) { // Check if there is a sourceFolder that ends with the path of the current output dir if (sourceMapping.getSourceFolder().endsWith(dir)) { String sourceFolder = sourceMapping.getSourceFolder(); // Check if there is a sourceMapping that matches the current output dir and is a prefix of the projectRelativePath if (new Path(sourceFolder).isPrefixOf(projectRelativePath)) { return true; } } } // In case no sourceMapping matches if (new Path(dir).isPrefixOf(projectRelativePath)) { return true; } } } } return false; }
Example #30
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); } }