当前位置: 首页>>代码示例>>Java>>正文


Java Resource.getURIFragment方法代码示例

本文整理汇总了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);
		}
		
	};
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:22,代码来源:GemocToggleBreakpointAction.java

示例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);
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:8,代码来源:ApiCompareView.java

示例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)
				;
	}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:30,代码来源:GenericSequentialModelDebugger.java

示例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;
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:41,代码来源:GemocSourceLocator.java

示例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();
}
 
开发者ID:eclipse,项目名称:n4js,代码行数:7,代码来源:N4JSUnloader.java


注:本文中的org.eclipse.emf.ecore.resource.Resource.getURIFragment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。