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


Java TransactionalEditingDomain.getResourceSet方法代码示例

本文整理汇总了Java中org.eclipse.emf.transaction.TransactionalEditingDomain.getResourceSet方法的典型用法代码示例。如果您正苦于以下问题:Java TransactionalEditingDomain.getResourceSet方法的具体用法?Java TransactionalEditingDomain.getResourceSet怎么用?Java TransactionalEditingDomain.getResourceSet使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.emf.transaction.TransactionalEditingDomain的用法示例。


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

示例1: notifySirius

import org.eclipse.emf.transaction.TransactionalEditingDomain; //导入方法依赖的package包/类
/**
 * Notifies Sirius about a change in the given {@link DSLBreakpoint}.
 * 
 * @param instructionUri
 *            the {@link URI} of the instruction to refresh.
 */
public void notifySirius(Set<URI> instructionUris) {
	final Map<String, Set<String>> toRefresh = representationToRefresh;
	for (IEditingSession session : SessionUIManager.INSTANCE
			.getUISessions()) {
		final TransactionalEditingDomain transactionalEditingDomain = session
				.getSession().getTransactionalEditingDomain();
		final ResourceSet resourceSet = transactionalEditingDomain
				.getResourceSet();
		final boolean instructionPresent = isOneInstructionPresent(
				instructionUris, resourceSet);
		if (instructionPresent) {
			final List<DRepresentation> representations = getRepresentationsToRefresh(
					toRefresh, session);
			refreshRepresentations(transactionalEditingDomain,
					representations);
		}
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:25,代码来源:AbstractGemocAnimatorServices.java

示例2: execute

import org.eclipse.emf.transaction.TransactionalEditingDomain; //导入方法依赖的package包/类
public static Object execute(TransactionalEditingDomain editingDomain, RecordingCommand command) {
	final CommandStack commandStack = editingDomain.getCommandStack();
	ResourceSet rs = editingDomain.getResourceSet();
	IExecutionCheckpoint checkpoint = IExecutionCheckpoint.CHECKPOINTS.get(rs);
	Object result = null;
	try {
		if (checkpoint != null) {
			checkpoint.allow(rs, true);
		}
		commandStack.execute(command);
		if (command.getResult() != null && command.getResult().size() == 1) {
			result = command.getResult().iterator().next();
		}
	} finally {
		if (checkpoint != null) {
			checkpoint.allow(rs, false);
		}
	}
	return result;
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:21,代码来源:CommandExecution.java

示例3: createEmfFileForDiagram

import org.eclipse.emf.transaction.TransactionalEditingDomain; //导入方法依赖的package包/类
public static void createEmfFileForDiagram(URI diagramResourceUri, final Diagram diagram) {

    // Create a resource set and EditingDomain
    final TransactionalEditingDomain editingDomain = GraphitiUiInternal.getEmfService().createResourceSetAndEditingDomain();
    final ResourceSet resourceSet = editingDomain.getResourceSet();
    // Create a resource for this file.
    final Resource resource = resourceSet.createResource(diagramResourceUri);
    final CommandStack commandStack = editingDomain.getCommandStack();
    commandStack.execute(new RecordingCommand(editingDomain) {

      @Override
      protected void doExecute() {
        resource.setTrackingModification(true);
        resource.getContents().add(diagram);

      }
    });

    save(editingDomain, Collections.<Resource, Map<?, ?>> emptyMap());
    editingDomain.dispose();
  }
 
开发者ID:eclipse,项目名称:triquetrum,代码行数:22,代码来源:FileService.java

示例4: run

import org.eclipse.emf.transaction.TransactionalEditingDomain; //导入方法依赖的package包/类
/**
 * @generated
 */
public void run(IAction action) {
	TransactionalEditingDomain editingDomain = GMFEditingDomainFactory.INSTANCE
			.createEditingDomain();
	ResourceSet resourceSet = editingDomain.getResourceSet();
	EObject diagramRoot = null;
	try {
		Resource resource = resourceSet.getResource(domainModelURI, true);
		diagramRoot = (EObject) resource.getContents().get(0);
	} catch (WrappedException ex) {
		StatemachineDiagramEditorPlugin.getInstance().logError(
				"Unable to load resource: " + domainModelURI, ex); //$NON-NLS-1$
	}
	if (diagramRoot == null) {
		MessageDialog.openError(getShell(),
				Messages.InitDiagramFile_ResourceErrorDialogTitle,
				Messages.InitDiagramFile_ResourceErrorDialogMessage);
		return;
	}
	Wizard wizard = new StatemachineNewDiagramFileWizard(domainModelURI,
			diagramRoot, editingDomain);
	wizard.setWindowTitle(NLS.bind(Messages.InitDiagramFile_WizardTitle,
			StatemachineEditPart.MODEL_ID));
	StatemachineDiagramEditorUtil.runWizard(getShell(), wizard,
			"InitDiagramFile"); //$NON-NLS-1$
}
 
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:29,代码来源:StatemachineInitDiagramFileAction.java

示例5: createDiagram

import org.eclipse.emf.transaction.TransactionalEditingDomain; //导入方法依赖的package包/类
/**
 * Create a diagram with given URIs.
 * 
 * @param diagramURI
 *            URI for the diagram file
 * @param modelURI
 *            URI for the model file
 * @param progressMonitor
 *            progress monitor
 * @return a resource for the new diagram file
 */
private Resource createDiagram(final URI diagramURI, final URI modelURI,
        final IProgressMonitor progressMonitor) {
    progressMonitor.beginTask("Creating diagram and model files", 2);
    // create a resource set and editing domain
    TransactionalEditingDomain editingDomain = GraphitiUi.getEmfService()
            .createResourceSetAndEditingDomain();
    ResourceSet resourceSet = editingDomain.getResourceSet();
    CommandStack commandStack = editingDomain.getCommandStack();
    // create resources for the diagram and domain model files
    final Resource diagramResource = resourceSet.createResource(diagramURI);
    final Resource modelResource = resourceSet.createResource(modelURI);
    if (diagramResource != null && modelResource != null) {
        commandStack.execute(new RecordingCommand(editingDomain) {
            @Override
            protected void doExecute() {
                createModel(diagramResource, diagramURI.lastSegment(), modelResource,
                        modelURI.lastSegment());
            }
        });
        progressMonitor.worked(1);

        try {
            modelResource.save(createSaveOptions());
            diagramResource.save(createSaveOptions());
        } catch (IOException exception) {
            IStatus status = new Status(IStatus.ERROR, PLUGIN_ID,
                    "Unable to store model and diagram resources", exception);
            StatusManager.getManager().handle(status);
        }
        setCharset(WorkspaceSynchronizer.getFile(modelResource));
        setCharset(WorkspaceSynchronizer.getFile(diagramResource));
    }
    progressMonitor.done();
    return diagramResource;
}
 
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:47,代码来源:GraphitiNewWizard.java

示例6: createEmfFileForDiagram

import org.eclipse.emf.transaction.TransactionalEditingDomain; //导入方法依赖的package包/类
public static TransactionalEditingDomain createEmfFileForDiagram(URI diagramResourceUri, final Diagram diagram,
		final InputStream contentStream, final IFile resourceFile) {

	// Create a resource set and EditingDomain
	final TransactionalEditingDomain editingDomain = DiagramEditorFactory.createResourceSetAndEditingDomain();
	final ResourceSet resourceSet = editingDomain.getResourceSet();
	// Create a resource for this file.
	final Resource resource = resourceSet.createResource(diagramResourceUri);

	final CommandStack commandStack = editingDomain.getCommandStack();
	commandStack.execute(new RecordingCommand(editingDomain) {

		@Override
		protected void doExecute() {
			resource.setTrackingModification(true);
			if (contentStream == null) {
				resource.getContents().add(diagram);
			} else {
				try {
					resourceFile.create(contentStream, IResource.FORCE, null);
				} catch (CoreException e) {
					// TODO
					e.printStackTrace();
				}
			}
		}
	});

	save(editingDomain, Collections.<Resource, Map<?, ?>> emptyMap());
	return editingDomain;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:32,代码来源:FileService.java


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