本文整理汇总了Java中org.eclipse.emf.common.util.Diagnostic类的典型用法代码示例。如果您正苦于以下问题:Java Diagnostic类的具体用法?Java Diagnostic怎么用?Java Diagnostic使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Diagnostic类属于org.eclipse.emf.common.util包,在下文中一共展示了Diagnostic类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: validateValue
import org.eclipse.emf.common.util.Diagnostic; //导入依赖的package包/类
/**
* {@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 (GrmViewsRepository.General.Properties.name == event.getAffectedEditor()) {
Object newValue = event.getNewValue();
if (newValue instanceof String) {
newValue = EEFConverterUtil.createFromString(GrmPackage.eINSTANCE.getNamedElement_Name().getEAttributeType(), (String)newValue);
}
ret = Diagnostician.INSTANCE.validate(GrmPackage.eINSTANCE.getNamedElement_Name().getEAttributeType(), newValue);
}
} catch (IllegalArgumentException iae) {
ret = BasicDiagnostic.toDiagnostic(iae);
} catch (WrappedException we) {
ret = BasicDiagnostic.toDiagnostic(we);
}
}
return ret;
}
示例2: validateValue
import org.eclipse.emf.common.util.Diagnostic; //导入依赖的package包/类
/**
* {@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 (HrmViewsRepository.Timing.TimingProperties.timings == event.getAffectedEditor()) {
BasicDiagnostic chain = new BasicDiagnostic();
for (Iterator iterator = ((List)event.getNewValue()).iterator(); iterator.hasNext();) {
chain.add(Diagnostician.INSTANCE.validate(HrmPackage.eINSTANCE.getHardwareMemory_Timings().getEAttributeType(), iterator.next()));
}
ret = chain;
}
} catch (IllegalArgumentException iae) {
ret = BasicDiagnostic.toDiagnostic(iae);
} catch (WrappedException we) {
ret = BasicDiagnostic.toDiagnostic(we);
}
}
return ret;
}
示例3: validateValue
import org.eclipse.emf.common.util.Diagnostic; //导入依赖的package包/类
/**
* {@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 (GqamViewsRepository.General.Properties.name == event.getAffectedEditor()) {
Object newValue = event.getNewValue();
if (newValue instanceof String) {
newValue = EEFConverterUtil.createFromString(GrmPackage.eINSTANCE.getNamedElement_Name().getEAttributeType(), (String)newValue);
}
ret = Diagnostician.INSTANCE.validate(GrmPackage.eINSTANCE.getNamedElement_Name().getEAttributeType(), newValue);
}
} catch (IllegalArgumentException iae) {
ret = BasicDiagnostic.toDiagnostic(iae);
} catch (WrappedException we) {
ret = BasicDiagnostic.toDiagnostic(we);
}
}
return ret;
}
示例4: validateValue
import org.eclipse.emf.common.util.Diagnostic; //导入依赖的package包/类
/**
* {@inheritDoc}
*
* @see org.eclipse.emf.eef.runtime.api.component.IPropertiesEditionComponent#validateValue(org.eclipse.emf.eef.runtime.api.notify.IPropertiesEditionEvent)
* @generated
*/
public Diagnostic validateValue(IPropertiesEditionEvent event) {
Diagnostic ret = Diagnostic.OK_INSTANCE;
if (event.getNewValue() != null) {
try {
if (AnalysisViewsRepository.ResultContainer.Properties.name == event.getAffectedEditor()) {
Object newValue = event.getNewValue();
if (newValue instanceof String) {
newValue = EEFConverterUtil.createFromString(AnalysisPackage.eINSTANCE.getNamedElement_Name().getEAttributeType(), (String)newValue);
}
ret = Diagnostician.INSTANCE.validate(AnalysisPackage.eINSTANCE.getNamedElement_Name().getEAttributeType(), newValue);
}
} catch (IllegalArgumentException iae) {
ret = BasicDiagnostic.toDiagnostic(iae);
} catch (WrappedException we) {
ret = BasicDiagnostic.toDiagnostic(we);
}
}
return ret;
}
示例5: validateValue
import org.eclipse.emf.common.util.Diagnostic; //导入依赖的package包/类
/**
* {@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 (MetamodelViewsRepository.Model.Properties.name == event.getAffectedEditor()) {
Object newValue = event.getNewValue();
if (newValue instanceof String) {
newValue = EEFConverterUtil.createFromString(MetamodelPackage.eINSTANCE.getModel_Name().getEAttributeType(), (String)newValue);
}
ret = Diagnostician.INSTANCE.validate(MetamodelPackage.eINSTANCE.getModel_Name().getEAttributeType(), newValue);
}
} catch (IllegalArgumentException iae) {
ret = BasicDiagnostic.toDiagnostic(iae);
} catch (WrappedException we) {
ret = BasicDiagnostic.toDiagnostic(we);
}
}
return ret;
}
示例6: createModel
import org.eclipse.emf.common.util.Diagnostic; //导入依赖的package包/类
/**
* This is the method called to load a resource into the editing domain's resource set based on the editor's input.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void createModel() {
URI resourceURI = EditUIUtil.getURI(getEditorInput());
Exception exception = null;
Resource resource = null;
try {
// Load the resource through the editing domain.
//
resource = editingDomain.getResourceSet().getResource(resourceURI, true);
}
catch (Exception e) {
exception = e;
resource = editingDomain.getResourceSet().getResource(resourceURI, false);
}
Diagnostic diagnostic = analyzeResourceProblems(resource, exception);
if (diagnostic.getSeverity() != Diagnostic.OK) {
resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
}
editingDomain.getResourceSet().eAdapters().add(problemIndicationAdapter);
}
示例7: analyzeResourceProblems
import org.eclipse.emf.common.util.Diagnostic; //导入依赖的package包/类
/**
* 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.eclipse.gemoc.trace.annotations.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.eclipse.gemoc.trace.annotations.editor",
0,
getString("_UI_CreateModelError_message", resource.getURI()),
new Object[] { exception });
}
else {
return Diagnostic.OK_INSTANCE;
}
}
示例8: analyzeResourceProblems
import org.eclipse.emf.common.util.Diagnostic; //导入依赖的package包/类
/**
* 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.eclipse.scada.protocol.ngp.model.editor", //$NON-NLS-1$
0,
getString ( "_UI_CreateModelError_message", resource.getURI () ), //$NON-NLS-1$
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.eclipse.scada.protocol.ngp.model.editor", //$NON-NLS-1$
0,
getString ( "_UI_CreateModelError_message", resource.getURI () ), //$NON-NLS-1$
new Object[] { exception } );
}
else
{
return Diagnostic.OK_INSTANCE;
}
}
示例9: validateValue
import org.eclipse.emf.common.util.Diagnostic; //导入依赖的package包/类
/**
* {@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 (GqamViewsRepository.General.Properties.referenceName == event.getAffectedEditor()) {
Object newValue = event.getNewValue();
if (newValue instanceof String) {
newValue = EEFConverterUtil.createFromString(GqamPackage.eINSTANCE.getReference_ReferenceName().getEAttributeType(), (String)newValue);
}
ret = Diagnostician.INSTANCE.validate(GqamPackage.eINSTANCE.getReference_ReferenceName().getEAttributeType(), newValue);
}
} catch (IllegalArgumentException iae) {
ret = BasicDiagnostic.toDiagnostic(iae);
} catch (WrappedException we) {
ret = BasicDiagnostic.toDiagnostic(we);
}
}
return ret;
}
示例10: validateValue
import org.eclipse.emf.common.util.Diagnostic; //导入依赖的package包/类
/**
* {@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 (SrmViewsRepository.General.Properties.name == event.getAffectedEditor()) {
Object newValue = event.getNewValue();
if (newValue instanceof String) {
newValue = EEFConverterUtil.createFromString(GrmPackage.eINSTANCE.getNamedElement_Name().getEAttributeType(), (String)newValue);
}
ret = Diagnostician.INSTANCE.validate(GrmPackage.eINSTANCE.getNamedElement_Name().getEAttributeType(), newValue);
}
} catch (IllegalArgumentException iae) {
ret = BasicDiagnostic.toDiagnostic(iae);
} catch (WrappedException we) {
ret = BasicDiagnostic.toDiagnostic(we);
}
}
return ret;
}
示例11: createModel
import org.eclipse.emf.common.util.Diagnostic; //导入依赖的package包/类
/**
* This is the method called to load a resource into the editing domain's resource set based on the editor's input.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void createModel ()
{
URI resourceURI = EditUIUtil.getURI ( getEditorInput () );
Exception exception = null;
Resource resource = null;
try
{
// Load the resource through the editing domain.
//
resource = editingDomain.getResourceSet ().getResource ( resourceURI, true );
}
catch ( Exception e )
{
exception = e;
resource = editingDomain.getResourceSet ().getResource ( resourceURI, false );
}
Diagnostic diagnostic = analyzeResourceProblems ( resource, exception );
if ( diagnostic.getSeverity () != Diagnostic.OK )
{
resourceToDiagnosticMap.put ( resource, analyzeResourceProblems ( resource, exception ) );
}
editingDomain.getResourceSet ().eAdapters ().add ( problemIndicationAdapter );
}
示例12: validateDevice
import org.eclipse.emf.common.util.Diagnostic; //导入依赖的package包/类
/**
* Validates a object instance and its children using the EMF core validator
* API.
*
* @param element
* the element to validate
* @param label
* the type label of the element
* @throws IllegalStateException
* if validation errors are encountered
*/
protected static void validateDevice ( final EObject object, final String label )
{
final Diagnostic diag = Diagnostician.INSTANCE.validate ( object );
if ( diag.getSeverity () == Diagnostic.ERROR )
{
final StringBuilder sb = new StringBuilder ( "Invalid " + label );
for ( final Diagnostic child : diag.getChildren () )
{
if ( child.getSeverity () == Diagnostic.ERROR )
{
sb.append ( System.lineSeparator () );
sb.append ( child.getMessage () );
}
}
throw new IllegalStateException ( sb.toString () );
}
}
示例13: validateValue
import org.eclipse.emf.common.util.Diagnostic; //导入依赖的package包/类
/**
* {@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 (HrmViewsRepository.General.Properties.name == event.getAffectedEditor()) {
Object newValue = event.getNewValue();
if (newValue instanceof String) {
newValue = EEFConverterUtil.createFromString(GrmPackage.eINSTANCE.getNamedElement_Name().getEAttributeType(), (String)newValue);
}
ret = Diagnostician.INSTANCE.validate(GrmPackage.eINSTANCE.getNamedElement_Name().getEAttributeType(), newValue);
}
} catch (IllegalArgumentException iae) {
ret = BasicDiagnostic.toDiagnostic(iae);
} catch (WrappedException we) {
ret = BasicDiagnostic.toDiagnostic(we);
}
}
return ret;
}
示例14: createModel
import org.eclipse.emf.common.util.Diagnostic; //导入依赖的package包/类
/**
* This is the method called to load a resource into the editing domain's resource set based on the editor's input.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void createModel() {
URI resourceURI = EditUIUtil.getURI(getEditorInput(), editingDomain.getResourceSet().getURIConverter());
Exception exception = null;
Resource resource = null;
try {
// Load the resource through the editing domain.
//
resource = editingDomain.getResourceSet().getResource(resourceURI, true);
}
catch (Exception e) {
exception = e;
resource = editingDomain.getResourceSet().getResource(resourceURI, false);
}
Diagnostic diagnostic = analyzeResourceProblems(resource, exception);
if (diagnostic.getSeverity() != Diagnostic.OK) {
resourceToDiagnosticMap.put(resource, analyzeResourceProblems(resource, exception));
}
editingDomain.getResourceSet().eAdapters().add(problemIndicationAdapter);
}
示例15: createModel
import org.eclipse.emf.common.util.Diagnostic; //导入依赖的package包/类
/**
* This is the method called to load a resource into the editing domain's resource set based on the editor's input.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
public void createModel ()
{
URI resourceURI = EditUIUtil.getURI ( getEditorInput (), editingDomain.getResourceSet ().getURIConverter () );
Exception exception = null;
Resource resource = null;
try
{
// Load the resource through the editing domain.
//
resource = editingDomain.getResourceSet ().getResource ( resourceURI, true );
}
catch ( Exception e )
{
exception = e;
resource = editingDomain.getResourceSet ().getResource ( resourceURI, false );
}
Diagnostic diagnostic = analyzeResourceProblems ( resource, exception );
if ( diagnostic.getSeverity () != Diagnostic.OK )
{
resourceToDiagnosticMap.put ( resource, analyzeResourceProblems ( resource, exception ) );
}
editingDomain.getResourceSet ().eAdapters ().add ( problemIndicationAdapter );
}