本文整理汇总了Java中org.eclipse.emf.ecore.resource.Resource.getURIFragment方法的典型用法代码示例。如果您正苦于以下问题:Java Resource.getURIFragment方法的具体用法?Java Resource.getURIFragment怎么用?Java Resource.getURIFragment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.emf.ecore.resource.Resource
的用法示例。
在下文中一共展示了Resource.getURIFragment方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createToggleBreakpointsUtils
import org.eclipse.emf.ecore.resource.Resource; //导入方法依赖的package包/类
@Override
protected DSLToggleBreakpointsUtils createToggleBreakpointsUtils() {
return new DSLToggleBreakpointsUtils(getModelIdentifier()){
@Override
protected DSLBreakpoint createBreakpoint(Object selected,
EObject instruction) throws CoreException {
final Resource res = ((EObject)instruction).eResource();
final ResourceSet resSet = res.getResourceSet();
final MelangeResource mr = resSet.getResources().stream().filter(r -> {
return r instanceof MelangeResource;
}).map(r -> (MelangeResource)r).findFirst().orElse(null);
if (mr != null) {
final String fragmentURI = res.getURIFragment(instruction);
instruction = mr.getWrappedResource().getEObject(fragmentURI);
}
return new GemocBreakpoint(identifier, instruction, true);
}
};
}
示例2: showInEditor
import org.eclipse.emf.ecore.resource.Resource; //导入方法依赖的package包/类
private void showInEditor(EObject eobj) {
final Resource res = eobj.eResource();
final URI uriBase = res.getURI();
final String frag = res.getURIFragment(eobj);
final URI uri = uriBase.appendFragment(frag);
uriOpener.open(uri, true);
}
示例3: hasRegularBreakpointTrue
import org.eclipse.emf.ecore.resource.Resource; //导入方法依赖的package包/类
private boolean hasRegularBreakpointTrue(EObject o) {
EObject target = o;
// Try to get the original object if 'o' comes from
// a downcast resource
if(this.engine instanceof PlainK3ExecutionEngine){
Resource res = o.eResource();
if(res != null) {
MelangeResourceImpl mr = null;
for(Resource candidate : res.getResourceSet().getResources()) {
if(candidate instanceof MelangeResourceImpl) {
mr = (MelangeResourceImpl) candidate;
break;
}
}
if(mr != null) {
String uriFragment = res.getURIFragment(o);
target = mr.getWrappedResource().getEObject(uriFragment);
}
}
}
return super.shouldBreak(target)
&& (Boolean.valueOf((String) getBreakpointAttributes(target, GemocBreakpoint.BREAK_ON_LOGICAL_STEP)) || Boolean
.valueOf((String) getBreakpointAttributes(target, GemocBreakpoint.BREAK_ON_MSE_OCCURRENCE)))
// && checkBreakpointProperty(target, o)
;
}
示例4: getEditorInput
import org.eclipse.emf.ecore.resource.Resource; //导入方法依赖的package包/类
@Override
public IEditorInput getEditorInput(Object element) {
if (element instanceof EObject) {
EObject eObject = (EObject) element;
EObject target = eObject;
Resource res = eObject.eResource();
if(res != null && res.getResourceSet() != null) {
MelangeResourceImpl mr = null;
for(Resource candidate : res.getResourceSet().getResources()) {
if(candidate instanceof MelangeResourceImpl) {
mr = (MelangeResourceImpl) candidate;
break;
}
}
if(mr != null) {
String uriFragment = res.getURIFragment(eObject);
target = mr.getWrappedResource().getEObject(uriFragment);
}
}
Resource r = eObject.eResource();
if (r instanceof XtextResource) {
URI uri = target.eResource().getURI();
if(uri.toPlatformString(true) != null){
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(new Path(uri.toPlatformString(true)));
IFileEditorInput input = new FileEditorInput(file);
return input;
}
}
else {
//Default
return getPresentation().getEditorInput(eObject);
}
}
return null;
}
示例5: getInitialFragment
import org.eclipse.emf.ecore.resource.Resource; //导入方法依赖的package包/类
private String getInitialFragment(EObject root) {
Resource resource = root.eResource();
if (resource != null)
return resource.getURIFragment(root);
return EcoreUtil.getURI(root).fragment();
}