Search in sources :

Example 1 with DataConversionException

use of org.jdom.DataConversionException in project intellij-community by JetBrains.

the class ProjectLevelVcsManagerImpl method loadState.

@Override
public void loadState(Element state) {
    mySerialization.readExternalUtil(state, myOptionsAndConfirmations);
    final Attribute attribute = state.getAttribute(SETTINGS_EDITED_MANUALLY);
    if (attribute != null) {
        try {
            myHaveLegacyVcsConfiguration = attribute.getBooleanValue();
        } catch (DataConversionException ignored) {
        }
    }
}
Also used : Attribute(org.jdom.Attribute) DataConversionException(org.jdom.DataConversionException)

Example 2 with DataConversionException

use of org.jdom.DataConversionException in project intellij-community by JetBrains.

the class MatchOptions method readExternal.

public void readExternal(Element element) {
    searchCriteria = element.getAttribute(TEXT_ATTRIBUTE_NAME).getValue();
    Attribute attr = element.getAttribute(LOOSE_MATCHING_ATTRIBUTE_NAME);
    if (attr != null) {
        try {
            looseMatching = attr.getBooleanValue();
        } catch (DataConversionException ignored) {
        }
    } else {
        // default is loose
        looseMatching = true;
    }
    attr = element.getAttribute(RECURSIVE_ATTRIBUTE_NAME);
    if (attr != null) {
        try {
            recursiveSearch = attr.getBooleanValue();
        } catch (DataConversionException ignored) {
        }
    }
    attr = element.getAttribute(CASESENSITIVE_ATTRIBUTE_NAME);
    if (attr != null) {
        try {
            caseSensitiveMatch = attr.getBooleanValue();
        } catch (DataConversionException ignored) {
        }
    }
    attr = element.getAttribute(FILE_TYPE_ATTR_NAME);
    if (attr != null) {
        String value = attr.getValue();
        myFileType = getFileTypeByName(value);
    }
    attr = element.getAttribute(DIALECT_ATTR_NAME);
    if (attr != null) {
        myDialect = Language.findLanguageByID(attr.getValue());
    }
    // @TODO deserialize scope
    List<Element> elements = element.getChildren(CONSTRAINT_TAG_NAME);
    if (elements != null && !elements.isEmpty()) {
        for (final Element element1 : elements) {
            final MatchVariableConstraint constraint = new MatchVariableConstraint();
            constraint.readExternal(element1);
            addVariableConstraint(constraint);
        }
    }
}
Also used : Attribute(org.jdom.Attribute) Element(org.jdom.Element) DataConversionException(org.jdom.DataConversionException)

Example 3 with DataConversionException

use of org.jdom.DataConversionException in project com.revolsys.open by revolsys.

the class TestReader method newPrecisionModel.

private double newPrecisionModel(final Element precisionModelElement) throws TestParseException {
    final Attribute scaleAttribute = precisionModelElement.getAttribute("scale");
    if (scaleAttribute == null) {
        throw new TestParseException("Missing scale attribute in <precisionModel>");
    }
    double scale;
    try {
        scale = scaleAttribute.getDoubleValue();
    } catch (final DataConversionException e) {
        throw new TestParseException("Could not convert scale attribute to double: " + scaleAttribute.getValue());
    }
    return scale;
}
Also used : Attribute(org.jdom.Attribute) DataConversionException(org.jdom.DataConversionException)

Example 4 with DataConversionException

use of org.jdom.DataConversionException in project beast-mcmc by beast-dev.

the class GraphMLUtils method dotFormat.

public static String dotFormat(Element graphElement) {
    StringBuilder sb = new StringBuilder();
    String graphName = graphElement.getAttributeValue(ARGModel.ID_ATTRIBUTE);
    sb.append(GRAPH_NAME);
    space(sb);
    if (graphName != null) {
        sb.append(graphName);
        space(sb);
    }
    startSection(sb);
    newLine(sb);
    tab(sb);
    sb.append(ARGModel.GRAPH_SIZE);
    endLine(sb);
    // newLine(sb);
    tab(sb);
    sb.append(ARGModel.DOT_EDGE_DEF);
    endLine(sb);
    // newLine(sb);
    tab(sb);
    sb.append(ARGModel.DOT_NODE_DEF);
    endLine(sb);
    // Fill in graph details
    List<Element> nodeList = graphElement.getChildren(ARGModel.NODE_ELEMENT);
    List<String> tipNames = new ArrayList<String>();
    for (Element nodeElement : nodeList) {
        String nodeName = nodeElement.getAttributeValue(ARGModel.ID_ATTRIBUTE);
        tab(sb);
        sb.append(nodeName);
        List<Attribute> attributes = nodeElement.getAttributes();
        int cnt = 1;
        boolean started = false;
        boolean isTip = false;
        int length = attributes.size();
        for (Attribute attribute : attributes) {
            String name = attribute.getName();
            if (name.compareTo(ARGModel.ID_ATTRIBUTE) != 0) {
                if (name.compareTo(ARGModel.IS_TIP) == 0) {
                    isTip = true;
                    try {
                        if (attribute.getBooleanValue()) {
                            tipNames.add(nodeName);
                        }
                    } catch (DataConversionException e) {
                        // To change body of catch statement use File | Settings | File Templates.
                        e.printStackTrace();
                    }
                    cnt++;
                } else {
                    if (!ignore(name)) {
                        if (!started) {
                            space(sb);
                            startAttribute(sb);
                            started = true;
                        } else
                            nextAttribute(sb);
                        sb.append(translate(name) + "=" + attribute.getValue());
                        cnt++;
                    // if (cnt < length)
                    // nextAttribute(sb);
                    // else {
                    // }
                    }
                }
            }
        }
        if (!isTip) {
            if (!started) {
                space(sb);
                startAttribute(sb);
                started = true;
            } else {
                nextAttribute(sb);
            }
            sb.append("label=\"\",shape=circle,height=0.02,width=0.2,fontsize=1");
        }
        if (started) {
            endAttribute(sb);
        }
        // if (!isTip) {
        // 
        // }
        endLine(sb);
    }
    List<Element> edgeList = graphElement.getChildren(ARGModel.EDGE_ELEMENT);
    for (Element edgeElement : edgeList) {
        String fromName = edgeElement.getAttributeValue(ARGModel.EDGE_FROM);
        String toName = edgeElement.getAttributeValue(ARGModel.EDGE_TO);
        tab(sb);
        sb.append(fromName + " -> " + toName);
        String edgeLength = edgeElement.getAttributeValue(ARGModel.EDGE_LENGTH);
        if (edgeLength != null && printLengths) {
            space(sb);
            startAttribute(sb);
            sb.append(ARGModel.EDGE_LENGTH + "=" + edgeLength + ",weight=1000.0");
            endAttribute(sb);
        }
        String partitions = edgeElement.getAttributeValue(ARGModel.EDGE_PARTITIONS);
        if (partitions != null) {
            space(sb);
            startAttribute(sb);
            sb.append("label=\"" + partitions + "\"");
            endAttribute(sb);
        }
        endLine(sb);
    }
    // newLine(sb);
    if (tipNames.size() > 0) {
        tab(sb);
        startSection(sb);
        sb.append("rank=same;");
        for (String name : tipNames) {
            space(sb);
            sb.append(name);
        }
        endSection(sb);
        newLine(sb);
    }
    endSection(sb);
    return sb.toString();
}
Also used : Attribute(org.jdom.Attribute) Element(org.jdom.Element) ArrayList(java.util.ArrayList) DataConversionException(org.jdom.DataConversionException)

Example 5 with DataConversionException

use of org.jdom.DataConversionException in project intellij-community by JetBrains.

the class Configuration method readExternal.

public void readExternal(Element element) {
    name = element.getAttributeValue(NAME_ATTRIBUTE_NAME);
    final Attribute attribute = element.getAttribute(CREATED_ATTRIBUTE_NAME);
    if (attribute != null) {
        try {
            created = attribute.getLongValue();
        } catch (DataConversionException ignore) {
        }
    }
}
Also used : Attribute(org.jdom.Attribute) DataConversionException(org.jdom.DataConversionException)

Aggregations

DataConversionException (org.jdom.DataConversionException)9 Attribute (org.jdom.Attribute)8 Element (org.jdom.Element)5 CSGObject (cbit.vcell.geometry.CSGObject)1 PointObject (cbit.vcell.mapping.spatial.PointObject)1 SpatialObject (cbit.vcell.mapping.spatial.SpatialObject)1 SurfaceRegionObject (cbit.vcell.mapping.spatial.SurfaceRegionObject)1 VolumeRegionObject (cbit.vcell.mapping.spatial.VolumeRegionObject)1 Constant (cbit.vcell.math.Constant)1 MacroscopicRateConstant (cbit.vcell.math.MacroscopicRateConstant)1 OptSolverResultSet (cbit.vcell.opt.OptSolverResultSet)1 OptRunResultSet (cbit.vcell.opt.OptSolverResultSet.OptRunResultSet)1 ExpressionException (cbit.vcell.parser.ExpressionException)1 ConstantArraySpec (cbit.vcell.solver.ConstantArraySpec)1 MathOverrides (cbit.vcell.solver.MathOverrides)1 ReplacementVariableDefinition (com.intellij.structuralsearch.ReplacementVariableDefinition)1 ArrayList (java.util.ArrayList)1 Vector (java.util.Vector)1