public FileProjectConfig(final URI path, final String name, final IWorkspaceConfig workspaceConfig) { this.path = UriUtil.toFolderURI(path); this.name = name; IWorkspaceConfig _elvis = null; if (workspaceConfig != null) { _elvis = workspaceConfig; } else { WorkspaceConfig _workspaceConfig = new WorkspaceConfig(this); _elvis = _workspaceConfig; } this.workspaceConfig = _elvis; }
@Override public FileSourceFolder findSourceFolderContaining(final URI member) { final Function1<FileSourceFolder, Boolean> _function = (FileSourceFolder source) -> { return Boolean.valueOf(UriUtil.isPrefixOf(source.getPath(), member)); }; return IterableExtensions.<FileSourceFolder>findFirst(this.sourceFolders, _function); }
public URI getBaseDir() { if ((this.baseDir == null)) { final String userDir = System.getProperty("user.dir"); File _file = new File(userDir); this.baseDir = UriUtil.createFolderURI(_file); } return this.baseDir; }
@Override public ISourceFolder findSourceFolderContaining(final URI member) { final Function1<SourceFolder, Boolean> _function = (SourceFolder it) -> { return Boolean.valueOf(UriUtil.isPrefixOf(this.path, member)); }; return IterableExtensions.<SourceFolder>findFirst(this.sourceFolders, _function); }
@Test public void testFolderUriHasTrailingSeparator() { final File folder = new File("."); final URI uri = UriUtil.createFolderURI(folder); Assert.assertTrue(uri.hasTrailingPathSeparator()); int _segmentCount = uri.segmentCount(); int _minus = (_segmentCount - 2); Assert.assertEquals(".", uri.segment(_minus)); }
public FileProjectConfig(final File root, final String name, final IWorkspaceConfig workspaceConfig) { this(UriUtil.createFolderURI(root), name, workspaceConfig); }
public FileProjectConfig(final File root, final IWorkspaceConfig workspaceConfig) { this(UriUtil.createFolderURI(root), root.getName(), workspaceConfig); }
@Test public void testPrefix() { final URI prefix = URI.createURI("file:/foo/"); final URI uri = URI.createURI("file:/foo/bar"); Assert.assertTrue(UriUtil.isPrefixOf(prefix, uri)); }
@Test public void testPrefixRequiresSameScheme() { final URI prefix = URI.createURI("platform:/foo/"); final URI uri = URI.createURI("file:/foo/bar"); Assert.assertFalse(UriUtil.isPrefixOf(prefix, uri)); }
@Test public void testPrefixRequiresTrailingSeparator() { final URI prefix = URI.createURI("file:/foo"); final URI uri = URI.createURI("file:/foo/bar"); Assert.assertFalse(UriUtil.isPrefixOf(prefix, uri)); }
@Test public void testPrefixRequiresSegmentsToMatch() { final URI prefix = URI.createURI("file:/foo"); final URI uri = URI.createURI("file:/buzz/bar"); Assert.assertFalse(UriUtil.isPrefixOf(prefix, uri)); }