本文整理汇总了Java中org.eclipse.emf.common.util.URI.isPlatform方法的典型用法代码示例。如果您正苦于以下问题:Java URI.isPlatform方法的具体用法?Java URI.isPlatform怎么用?Java URI.isPlatform使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.emf.common.util.URI
的用法示例。
在下文中一共展示了URI.isPlatform方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: tryLocateGeneratedFile
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
private IFile tryLocateGeneratedFile(final IFile file, final String genID) {
final URI fileUri = createPlatformResourceURI(file.getFullPath().toOSString(), true);
if (fileUri.isPlatform()) {
final Optional<? extends IN4JSProject> project = core.findProject(fileUri);
if (project.isPresent()) {
try {
final String targetFileName = compilerHelper.getTargetFileName(fileUri, JS_FILE_EXTENSION);
final String targetFileRelativeLocation = project.get().getOutputPath() + "/"
// TODO replace hard coded ES5 sub-generator ID once it is clear how to use various
// sub-generators for runners (IDE-1487)
+ genID + "/" + targetFileName;
final IFile targetFile = file.getProject().getFile(targetFileRelativeLocation);
if (targetFile.exists()) {
return targetFile;
}
} catch (final GeneratorException e) {
// file is not contained in a source container.
return null;
}
}
}
return null;
}
示例2: assertResourceDescriptions
import org.eclipse.emf.common.util.URI; //导入方法依赖的package包/类
/**
* Checks if expected list of stringified file locations matches
*
* @param expected
* collection of entries
* @param actual
* collection of entries
*/
public void assertResourceDescriptions(Collection<String> expected, Iterable<IResourceDescription> actual) {
Set<String> extraDescriptions = new HashSet<>();
Set<String> missingDescriptions = new HashSet<>(expected);
for (IResourceDescription iResourceDescription : actual) {
URI uri = iResourceDescription.getURI();
String stringUri = uri.isPlatform() ? uri.toPlatformString(false) : uri.toFileString();
if (!missingDescriptions.contains(stringUri)) {
extraDescriptions.add(stringUri);
} else {
missingDescriptions.remove(stringUri);
}
}
if (missingDescriptions.isEmpty() && extraDescriptions.isEmpty()) {
return;
}
StringBuilder msg = new StringBuilder("unexpected actual resources" + "\n");
if (!extraDescriptions.isEmpty()) {
msg.append("actual contains " + extraDescriptions.size() + " extra resources" + "\n");
}
if (!missingDescriptions.isEmpty()) {
msg.append("actual is missing " + missingDescriptions.size() + " expected resources" + "\n");
}
for (String extra : extraDescriptions) {
msg.append("[extra] " + extra + "\n");
}
for (String missing : missingDescriptions) {
msg.append("[missing] " + missing + "\n");
}
fail(msg.toString());
}