mirror of
https://github.com/sigmasternchen/xtext-core
synced 2025-03-16 08:48:55 +00:00
[356750] addPath can also take a comma-separated list of paths and
splits it. This feature is useful for workflows where the list of paths is passed in as a single argument. Change-Id: I0b933c18c318487544e29ed5b9e36cf8acd30698 Signed-off-by: Karsten Thoms <karsten.thoms@itemis.de>
This commit is contained in:
parent
752959b238
commit
9297b3ebb4
2 changed files with 28 additions and 10 deletions
|
@ -70,16 +70,25 @@ public class Reader extends AbstractReader {
|
|||
|
||||
/**
|
||||
* <p>
|
||||
* A path pointing to a folder, jar or zip which contains EMF resources.
|
||||
* </p><p>
|
||||
* Example use:
|
||||
* A comma-separated list of paths pointing to a folder, jar or zip which contains EMF resources.
|
||||
* </p>
|
||||
* <p>
|
||||
* Example use (MWE2):
|
||||
* </p>
|
||||
* <code>
|
||||
* <path value="./foo/bar.jar"/>
|
||||
* path = "./foo/bar.jar,./src/main/model"
|
||||
* </code>
|
||||
* <p>
|
||||
* Example use (MWE1):
|
||||
* </p>
|
||||
* <code>
|
||||
* <path value="./foo/bar.jar,./src/main/model"/>
|
||||
* </code>
|
||||
*/
|
||||
public void addPath(String path) {
|
||||
this.pathes.add(path);
|
||||
for (String p : path.split(",")) {
|
||||
this.pathes.add(p.trim());
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getPathes() {
|
||||
|
@ -89,8 +98,15 @@ public class Reader extends AbstractReader {
|
|||
/**
|
||||
* <p>
|
||||
* Automatically adds all class path entries of the current process (more specifically uses 'java.class.path' system property).
|
||||
* </p><p>
|
||||
* Example use:
|
||||
* </p>
|
||||
* <p>
|
||||
* Example use (MWE2):
|
||||
* </p>
|
||||
* <code>
|
||||
* useJavaClassPath = true
|
||||
* </code>
|
||||
* <p>
|
||||
* Example use (MWE1):
|
||||
* </p>
|
||||
* <code>
|
||||
* <useJavaClassPath value="true"/>
|
||||
|
|
|
@ -94,9 +94,11 @@ public class ReaderTest extends AbstractReaderTest {
|
|||
@SuppressWarnings("unchecked")
|
||||
@Test public void testShadowingPathes() throws Exception {
|
||||
Reader reader = getReader();
|
||||
reader.addPath(pathTo("shadowingtest/folder 1"));
|
||||
reader.addPath(pathTo("shadowingtest/folder 2"));
|
||||
reader.addPath(pathTo("shadowingtest/folder 3"));
|
||||
// also test adding multiple paths as comma-separated list, see bug#356750
|
||||
reader.addPath(
|
||||
pathTo("shadowingtest/folder 1")
|
||||
+"," +pathTo("shadowingtest/folder 2")
|
||||
+" , "+pathTo("shadowingtest/folder 3"));
|
||||
reader.addRegister(new IndexTestLanguageStandaloneSetup());
|
||||
SlotEntry entry = createSlotEntry();
|
||||
entry.setType("Entity");
|
||||
|
|
Loading…
Reference in a new issue