本文整理汇总了Java中org.eclipse.emf.common.util.URI.createURI方法的典型用法代码示例。如果您正苦于以下问题:Java URI.createURI方法的具体用法?Java URI.createURI怎么用?Java URI.createURI使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.emf.common.util.URI
的用法示例。
在下文中一共展示了URI.createURI方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadPackage
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
/**
* Laods the package and any sub-packages from their serialized form.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void loadPackage() {
if (isLoaded) return;
isLoaded = true;
URL url = getClass().getResource(packageFilename);
if (url == null) {
throw new RuntimeException("Missing serialized package: " + packageFilename);
}
URI uri = URI.createURI(url.toString());
Resource resource = new EcoreResourceFactoryImpl().createResource(uri);
try {
resource.load(null);
}
catch (IOException exception) {
throw new WrappedException(exception);
}
initializeFromLoadedEPackage(this, (EPackage)resource.getContents().get(0));
createResource(eNS_URI);
}
示例2: resolve
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
@Override
public URI resolve(URI uri) {
URI resolvedURI = super.resolve(uri);
if (!_queryParameters.isEmpty() && resolvedURI.scheme() != null && !resolvedURI.scheme().equals("melange")
&& resolvedURI.fileExtension() != null && resolvedURI.fileExtension().equals(_fileExtension)) {
String fileExtensionWithPoint = "." + _fileExtension;
int lastIndexOfFileExtension = resolvedURI.toString().lastIndexOf(fileExtensionWithPoint);
String part1 = resolvedURI.toString().substring(0, lastIndexOfFileExtension);
part1 = part1.replaceFirst("platform:/", "melange:/");
String part2 = fileExtensionWithPoint + _queryParameters;
String part3 = resolvedURI.toString()
.substring(lastIndexOfFileExtension + fileExtensionWithPoint.length());
String newURIAsString = part1 + part2 + part3;
return URI.createURI(newURIAsString);
}
return resolvedURI;
}
示例3: loadPackage
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
/**
* Laods the package and any sub-packages from their serialized form.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void loadPackage() {
if (isLoaded)
return;
isLoaded = true;
URL url = getClass().getResource(packageFilename);
if (url == null) {
throw new RuntimeException("Missing serialized package: " + packageFilename);
}
URI uri = URI.createURI(url.toString());
Resource resource = new EcoreResourceFactoryImpl().createResource(uri);
try {
resource.load(null);
} catch (IOException exception) {
throw new WrappedException(exception);
}
initializeFromLoadedEPackage(this, (EPackage) resource.getContents().get(0));
createResource(eNS_URI);
}
示例4: testTestTreeClone
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
/***/
@Test
public void testTestTreeClone() throws Exception {
final List<TestSuite> originalTestSuites = newArrayList();
final TestSuite originalTestSuite = new TestSuite("name");
final TestCase originalTestCase = new TestCase(new ID("testId"), "testId", "testId", "testId", "testId",
URI.createURI("testURI_testId"));
originalTestSuite.add(originalTestCase);
originalTestSuites.add(originalTestSuite);
final TestTree originalTestTree = new TestTree(new ID("value"), originalTestSuites);
final TestTree copyTestTree = originalTestTree.clone();
assertEquals(originalTestTree, copyTestTree);
assertFalse(originalTestTree == copyTestTree);
assertFalse(originalTestSuites == copyTestTree.getSuites());
assertFalse(originalTestSuite == getOnlyElement(copyTestTree.getSuites()));
assertEquals(originalTestCase, getOnlyElement(getOnlyElement(copyTestTree.getSuites())
.getTestCases()));
assertFalse(originalTestCase == getOnlyElement(getOnlyElement(copyTestTree.getSuites())
.getTestCases()));
}
示例5: tckParse
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
public void tckParse(final File f, final Boolean valid, final String description) throws IOException, TckParseException {
final URI fileURI = URI.createURI(f.toURI().toString());
try {
final RamlModelResult<EObject> result = new RamlModelBuilder().build(fileURI);
if (valid) {
assertThat(result.getValidationResults())
.describedAs(fileURI.toFileString().replace(tckURL.getPath(), "") + "(" + f.getName() + ":0) " + description)
.isEmpty();
} else {
assertThat(result.getValidationResults())
.describedAs(fileURI.toFileString().replace(tckURL.getPath(), "") + "(" + f.getName() + ":0) " + description)
.isNotEmpty();
}
} catch (Throwable e) {
throw new TckParseException(f.toString() + "(" + f.getName() + ":0)", e);
}
}
示例6: api
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
@Ignore
@Test
public void api() {
final File apiFile = new File("/Users/mkoester/Development/commercetools-api-reference/api.raml");
assumeTrue(apiFile.exists());
final URI apiUri = URI.createURI(apiFile.toURI().toString());
final URIConverter uriConverter = new RamlResourceSet().getURIConverter();
final RAMLCustomLexer lexer = new RAMLCustomLexer(apiUri, uriConverter);
final TokenStream tokenStream = new CommonTokenStream(lexer);
final RAMLParser parser = new RAMLParser(tokenStream);
final Resource resource = new RamlResourceSet().createResource(apiUri);
final Scope scope = Scope.of(resource);
final TypeDeclarationResolver resolver = new TypeDeclarationResolver();
resolver.resolve(parser.api(), scope);
assertThat(resource.getErrors()).isEmpty();
}
示例7: registerProject
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
/**
*
* @param location
* project directory containing manifest.n4mf directly
*/
public void registerProject(URI location) {
if (location.lastSegment().isEmpty()) {
throw new IllegalArgumentException("lastSegment may not be empty");
}
if (!projectElementHandles.containsKey(location)) {
LazyProjectDescriptionHandle lazyDescriptionHandle = createLazyDescriptionHandle(location, false);
projectElementHandles.put(location, lazyDescriptionHandle);
for (String libraryPath : lazyDescriptionHandle.createProjectElementHandle().getLibraryPaths()) {
URI libraryFolder = location.appendSegment(libraryPath);
File lib = new File(java.net.URI.create(libraryFolder.toString()));
if (lib.isDirectory()) {
for (File archive : lib.listFiles()) {
if (archive.getName().endsWith(IN4JSArchive.NFAR_FILE_EXTENSION_WITH_DOT)) {
URI archiveLocation = URI.createURI(archive.toURI().toString());
projectElementHandles.put(archiveLocation,
createLazyDescriptionHandle(archiveLocation, true));
}
}
}
}
}
}
示例8: tckTest
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
@Test
@UseDataProvider("allTckApiRamlFiles")
public void tckTest(final File f) throws IOException, TckParseException {
final Resource resource;
final URI fileURI = URI.createURI(f.toURI().toString());
try {
resource = fromUri(fileURI);
} catch (Exception e) {
throw new TckParseException(fileURI.toString(), e);
}
if (!resource.getErrors().isEmpty()) {
String file = fileURI.toString();
System.out.println(file);
}
}
示例9: findArtifactInFolder
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
@Override
public URI findArtifactInFolder(URI folderLocation, String folderRelativePath) {
final Path sourceContainerDirectory = Paths.get(java.net.URI.create(folderLocation.toString()));
final Path subPath = Paths.get(folderRelativePath.replace("/", File.separator));
final File file = sourceContainerDirectory.resolve(subPath).toFile().getAbsoluteFile();
if (file.exists())
return URI.createURI(file.toURI().toString());
return null;
}
示例10: testArchiveURIForZipEntry
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
@SuppressWarnings("javadoc")
@Test
public void testArchiveURIForZipEntry() {
ZipEntry entry = new ZipEntry("a/b/c.js");
URI base = URI.createURI("file:/a/b/c.nfar");
URI manifestURI = ArchiveURIUtil.createURI(base, entry);
Assert.assertEquals("archive:file:/a/b/c.nfar!/a/b/c.js", manifestURI.toString());
}
示例11: test
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
/**
* generated instances of the tests will use this base implementation
*/
@Override
@Test
public void test() throws Exception {
if (this.parserN4JS == null) {
throw new Error("parser instance is null");
}
String code = TestCodeProvider.getContentsFromFileEntry(config.entry, config.resourceName);
if (code == null) {
throw new Error("test data code instance is null");
}
Analyser analyser = createAnalyzer(code);
XtextResourceSet resourceSet = resourceSetProvider.get();
URI uri = URI.createURI(config.entry.getName());
// ECMA 6 test suite was changed - "use strict" is synthesized by the test runner
// we do the same here
if (code.contains("flags: [onlyStrict]")) {
// by using the proper file extension
uri = uri.trimFileExtension().appendFileExtension("n4js");
}
Script script = doParse(code, uri, resourceSet, analyser);
if (config.isValidator()) {
// validation flag is bogus since it will produce linking issues
// thus the negative tests will likely succeed for bogus reasons
throw new IllegalStateException(config.entry.getName());
}
// try {
analyser.analyse(script, config.entry.getName(), code);
// } catch (AssertionError e) {
// System.out.println(config.entry.getName());
// throw e;
// }
}
示例12: apiViaHttp
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
@Ignore
@Test
public void apiViaHttp() {
final URI uri = URI.createURI("http://localhost:5050/api-raml/");
final Resource resource = fromUri(uri);
resource.getContents();
assertThat(resource).isNotNull();
}
示例13: setUp
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
@Before
public void setUp() throws IOException {
uri = URI.createURI("file://tmp/");
resource = new SharedResource(uri);
//this.write(resource);
}
示例14: relative
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
public String relative ( String base, String uri )
{
URI baseUri = URI.createURI(base);
return URI.createURI(uri).deresolve(baseUri,false,true,false).toString();
}
示例15: getResource
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
public static Resource getResource(IFile file) {
URI uri = URI.createURI(file.getLocationURI().toString());
return getResource(uri);
}