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


Java CDOView类代码示例

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


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

示例1: checkDetachedObjects

import org.eclipse.emf.cdo.view.CDOView; //导入依赖的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: renameResourceNode

import org.eclipse.emf.cdo.view.CDOView; //导入依赖的package包/类
/**
 * Renames the given {@link CDOResourceNode} and its contents if any.
 * 
 * @param newView
 *            the {@link CDOView} before changes
 * @param repositoryLocation
 *            the repository location
 * @param oldNode
 *            the {@link CDOResourceNode} before changes
 * @param newNode
 *            the {@link CDOResourceNode} after changes
 */
private void renameResourceNode(CDOView newView, ILocation repositoryLocation, CDOResourceNode oldNode,
		CDOResourceNode newNode) {
	final ILocation location = MappingUtils.getConnectorRegistry().getLocation(repositoryLocation,
			oldNode);
	if (location != null) {
		MappingUtils.getConnectorRegistry().updateLocation(location, newNode);
	}
	if (oldNode instanceof CDOResourceFolder) {
		for (CDOResourceNode oldChild : ((CDOResourceFolder)oldNode).getNodes()) {
			final CDOResourceNode newChild = (CDOResourceNode)newView.getObject(oldChild.cdoID());
			if (newChild != null) {
				renameResourceNode(newView, repositoryLocation, oldChild, newChild);
			}
		}
	}
}
 
开发者ID:ModelWriter,项目名称:Source,代码行数:29,代码来源:MappingCDOListener.java

示例3: resourceContentChanged

import org.eclipse.emf.cdo.view.CDOView; //导入依赖的package包/类
/**
 * Updates changed {@link CDOResource}.
 * 
 * @param base
 *            the {@link IBase}
 * @param changedElements
 *            the {@link Set} of changed elements per {@link CDOView}
 */
private void resourceContentChanged(IBase base, Map<CDOView, Set<Object>> changedElements) {
	for (Entry<CDOView, Set<Object>> entry : changedElements.entrySet()) {
		final ILocation repositoryLocation = MappingUtils.getConnectorRegistry().getLocation(base, entry
				.getKey());
		if (repositoryLocation != null) {
			for (Object element : entry.getValue()) {
				final ILocation location = MappingUtils.getConnectorRegistry().getLocation(
						repositoryLocation, element);
				if (location != null) {
					MappingUtils.getConnectorRegistry().updateLocation(location, element);
				}
			}
		}
	}
}
 
开发者ID:ModelWriter,项目名称:Source,代码行数:24,代码来源:MappingCDOListener.java

示例4: registerBase

import org.eclipse.emf.cdo.view.CDOView; //导入依赖的package包/类
/**
 * {@link IBaseRegistry#register(IBase) Registers} the given {@link BaseImpl}.
 * 
 * @param view
 *            the {@link CDOView}
 * @param base
 *            the {@link BaseImpl}
 */
protected void registerBase(CDOView view, BaseImpl base) {
	MappingUtils.getMappingRegistry().register(base);
	final CDOID cdoID = base.cdoID();
	Map<String, Map<Integer, BaseImpl>> repoMap = bases.get(cdoID);
	if (repoMap == null) {
		repoMap = new HashMap<String, Map<Integer, BaseImpl>>();
		bases.put(cdoID, repoMap);
	}
	final String uuid = view.getSession().getRepositoryInfo().getUUID();
	Map<Integer, BaseImpl> branchMap = repoMap.get(uuid);
	if (branchMap == null) {
		branchMap = new HashMap<Integer, BaseImpl>();
		repoMap.put(uuid, branchMap);
	}
	branchMap.put(view.getBranch().getID(), base);
	MappingUtils.getMappingRegistry().register(base);
}
 
开发者ID:ModelWriter,项目名称:Source,代码行数:26,代码来源:CDOMappingBaseListener.java

示例5: unregisterBase

import org.eclipse.emf.cdo.view.CDOView; //导入依赖的package包/类
/**
 * {@link IBaseRegistry#unregister(IBase) Unregisters} the given {@link BaseImpl}.
 * 
 * @param view
 *            the {@link CDOView}
 * @param base
 *            the {@link BaseImpl}
 */
protected void unregisterBase(CDOView view, BaseImpl base) {
	final CDOID cdoID = base.cdoID();
	final Map<String, Map<Integer, BaseImpl>> repoMap = bases.get(cdoID);
	if (repoMap != null) {
		final String uuid = view.getSession().getRepositoryInfo().getUUID();
		final Map<Integer, BaseImpl> branchMap = repoMap.get(uuid);
		if (branchMap != null) {
			final BaseImpl toRemove = branchMap.remove(view.getBranch().getID());
			if (toRemove != null) {
				MappingUtils.getMappingRegistry().unregister(toRemove);
				removeFromMap(cdoID, repoMap, uuid, branchMap);
			}
		}
	}
}
 
开发者ID:ModelWriter,项目名称:Source,代码行数:24,代码来源:CDOMappingBaseListener.java

示例6: getResource

import org.eclipse.emf.cdo.view.CDOView; //导入依赖的package包/类
/**
 * Gets the resource of the textual diagram in the commit's current version.
 * 
 * @param commit
 *            the commit info of the commit
 * @param currentView
 *            the current view on the diagram
 * @return the corresponding resource
 */
public CDOResource getResource(CDOView currentView, IFile file) {
    ConcreteSyntaxModel concreteSyntaxModel = getConcreteSyntaxModel(currentView, file);
    if (concreteSyntaxModel == null) {
        return null;
    }
    EObject rootElement = concreteSyntaxModel.getRootElement();
    URI rootURI = EcoreUtil.getURI(rootElement);
    String resourcePath = CDOURIUtil.extractResourcePath(rootURI);
    try {
        return currentView.getResource(resourcePath);
    } catch (InvalidURIException e) {
        LOGGER.trace(e.getMessage(), e);
        return null;
    }
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:25,代码来源:ComparisonManager.java

示例7: reset

import org.eclipse.emf.cdo.view.CDOView; //导入依赖的package包/类
private static void reset(CDOView historicView, CDOTransaction transaction, IResource resource)
        throws IOException, ConcreteSyntaxTypeNotAvailableException {
    // configure resource sets
    ResourceSet historicRS = historicView.getResourceSet();
    ResourceSet currentRS = transaction.getResourceSet();
    historicRS.setResourceFactoryRegistry(
            CDOResourceHandler.createFactoryWrapper(historicRS.getResourceFactoryRegistry()));
    currentRS.setResourceFactoryRegistry(
            CDOResourceHandler.createFactoryWrapper(currentRS.getResourceFactoryRegistry()));

    // determine resources to reset
    Collection<URI> relevantUris;
    if (resource instanceof IFile) {
        relevantUris = findRelevantURIs(transaction, (IFile) resource);
    } else if (resource instanceof IProject) {
        relevantUris = findRelevantURIs(transaction, (IProject) resource);
    } else {
        throw new IllegalArgumentException("The selected resource is neither a project nor a file.");
    }

    reset(historicView, transaction, relevantUris);
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:23,代码来源:ResetToPreviousStateCommand.java

示例8: createCDOResource

import org.eclipse.emf.cdo.view.CDOView; //导入依赖的package包/类
private static CDOResourceFolder createCDOResource(IProject project, String cdoRepoPath,
		IListener listener) throws CommitException {
	CDOSession cdoSession = CDOConnectionManager.getInstance().acquireSession(project);
	CDOResourceFolder result = null;
	try {
		CDOView cdoView = cdoSession.openView();
		cdoView.addListener(listener);
		cdoView.options().addChangeSubscriptionPolicy(CDOAdapterPolicy.ALL);
		if (!cdoView.hasResource(cdoRepoPath)) {
			CDOTransaction transaction = cdoSession.openTransaction();
			transaction.createResourceFolder(cdoRepoPath);
			transaction.commit();
			transaction.close();
		}
		result = cdoView.getResourceFolder(cdoRepoPath);
		return result;
	} finally {
		if (result == null) {
			CDOConnectionManager.getInstance().releaseSession(cdoSession);
		}
	}
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:23,代码来源:CDOHandlingBackgroundTask.java

示例9: doFullCheckout

import org.eclipse.emf.cdo.view.CDOView; //导入依赖的package包/类
private void doFullCheckout() throws CoreException {
    CDOView view = getRepositoryFolder().cdoView();
    try {
        CDOTransferSystem target = new PathmapFilteringTransferSystem(WorkspaceTransferSystem.INSTANCE);
        RepositoryTransferSystem source = new RepositoryTransferSystem(view);

        cleanUpFolder(workspaceFolder);

        CDOTransfer transfer = new CDOTransferUMLFirst(source, target);
        transfer.setTargetPath(workspaceFolder.getFullPath());
        getRepositoryFolder().getNodes().forEach(n -> transfer.map(n.getPath(), new NullProgressMonitor()));

        // no default factory is registered in the CDO utilities
        transfer.getModelTransferContext().registerTargetExtension("*", new XMIResourceFactoryImpl());
        UMLUtil.init(transfer.getModelTransferContext().getTargetResourceSet());
        transfer.getModelTransferContext().getTargetResourceSet().getResource(UML_PRIMITIVE_TYPES_URI, true);

        transfer.perform();

        refreshFolder(workspaceFolder);
    } catch (RuntimeException e) {
        throw new CoreException(new Status(IStatus.ERROR, Activator.PLUGIN_ID, "Failed to transfer models", e));
    }
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:25,代码来源:ModelGenCheckoutTask.java

示例10: createModelNodes

import org.eclipse.emf.cdo.view.CDOView; //导入依赖的package包/类
private static ModelNode[] createModelNodes(IProject project) {
	String resourceName = project.getName(); //TODO this should not be located here but at a central location
	CDOSession session = CDOConnectionManager.getInstance().acquireSession(project);
	try {
		CDOView view = session.openView();
		try {
			if (!view.hasResource(resourceName)) {
				return ArrayUtils.toArray();
			}
			CDOResourceFolder cdoFolder = view.getResourceFolder(resourceName);
			return cdoFolder.getNodes().stream().filter(n -> "notation".equals(n.getExtension())).filter(CDOResource.class::isInstance).map(r -> new ModelNode(getBaseName(r))).toArray(ModelNode[]::new);
		} finally {
			IOUtil.closeSilent(view);
		}
	} finally {
		CDOConnectionManager.getInstance().releaseSession(session);
	}
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:19,代码来源:ModelContentProvider.java

示例11: fixStaleReferences

import org.eclipse.emf.cdo.view.CDOView; //导入依赖的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

示例12: findPossibleStaleReferences

import org.eclipse.emf.cdo.view.CDOView; //导入依赖的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

示例13: isReadOnlyRequired

import org.eclipse.emf.cdo.view.CDOView; //导入依赖的package包/类
public static boolean isReadOnlyRequired(IFile launcherFile)
        throws IOException, ConcreteSyntaxTypeNotAvailableException {
    CDOSession session = CDOConnectionManager.getInstance().acquireSession(launcherFile.getProject());
    try {
        CDOView temporaryView = session.openView();
        try {
            Diagram launcherModel = loadDiagram(temporaryView, launcherFile);
            URI umlURI = determineUMLURI(launcherModel);
            return getWriteLock(temporaryView, umlURI).isLockedByOthers();
        } finally {
            IOUtil.closeSilent(temporaryView);
        }
    } finally {
        CDOConnectionManager.getInstance().releaseSession(session);
    }
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:17,代码来源:LockStateInfo.java

示例14: getCDOView

import org.eclipse.emf.cdo.view.CDOView; //导入依赖的package包/类
@Override
public Optional<CDOView> getCDOView() {
    try {
        IPageManager pageManager = getEditorPart().getServicesRegistry().getService(IPageManager.class);
        Set<CDOView> cdoViews = pageManager.allPages().stream().filter(EObject.class::isInstance)
                .map(EObject.class::cast).map(EObject::eResource).filter(CDOResource.class::isInstance)
                .map(CDOResource.class::cast).map(CDOResource::cdoView).filter(Objects::nonNull)
                .collect(Collectors.toSet());
        if (cdoViews.isEmpty()) {
            LOGGER.warn("Could not find CDO view.");
        } else {
            if (cdoViews.size() > 1) {
                LOGGER.warn("Got multiple CDO views. Taking the first one.");
            }
            return Optional.of(cdoViews.iterator().next());
        }
    } catch (ServiceException e) {
        LOGGER.warn("Could not load services registry.", e);
    }
    return Optional.empty();
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:22,代码来源:FocusManagerGraphical.java

示例15: getView

import org.eclipse.emf.cdo.view.CDOView; //导入依赖的package包/类
protected CDOView getView(QJob job) {

		if(view == null) {

			Map<String, CDOView> typedViews = views.get(job);
			if(typedViews == null) {
				typedViews =  new HashMap<String, CDOView>();
				views.put(job, typedViews);
			}
			else
				view = typedViews.get(klass.getName());

			if(view == null) {
				view = getSession().openView();
				typedViews.put(klass.getName(), view);
			}
		}
		return view;
	}
 
开发者ID:asupdev,项目名称:asup,代码行数:20,代码来源:CDOResourceReaderImpl.java


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