• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java CDOObject类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: checkDetachedObjects

import org.eclipse.emf.cdo.CDOObject; //导入依赖的package包/类
/**
 * Checks for {@link CDOSessionInvalidationEvent#getDetachedObjects() detached objects}.
 * 
 * @param cdoSessionInvalidationEvent
 *            the {@link CDOSessionInvalidationEvent}
 */
protected void checkDetachedObjects(final CDOSessionInvalidationEvent cdoSessionInvalidationEvent) {
	final CDOView view = cdoSessionInvalidationEvent.getSource().openView(cdoSessionInvalidationEvent
			.getBranch(), cdoSessionInvalidationEvent.getPreviousTimeStamp());

	for (CDOIDAndVersion cdoidAndVersion : cdoSessionInvalidationEvent.getDetachedObjects()) {
		final CDOObject object = view.getObject(cdoidAndVersion.getID());
		if (object instanceof CDOResourceNode) {
			final CDOResourceNode node = (CDOResourceNode)object;
			for (IBase base : bases) {
				final ILocation repositoryLocation = MappingUtils.getConnectorRegistry().getLocation(base,
						view);
				if (repositoryLocation != null) {
					deleteResourceNode(repositoryLocation, node);
				}
			}
		} else {
			// TODO other deletions/resource change
		}
	}

	view.close();
}
 
开发者ID:ModelWriter,项目名称:Source,代码行数:29,代码来源:MappingCDOListener.java


示例2: sendCurrentlyFocusedElement

import org.eclipse.emf.cdo.CDOObject; //导入依赖的package包/类
@Override
public void sendCurrentlyFocusedElement() {
    Optional<Element> element = focusManager.getFocusedElement();
    if (!element.isPresent()) {
        LOGGER.info("No element focused.");
        return;
    }

    Optional<IDiagramType> currentDiagramType = focusManager.getDiagramType();
    if (!currentDiagramType.isPresent()) {
        LOGGER.info("Diagram type could not be detected.");
        return;
    }

    Element focusedElement = element.get();

    try {
        CDOObject cdoObject = CDOUtil.getCDOObject(focusedElement);
        messageHandler.sendFocus(cdoObject);
        LOGGER.debug("sendCurrentlyFocusedElement element={}", cdoObject);

    } catch (Exception e) {
        LOGGER.error("Could not send focus request.", e);
    }

}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:27,代码来源:FocusedDiagram.java


示例3: fixStaleReferences

import org.eclipse.emf.cdo.CDOObject; //导入依赖的package包/类
private void fixStaleReferences(CDOTransaction transaction) {
    Collection<CDOCommitInfo> infos = Lists.newArrayList();
    transaction.getSession().getCommitInfoManager().getCommitInfos(transaction.getBranch(), lastMergeTimeBranch,
            CDOView.UNSPECIFIED_DATE, infos::add);
    Set<CrossReferenceSetting> candidates = infos.stream()
            .flatMap(i -> findPossibleStaleReferences(transaction.getSession(), i).stream())
            .collect(Collectors.toSet());
    for (CrossReferenceSetting setting : candidates) {
        try {
            CDOObject eObject = transaction.getObject(setting.getObject());
            fixStaleReference(eObject, setting);
        } catch (ObjectNotFoundException e) {
            LOGGER.warn("Attempt to fix a stale reference on an non existing object.", e);
        }
    }
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:17,代码来源:TransformationManager.java


示例4: fixStaleReference

import org.eclipse.emf.cdo.CDOObject; //导入依赖的package包/类
private static void fixStaleReference(CDOObject eObject, CrossReferenceSetting setting) {
    EReference eReference = setting.getReference();
    if (eObject == null) {
        return;
    }
    Object value = eObject.eGet(eReference, true);
    if (value instanceof EObject && CDOUtil.isStaleObject(value)) {
        CDOUtil.cleanStaleReference(eObject, eReference);
    } else if (value instanceof List<?>) {
        List<?> list = (List<?>) value;
        for (Object o : list) {
            if (CDOUtil.isStaleObject(o)) {
                int index = list.indexOf(o);
                CDOUtil.cleanStaleReference(eObject, eReference, index);
            }
        }
    }
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:19,代码来源:TransformationManager.java


示例5: findPossibleStaleReferences

import org.eclipse.emf.cdo.CDOObject; //导入依赖的package包/类
private static Set<CrossReferenceSetting> findPossibleStaleReferences(CDOSession session,
        CDOCommitInfo commitInfo) {
    CDOView historicView = session.openView(commitInfo.getBranch(), commitInfo.getTimeStamp() - 1);
    try {
        Set<CDOObject> detachedObjects = commitInfo.getDetachedObjects().stream().map(CDOIDAndVersion::getID)
                .map(historicView::getObject).collect(Collectors.toSet());
        if (detachedObjects.isEmpty()) {
            return Collections.emptySet();
        }
        return historicView.queryXRefs(detachedObjects, new EReference[0]).stream()
                .map(ref -> new CrossReferenceSetting((EReference) ref.getSourceFeature(),
                        ref.getSourceObject().cdoID()))
                .collect(Collectors.toSet());
    } finally {
        IOUtil.closeSilent(historicView);
    }
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:18,代码来源:TransformationManager.java


示例6: tryLock

import org.eclipse.emf.cdo.CDOObject; //导入依赖的package包/类
@Override
	public boolean tryLock(QJob job, QSystem object, long time, LockType lockType) {
		try {
			CDOObject cdoSystem = CDOUtil.getCDOObject((EObject)object);		
//				cdoSystem = transaction.getObject(cdoSystem.cdoID(), true);
			
			// lock system for shared synchronization
			CDOLock lock = cdoSystem.cdoWriteLock();
			
			// locked by this view or others
			if(lock.isLocked() || lock.isLockedByOthers())
				return false;

			return lock.tryLock(time);
		} catch (InterruptedException e) {
			System.err.println(e.getMessage());
			return false;
		}
		
	}
 
开发者ID:asupdev,项目名称:asup,代码行数:21,代码来源:CDOSystemLockerImpl.java


示例7: tryLock

import org.eclipse.emf.cdo.CDOObject; //导入依赖的package包/类
@Override
	public boolean tryLock(QJob job, T object, long time, LockType lockType) {
		try {

			CDOObject cdoObject = CDOUtil.getCDOObject((EObject)object);
//				cdoSystem = transaction.getObject(cdoSystem.cdoID(), true);

			// lock system for shared synchronization
			CDOLock lock = cdoObject.cdoWriteLock();

			// locked by this view or others
//			if(lock.isLocked() || lock.isLockedByOthers())
//				return false;

			return lock.tryLock(time, TimeUnit.SECONDS);
		}
		catch (InterruptedException e) {
			System.err.println(e.getMessage());
			return false;
		}

	}
 
开发者ID:asupdev,项目名称:asup,代码行数:23,代码来源:CDOObjectLockerImpl.java


示例8: data

import org.eclipse.emf.cdo.CDOObject; //导入依赖的package包/类
private static JsonNode data(ObjectMapper mapper, EObject o) {
	CDOObject oo = CDOUtil.getCDOObject(o);
	long i = CDOIDUtil.getLong(CDOIDUtil.getCDOID(oo));

	return mapper.createObjectNode()
			.put("eClass", "org.emfjson.sample.model#//User")
			.put("name", "Frank")
			.set("friends", mapper.createArrayNode()
					.add(i));
}
 
开发者ID:emfjson,项目名称:emfjson-samples,代码行数:11,代码来源:Main.java


示例9: serialize

import org.eclipse.emf.cdo.CDOObject; //导入依赖的package包/类
@Override
public void serialize(EObject source, EObject value, JsonGenerator jg, SerializerProvider provider) throws IOException {
	final CDOObject cdoObject = CDOUtil.getCDOObject(value);
	final CDOID cdoid = CDOIDUtil.getCDOID(cdoObject);

	if (cdoid != null) {
		jg.writeNumber(CDOIDUtil.getLong(cdoid));
	} else {
		jg.writeNull();
	}
}
 
开发者ID:emfjson,项目名称:emfjson-samples,代码行数:12,代码来源:CDOReferenceSerializer.java


示例10: serialize

import org.eclipse.emf.cdo.CDOObject; //导入依赖的package包/类
@Override
public void serialize(EObject object, JsonGenerator jg, SerializerProvider provider) throws IOException {
	final JacksonOptions options = (JacksonOptions) provider.getAttribute("options");
	final CDOObject cdoObject = CDOUtil.getCDOObject(object);
	final CDOID cdoid = CDOIDUtil.getCDOID(cdoObject);

	jg.writeNumberField(options.idField, CDOIDUtil.getLong(cdoid));
}
 
开发者ID:emfjson,项目名称:emfjson-samples,代码行数:9,代码来源:CDOIDSerializer.java


示例11: checkAttachedObjects

import org.eclipse.emf.cdo.CDOObject; //导入依赖的package包/类
/**
 * Checks for {@link CDOSessionInvalidationEvent#getNewObjects() attached objects}.
 * 
 * @param cdoSessionInvalidationEvent
 *            the {@link CDOSessionInvalidationEvent}
 */
protected void checkAttachedObjects(CDOSessionInvalidationEvent cdoSessionInvalidationEvent) {
	final CDOView view = cdoSessionInvalidationEvent.getLocalTransaction();

	for (CDOIDAndVersion cdoidAndVersion : cdoSessionInvalidationEvent.getNewObjects()) {
		final CDOObject object = view.getObject(cdoidAndVersion.getID());
		if (object instanceof BaseImpl) {
			registerBase(view, (BaseImpl)object);
		}
	}
}
 
开发者ID:ModelWriter,项目名称:Source,代码行数:17,代码来源:CDOMappingBaseListener.java


示例12: checkDetachedObjects

import org.eclipse.emf.cdo.CDOObject; //导入依赖的package包/类
/**
 * Checks for {@link CDOSessionInvalidationEvent#getDetachedObjects() detached objects}.
 * 
 * @param cdoSessionInvalidationEvent
 *            the {@link CDOSessionInvalidationEvent}
 */
protected void checkDetachedObjects(final CDOSessionInvalidationEvent cdoSessionInvalidationEvent) {
	final CDOView view = cdoSessionInvalidationEvent.getSource().openView(cdoSessionInvalidationEvent
			.getBranch(), cdoSessionInvalidationEvent.getPreviousTimeStamp());

	for (CDOIDAndVersion cdoidAndVersion : cdoSessionInvalidationEvent.getDetachedObjects()) {
		final CDOObject object = view.getObject(cdoidAndVersion.getID());
		if (object instanceof BaseImpl) {
			unregisterBase(view, (BaseImpl)object);
		}
	}

	view.close();
}
 
开发者ID:ModelWriter,项目名称:Source,代码行数:20,代码来源:CDOMappingBaseListener.java


示例13: initStateOfObject

import org.eclipse.emf.cdo.CDOObject; //导入依赖的package包/类
private static void initStateOfObject(CDOView view, CDOID cdoid) {
    CDOObject cdoObject = getCDOObjectById(view, cdoid);
    if (cdoObject == null) {
        return;
    }
    String nsURI = cdoObject.eClass().getEPackage().getNsURI();

    Optional<IDerivedStateProcessor> extension = DerivedStateCalculatorRegistry.INSTANCE.getExtension(nsURI);
    if (extension.isPresent()) {
        IDerivedStateProcessor prevDerivedStateProcessor = extension.get();
        prevDerivedStateProcessor.initState(cdoObject, true);
    }
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:14,代码来源:ComparisonManager.java


示例14: getCDOObjectById

import org.eclipse.emf.cdo.CDOObject; //导入依赖的package包/类
private static CDOObject getCDOObjectById(CDOView view, CDOID cdoid) {
    try {
        return view.getObject(cdoid);
    } catch (Exception e) {
        LOGGER.warn(e.getMessage(), e);
        return null;
    }
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:9,代码来源:ComparisonManager.java


示例15: getResourceCDOId

import org.eclipse.emf.cdo.CDOObject; //导入依赖的package包/类
private static CDOID getResourceCDOId(ConcreteSyntaxModel textModel) {
    CDOObject textRoot = CDOUtil.getCDOObject(textModel.getRootElement());
    CDOResource cdoResource = textRoot.cdoResource();
    if (cdoResource == null) {
        return null;
    }
    return cdoResource.cdoID();
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:9,代码来源:ComparisonManager.java


示例16: handleFocusRequest

import org.eclipse.emf.cdo.CDOObject; //导入依赖的package包/类
private void handleFocusRequest(CDOObject object, long timestamp) {
    LOGGER.debug("handleFocusRequest for id={} at t={}", object.cdoID(), timestamp);
    history.add(new HistoryElement(object, timestamp));
    historyChangedListeners.forEach(l -> l.historyChanged(this));
    if (!mute) {
        Display.getDefault().syncExec(() -> showFocusDialog(object));
    }
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:9,代码来源:FocusedDiagram.java


示例17: showFocusDialog

import org.eclipse.emf.cdo.CDOObject; //导入依赖的package包/类
private void showFocusDialog(CDOObject object) {
    Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
    String elementLabel = LabelUtils.getEObjectLabel(object);
    String message = elementLabel + " has been focused. Would you like to jump to it?";
    Toolkit.getDefaultToolkit().beep();
    if (MessageDialog.openConfirm(shell, "Incoming element focus", message)) {
        setFocusedElement(object);
    }
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:10,代码来源:FocusedDiagram.java


示例18: handleFocusRequest

import org.eclipse.emf.cdo.CDOObject; //导入依赖的package包/类
@Override
public void handleFocusRequest(String diagramIdentifier, CDOID elementID) {
    Optional<CDOView> cdoView = viewProvider.get();
    if (!cdoView.isPresent()) {
        LOGGER.warn("Could not recover object by ID because of missing CDO view.");
        return;
    }
    CDOObject object = cdoView.get().getObject(elementID);
    focusRequestHandler.handleFocusRequest(object, System.currentTimeMillis());
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:11,代码来源:MessageHandler.java


示例19: selectAppropriateModel

import org.eclipse.emf.cdo.CDOObject; //导入依赖的package包/类
private void selectAppropriateModel(IEditorPart editorPart) throws PartInitException {
    try {
        ServicesRegistry servicesRegistry = getServicesRegistery(editorPart);
        EObject rootObject = getConcreteSyntaxModel().getRootElement();
        CDOObject rootObjectCDO = CDOUtil.getCDOObject(rootObject);
        final CDOID rootObjectID = rootObjectCDO.cdoID();
        IPageManager pageManager = servicesRegistry.getService(IPageManager.class);
        Optional<CDOObject> pagedElement = pageManager.allPages().stream().filter(p -> p instanceof EObject)
                .map(p -> (EObject) p).map(CDOUtil::getCDOObject).filter(o -> rootObjectID.equals(o.cdoID()))
                .findFirst();

        if (pagedElement.isPresent()) {
            pageManager.closeOtherPages(pagedElement.get());
            rootObject = pagedElement.get();
        }

        // enforce loading of primitive types
        ResourceSet rs = rootObject.eResource().getResourceSet();
        if (rs != null) {
            rs.getResource(UML_PRIMITIVE_TYPES_URI, true);
        } else {
            LOGGER.warn("The element about to be selected is not contained in a resource set.");
        }

        OpenElementService openElementService = servicesRegistry.getService(OpenElementService.class);
        openElementService.openElement(rootObject);
    } catch (ServiceException e) {
        throw new PartInitException("Could not select the correct diagram.", e);
    }
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:31,代码来源:PapyrusCDOLauncher.java


示例20: isDirectlyContainedInRepositoryFolder

import org.eclipse.emf.cdo.CDOObject; //导入依赖的package包/类
private boolean isDirectlyContainedInRepositoryFolder(CDOObject o) {
	if (!o.cdoInvalid()) {
		URI resourceURI = null;
		if (o.cdoResource() != null) {
			resourceURI = o.cdoResource().getURI();
		}
		if (o instanceof CDOResourceNode) {
			resourceURI = ((CDOResourceNode)o).getURI();
		}
		return isChild(repositoryFolder.getURI(), resourceURI);
	}

	return false;
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:15,代码来源:CDOHandlingBackgroundTask.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java UpdateByExampleSelectiveMethodGenerator类代码示例发布时间:2022-05-22
下一篇:
Java ModelMagmaCube类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap