Java Code Examples for org.eclipse.emf.common.util.Diagnostic#OK_INSTANCE

The following examples show how to use org.eclipse.emf.common.util.Diagnostic#OK_INSTANCE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ServiceActivatorPropertiesEditionComponent.java    From eip-designer with Apache License 2.0 6 votes vote down vote up
/**
 * {@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 (EipViewsRepository.ServiceActivator.Properties.name == event.getAffectedEditor()) {
				Object newValue = event.getNewValue();
				if (newValue instanceof String) {
					newValue = EEFConverterUtil.createFromString(EipPackage.eINSTANCE.getEndpoint_Name().getEAttributeType(), (String)newValue);
				}
				ret = Diagnostician.INSTANCE.validate(EipPackage.eINSTANCE.getEndpoint_Name().getEAttributeType(), newValue);
			}
		} catch (IllegalArgumentException iae) {
			ret = BasicDiagnostic.toDiagnostic(iae);
		} catch (WrappedException we) {
			ret = BasicDiagnostic.toDiagnostic(we);
		}
	}
	return ret;
}
 
Example 2
Source File: GenconfEditor.java    From M2Doc with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 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.m2doc.genconf.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.m2doc.genconf.editor", 0,
                getString("_UI_CreateModelError_message", resource.getURI()), new Object[] {exception});
    } else {
        return Diagnostic.OK_INSTANCE;
    }
}
 
Example 3
Source File: CompositeProcessorPropertiesEditionComponent.java    From eip-designer with Apache License 2.0 6 votes vote down vote up
/**
 * {@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 (EipViewsRepository.CompositeProcessor.Properties.name == event.getAffectedEditor()) {
				Object newValue = event.getNewValue();
				if (newValue instanceof String) {
					newValue = EEFConverterUtil.createFromString(EipPackage.eINSTANCE.getEndpoint_Name().getEAttributeType(), (String)newValue);
				}
				ret = Diagnostician.INSTANCE.validate(EipPackage.eINSTANCE.getEndpoint_Name().getEAttributeType(), newValue);
			}
		} catch (IllegalArgumentException iae) {
			ret = BasicDiagnostic.toDiagnostic(iae);
		} catch (WrappedException we) {
			ret = BasicDiagnostic.toDiagnostic(we);
		}
	}
	return ret;
}
 
Example 4
Source File: SplitterPropertiesEditionComponent.java    From eip-designer with Apache License 2.0 6 votes vote down vote up
/**
 * {@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 (EipViewsRepository.Splitter.Properties.name == event.getAffectedEditor()) {
				Object newValue = event.getNewValue();
				if (newValue instanceof String) {
					newValue = EEFConverterUtil.createFromString(EipPackage.eINSTANCE.getEndpoint_Name().getEAttributeType(), (String)newValue);
				}
				ret = Diagnostician.INSTANCE.validate(EipPackage.eINSTANCE.getEndpoint_Name().getEAttributeType(), newValue);
			}
		} catch (IllegalArgumentException iae) {
			ret = BasicDiagnostic.toDiagnostic(iae);
		} catch (WrappedException we) {
			ret = BasicDiagnostic.toDiagnostic(we);
		}
	}
	return ret;
}
 
Example 5
Source File: ConfigurationEditor.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 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.da.server.exec.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.da.server.exec.editor", //$NON-NLS-1$
                0,
                getString ( "_UI_CreateModelError_message", resource.getURI () ), //$NON-NLS-1$
                new Object[] { exception } );
    }
    else
    {
        return Diagnostic.OK_INSTANCE;
    }
}
 
Example 6
Source File: ComponentEditor.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 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.eclipse.scada.configuration.component.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.configuration.component.editor", //$NON-NLS-1$
        0, getString ( "_UI_CreateModelError_message", resource.getURI () ), //$NON-NLS-1$
        new Object[] { exception } );
    }
    else
    {
        return Diagnostic.OK_INSTANCE;
    }
}
 
Example 7
Source File: GlobalizeEditor.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 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.eclipse.scada.configuration.globalization.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.configuration.globalization.editor", //$NON-NLS-1$
                0, getString ( "_UI_CreateModelError_message", resource.getURI () ), //$NON-NLS-1$
                new Object[] { exception } );
    }
    else
    {
        return Diagnostic.OK_INSTANCE;
    }
}
 
Example 8
Source File: EipEditor.java    From eip-designer with Apache License 2.0 6 votes vote down vote up
/**
   * 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,
               "com.github.lbroudoux.dsl.eip.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,
               "com.github.lbroudoux.dsl.eip.editor",
               0,
               getString("_UI_CreateModelError_message", resource.getURI()),
               new Object[] { exception });
     }
     else {
        return Diagnostic.OK_INSTANCE;
     }
  }
 
Example 9
Source File: GatewayPropertiesEditionComponent.java    From eip-designer with Apache License 2.0 6 votes vote down vote up
/**
 * {@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 (EipViewsRepository.Gateway.Properties.name == event.getAffectedEditor()) {
				Object newValue = event.getNewValue();
				if (newValue instanceof String) {
					newValue = EEFConverterUtil.createFromString(EipPackage.eINSTANCE.getEndpoint_Name().getEAttributeType(), (String)newValue);
				}
				ret = Diagnostician.INSTANCE.validate(EipPackage.eINSTANCE.getEndpoint_Name().getEAttributeType(), newValue);
			}
		} catch (IllegalArgumentException iae) {
			ret = BasicDiagnostic.toDiagnostic(iae);
		} catch (WrappedException we) {
			ret = BasicDiagnostic.toDiagnostic(we);
		}
	}
	return ret;
}
 
Example 10
Source File: CoreEditor.java    From ifml-editor with MIT License 6 votes vote down vote up
/**
 * 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,
				 "IFMLEditor.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,
				 "IFMLEditor.editor",
				 0,
				 getString("_UI_CreateModelError_message", resource.getURI()),
				 new Object[] { exception });
	}
	else {
		return Diagnostic.OK_INSTANCE;
	}
}
 
Example 11
Source File: MemoryEditor.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 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.eclipse.scada.configuration.memory.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.scada.configuration.memory.editor", 0, getString ( "_UI_CreateModelError_message", resource.getURI () ), new Object[] { exception } );
    }
    else
    {
        return Diagnostic.OK_INSTANCE;
    }
}
 
Example 12
Source File: WorldEditor.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 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.eclipse.scada.configuration.world.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.configuration.world.editor", //$NON-NLS-1$
        0, getString ( "_UI_CreateModelError_message", resource.getURI () ), //$NON-NLS-1$
        new Object[] { exception } );
    }
    else
    {
        return Diagnostic.OK_INSTANCE;
    }
}
 
Example 13
Source File: OsgiEditor.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 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.eclipse.scada.configuration.world.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.configuration.world.editor", //$NON-NLS-1$
        0, getString ( "_UI_CreateModelError_message", resource.getURI () ), //$NON-NLS-1$
        new Object[] { exception } );
    }
    else
    {
        return Diagnostic.OK_INSTANCE;
    }
}
 
Example 14
Source File: ProfileEditor.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 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.eclipse.scada.configuration.world.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.configuration.world.editor", //$NON-NLS-1$
        0, getString ( "_UI_CreateModelError_message", resource.getURI () ), //$NON-NLS-1$
        new Object[] { exception } );
    }
    else
    {
        return Diagnostic.OK_INSTANCE;
    }
}
 
Example 15
Source File: SetupEditor.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 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.eclipse.scada.configuration.world.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.configuration.world.editor", //$NON-NLS-1$
        0, getString ( "_UI_CreateModelError_message", resource.getURI () ), //$NON-NLS-1$
        new Object[] { exception } );
    }
    else
    {
        return Diagnostic.OK_INSTANCE;
    }
}
 
Example 16
Source File: DeploymentEditor.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 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.eclipse.scada.configuration.world.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.configuration.world.editor", //$NON-NLS-1$
        0, getString ( "_UI_CreateModelError_message", resource.getURI () ), //$NON-NLS-1$
        new Object[] { exception } );
    }
    else
    {
        return Diagnostic.OK_INSTANCE;
    }
}
 
Example 17
Source File: VisualInterfaceEditor.java    From neoscada with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * 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.eclipse.scada.vi.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.vi.model.editor", //$NON-NLS-1$
                0, getString ( "_UI_CreateModelError_message", resource.getURI () ), //$NON-NLS-1$
                new Object[] { exception } );
    }
    else
    {
        return Diagnostic.OK_INSTANCE;
    }
}
 
Example 18
Source File: InvocableEndpointPropertiesEditionComponent.java    From eip-designer with Apache License 2.0 6 votes vote down vote up
/**
 * {@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 (EipViewsRepository.InvocableEndpoint.Properties.name == event.getAffectedEditor()) {
				Object newValue = event.getNewValue();
				if (newValue instanceof String) {
					newValue = EEFConverterUtil.createFromString(EipPackage.eINSTANCE.getEndpoint_Name().getEAttributeType(), (String)newValue);
				}
				ret = Diagnostician.INSTANCE.validate(EipPackage.eINSTANCE.getEndpoint_Name().getEAttributeType(), newValue);
			}
		} catch (IllegalArgumentException iae) {
			ret = BasicDiagnostic.toDiagnostic(iae);
		} catch (WrappedException we) {
			ret = BasicDiagnostic.toDiagnostic(we);
		}
	}
	return ret;
}
 
Example 19
Source File: ExtensionsEditor.java    From ifml-editor with MIT License 6 votes vote down vote up
/**
 * 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,
				 "IFMLEditor.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,
				 "IFMLEditor.editor",
				 0,
				 getString("_UI_CreateModelError_message", resource.getURI()),
				 new Object[] { exception });
	}
	else {
		return Diagnostic.OK_INSTANCE;
	}
}
 
Example 20
Source File: EIPModelPropertiesEditionComponent.java    From eip-designer with Apache License 2.0 5 votes vote down vote up
/**
 * {@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 {
		} catch (IllegalArgumentException iae) {
			ret = BasicDiagnostic.toDiagnostic(iae);
		} catch (WrappedException we) {
			ret = BasicDiagnostic.toDiagnostic(we);
		}
	}
	return ret;
}