Java Code Examples for com.intellij.openapi.roots.ModuleRootModificationUtil#addContentRoot()
The following examples show how to use
com.intellij.openapi.roots.ModuleRootModificationUtil#addContentRoot() .
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: WorkspaceTest.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Test public void canLoadWorkspaceWithConfigFile() throws Exception { final VirtualFile expectedRoot = tmp.ensureDir("abc"); tmp.writeFile("abc/WORKSPACE", ""); tmp.ensureDir("abc/dart"); final VirtualFile contentRoot = tmp.ensureDir("abc/dart/something"); ModuleRootModificationUtil.addContentRoot(fixture.getModule(), contentRoot.getPath()); tmp.ensureDir("abc/dart/config/intellij-plugins"); tmp.writeFile("abc/dart/config/intellij-plugins/flutter.json", "{\"daemonScript\": \"something_daemon.sh\"," + "\"doctorScript\": \"something_doctor.sh\"}"); tmp.writeFile("abc/something_daemon.sh", ""); tmp.writeFile("abc/something_doctor.sh", ""); final Workspace w = Workspace.loadUncached(fixture.getProject()); assertNotNull("expected a workspace", w); assertEquals(expectedRoot, w.getRoot()); assertEquals("something_daemon.sh", w.getDaemonScript()); assertEquals("something_doctor.sh", w.getDoctorScript()); }
Example 2
Source File: WorkspaceTest.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Test public void canLoadWorkspaceWithConfigFileAndScriptInReadonly() throws Exception { final VirtualFile expectedRoot = tmp.ensureDir("abc"); tmp.writeFile("abc/WORKSPACE", ""); tmp.ensureDir("abc/dart"); final VirtualFile contentRoot = tmp.ensureDir("abc/dart/something"); ModuleRootModificationUtil.addContentRoot(fixture.getModule(), contentRoot.getPath()); tmp.ensureDir("READONLY/abc/dart/config/intellij-plugins"); tmp.writeFile("READONLY/abc/dart/config/intellij-plugins/flutter.json", "{\"daemonScript\": \"scripts/flutter_daemon.sh\"," + "\"doctorScript\": \"scripts/flutter_doctor.sh\"}"); tmp.ensureDir("READONLY/abc/scripts"); tmp.writeFile("READONLY/abc/scripts/flutter_daemon.sh", ""); tmp.writeFile("READONLY/abc/scripts/flutter_doctor.sh", ""); final Workspace w = Workspace.loadUncached(fixture.getProject()); assertNotNull("expected a workspace", w); assertEquals(expectedRoot, w.getRoot()); assertEquals("../READONLY/abc/scripts/flutter_daemon.sh", w.getDaemonScript()); assertEquals("../READONLY/abc/scripts/flutter_doctor.sh", w.getDoctorScript()); }
Example 3
Source File: WorkspaceTest.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Test public void canLoadWorkspaceWithConfigFile() throws Exception { final VirtualFile expectedRoot = tmp.ensureDir("abc"); tmp.writeFile("abc/WORKSPACE", ""); tmp.ensureDir("abc/dart"); final VirtualFile contentRoot = tmp.ensureDir("abc/dart/something"); ModuleRootModificationUtil.addContentRoot(fixture.getModule(), contentRoot.getPath()); tmp.ensureDir("abc/dart/config/intellij-plugins"); tmp.writeFile("abc/dart/config/intellij-plugins/flutter.json", "{\"daemonScript\": \"something_daemon.sh\"," + "\"doctorScript\": \"something_doctor.sh\"}"); tmp.writeFile("abc/something_daemon.sh", ""); tmp.writeFile("abc/something_doctor.sh", ""); final Workspace w = Workspace.loadUncached(fixture.getProject()); assertNotNull("expected a workspace", w); assertEquals(expectedRoot, w.getRoot()); assertEquals("something_daemon.sh", w.getDaemonScript()); assertEquals("something_doctor.sh", w.getDoctorScript()); }
Example 4
Source File: WorkspaceTest.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Test public void canLoadWorkspaceWithConfigFileAndScriptInReadonly() throws Exception { final VirtualFile expectedRoot = tmp.ensureDir("abc"); tmp.writeFile("abc/WORKSPACE", ""); tmp.ensureDir("abc/dart"); final VirtualFile contentRoot = tmp.ensureDir("abc/dart/something"); ModuleRootModificationUtil.addContentRoot(fixture.getModule(), contentRoot.getPath()); tmp.ensureDir("READONLY/abc/dart/config/intellij-plugins"); tmp.writeFile("READONLY/abc/dart/config/intellij-plugins/flutter.json", "{\"daemonScript\": \"scripts/flutter_daemon.sh\"," + "\"doctorScript\": \"scripts/flutter_doctor.sh\"}"); tmp.ensureDir("READONLY/abc/scripts"); tmp.writeFile("READONLY/abc/scripts/flutter_daemon.sh", ""); tmp.writeFile("READONLY/abc/scripts/flutter_doctor.sh", ""); final Workspace w = Workspace.loadUncached(fixture.getProject()); assertNotNull("expected a workspace", w); assertEquals(expectedRoot, w.getRoot()); assertEquals("../READONLY/abc/scripts/flutter_daemon.sh", w.getDaemonScript()); assertEquals("../READONLY/abc/scripts/flutter_doctor.sh", w.getDoctorScript()); }
Example 5
Source File: BlazeSampleDataDirectoryProvider.java From intellij with Apache License 2.0 | 6 votes |
@Override @Nullable public PathString getOrCreateSampleDataDirectory() throws IOException { PathString sampleDataDirectory = getSampleDataDirectory(); if (sampleDataDirectory == null) { return null; } PathString rootPath = sampleDataDirectory.getRoot(); VirtualFile root = rootPath != null ? toVirtualFile(rootPath) : null; if (root == null) { return sampleDataDirectory; } createDirectoryIfMissing(root, sampleDataDirectory.getPortablePath()); // We want to make sure that the sample data directory is associated with this resource module // instead of just being lumped into the workspace module because it sits outside the res // folder. ModuleRootModificationUtil.addContentRoot(module, sampleDataDirectory.getPortablePath()); return sampleDataDirectory; }
Example 6
Source File: WorkspaceTest.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Test public void canLoadWorkspaceWithoutConfigFile() throws Exception { final VirtualFile expectedRoot = tmp.ensureDir("abc"); tmp.writeFile("abc/WORKSPACE", ""); tmp.ensureDir("abc/dart"); final VirtualFile contentRoot = tmp.ensureDir("abc/dart/something"); ModuleRootModificationUtil.addContentRoot(fixture.getModule(), contentRoot.getPath()); final Workspace w = Workspace.loadUncached(fixture.getProject()); assertNotNull("expected a workspace", w); assertEquals(expectedRoot, w.getRoot()); assertFalse("config shouldn't be there", w.hasPluginConfig()); }
Example 7
Source File: WorkspaceTest.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 5 votes |
@Test public void canLoadWorkspaceWithoutConfigFile() throws Exception { final VirtualFile expectedRoot = tmp.ensureDir("abc"); tmp.writeFile("abc/WORKSPACE", ""); tmp.ensureDir("abc/dart"); final VirtualFile contentRoot = tmp.ensureDir("abc/dart/something"); ModuleRootModificationUtil.addContentRoot(fixture.getModule(), contentRoot.getPath()); final Workspace w = Workspace.loadUncached(fixture.getProject()); assertNotNull("expected a workspace", w); assertEquals(expectedRoot, w.getRoot()); assertFalse("config shouldn't be there", w.hasPluginConfig()); }
Example 8
Source File: FlutterPositionMapperTest.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Before public void setUp() throws Exception { sourceRoot = tmp.ensureDir("root"); ModuleRootModificationUtil.addContentRoot(fixture.getModule(), sourceRoot.getPath()); }
Example 9
Source File: FlutterPositionMapperTest.java From flutter-intellij with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Before public void setUp() throws Exception { sourceRoot = tmp.ensureDir("root"); ModuleRootModificationUtil.addContentRoot(fixture.getModule(), sourceRoot.getPath()); }