public void merge(Diagnostic diagnostic) { if (diagnostic.getChildren().isEmpty()) { add(diagnostic); } else { addAll(diagnostic); } }
public static Diagnostic createDiagnostic(Diagnostic baseDiagnostic, String source, int code) { BasicDiagnostic basicDiagnostic = new BasicDiagnostic( baseDiagnostic.getSeverity(), source, code, baseDiagnostic.getMessage(), baseDiagnostic.getData().toArray()); basicDiagnostic.addAll(baseDiagnostic); return basicDiagnostic; }
/** * Parses an instance type name and returns a diagnostic representing the result of the analysis. * The {@link Diagnostic#getData() data} of the diagnostic will contain as the first object, the resulting {@link EGenericType generic type}. * @param instanceTypeName an instance type name. * @return the diagnostic result of the analysis. */ public Diagnostic parseInstanceTypeName(final String instanceTypeName) { BasicDiagnostic placeholder = new BasicDiagnostic(); char [] instanceTypeNameCharacterArray = instanceTypeName == null ? NO_CHARS: instanceTypeName.toCharArray(); EGenericType eGenericType = handleInstanceTypeName(instanceTypeNameCharacterArray, 0, instanceTypeNameCharacterArray.length, placeholder); BasicDiagnostic result = createDiagnostic (placeholder.getSeverity(), DIAGNOSTIC_SOURCE, WELL_FORMED_INSTANCE_TYPE_NAME, "_UI_EClassifierInstanceTypeNameAnalysisResult_diagnostic", new Object [] { instanceTypeName }, new Object [] { eGenericType, instanceTypeName }); result.addAll(placeholder); return result; }
/** * Parses a list of type parameters and returns a diagnostic representing the result of the analysis. * The {@link Diagnostic#getData() data} of the diagnostic will contain as the first object, the resulting list of {@link ETypeParameter type parameters}. * @param typeParameterList a comma separated list of type parameters delimited by '<' and '>'. * @return the diagnostic result of the analysis. */ public Diagnostic parseTypeParameterList(final String typeParameterList) { BasicDiagnostic placeholder = new BasicDiagnostic(); char [] instanceTypeNameCharacterArray = typeParameterList == null ? NO_CHARS : typeParameterList.toCharArray(); List<ETypeParameter> eTypeParameters = handleTypeParameters(instanceTypeNameCharacterArray, 0, instanceTypeNameCharacterArray.length, placeholder); BasicDiagnostic result = createDiagnostic (placeholder.getSeverity(), DIAGNOSTIC_SOURCE, WELL_FORMED_INSTANCE_TYPE_NAME, "_UI_EClassifierInstanceTypeNameAnalysisResult_diagnostic", new Object [] { typeParameterList }, new Object [] { eTypeParameters, typeParameterList }); result.addAll(placeholder); return result; }
/** * Parses a type parameter and returns a diagnostic representing the result of the analysis. * The {@link Diagnostic#getData() data} of the diagnostic will contain as the first object, the resulting {@link ETypeParameter type parameter}. * @param typeParameter a type parameter. * @return the diagnostic result of the analysis. */ public Diagnostic parseTypeParameter(final String typeParameter) { BasicDiagnostic placeholder = new BasicDiagnostic(); char [] instanceTypeNameCharacterArray = typeParameter == null ? NO_CHARS : typeParameter.toCharArray(); ETypeParameter eTypeParameter = handleTypeParameter(instanceTypeNameCharacterArray, 0, instanceTypeNameCharacterArray.length, placeholder); BasicDiagnostic result = createDiagnostic (placeholder.getSeverity(), DIAGNOSTIC_SOURCE, WELL_FORMED_INSTANCE_TYPE_NAME, "_UI_EClassifierInstanceTypeNameAnalysisResult_diagnostic", new Object [] { typeParameter }, new Object [] { eTypeParameter, typeParameter }); result.addAll(placeholder); return result; }
/** * Parses an instance type name and returns a diagnostic representing the result of the analysis. * The {@link Diagnostic#getData() data} of the diagnostic will contain as the first object, the resulting {@link EGenericType generic type}. * @param instanceTypeName an instance type name. * @return the diagnostic result of the analysis. */ public Diagnostic parseInstanceTypeName(final String instanceTypeName) { BasicDiagnostic placeholder = new BasicDiagnostic(); char [] instanceTypeNameCharacterArray = instanceTypeName == null ? NO_CHARS: instanceTypeName.toCharArray(); EGenericType eGenericType = handleInstanceTypeName(instanceTypeNameCharacterArray, 0, instanceTypeNameCharacterArray.length, placeholder); BasicDiagnostic result = createDiagnostic (placeholder.getSeverity(), DIAGNOSTIC_SOURCE, WELL_FORMED_INSTANCE_TYPE_NAME, "_UI_EClassifierInstanceTypeNameAnalysisResult_diagnostic", new Object [] { instanceTypeName }, new Object [] { eGenericType, instanceTypeName }); result.addAll(placeholder); return result; }
/** * Parses a list of type arguments and returns a diagnostic representing the result of the analysis. * The {@link Diagnostic#getData() data} of the diagnostic will contain as the first object, the resulting list of {@link EGenericType type arguments}. * @param typeArgumentList a comma separated list of type arguments. * @return the diagnostic result of the analysis. * @since 2.4 */ public Diagnostic parseTypeArgumentList(final String typeArgumentList) { BasicDiagnostic placeholder = new BasicDiagnostic(); char [] instanceTypeNameCharacterArray = typeArgumentList == null ? NO_CHARS : typeArgumentList.toCharArray(); List<EGenericType> eTypeArguments = handleTypeArguments(instanceTypeNameCharacterArray, 0, instanceTypeNameCharacterArray.length, placeholder); BasicDiagnostic result = createDiagnostic (placeholder.getSeverity(), DIAGNOSTIC_SOURCE, WELL_FORMED_INSTANCE_TYPE_NAME, "_UI_EClassifierInstanceTypeNameAnalysisResult_diagnostic", new Object [] { typeArgumentList }, new Object [] { eTypeArguments, typeArgumentList }); result.addAll(placeholder); return result; }
/** * Parses a list of type parameters and returns a diagnostic representing the result of the analysis. * The {@link Diagnostic#getData() data} of the diagnostic will contain as the first object, the resulting list of {@link ETypeParameter type parameters}. * @param typeParameterList a comma separated list of type parameters delimited by '<' and '>'. * @return the diagnostic result of the analysis. */ public Diagnostic parseTypeParameterList(final String typeParameterList) { BasicDiagnostic placeholder = new BasicDiagnostic(); char [] instanceTypeNameCharacterArray = typeParameterList == null ? NO_CHARS : typeParameterList.toCharArray(); List<ETypeParameter> eTypeParameters = handleTypeParameters(instanceTypeNameCharacterArray, 0, instanceTypeNameCharacterArray.length, placeholder); BasicDiagnostic result = createDiagnostic (placeholder.getSeverity(), DIAGNOSTIC_SOURCE, WELL_FORMED_INSTANCE_TYPE_NAME, "_UI_EClassifierInstanceTypeNameAnalysisResult_diagnostic", new Object [] { typeParameterList }, new Object [] { eTypeParameters, typeParameterList }); result.addAll(placeholder); return result; }
/** * Parses a type parameter and returns a diagnostic representing the result of the analysis. * The {@link Diagnostic#getData() data} of the diagnostic will contain as the first object, the resulting {@link ETypeParameter type parameter}. * @param typeParameter comma separated list of type parameters delimited by '<' and '>'. * @return the diagnostic result of the analysis. */ public Diagnostic parseTypeParameter(final String typeParameter) { BasicDiagnostic placeholder = new BasicDiagnostic(); char [] instanceTypeNameCharacterArray = typeParameter == null ? NO_CHARS : typeParameter.toCharArray(); ETypeParameter eTypeParameter = handleTypeParameter(instanceTypeNameCharacterArray, 0, instanceTypeNameCharacterArray.length, placeholder); BasicDiagnostic result = createDiagnostic (placeholder.getSeverity(), DIAGNOSTIC_SOURCE, WELL_FORMED_INSTANCE_TYPE_NAME, "_UI_EClassifierInstanceTypeNameAnalysisResult_diagnostic", new Object [] { typeParameter }, new Object [] { eTypeParameter, typeParameter }); result.addAll(placeholder); return result; }
/** * Parses a list of type arguments and returns a diagnostic representing the result of the analysis. * The {@link Diagnostic#getData() data} of the diagnostic will contain as the first object, the resulting list of {@link EGenericType type arguments}. * @param typeArgumentList a comma separated list of type arguments. * @return the diagnostic result of the analysis. * @since 2.4 */ public Diagnostic parseTypeArgumentList(final String typeArgumentList) { BasicDiagnostic placeholder = new BasicDiagnostic(); char [] instanceTypeNameCharacterArray = typeArgumentList == null ? NO_CHARS : typeArgumentList.toCharArray(); List<EGenericType> eTypeArguments = handleTypeArguments(instanceTypeNameCharacterArray, 0, instanceTypeNameCharacterArray.length, placeholder); BasicDiagnostic result = createDiagnostic (placeholder.getSeverity(), DIAGNOSTIC_SOURCE, WELL_FORMED_INSTANCE_TYPE_NAME, "_UI_EClassifierInstanceTypeNameAnalysisResult_diagnostic", new Object [] { typeArgumentList }, new Object [] { eTypeArguments, typeArgumentList }); result.addAll(placeholder); return result; }
diagnosic.addAll(typeBuilderDiagnostic);
diagnosic.addAll(typeBuilderDiagnostic);
public static Diagnostic mergeDiagnostic(Diagnostic baseDiagnostic, Diagnostic diagnosticToBeMerged) { if (diagnosticToBeMerged == null) { return baseDiagnostic; } else { if (baseDiagnostic == null) { return diagnosticToBeMerged; } else if (baseDiagnostic instanceof DiagnosticChain) { ((DiagnosticChain)baseDiagnostic).merge(diagnosticToBeMerged); return baseDiagnostic; } else { BasicDiagnostic basicDiagnostic = new BasicDiagnostic( baseDiagnostic.getSeverity(), baseDiagnostic.getSource(), baseDiagnostic.getCode(), baseDiagnostic.getMessage(), baseDiagnostic.getData().toArray()); basicDiagnostic.addAll(baseDiagnostic); basicDiagnostic.add(diagnosticToBeMerged); return basicDiagnostic; } } }
new Object[]{throwable}); basicDiagnostic.addAll(diagnostic); diagnostic = basicDiagnostic;