use of org.eclipse.emf.common.util.BasicDiagnostic in project InformationSystem by ObeoNetwork.
the class StateMachineEditor method analyzeResourceProblems.
/**
* Returns a diagnostic describing the errors and warnings listed in the resource
* and the specified exception (if any).
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) {
if (!resource.getErrors().isEmpty() || !resource.getWarnings().isEmpty()) {
BasicDiagnostic basicDiagnostic = new BasicDiagnostic(Diagnostic.ERROR, "org.obeonetwork.dsl.statemachine.editor", 0, getString("_UI_CreateModelError_message", resource.getURI()), new Object[] { exception == null ? (Object) resource : exception });
basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true));
return basicDiagnostic;
} else if (exception != null) {
return new BasicDiagnostic(Diagnostic.ERROR, "org.obeonetwork.dsl.statemachine.editor", 0, getString("_UI_CreateModelError_message", resource.getURI()), new Object[] { exception });
} else {
return Diagnostic.OK_INSTANCE;
}
}
use of org.eclipse.emf.common.util.BasicDiagnostic in project InformationSystem by ObeoNetwork.
the class SoaEditor method analyzeResourceProblems.
/**
* Returns a diagnostic describing the errors and warnings listed in the resource
* and the specified exception (if any).
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public Diagnostic analyzeResourceProblems(Resource resource, Exception exception) {
boolean hasErrors = !resource.getErrors().isEmpty();
if (hasErrors || !resource.getWarnings().isEmpty()) {
BasicDiagnostic basicDiagnostic = new BasicDiagnostic(hasErrors ? Diagnostic.ERROR : Diagnostic.WARNING, "org.obeonetwork.dsl.soa.editor", 0, getString("_UI_CreateModelError_message", resource.getURI()), new Object[] { exception == null ? (Object) resource : exception });
basicDiagnostic.merge(EcoreUtil.computeDiagnostic(resource, true));
return basicDiagnostic;
} else if (exception != null) {
return new BasicDiagnostic(Diagnostic.ERROR, "org.obeonetwork.dsl.soa.editor", 0, getString("_UI_CreateModelError_message", resource.getURI()), new Object[] { exception });
} else {
return Diagnostic.OK_INSTANCE;
}
}
use of org.eclipse.emf.common.util.BasicDiagnostic in project InformationSystem by ObeoNetwork.
the class FinalStateFinalStatePropertiesEditionComponent method validateValue.
/**
* {@inheritDoc}
*
* @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#validateValue(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent)
*/
public Diagnostic validateValue(IPropertiesEditionEvent event) {
Diagnostic ret = Diagnostic.OK_INSTANCE;
if (event.getNewValue() != null) {
try {
if (StatemachineViewsRepository.FinalState.Properties.description == event.getAffectedEditor()) {
Object newValue = event.getNewValue();
if (newValue instanceof String) {
newValue = EEFConverterUtil.createFromString(EnvironmentPackage.eINSTANCE.getObeoDSMObject_Description().getEAttributeType(), (String) newValue);
}
ret = Diagnostician.INSTANCE.validate(EnvironmentPackage.eINSTANCE.getObeoDSMObject_Description().getEAttributeType(), newValue);
}
if (StatemachineViewsRepository.FinalState.Properties.keywords == event.getAffectedEditor()) {
BasicDiagnostic chain = new BasicDiagnostic();
for (Iterator iterator = ((List) event.getNewValue()).iterator(); iterator.hasNext(); ) {
chain.add(Diagnostician.INSTANCE.validate(EnvironmentPackage.eINSTANCE.getObeoDSMObject_Keywords().getEAttributeType(), iterator.next()));
}
ret = chain;
}
} catch (IllegalArgumentException iae) {
ret = BasicDiagnostic.toDiagnostic(iae);
} catch (WrappedException we) {
ret = BasicDiagnostic.toDiagnostic(we);
}
}
return ret;
}
use of org.eclipse.emf.common.util.BasicDiagnostic in project InformationSystem by ObeoNetwork.
the class RegionRegionPropertiesEditionComponent method validateValue.
/**
* {@inheritDoc}
*
* @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#validateValue(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent)
*/
public Diagnostic validateValue(IPropertiesEditionEvent event) {
Diagnostic ret = Diagnostic.OK_INSTANCE;
if (event.getNewValue() != null) {
try {
if (StatemachineViewsRepository.Region.Properties.description == event.getAffectedEditor()) {
Object newValue = event.getNewValue();
if (newValue instanceof String) {
newValue = EEFConverterUtil.createFromString(EnvironmentPackage.eINSTANCE.getObeoDSMObject_Description().getEAttributeType(), (String) newValue);
}
ret = Diagnostician.INSTANCE.validate(EnvironmentPackage.eINSTANCE.getObeoDSMObject_Description().getEAttributeType(), newValue);
}
if (StatemachineViewsRepository.Region.Properties.keywords == event.getAffectedEditor()) {
BasicDiagnostic chain = new BasicDiagnostic();
for (Iterator iterator = ((List) event.getNewValue()).iterator(); iterator.hasNext(); ) {
chain.add(Diagnostician.INSTANCE.validate(EnvironmentPackage.eINSTANCE.getObeoDSMObject_Keywords().getEAttributeType(), iterator.next()));
}
ret = chain;
}
if (StatemachineViewsRepository.Region.Properties.name == event.getAffectedEditor()) {
Object newValue = event.getNewValue();
if (newValue instanceof String) {
newValue = EEFConverterUtil.createFromString(StateMachinePackage.eINSTANCE.getNamedElement_Name().getEAttributeType(), (String) newValue);
}
ret = Diagnostician.INSTANCE.validate(StateMachinePackage.eINSTANCE.getNamedElement_Name().getEAttributeType(), newValue);
}
} catch (IllegalArgumentException iae) {
ret = BasicDiagnostic.toDiagnostic(iae);
} catch (WrappedException we) {
ret = BasicDiagnostic.toDiagnostic(we);
}
}
return ret;
}
use of org.eclipse.emf.common.util.BasicDiagnostic in project InformationSystem by ObeoNetwork.
the class StateMachineStateMachinePropertiesEditionComponent method validateValue.
/**
* {@inheritDoc}
*
* @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#validateValue(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent)
*/
public Diagnostic validateValue(IPropertiesEditionEvent event) {
Diagnostic ret = Diagnostic.OK_INSTANCE;
if (event.getNewValue() != null) {
try {
if (StatemachineViewsRepository.StateMachine_.Properties.description == event.getAffectedEditor()) {
Object newValue = event.getNewValue();
if (newValue instanceof String) {
newValue = EEFConverterUtil.createFromString(EnvironmentPackage.eINSTANCE.getObeoDSMObject_Description().getEAttributeType(), (String) newValue);
}
ret = Diagnostician.INSTANCE.validate(EnvironmentPackage.eINSTANCE.getObeoDSMObject_Description().getEAttributeType(), newValue);
}
if (StatemachineViewsRepository.StateMachine_.Properties.keywords == event.getAffectedEditor()) {
BasicDiagnostic chain = new BasicDiagnostic();
for (Iterator iterator = ((List) event.getNewValue()).iterator(); iterator.hasNext(); ) {
chain.add(Diagnostician.INSTANCE.validate(EnvironmentPackage.eINSTANCE.getObeoDSMObject_Keywords().getEAttributeType(), iterator.next()));
}
ret = chain;
}
if (StatemachineViewsRepository.StateMachine_.Properties.name == event.getAffectedEditor()) {
Object newValue = event.getNewValue();
if (newValue instanceof String) {
newValue = EEFConverterUtil.createFromString(StateMachinePackage.eINSTANCE.getNamedElement_Name().getEAttributeType(), (String) newValue);
}
ret = Diagnostician.INSTANCE.validate(StateMachinePackage.eINSTANCE.getNamedElement_Name().getEAttributeType(), newValue);
}
} catch (IllegalArgumentException iae) {
ret = BasicDiagnostic.toDiagnostic(iae);
} catch (WrappedException we) {
ret = BasicDiagnostic.toDiagnostic(we);
}
}
return ret;
}
Aggregations