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


Java TransactionalEditingDomain类代码示例

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


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

示例1: setQueriesSamples

import org.eclipse.emf.transaction.TransactionalEditingDomain; //导入依赖的package包/类
/**
 * 
 * @param sqlogger "Monte-Carlo" simulation results
 * @param model The instance of the SimQRi model
 * @deprecated
 * This method set simulation results to queries objects of the Sirius Metamodel instance. 
 * No longer used due to a too long time for setting results when there are a lot of queries
 */
@SuppressWarnings("unused")
private void setQueriesSamples(TraceLogger sqlogger, Model model) {
	Iterator<SamplingTuple> itProbes = sqlogger.logs().mcSamplings().probesSampling().iterator();
	while(itProbes.hasNext()) {
		SamplingTuple probes = itProbes.next();
		for(Query q : model.getQuery()) {
			if(q.getName().equals(probes.name())) {
				TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(q);
				domain.getCommandStack().execute(new RecordingCommand(domain) {
				   public void doExecute() {
					  // q.setResult("");
					  // q.setMax(String.format("%.2f", JsonFormat.jsonToDouble(probes.samplingStr(), "max")));
					  // q.setMin(String.format("%.2f", JsonFormat.jsonToDouble(probes.samplingStr(), "min")));
					  // q.setMean(String.format("%.2f", JsonFormat.jsonToDouble(probes.samplingStr(), "mean")));
					  // q.setVariance(String.valueOf(JsonFormat.jsonToDouble(probes.samplingStr(), "variance")));
				   }
				});
			}
		}
	}
}
 
开发者ID:cetic,项目名称:SimQRI,代码行数:30,代码来源:Simulation.java

示例2: canHandle

import org.eclipse.emf.transaction.TransactionalEditingDomain; //导入依赖的package包/类
@Override
/*
 * This is the operation used to act as a StepManager in K3. We return true
 * if we have the same editing domain as the object. (non-Javadoc)
 * 
 * @see fr.inria.diverse.k3.al.annotationprocessor.stepmanager.IStepManager#
 * canHandle (java.lang.Object)
 */
public boolean canHandle(Object caller) {
	if (caller instanceof EObject) {
		EObject eObj = (EObject) caller;
		org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain = getEditingDomain(eObj);
		return editingDomain == this.editingDomain;

	}
	return false;
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:18,代码来源:PlainK3ExecutionEngine.java

示例3: notifySirius

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

示例4: restoreState

import org.eclipse.emf.transaction.TransactionalEditingDomain; //导入依赖的package包/类
@Override
public void restoreState(State<?, ?> state) {
	
	if (modelResource != null && state instanceof GenericState) {
		try {
			final TransactionalEditingDomain ed = TransactionUtil.getEditingDomain(modelResource);
			if (ed != null) {
				final RecordingCommand command = new RecordingCommand(ed, "") {
					protected void doExecute() {
						restoreStateExecute((GenericState) state);
					}
				};
				CommandExecution.execute(ed, command);
			}
		} catch (Exception e) {
			throw e;
		}
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:20,代码来源:GenericStateManager.java

示例5: createSession

import org.eclipse.emf.transaction.TransactionalEditingDomain; //导入依赖的package包/类
public Session createSession(ResourceSet set, final URI sessionResourceURI, IProgressMonitor monitor) throws CoreException {
	final TransactionalEditingDomain transactionalEditingDomain = EditingDomainFactoryService.INSTANCE.getEditingDomainFactory().createEditingDomain(set);

	// Configure the resource set, its is done here and not before the
	// editing domain creation which could provide its own resource set.
	transactionalEditingDomain.getResourceSet().eAdapters().add(new SiriusCrossReferenceAdapterImpl());
	if (Movida.isEnabled()) {
		transactionalEditingDomain.getResourceSet().setURIConverter(new ViewpointURIConverter((ViewpointRegistry) org.eclipse.sirius.business.api.componentization.ViewpointRegistry.getInstance()));
	}

	// Create or load the session.
	boolean alreadyExistingResource = exists(sessionResourceURI, transactionalEditingDomain.getResourceSet());
	Session session = null;
	if (alreadyExistingResource) {
		session = loadSessionModelResource(sessionResourceURI, transactionalEditingDomain, monitor);
	} else {
		session = createSessionResource(sessionResourceURI, transactionalEditingDomain, monitor);
	}
	return session;
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:21,代码来源:DebugSessionFactory.java

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

示例7: refreshRepresentations

import org.eclipse.emf.transaction.TransactionalEditingDomain; //导入依赖的package包/类
/**Refreshes given {@link DRepresentation} in the given {@link TransactionalEditingDomain}.
 * @param transactionalEditingDomain the {@link TransactionalEditingDomain}
 * @param representations the {@link List} of {@link DRepresentation} to refresh
 */
public void refreshRepresentations(
		final TransactionalEditingDomain transactionalEditingDomain,
		final List<DRepresentation> representations) {
	// TODO prevent the editors from getting dirty
	if (representations.size() != 0) {
		final RefreshRepresentationsCommand refresh = new RefreshRepresentationsCommand(
				transactionalEditingDomain,
				new NullProgressMonitor(),
				representations);
		try {
			CommandExecution.execute(transactionalEditingDomain, refresh);
		} catch (Exception e){
			String repString = representations.stream().map(r -> r.getName()).collect(Collectors.joining(", "));
			Activator.getDefault().getLog().log(new Status(IStatus.WARNING, Activator.PLUGIN_ID, "Failed to refresh Sirius representation(s)["+repString+"], we hope to be able to do it later", e));
		}
		
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:23,代码来源:AbstractGemocAnimatorServices.java

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

示例9: restoreState

import org.eclipse.emf.transaction.TransactionalEditingDomain; //导入依赖的package包/类
@Override
public void restoreState(State<?, ?> state) {
	if (modelResource != null && state instanceof fsmTrace.States.SpecificState) {
		try {
			final TransactionalEditingDomain ed = TransactionUtil.getEditingDomain(modelResource);
			if (ed != null) {
				final RecordingCommand command = new RecordingCommand(ed, "") {
					protected void doExecute() {
						restoreStateExecute((fsmTrace.States.SpecificState) state);
					}
				};
				CommandExecution.execute(ed, command);
			}
		} catch (Exception e) {
			throw e;
		}
	}
}
 
开发者ID:eclipse,项目名称:gemoc-studio,代码行数:19,代码来源:FsmTraceStateManager.java

示例10: linkActivated

import org.eclipse.emf.transaction.TransactionalEditingDomain; //导入依赖的package包/类
@Override
public void linkActivated(final HyperlinkEvent event) {
	Session session = ActivityExplorerManager.INSTANCE.getSession();
	RefreshEditorsPrecommitListener repl = session.getRefreshEditorsListener();
	repl.notify(SessionListener.REPRESENTATION_CHANGE);
	repl.notify(SessionListener.SEMANTIC_CHANGE);
	EObject root = ActivityExplorerManager.INSTANCE.getRootSemanticModel();
	if (root instanceof Project) {
		Project rootProject = (Project) root;
		final EList<BehaviorScenario> bsList = rootProject.getDesign().getWorkloadBehavior().getBehavior();
		if (bsList.isEmpty()) {
			final BehaviorScenario bs = GqamFactory.eINSTANCE.createBehaviorScenario();
			final TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(rootProject);
			domain.getCommandStack().execute(new RecordingCommand(domain) {
				public void doExecute() {
					bsList.add(bs);
				}
			});
		}
		linkPressed(event, bsList.get(0), session);
	}
}
 
开发者ID:polarsys,项目名称:time4sys,代码行数:23,代码来源:BehaviorScenarioActivity.java

示例11: linkPressed

import org.eclipse.emf.transaction.TransactionalEditingDomain; //导入依赖的package包/类
@Override
protected void linkPressed(final HyperlinkEvent event, final EObject project_p, final Session session) {
	if (project_p instanceof Project) {
		TransactionalEditingDomain domain = TransactionUtil.getEditingDomain(project_p);
		domain.getCommandStack().execute(new RecordingCommand(domain) {

			@Override
			protected void doExecute() {
				final Project prj = ((Project) project_p);
				final Mapping mapping = ToPeriodicDerivation.getOrApply(prj);
				final DesignModel toBeAnalysedModel = (DesignModel) mapping.getSubLinks().get(0).getUniqueTargetValue("copy");
				final URI uri = prj.eResource().getURI();
				IPath path = new Path(uri.toPlatformString(true));
				final String filename = path.lastSegment().replaceAll(".time4sys", "-report.asciidoc");
				path = path.removeLastSegments(1);
				path = path.append(filename);
				IWorkspaceRoot wrkspc = ResourcesPlugin.getWorkspace().getRoot();
				final IFile output = wrkspc.getFile(path);
				generateReport(toBeAnalysedModel, output, null);
			}
		});

	}
}
 
开发者ID:polarsys,项目名称:time4sys,代码行数:25,代码来源:DesignSimpleReport.java

示例12: restoreState

import org.eclipse.emf.transaction.TransactionalEditingDomain; //导入依赖的package包/类
@Override
public void restoreState(State<?, ?> state) {
	if (modelResource != null && state instanceof minitlTrace.States.SpecificState) {
		try {
			final TransactionalEditingDomain ed = TransactionUtil.getEditingDomain(modelResource);
			if (ed != null) {
				final RecordingCommand command = new RecordingCommand(ed, "") {
					protected void doExecute() {
						restoreStateExecute((minitlTrace.States.SpecificState) state);
					}
				};
				CommandExecution.execute(ed, command);
			}
		} catch (Exception e) {
			throw e;
		}
	}
}
 
开发者ID:tetrabox,项目名称:minitl,代码行数:19,代码来源:MinitlTraceStateManager.java

示例13: executeCommand

import org.eclipse.emf.transaction.TransactionalEditingDomain; //导入依赖的package包/类
@Override
public void executeCommand(final Runnable r) {
    if (editorPart instanceof DiagramDocumentEditor) {
        // GMF editors use transactional editing domains. Thus,
        // the command needs to be executed within a transaction.
        RecordingCommand rc = new RecordingCommand((TransactionalEditingDomain) getEditingDomain()) {
            @Override
            protected void doExecute() {
                r.run();
            }
        };
        getEditingDomain().getCommandStack().execute(rc);
        getEditingDomain().getCommandStack().undo();
    } else {
        // EMF tree editors use regular editing domains, thus the
        // Runnable can be executed directly.
        r.run();
    }
}
 
开发者ID:vitruv-tools,项目名称:Vitruv,代码行数:20,代码来源:DefaultEditorPartAdapterFactoryImpl.java

示例14: openNewEMFDiagramEditorPart

import org.eclipse.emf.transaction.TransactionalEditingDomain; //导入依赖的package包/类
public IEditorPart openNewEMFDiagramEditorPart(URL modelURL, URL diagramURL) {
    MockEditingDomainFactory fact = new MockEditingDomainFactory();
    TransactionalEditingDomain editingDomain = fact.createEditingDomain(modelURL);

    // TODO: actually open diagram, this currently results in exception
    // Resource diagRes = Models.loadModel(diagramURL);
    // editingDomain.getResourceSet().getResources().add(diagRes);

    IGMFEditor result = createNiceMock(IGMFEditor.class);
    reset(result);
    expect(result.getEditingDomain()).andReturn(editingDomain).anyTimes();
    replay(result);

    this.activeEditorPart = result;
    currentEditors.add(result);
    workbenchMock.changedEditorPart(result, EditorPartMgmtEvent.OPEN);
    return result;
}
 
开发者ID:vitruv-tools,项目名称:Vitruv,代码行数:19,代码来源:EclipseMock.java

示例15: performIssueValidationFixingTransactional

import org.eclipse.emf.transaction.TransactionalEditingDomain; //导入依赖的package包/类
private void performIssueValidationFixingTransactional(Collection<TransactionalEditingDomain> domains,
        Resource documentResource) throws OperationCanceledError {

    final Collection<Issue> detectedIssues = new ArrayList<>();

    domains.stream().filter(TransactionalEditingDomainImpl.class::isInstance)
            .map(TransactionalEditingDomainImpl.class::cast).forEach(d -> setValidatorFactory(d, detectedIssues));

    Runnable lastCommandStackAction = null;
    for (TransactionalEditingDomain domain : domains) {
        if (lastCommandStackAction == null) {
            lastCommandStackAction = createFixingRecordingCommand(domain, documentResource, detectedIssues);
        } else {
            lastCommandStackAction = createDelegatingRecordingCommand(domain, lastCommandStackAction);
        }

    }

    Optional.ofNullable(lastCommandStackAction).ifPresent(Runnable::run);
}
 
开发者ID:Cooperate-Project,项目名称:CooperateModelingEnvironment,代码行数:21,代码来源:CooperateCDOXtextEditor.java


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