當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。