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


Java HawkResource类代码示例

本文整理汇总了Java中org.hawk.emfresource.HawkResource的典型用法代码示例。如果您正苦于以下问题:Java HawkResource类的具体用法?Java HawkResource怎么用?Java HawkResource使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


HawkResource类属于org.hawk.emfresource包,在下文中一共展示了HawkResource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: greedySerialize

import org.hawk.emfresource.HawkResource; //导入依赖的package包/类
protected Serializer greedySerialize(final HawkResource resource, IProgressMonitor monitor)
		throws Exception, IfcModelInterfaceException {
	final int total = resource.getContents().size();
	/*
	 * Greedy loading modes are simple: we already have everything in the
	 * model, so we can use the standard EMF facilities.
	 */
	final Serializer serializer = createSerializer(resource);
	long oid = 0;
	int current = 0, offset = 0;
	for (TreeIterator<EObject> it = resource.getAllContents(); it.hasNext();) {
		final EObject eo = it.next();
		oid = addToSerializer(serializer, oid, eo);
		++current;

		if (current == REPORTING_BATCH_SIZE) {
			offset += current;
			current = 0;
			monitor.subTask(String.format("Populating IFC serializer (%d/%d)", offset, total));
		}
	}
	return serializer;
}
 
开发者ID:mondo-project,项目名称:mondo-integration,代码行数:24,代码来源:IFCExportJobExecutor.java

示例2: getResource

import org.hawk.emfresource.HawkResource; //导入依赖的package包/类
protected HawkResource getResource()
{
	return new LocalHawkResourceImpl(URI.createURI("hawk://"), 
			getHawkModel().getIndexer(), false, 
			Collections.singletonList(request.getRepositoryPattern()),
			request.getFilePatterns());
}
 
开发者ID:mondo-project,项目名称:mondo-integration,代码行数:8,代码来源:IFCExportJobExecutor.java

示例3: exportToSTEP

import org.hawk.emfresource.HawkResource; //导入依赖的package包/类
protected void exportToSTEP(final File dest, final IProgressMonitor monitor)
		throws IOException, FileNotFoundException, Exception, IfcModelInterfaceException, SerializerException,
		CoreException {
	monitor.beginTask("Exporting " + getHawkModel().getName() + " to " + dest.getName(), 4);

	monitor.subTask("Loading Hawk resource");
	final ResourceSet rs = new ResourceSetImpl();
	final HawkResource resource = getResource();
	try {
		rs.getResources().add(resource);
		monitor.worked(1);
		if (monitor.isCanceled()) {
			return;
		}

		monitor.subTask("Populating IFC serializer");
		Serializer serializer = greedySerialize(resource, monitor);
		serializer.getModel().generateMinimalExpressIds();
		monitor.worked(1);
		if (monitor.isCanceled()) {
			return;
		}

		monitor.subTask("Writing STEP file");
		serializer.writeToFile(dest, new ProgressReporter() {
			@Override
			public void update(long progress, long max) {
				monitor.subTask(String.format("Writing STEP file (%d/%d)", progress, max));
			}
		});
		monitor.worked(1);
		if (monitor.isCanceled()) {
			return;
		}
	} finally {
		// TODO: ask Will - why don't we unload the resource here?
		//resource.unload();
	}
}
 
开发者ID:mondo-project,项目名称:mondo-integration,代码行数:40,代码来源:IFCExportJobExecutor.java

示例4: createSerializer

import org.hawk.emfresource.HawkResource; //导入依赖的package包/类
private Serializer createSerializer(final HawkResource resource) throws Exception {
	Serializer serializer = null;
	for (TreeIterator<EObject> it = EcoreUtil.getAllContents(resource, false); it.hasNext()
			&& serializer == null;) {
		EObject eo = it.next();
		if (eo instanceof IdEObject) {
			serializer = createSerializer(eo.eClass().getEPackage().getNsURI());
		}
	}
	return serializer;
}
 
开发者ID:mondo-project,项目名称:mondo-integration,代码行数:12,代码来源:IFCExportJobExecutor.java

示例5: fetchNode

import org.hawk.emfresource.HawkResource; //导入依赖的package包/类
@Override
public EObject fetchNode(HawkResource containerResource, String uriFragment, boolean fetchAttributes) throws Exception {
	if (!(containerResource instanceof HawkFileResourceImpl)) {
		return null;
	}

	final HawkFileResourceImpl r = (HawkFileResourceImpl)containerResource;
	final FileNode fileNode = uriToFileNode.get(r.getURI().toString());
	LOGGER.warn("Iterating over the contents of {}{} to find fragment {}: inefficient!",
			fileNode.getRepositoryURL(), fileNode.getFilePath(), uriFragment);

	String nodeId = null;
	try (IGraphTransaction tx = fileNode.getNode().getGraph().beginTransaction()) {
		for (ModelElementNode me : fileNode.getModelElements()) {
			final String fragment = me.getElementId();
			final String currentNodeId = me.getNodeId();
			if (uriFragment.equals(fragment)) {
				nodeId = currentNodeId;
			}
		}
	}

	if (nodeId != null) {
		return fetchNode(nodeId, fetchAttributes);
	} else {
		return null;
	}
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:29,代码来源:LocalHawkResourceImpl.java

示例6: generateCustomizerActions

import org.hawk.emfresource.HawkResource; //导入依赖的package包/类
@Override
public Collection<IAction> generateCustomizerActions(ISelection selection) {
	if (selection instanceof IStructuredSelection) {
		final IStructuredSelection ssel = (IStructuredSelection)selection;
		if (ssel.getFirstElement() instanceof HawkResource) {
			final HawkResource r = (HawkResource)ssel.getFirstElement();
			final List<IAction> actions = new ArrayList<>();
			final Action fetchByEClass = new FetchByEClassAction(r);
			fetchByEClass.setText("Fetch by EClass");
			actions.add(fetchByEClass);
			return actions;
		}
	}
	return Collections.emptyList();
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:16,代码来源:HawkResourceExeedCustomizer.java

示例7: fetchNode

import org.hawk.emfresource.HawkResource; //导入依赖的package包/类
@Override
public EObject fetchNode(HawkResource containerResource, String uriFragment, boolean mustFetchAttributes) throws Exception {
	// TODO We need to extend the Thrift API to support this, and it'd be an inefficient operation right now.
	throw new UnsupportedOperationException();
}
 
开发者ID:mondo-project,项目名称:mondo-integration,代码行数:6,代码来源:HawkResourceImpl.java

示例8: HawkQueryRuntimeContext

import org.hawk.emfresource.HawkResource; //导入依赖的package包/类
public HawkQueryRuntimeContext(final HawkResource hawkResource, final Logger logger) {
	super(null, logger, null);
	this.hawkResource = hawkResource;
}
 
开发者ID:mondo-project,项目名称:mondo-integration,代码行数:5,代码来源:HawkQueryRuntimeContext.java

示例9: LazyResolver

import org.hawk.emfresource.HawkResource; //导入依赖的package包/类
public LazyResolver(HawkResource resource) {
	this.resource = resource;
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:4,代码来源:LazyResolver.java

示例10: HawkFileResourceImpl

import org.hawk.emfresource.HawkResource; //导入依赖的package包/类
/**
 * Creates a resource as a subordinate of another. Used to indicate the
 * repository URL and file of an {@link EObject}.
 */
public HawkFileResourceImpl(final URI uri, final HawkResource mainResource) {
	super(uri);
	this.mainResource = mainResource;
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:9,代码来源:HawkFileResourceImpl.java

示例11: fetchNode

import org.hawk.emfresource.HawkResource; //导入依赖的package包/类
@Override
public EObject fetchNode(HawkResource containerResource, String uriFragment, boolean mustFetchAttributes) throws Exception {
	return mainResource.fetchNode(containerResource, uriFragment, mustFetchAttributes);
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:5,代码来源:HawkFileResourceImpl.java

示例12: FetchByEClassAction

import org.hawk.emfresource.HawkResource; //导入依赖的package包/类
public FetchByEClassAction(HawkResource r) {
	this.resource = r;
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:4,代码来源:FetchByEClassAction.java

示例13: hasChildren

import org.hawk.emfresource.HawkResource; //导入依赖的package包/类
@Override
public boolean hasChildren(Resource r, EObject eob) {
	final HawkResource hawkResource = (HawkResource)r;
	return hawkResource.hasChildren(eob);
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:6,代码来源:HawkResourceExeedCustomizer.java

示例14: isEnabledFor

import org.hawk.emfresource.HawkResource; //导入依赖的package包/类
@Override
public boolean isEnabledFor(Resource r) {
	return r instanceof HawkResource;
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:5,代码来源:HawkResourceExeedCustomizer.java

示例15: EClassSelectionDialog

import org.hawk.emfresource.HawkResource; //导入依赖的package包/类
EClassSelectionDialog(Shell parentShell, HawkResource hawkResource) {
	super(parentShell);
	this.resource = hawkResource;
}
 
开发者ID:mondo-project,项目名称:mondo-hawk,代码行数:5,代码来源:EClassSelectionDialog.java


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