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


Java TransactionalEditingDomain.dispose方法代码示例

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


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

示例1: fillDiagramFromPtolemyModel

import org.eclipse.emf.transaction.TransactionalEditingDomain; //导入方法依赖的package包/类
/**
 * Iterate over all model elements in a Ptolemy II model, create corresponding elements in a Triq workflow diagram, and store the diagram file in the given
 * destination folder.
 *
 * @param destFolder
 * @param diagram
 * @param ptolemyModel
 * @return
 */
public static Diagram fillDiagramFromPtolemyModel(IFolder destFolder, Diagram diagram, ptolemy.actor.CompositeActor ptolemyModel) {
  // Get the default resource set to hold the new resource
  ResourceSet resourceSet = new ResourceSetImpl();
  TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(resourceSet);
  if (editingDomain == null) {
    editingDomain = TransactionalEditingDomain.Factory.INSTANCE.createEditingDomain(resourceSet);
  }

  FillDiagramFromPtolemyModelCommand operation = new FillDiagramFromPtolemyModelCommand(destFolder, editingDomain, diagram, ptolemyModel);
  editingDomain.getCommandStack().execute(operation);
  try {
    operation.getCreatedResource().save(Collections.EMPTY_MAP);
  } catch (IOException e) {
    e.printStackTrace();
  }

  // Dispose the editing domain to eliminate memory leak
  editingDomain.dispose();

  return diagram;
}
 
开发者ID:eclipse,项目名称:triquetrum,代码行数:31,代码来源:WizardUtils.java

示例2: 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

示例3: run

import org.eclipse.emf.transaction.TransactionalEditingDomain; //导入方法依赖的package包/类
@Override
public void run() {
	InputDialog inputDialog = new InputDialog(null, "Provide String", "Provide a new Name for the EClass", eclass.getName(), null);
	int open = inputDialog.open();
	if (open == Dialog.OK) {
		String newName = inputDialog.getValue();
		Resource resource = eclass.eResource();
		ResourceSet resourceSet = resource.getResourceSet();
		TransactionalEditingDomain domain = TransactionalEditingDomain.Factory.INSTANCE.createEditingDomain(resourceSet);
		try{
		if (domain != null){
			Command setCommand = domain.createCommand(SetCommand.class, new CommandParameter(eclass,
					EcorePackage.Literals.ENAMED_ELEMENT__NAME, newName));
			domain.getCommandStack().execute(setCommand);
			try {
				resource.save(Collections.emptyMap());
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		}finally{
			domain.dispose();
		}
	}
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:26,代码来源:RenameActionProvider.java

示例4: createDiagram

import org.eclipse.emf.transaction.TransactionalEditingDomain; //导入方法依赖的package包/类
public static ImportBpmnElementsCommand createDiagram(String processName, String bpmnFile, 
        IProject project, IContainer targetFolder) {
  
  // Get the default resource set to hold the new resource
  ResourceSet resourceSet = new ResourceSetImpl();
  TransactionalEditingDomain editingDomain = TransactionUtil.getEditingDomain(resourceSet);
  if (editingDomain == null) {
    // Not yet existing, create one
    editingDomain = TransactionalEditingDomain.Factory.INSTANCE.createEditingDomain(resourceSet);
  }
  
  // Create the data within a command and save (must not happen inside
  // the command since finishing the command will trigger setting the 
  // modification flag on the resource which will be used by the save
  // operation to determine which resources need to be saved)
  ImportBpmnElementsCommand operation = new ImportBpmnElementsCommand( 
          editingDomain, processName, bpmnFile, targetFolder);
  editingDomain.getCommandStack().execute(operation);
  try {
    operation.getCreatedResource().save(null);
  } catch (IOException e) {
    IStatus status = new Status(IStatus.ERROR, ActivitiPlugin.getID(), e.getMessage(), e); //$NON-NLS-1$
    ErrorDialog.openError(Display.getCurrent().getActiveShell(), "Error Occured", e.getMessage(), status);
  }

  // Dispose the editing domain to eliminate memory leak
  editingDomain.dispose();
  return operation;
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:30,代码来源:ImportBpmnUtil.java

示例5: doSave

import org.eclipse.emf.transaction.TransactionalEditingDomain; //导入方法依赖的package包/类
@Override
public void doSave(IProgressMonitor progressMonitor) {
 super.doSave(progressMonitor);
 IFile associatedBPMN2File = ((IFileEditorInput) getEditorInput()).getFile();
 final IFile diagramFile = getAssociatedDiagramIFile(associatedBPMN2File);
  if(diagramFile.exists() == false) {
    String bpmnFile = associatedBPMN2File.getRawLocation().toFile().getAbsolutePath();
    String processName = bpmnFile.substring(bpmnFile.lastIndexOf(File.separator) + 1);
    processName = processName.replace(".xml", "");
    processName = processName.replace(".bpmn20", "");
    ImportBpmnUtil.createDiagram(processName, bpmnFile, 
            associatedBPMN2File.getProject(), associatedBPMN2File.getParent());
  
  } else {
  	ResourceSet resourceSet = new ResourceSetImpl();
  	TransactionalEditingDomain domain = TransactionalEditingDomain.Factory.INSTANCE.createEditingDomain(resourceSet);
		final Diagram diagram = GraphitiUiInternal.getEmfService().getDiagramFromFile(diagramFile, domain.getResourceSet());
		domain.getResourceSet().getResources().add(diagram.eResource());
		
		try {
			
     final IStorage storage = ((IFileEditorInput) getEditorInput()).getStorage();
     DiagramUpdater operation = new DiagramUpdater( 
     		domain, diagram, storage);
     domain.getCommandStack().execute(operation);
    
    	diagram.eResource().save(null);
    } catch (Exception e) {
      IStatus status = new Status(IStatus.ERROR, ActivitiPlugin.getID(), e.getMessage(), e); //$NON-NLS-1$
      ErrorDialog.openError(Display.getCurrent().getActiveShell(), "Failed to synchronize Activiti model file", e.getMessage(), status);
    }

    // Dispose the editing domain to eliminate memory leak
    domain.dispose();
  }
}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:37,代码来源:ActivitiBMPN2Editor.java


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