Examples of FXGElement


Examples of at.bestsolution.efxclipse.formats.fxg.fxg.FXGElement

    public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException {
      if (FXG_NS.equals(uri)) {
        if (foreignNamespace.isEmpty()) {
          if (Character.isUpperCase(localName.charAt(0))) {
            EClassifier classifier = FxgPackage.eINSTANCE.getEClassifier(localName);
            FXGElement element = null;

            if (classifier == null) {
              if (graphic.get_children().get(0) instanceof Library) {
                Library l = (Library) graphic.get_children().get(0);
                for (Definition d : l.get_children()) {
                  if (localName.equals(d.getName())) {
                    element = EcoreUtil.copy(d.get_children().get(0));
                    break;
                  }
                }
              }
            } else {
              element = (FXGElement) EcoreUtil.create((EClass) classifier);
            }

            if (element == null) {
              throw new IllegalStateException();
            }

            if (element instanceof Graphic) {
              graphic = (Graphic) element;
            }

            EStructuralFeature feature = null;
            if (!targetFeatureStack.isEmpty()) {
              feature = targetFeatureStack.lastElement();
            }

            if (feature != null && !elementStack.isEmpty()) {
              if (feature.isMany()) {
                List<FXGElement> list = (List<FXGElement>) elementStack.lastElement().eGet(feature);
                list.add(element);
              } else {
                elementStack.lastElement().eSet(feature, element);
              }
            }

            for (int i = 0; i < attributes.getLength(); i++) {
              if (FXG_NS.equals(attributes.getURI(i)) || "".equals(attributes.getURI(i))) {
                String name = attributes.getLocalName(i);
                EStructuralFeature f = element.eClass().getEStructuralFeature(name);
                if (f != null) {
                  Object o = EcoreUtil.createFromString((EDataType) f.getEType(), attributes.getValue(i));
                  element.eSet(f, o);
                } else {
                  System.err.println("Could not find feature '" + name + "' in " + element.eClass().getName());
                }
              }
            }

            if (element instanceof ContainerElement<?>) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.