本文整理汇总了Java中org.eclipse.xtext.validation.CheckType.NORMAL属性的典型用法代码示例。如果您正苦于以下问题:Java CheckType.NORMAL属性的具体用法?Java CheckType.NORMAL怎么用?Java CheckType.NORMAL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.xtext.validation.CheckType
的用法示例。
在下文中一共展示了CheckType.NORMAL属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkTopLeveEntryIsDefaultEntry
@Check(CheckType.NORMAL)
public void checkTopLeveEntryIsDefaultEntry(final Entry entry) {
Region parentRegion = entry.getParentRegion();
// 1. check if is toplevel
if (isTopLevelRegion(parentRegion)) {
boolean isDefaultEntry = STextValidationModelUtils.isDefault(entry);
// 2. check if is default entry
if (!isDefaultEntry) {
Map<Region, List<Entry>> regionsWithoutDefaultEntry = STextValidationModelUtils
.getRegionsWithoutDefaultEntry(Lists.newArrayList(parentRegion));
List<Entry> list = regionsWithoutDefaultEntry.get(parentRegion);
if (list != null)
error(TOP_LEVEL_REGION_ENTRY_HAVE_TO_BE_A_DEFAULT_ENTRY, entry, SGraphPackage.Literals.ENTRY__KIND,
-1);
else
warning(TOP_LEVEL_REGION_ENTRY_HAVE_TO_BE_A_DEFAULT_ENTRY, entry,
SGraphPackage.Literals.ENTRY__KIND, -1);
}
}
}
示例2: checkDesignNameUnique
@Check(CheckType.NORMAL)
public void checkDesignNameUnique(Design design) {
List<Design> designs = new ArrayList<Design>();
IResourceDescription resourceDescription = resourceDescriptions.getResourceDescription(design.eResource()
.getURI());
List<IContainer> visiblecontainers = containermanager.getVisibleContainers(resourceDescription,
resourceDescriptions);
for (IContainer container : visiblecontainers) {
for (IEObjectDescription eobjectDescription : container.getExportedObjects()) {
EObject eObjectOrProxy = eobjectDescription.getEObjectOrProxy();
if (eObjectOrProxy instanceof Design)
designs.add((Design) eObjectOrProxy);
}
}
int count = 0;
for (Design d : designs) {
if (d.eIsProxy())
d = (Design) EcoreUtil.resolve(d, design);
if (design.getName().equals(d.getName()))
count++;
}
if (count > 1)
error("Duplicate design in project.", PhdlPackage.Literals.DESIGN__NAME);
}
示例3: checkPackageNameUnique
@Check(CheckType.NORMAL)
public void checkPackageNameUnique(Package pkg) {
List<Package> packages = new ArrayList<Package>();
IResourceDescription resourceDescription = resourceDescriptions
.getResourceDescription(pkg.eResource().getURI());
List<IContainer> visiblecontainers = containermanager.getVisibleContainers(resourceDescription,
resourceDescriptions);
for (IContainer container : visiblecontainers) {
for (IEObjectDescription eobjectDescription : container.getExportedObjects()) {
EObject eObjectOrProxy = eobjectDescription.getEObjectOrProxy();
if (eObjectOrProxy instanceof Package)
packages.add((Package) eObjectOrProxy);
}
}
int count = 0;
for (Package p : packages) {
if (p.eIsProxy())
p = (Package) EcoreUtil.resolve(p, pkg);
if (pkg.getName().equals(p.getName()))
count++;
}
if (count > 1)
error("Duplicate package in project.", PhdlPackage.Literals.PACKAGE__NAME);
}
示例4: checkIssueExpressionExists
/**
* Checks that at least one issue expression exists in a context's constraints.
* <p>
* To be executed on save only as the error will otherwise be distracting.
* </p>
*
* @param context
* the context to be checked
*/
@Check(CheckType.NORMAL)
public void checkIssueExpressionExists(final Context context) {
if (context.getContextVariable() == null || context.getConstraint() == null) {
return;
}
if (Iterables.isEmpty(generatorExtensions.issues(context))) {
error(Messages.CheckJavaValidator_MISSING_ISSUE_EXPRESSION, context, CheckPackage.Literals.CONTEXT__CONSTRAINT, IssueCodes.MISSING_ISSUE_EXPRESSION);
}
}
示例5: getCheckType
@Override
public CheckType getCheckType(String markerType) {
if (fastValidationMarker.equals(markerType)) {
return CheckType.FAST;
}
if (normalValidationMarker.equals(markerType)) {
return CheckType.NORMAL;
}
if (expensiveValidationMarker.equals(markerType)) {
return CheckType.EXPENSIVE;
}
return super.getCheckType(markerType);
}
示例6: toCheckType
public static CheckType toCheckType(String markerType) {
if (FAST_VALIDATION.equals(markerType))
return CheckType.FAST;
if (NORMAL_VALIDATION.equals(markerType))
return CheckType.NORMAL;
if (EXPENSIVE_VALIDATION.equals(markerType))
return CheckType.EXPENSIVE;
// default
return CheckType.FAST;
}
示例7: checkValueReferenedBeforeDefined
@Check(CheckType.NORMAL)
public void checkValueReferenedBeforeDefined(Scope scope) {
EList<Declaration> declarations = scope.getDeclarations();
Set<QualifiedName> defined = Sets.newHashSet();
for (Declaration declaration : declarations) {
if (declaration instanceof VariableDefinition) {
VariableDefinition definition = (VariableDefinition) declaration;
if (!definition.isConst())
return;
Expression initialValue = definition.getInitialValue();
List<Expression> toCheck = Lists.newArrayList(initialValue);
TreeIterator<EObject> eAllContents = initialValue.eAllContents();
while (eAllContents.hasNext()) {
EObject next = eAllContents.next();
if (next instanceof Expression)
toCheck.add((Expression) next);
}
for (Expression expression : toCheck) {
EObject referencedObject = null;
if (expression instanceof FeatureCall)
referencedObject = ((FeatureCall) expression).getFeature();
else if (expression instanceof ElementReferenceExpression)
referencedObject = ((ElementReferenceExpression) expression).getReference();
if (referencedObject instanceof VariableDefinition) {
if (!defined.contains(nameProvider.getFullyQualifiedName(referencedObject)))
error(REFERENCE_CONSTANT_BEFORE_DEFINED, definition,
StextPackage.Literals.VARIABLE_DEFINITION__INITIAL_VALUE);
}
}
defined.add(nameProvider.getFullyQualifiedName(definition));
}
}
}
示例8: checkTopLevelRegionHasEntry
@Check(CheckType.NORMAL)
public void checkTopLevelRegionHasEntry(final Region region) {
if (isTopLevelRegion(region)) {
if (!STextValidationModelUtils.getRegionsWithoutDefaultEntry(Collections.singletonList(region)).isEmpty()) {
error(REGION_UNBOUND_DEFAULT_ENTRY_POINT, region, null, -1);
}
}
}
示例9: getCheckType
@Override
public CheckType getCheckType(String markerType) {
if (SCTMarkerType.FAST_VALIDATION.equals(markerType))
return CheckType.FAST;
if (SCTMarkerType.NORMAL_VALIDATION.equals(markerType))
return CheckType.NORMAL;
if (SCTMarkerType.EXPENSIVE_VALIDATION.equals(markerType))
return CheckType.EXPENSIVE;
// default
return CheckType.FAST;
}
示例10: checkSubInstanceIsTop
@Check(CheckType.NORMAL)
public void checkSubInstanceIsTop(Instance s) {
if (s.getSubDesign().isDesign()) {
EStructuralFeature f = PhdlPackage.Literals.INSTANCE__SUB_DESIGN;
error("Cannot instance a top-level design.", s, f, -1);
}
}
示例11: getType
private CheckType getType(final CheckMode mode) {
if (mode == CheckMode.FAST_ONLY) {
return CheckType.FAST;
} else if (mode == CheckMode.EXPENSIVE_ONLY) {
return CheckType.EXPENSIVE;
} else if (mode == CheckMode.ALL) {
return CheckType.FAST;
} else if (mode == CheckMode.NORMAL_AND_FAST) {
return CheckType.FAST;
} else if (mode == CheckMode.NORMAL_ONLY) {
return CheckType.NORMAL;
} else
return CheckType.FAST;
}
示例12: getType
@Override
public CheckType getType() {
return CheckType.NORMAL;
}
示例13: greetingNameLengthGreeting
/**
* greetingNameLengthGreeting.
*/
@Check(CheckType.NORMAL)
public void greetingNameLengthGreeting(final Greeting context) {
greetingNameLengthImpl.runGreeting(context);
}
示例14: checkUnusedVariablesInInternalScope
@Check(CheckType.NORMAL)
public void checkUnusedVariablesInInternalScope(InternalScope internalScope) {
EList<Declaration> internalScopeDeclarations = internalScope.getDeclarations();
EObject rootContainer = EcoreUtil.getRootContainer(internalScope);
Resource rootRes = getResource(rootContainer);
Statechart statechart = (Statechart) EcoreUtil.getObjectByType(rootRes.getContents(),
SGraphPackage.Literals.STATECHART);
if (statechart == null)
return;
List<ElementReferenceExpression> allUsedElementReferences = EcoreUtil2.getAllContentsOfType(statechart,
ElementReferenceExpression.class);
if (statechart.getSpecification() != null) {
for (Declaration internalDeclaration : internalScopeDeclarations) {
boolean internalDeclarationUsed = false;
for (ElementReferenceExpression elementReference : allUsedElementReferences) {
if (elementReference.getReference().eContainer() instanceof InternalScope) {
if (elementReference.getReference() instanceof VariableDefinition) {
if (((VariableDefinition) elementReference.getReference()).getName()
.equals(internalDeclaration.getName())
&& internalDeclaration instanceof VariableDefinition) {
internalDeclarationUsed = true;
break;
}
} else if (elementReference.getReference() instanceof EventDefinition) {
if (((EventDefinition) elementReference.getReference()).getName().equals(
internalDeclaration.getName()) && internalDeclaration instanceof EventDefinition) {
internalDeclarationUsed = true;
break;
}
} else if (elementReference.getReference() instanceof OperationDefinition) {
if (((OperationDefinition) elementReference.getReference()).getName()
.equals(internalDeclaration.getName())
&& internalDeclaration instanceof OperationDefinition) {
internalDeclarationUsed = true;
break;
}
}
}
}
if (!internalDeclarationUsed) {
if (internalDeclaration instanceof VariableDefinition
|| internalDeclaration instanceof EventDefinition
|| internalDeclaration instanceof OperationDefinition)
warning(INTERNAL_DECLARATION_UNUSED, internalDeclaration, null, -1);
}
}
}
}
示例15: checkDuplicateClassesInFiles
@Check(CheckType.NORMAL)
public void checkDuplicateClassesInFiles(final SJClass c) {
final QualifiedName className = this._iQualifiedNameProvider.getFullyQualifiedName(c);
Iterable<IEObjectDescription> _visibleClassesDescriptions = this._smallJavaIndex.getVisibleClassesDescriptions(c);
final Procedure1<IEObjectDescription> _function = new Procedure1<IEObjectDescription>() {
@Override
public void apply(final IEObjectDescription desc) {
boolean _and = false;
boolean _and_1 = false;
QualifiedName _qualifiedName = desc.getQualifiedName();
boolean _equals = Objects.equal(_qualifiedName, className);
if (!_equals) {
_and_1 = false;
} else {
EObject _eObjectOrProxy = desc.getEObjectOrProxy();
boolean _notEquals = (!Objects.equal(_eObjectOrProxy, c));
_and_1 = _notEquals;
}
if (!_and_1) {
_and = false;
} else {
URI _eObjectURI = desc.getEObjectURI();
URI _trimFragment = _eObjectURI.trimFragment();
Resource _eResource = c.eResource();
URI _uRI = _eResource.getURI();
boolean _notEquals_1 = (!Objects.equal(_trimFragment, _uRI));
_and = _notEquals_1;
}
if (_and) {
String _name = c.getName();
String _plus = ("The type " + _name);
String _plus_1 = (_plus + " is already defined");
EAttribute _sJClass_Name = SmallJavaPackage.eINSTANCE.getSJClass_Name();
SmallJavaValidator.this.error(_plus_1, _sJClass_Name,
SmallJavaValidator.DUPLICATE_CLASS);
return;
}
}
};
IterableExtensions.<IEObjectDescription>forEach(_visibleClassesDescriptions, _function);
}