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


Java RecordingCommand类代码示例

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


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

示例1: setQueriesSamples

import org.eclipse.emf.transaction.RecordingCommand; //导入依赖的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: popStackFrameReply

import org.eclipse.emf.transaction.RecordingCommand; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.gemoc.dsl.debug.ide.IModelUpdater#popStackFrameReply(org.eclipse.gemoc.dsl.debug.Thread)
 */
public StackFrame popStackFrameReply(final Thread thread) {
	final Command command = new RecordingCommand(domain, "Pop Stack Frame Reply") {
		StackFrame res;

		@Override
		protected void doExecute() {
			res = ThreadUtils.popStackFrameReply(thread);
		}

		@Override
		public Collection<?> getResult() {
			final java.util.List<Object> list = new ArrayList<Object>();
			list.add(res);
			return list;
		}

	};
	doExecute(command);
	return (StackFrame)command.getResult().iterator().next();
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:26,代码来源:TransactionalModelUpdater.java

示例3: pushStackFrameReply

import org.eclipse.emf.transaction.RecordingCommand; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * 
 * @see org.eclipse.gemoc.dsl.debug.ide.IModelUpdater#pushStackFrameReply(org.eclipse.gemoc.dsl.debug.Thread,
 *      java.lang.String, org.eclipse.emf.ecore.EObject, org.eclipse.emf.ecore.EObject, boolean)
 */
public StackFrame pushStackFrameReply(final Thread thread, final String name, final EObject context,
		final EObject instruction, final boolean canStepInto) {
	final Command command = new RecordingCommand(domain, "Push Stack Frame Reply") {
		StackFrame res;

		@Override
		protected void doExecute() {
			res = ThreadUtils.pushStackFrameReply(thread, name, context, instruction, canStepInto);
		}

		@Override
		public Collection<?> getResult() {
			final java.util.List<Object> list = new ArrayList<Object>();
			list.add(res);
			return list;
		}

	};
	doExecute(command);
	return (StackFrame)command.getResult().iterator().next();
}
 
开发者ID:eclipse,项目名称:gemoc-studio-modeldebugging,代码行数:28,代码来源:TransactionalModelUpdater.java

示例4: restoreState

import org.eclipse.emf.transaction.RecordingCommand; //导入依赖的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: execute

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

示例6: restoreState

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

示例7: linkActivated

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

示例8: linkPressed

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

示例9: restoreState

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

示例10: executeCommand

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

示例11: execute

import org.eclipse.emf.transaction.RecordingCommand; //导入依赖的package包/类
/**
 * @see org.eclipse.gef.commands.CommandStack#execute(org.eclipse.gef.commands.Command)
 */
@Override
public void execute(final Command command) {
    transactionEditingDomain.getCommandStack().execute(new RecordingCommand(transactionEditingDomain) {
        @SuppressWarnings("deprecation")
        @Override
        protected void doExecute() {
            notifyListeners(command, PRE_EXECUTE);
            command.execute();
            executeHandler(command);
            notifyListeners();

            notifyListeners(command, POST_EXECUTE);
            // isGEFCommand = true;
        }
    });
    // super.execute(new EmptyCommand());
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:21,代码来源:UMLDiagramCommandStack.java

示例12: run

import org.eclipse.emf.transaction.RecordingCommand; //导入依赖的package包/类
/**
 * 트랜잭셔널 액션 실행
 * 
 * @param transactionalAction
 *            void
 */
public static void run(final TransactionalAction transactionalAction) {
    TransactionalEditingDomain transactionalEditingDomain = null;

    if (domainModelHandler != null) {
        transactionalEditingDomain = domainModelHandler.getTransactionalEditingDomain();
    } else {
        transactionalEditingDomain = getHandlerInstance().getTransactionalEditingDomain();
    }

    transactionalEditingDomain.getCommandStack().execute(new RecordingCommand(transactionalEditingDomain) {
        /**
         * @see org.eclipse.emf.transaction.RecordingCommand#doExecute()
         */
        @Override
        protected void doExecute() {
            transactionalAction.doExecute();
        }
    });
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:26,代码来源:DomainModelHandlerUtil.java

示例13: createUMLGlossary

import org.eclipse.emf.transaction.RecordingCommand; //导入依赖的package包/类
/**
 * 
 * 
 * @param uri
 * @return Resource
 */
public static Resource createUMLGlossary(URI uri) {
    final Resource resource;

    if (domainModelHandler != null) {
        resource = domainModelHandler.getTransactionalEditingDomain().getResourceSet().createResource(uri);
    } else {
        resource = getHandlerInstance().getTransactionalEditingDomain().getResourceSet().createResource(uri);
    }

    domainModelHandler.getTransactionalEditingDomain()
        .getCommandStack()
        .execute(new RecordingCommand(domainModelHandler.getTransactionalEditingDomain()) {
            /**
             * @see org.eclipse.emf.transaction.RecordingCommand#doExecute()
             */
            @Override
            protected void doExecute() {
                Glossary glossaryModel = UMLGlossaryFactory.eINSTANCE.createGlossary();
                resource.getContents().add(glossaryModel);
            }
        });

    return resource;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:31,代码来源:DomainModelHandlerUtil.java

示例14: createUMLModelRoot

import org.eclipse.emf.transaction.RecordingCommand; //导入依赖的package包/类
/**
 * 최상위 UML 모델 생성
 * 
 * @param uri
 * @return Resource
 */
public Resource createUMLModelRoot(URI uri, final String modelName) {
    final Resource resource = transactionEditingDomain.getResourceSet().createResource(uri);
    DomainUtil.registerDefaultPathmaps();

    transactionEditingDomain.getCommandStack().execute(new RecordingCommand(transactionEditingDomain) {
        /**
         * @see org.eclipse.emf.transaction.RecordingCommand#doExecute()
         */
        @Override
        protected void doExecute() {
            Model umlModelRoot = UMLFactory.eINSTANCE.createModel();
            umlModelRoot.setName(modelName);

            Model umlLibrary = (Model) DomainUtil.load(URI.createURI(UMLResource.UML_PRIMITIVE_TYPES_LIBRARY_URI));
            umlModelRoot.createPackageImport(umlLibrary);

            resource.getContents().add(umlModelRoot);
        }
    });

    return resource;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:29,代码来源:UMLDomainTest.java

示例15: createUMLGlossary

import org.eclipse.emf.transaction.RecordingCommand; //导入依赖的package包/类
/**
 * 용어집 모델 생성
 * 
 * @param uri
 * @return Resource
 */
public Resource createUMLGlossary(URI uri) {
    final Resource resource = transactionEditingDomain.getResourceSet().createResource(uri);

    transactionEditingDomain.getCommandStack().execute(new RecordingCommand(transactionEditingDomain) {
        /**
         * @see org.eclipse.emf.transaction.RecordingCommand#doExecute()
         */
        @Override
        protected void doExecute() {
            Glossary glossaryModel = UMLGlossaryFactory.eINSTANCE.createGlossary();
            resource.getContents().add(glossaryModel);
        }
    });

    return resource;
}
 
开发者ID:SK-HOLDINGS-CC,项目名称:NEXCORE-UML-Modeler,代码行数:23,代码来源:UMLDomainTest.java


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