本文整理汇总了Java中org.eclipse.emf.common.util.Monitor类的典型用法代码示例。如果您正苦于以下问题:Java Monitor类的具体用法?Java Monitor怎么用?Java Monitor使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Monitor类属于org.eclipse.emf.common.util包,在下文中一共展示了Monitor类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: doGenerate
import org.eclipse.emf.common.util.Monitor; //导入依赖的package包/类
/**
* Launches the generation described by this instance.
*
* @param monitor
* This will be used to display progress information to the user.
* @throws IOException
* This will be thrown if any of the output files cannot be saved to disk.
* @generated not
*/
@Override
public void doGenerate(Monitor monitor) throws IOException {
//org.eclipse.emf.ecore.util.EcoreUtil.resolveAll(model);
/*
* If you want to check for potential errors in your models before the launch of the generation, you
* use the code below.
*/
//if (model != null && model.eResource() != null) {
// List<org.eclipse.emf.ecore.resource.Resource.Diagnostic> errors = model.eResource().getErrors();
// for (org.eclipse.emf.ecore.resource.Resource.Diagnostic diagnostic : errors) {
// System.err.println(diagnostic.toString());
// }
//}
super.doGenerate(monitor);
}
示例2: match
import org.eclipse.emf.common.util.Monitor; //导入依赖的package包/类
@Override
public Comparison match(IComparisonScope scope, Monitor monitor) {
Predicate<EObject> predicate = new Predicate<EObject>() {
@Override
public boolean apply(EObject eobject) {
// We only want to diff the SGraph and notation elements,
// not the transient palceholders for concrete languages
EPackage ePackage = eobject.eClass().getEPackage();
return ePackage == SGraphPackage.eINSTANCE || ePackage == NotationPackage.eINSTANCE;
}
};
if (scope instanceof DefaultComparisonScope) {
DefaultComparisonScope defaultScope = (DefaultComparisonScope) scope;
defaultScope.setEObjectContentFilter(predicate);
defaultScope.setResourceContentFilter(predicate);
}
return super.match(scope, monitor);
}
示例3: postComparison
import org.eclipse.emf.common.util.Monitor; //导入依赖的package包/类
@Override
public void postComparison(Comparison comparison, Monitor monitor) {
for (Diff diff : comparison.getDifferences()) {
if (diff instanceof EdgeChange) {
EdgeChange edgeChange = (EdgeChange) diff;
switch (edgeChange.getKind()) {
case ADD:
postProcessEdgeAddition(edgeChange);
break;
case DELETE:
postProcessEdgeDeletion(edgeChange);
break;
default: // do nothing
}
}
}
}
示例4: match
import org.eclipse.emf.common.util.Monitor; //导入依赖的package包/类
/**
* {@inheritDoc}
* <p>
* <b>Note:</b> This method overrides
* {@link DefaultMatchEngine#match(Comparison, IComparisonScope, EObject, EObject, EObject, Monitor)}
* to remove incompatible Guava dependencies. It should be removed if/when
* Guava dependencies become compatible with NeoEMF.
*/
@Override
protected void match(Comparison comparison, IComparisonScope scope, EObject left,
EObject right, EObject origin, Monitor monitor) {
if (left == null || right == null) {
throw new IllegalArgumentException();
}
final Iterator<? extends EObject> leftEObjects = Iterators.concat(
Iterators.singletonIterator(left), scope.getChildren(left));
final Iterator<? extends EObject> rightEObjects = Iterators.concat(
Iterators.singletonIterator(right), scope.getChildren(right));
final Iterator<? extends EObject> originEObjects;
if (origin != null) {
originEObjects = Iterators.concat(Iterators.singletonIterator(origin),
scope.getChildren(origin));
} else {
originEObjects = Collections.emptyIterator();
}
getEObjectMatcher().createMatches(comparison, leftEObjects, rightEObjects, originEObjects,
monitor);
}
示例5: match
import org.eclipse.emf.common.util.Monitor; //导入依赖的package包/类
/**
* Build the matches for two given resources. The direct sub elements will be detected and
* pushed into a match process for sub elements.
*
* @param comparison
* The comparison model to feed.
* @param leftRes
* The changed resource.
* @param rightRes
* The original resource.
* @param monitor
* The progress monitor.
*/
protected void match(Comparison comparison, final Resource leftRes, final Resource rightRes, Monitor monitor) {
List<EObject> leftElements = new ArrayList<EObject>();
List<EObject> rightElements = new ArrayList<EObject>();
if (leftRes != null) {
leftElements = leftRes.getContents();
}
if (rightRes != null) {
rightElements = rightRes.getContents();
}
List<Match> matches = match(comparison, leftElements, rightElements, monitor);
comparison.getMatches().addAll(matches);
}
示例6: postMatch
import org.eclipse.emf.common.util.Monitor; //导入依赖的package包/类
@Override
public void postMatch(Comparison comparison, Monitor monitor) {
final List<Match> matches = new ArrayList<>(comparison.getMatches());
final List<Match> treatedMatches = new ArrayList<>();
matches.forEach(m1 -> {
matches.forEach(m2 -> {
if (m1 != m2 && !treatedMatches.contains(m2)) {
final EObject left;
final EObject right;
if (m1.getLeft() != null && m1.getRight() == null && m2.getLeft() == null
&& m2.getRight() != null) {
left = m1.getLeft();
right = m2.getRight();
} else if (m2.getLeft() != null && m2.getRight() == null && m1.getLeft() == null
&& m1.getRight() != null) {
left = m2.getLeft();
right = m1.getRight();
} else {
return;
}
final String leftId = getIdFunction.apply(left);
final String rightId = getIdFunction.apply(right);
if (leftId.equals(rightId)) {
comparison.getMatches().remove(m1);
comparison.getMatches().remove(m2);
final Match match = new MatchSpec();
match.setLeft(left);
match.setRight(right);
comparison.getMatches().add(match);
}
}
});
treatedMatches.add(m1);
});
}
示例7: doGenerate
import org.eclipse.emf.common.util.Monitor; //导入依赖的package包/类
/**
* Launches the generation described by this instance.
*
* @param monitor
* This will be used to display progress information to the user.
* @throws IOException
* This will be thrown if any of the output files cannot be
* saved to disk.
* @generated
*/
@Override
public void doGenerate ( Monitor monitor ) throws IOException
{
/*
* TODO if you wish to change the generation as a whole, override this. The default behavior should
* be sufficient in most cases. If you want to change the content of this method, do NOT forget to
* change the "@generated" tag in the Javadoc of this method to "@generated NOT". Without this new tag,
* any compilation of the Acceleo module with the main template that has caused the creation of this
* class will revert your modifications. If you encounter a problem with an unresolved proxy during the
* generation, you can remove the comments in the following instructions to check for problems. Please
* note that those instructions may have a significant impact on the performances.
*/
//org.eclipse.emf.ecore.util.EcoreUtil.resolveAll(model);
/*
* If you want to check for potential errors in your models before the launch of the generation, you
* use the code below.
*/
//if (model != null && model.eResource() != null) {
// List<org.eclipse.emf.ecore.resource.Resource.Diagnostic> errors = model.eResource().getErrors();
// for (org.eclipse.emf.ecore.resource.Resource.Diagnostic diagnostic : errors) {
// System.err.println(diagnostic.toString());
// }
//}
super.doGenerate(monitor);
}
示例8: doGenerate
import org.eclipse.emf.common.util.Monitor; //导入依赖的package包/类
/**
* Launches the generation described by this instance.
*
* @param monitor
* This will be used to display progress information to the user.
* @throws IOException
* This will be thrown if any of the output files cannot be saved to disk.
* @generated
*/
@Override
public void doGenerate(Monitor monitor) throws IOException {
/*
* TODO if you wish to change the generation as a whole, override this. The default behavior should
* be sufficient in most cases. If you want to change the content of this method, do NOT forget to
* change the "@generated" tag in the Javadoc of this method to "@generated NOT". Without this new tag,
* any compilation of the Acceleo module with the main template that has caused the creation of this
* class will revert your modifications. If you encounter a problem with an unresolved proxy during the
* generation, you can remove the comments in the following instructions to check for problems. Please
* note that those instructions may have a significant impact on the performances.
*/
//org.eclipse.emf.ecore.util.EcoreUtil.resolveAll(model);
/*
* If you want to check for potential errors in your models before the launch of the generation, you
* use the code below.
*/
//if (model != null && model.eResource() != null) {
// List<org.eclipse.emf.ecore.resource.Resource.Diagnostic> errors = model.eResource().getErrors();
// for (org.eclipse.emf.ecore.resource.Resource.Diagnostic diagnostic : errors) {
// System.err.println(diagnostic.toString());
// }
//}
super.doGenerate(monitor);
}
示例9: generate
import org.eclipse.emf.common.util.Monitor; //导入依赖的package包/类
/**
* Generate a document from the specified generation configuration.
*
* @param generation
* the generation configuration
* @param classProvider
* the {@link IClassProvider}
* @param monitor
* used to track the progress will generating.
* @return generated file
* @throws DocumentGenerationException
* DocumentGenerationException
* @throws DocumentParserException
* DocumentParserException
* @throws IOException
* IOException
*/
public static List<URI> generate(Generation generation, IClassProvider classProvider, Monitor monitor)
throws DocumentGenerationException, IOException, DocumentParserException {
if (generation == null) {
throw new IllegalArgumentException("Null configuration object passed.");
}
// get the template path and parses it.
String templateFilePath = generation.getTemplateFileName();
if (templateFilePath == null) {
throw new DocumentGenerationException("The template file path isn't set in the provided configuration");
}
// get the result path and parses it.
String resultFilePath = generation.getResultFileName();
if (resultFilePath == null) {
throw new DocumentGenerationException("The result file path isn't set in the provided configuration");
}
// get template and result file
URI templateFile = getResolvedURI(generation, URI.createURI(generation.getTemplateFileName(), false));
URI generatedFile = getResolvedURI(generation, URI.createURI(generation.getResultFileName(), false));
if (!URIConverter.INSTANCE.exists(templateFile, Collections.EMPTY_MAP)) {
throw new DocumentGenerationException("The template file doest not exist " + templateFilePath);
}
// generate result file.
return generate(generation, classProvider, templateFile, generatedFile, monitor);
}
示例10: doGenerate
import org.eclipse.emf.common.util.Monitor; //导入依赖的package包/类
/**
* Launches the generation described by this instance.
*
* @param monitor
* This will be used to display progress information to the user.
* @throws IOException
* This will be thrown if any of the output files cannot be saved to disk.
* @generated not
*/
@Override
public void doGenerate(Monitor monitor) throws IOException {
/*
* be sufficient in most cases. If you want to change the content of this method, do NOT forget to
* change the "@generated" tag in the Javadoc of this method to "@generated NOT". Without this new tag,
* any compilation of the Acceleo module with the main template that has caused the creation of this
* class will revert your modifications. If you encounter a problem with an unresolved proxy during the
* generation, you can remove the comments in the following instructions to check for problems. Please
* note that those instructions may have a significant impact on the performances.
*/
//org.eclipse.emf.ecore.util.EcoreUtil.resolveAll(model);
/*
* If you want to check for potential errors in your models before the launch of the generation, you
* use the code below.
*/
//if (model != null && model.eResource() != null) {
// List<org.eclipse.emf.ecore.resource.Resource.Diagnostic> errors = model.eResource().getErrors();
// for (org.eclipse.emf.ecore.resource.Resource.Diagnostic diagnostic : errors) {
// System.err.println(diagnostic.toString());
// }
//}
super.doGenerate(monitor);
}
示例11: doGenerate
import org.eclipse.emf.common.util.Monitor; //导入依赖的package包/类
/**
* Launches the generation described by this instance.
*
* @param monitor
* This will be used to display progress information to the user.
* @throws IOException
* This will be thrown if any of the output files cannot be
* saved to disk.
* @generated not
*/
@Override
public void doGenerate(Monitor monitor) throws IOException {
/*
* be sufficient in most cases. If you want to change the content of this method, do NOT forget to
* change the "@generated" tag in the Javadoc of this method to "@generated NOT". Without this new tag,
* any compilation of the Acceleo module with the main template that has caused the creation of this
* class will revert your modifications. If you encounter a problem with an unresolved proxy during the
* generation, you can remove the comments in the following instructions to check for problems. Please
* note that those instructions may have a significant impact on the performances.
*/
//org.eclipse.emf.ecore.util.EcoreUtil.resolveAll(model);
/*
* If you want to check for potential errors in your models before the launch of the generation, you
* use the code below.
*/
//if (model != null && model.eResource() != null) {
// List<org.eclipse.emf.ecore.resource.Resource.Diagnostic> errors = model.eResource().getErrors();
// for (org.eclipse.emf.ecore.resource.Resource.Diagnostic diagnostic : errors) {
// System.err.println(diagnostic.toString());
// }
//}
super.doGenerate(monitor);
}