Package at.bestsolution.efxclipse.tooling.fxgraph.fXGraph

Examples of at.bestsolution.efxclipse.tooling.fxgraph.fXGraph.Property


    }
  }

  @Override
  public void completeProperty_Value(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
    Property prop;
   
    if( model instanceof Property ) {
      prop = (Property) model;
    } else if( model instanceof Element ) {
      prop = (Property) model.eContainer();
    } else {
      return;
    }
   
    if (prop.eContainer() instanceof Element) {
      Element el = (Element) prop.eContainer();

      try {
        IJavaProject javaProject = projectProvider.getJavaProject(el.eResource().getResourceSet());
        IType type = javaProject.findType(el.getType().getQualifiedName());

        if (type != null) {
          IFXClass fxClazz = FXPlugin.getClassmodel().findClass(javaProject, type);
          IFXProperty fxProp = fxClazz.getProperty(prop.getName());
          if (fxProp != null) {
            completeProperty_ValueProposals(fxProp, model, context, FXGraphPackage.Literals.PROPERTY__VALUE, acceptor);
          }
        }

      } catch (JavaModelException e) {
        LOGGER.error("Failed to retrieve property value proposals", e);
      }
    } else if (prop.eContainer() instanceof MapValueProperty) {
      // TODO Can we provide a proposal here?
    }
  }
View Full Code Here


 
  @Override
  public void completeBindValueProperty_Attribute(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
    BindValueProperty b = (BindValueProperty) model;
    if (b.getElementReference() != null && b.getElementReference().getType() != null) {
      Property property = (Property) b.eContainer();
      Element targetClass = (Element) property.eContainer();
      Element element = b.getElementReference();
     
      try {
        IJavaProject javaProject = projectProvider.getJavaProject(element.eResource().getResourceSet());
        IType sourceType = javaProject.findType(element.getType().getQualifiedName());
        IType targetType = javaProject.findType(targetClass.getType().getQualifiedName());
       
        IFXClass fxSourceClazz = FXPlugin.getClassmodel().findClass(javaProject, sourceType);
        IFXClass fxTargetClass = FXPlugin.getClassmodel().findClass(javaProject, targetType);
        IFXProperty targetProperty = fxTargetClass.getProperty(property.getName());
       
        if( targetProperty instanceof IFXPrimitiveProperty ) {
          IFXPrimitiveProperty pp = (IFXPrimitiveProperty) targetProperty;
          for( IFXProperty sourceProp: fxSourceClazz.getAllProperties().values() ) {
            if( sourceProp instanceof IFXEventHandlerProperty ) {
View Full Code Here

      listProp = (ListValueProperty) m.eContainer();
    }
   
    if( listProp != null ) {
      if( listProp.eContainer() instanceof Property ) {
        Property property = (Property) listProp.eContainer();
        if( property.eContainer() instanceof Element ) {
          try {
            Element element = (Element) property.eContainer();
            IJavaProject javaProject = projectProvider.getJavaProject(element.eResource().getResourceSet());
            IType ownerType = javaProject.findType(element.getType().getQualifiedName());
            IFXClass fxOwnerClazz = FXPlugin.getClassmodel().findClass(javaProject, ownerType);
            IFXProperty ownerProperty = fxOwnerClazz.getProperty(property.getName());
           
            if (ownerProperty instanceof IFXCollectionProperty) {
              IFXCollectionProperty cp = (IFXCollectionProperty) ownerProperty;
              String type = cp.getElementType().getElementName();
              if( "String".equals(type) ) {
View Full Code Here

    if( ! model.eResource().getContents().isEmpty() ) {
      Model m = (Model) model.eResource().getContents().get(0);
      if( m.getComponentDef() != null ) {
        if( m.getComponentDef().getController() != null ) {
          if( model.eContainer() instanceof Property ) {
            Property property = (Property) model.eContainer();
            if( property.eContainer() instanceof Element ) {
              try {
                Element element = (Element) property.eContainer();
                IJavaProject javaProject = projectProvider.getJavaProject(element.eResource().getResourceSet());
                IType ownerType = javaProject.findType(element.getType().getQualifiedName());
                IFXClass fxOwnerClazz = FXPlugin.getClassmodel().findClass(javaProject, ownerType);
                IFXProperty ownerProperty = fxOwnerClazz.getProperty(property.getName());
               
                if( ownerProperty instanceof IFXEventHandlerProperty ) {
                  IFXEventHandlerProperty p = (IFXEventHandlerProperty) ownerProperty;
                  IType ctrlType = javaProject.findType(m.getComponentDef().getController().getQualifiedName());
                  IFXCtrlClass ctrlClass = FXPlugin.getClassmodel().findCtrlClass(javaProject, ctrlType);
View Full Code Here

              IType defType = javaProject.findType(element.getType().getQualifiedName());
              ReferenceValueProperty rp = (ReferenceValueProperty) model;
             
              IType targetType = null;
              if( rp.eContainer() instanceof Property ) {
                Property p = (Property) rp.eContainer();
                if( p.eContainer() instanceof Element ) {
                  Element e = (Element) p.eContainer();
                  IType ownerType = javaProject.findType(e.getType().getQualifiedName());
                  IFXClass ownerClass = FXPlugin.getClassmodel().findClass(javaProject, ownerType);
                  IFXProperty ownerProp = ownerClass.getProperty(p.getName());
                  if( ownerProp instanceof IFXObjectProperty ) {
                    targetType = ((IFXObjectProperty) ownerProp).getElementType();
                  }
                }
              } else if( rp.eContainer() instanceof StaticCallValueProperty ) {
                LOGGER.warn("Unable to extract type for " + rp.eContainer());
              } else if( rp.eContainer() instanceof ListValueProperty ) {
                ListValueProperty lvp = (ListValueProperty) rp.eContainer();
                if( lvp.eContainer() instanceof Property ) {
                  Property p = (Property) lvp.eContainer();
                  if( p.eContainer() instanceof Element ) {
                    Element e = (Element) p.eContainer();
                    IType ownerType = javaProject.findType(e.getType().getQualifiedName());
                    IFXClass ownerClass = FXPlugin.getClassmodel().findClass(javaProject, ownerType);
                    IFXProperty ownerProp = ownerClass.getProperty(p.getName());
                    if( ownerProp instanceof IFXCollectionProperty ) {
                      targetType = ((IFXCollectionProperty) ownerProp).getElementType();
                    }
                  }
                } else {
View Full Code Here

          createNode(parentNode, o);
        }
      }
      return;
    } else if( modelElement instanceof Property ) {
      Property p = (Property) modelElement;
      if( p.getValue() instanceof SimpleValueProperty ) {
        return;
      } else if( p.getValue() instanceof ListValueProperty ) {
        ListValueProperty lp = (ListValueProperty) p.getValue();
        for( ListValueElement e : lp.getValue() ) {
          if( lp.getValue() != null ) {
            createNode(parentNode, e);
          }
        }
        return
      } else if( p.getValue() instanceof ResourceValueProperty ) {
        return;
      } else if( p.getValue() instanceof MapValueProperty ) {
        MapValueProperty mp = (MapValueProperty) p.getValue();
        for( Property mpp : mp.getProperties() ) {
          createNode(parentNode, mpp);
        }
        return;
      }
    } else if( modelElement instanceof StaticCallValueProperty ) {
      StaticCallValueProperty p = (StaticCallValueProperty) modelElement;
      if( p.getValue() instanceof SimpleValueProperty ) {
        return;
      } else {
        if( p.getValue() != null ) {
          createNode(parentNode, p.getValue())
        }
        return;
      }
    }
   
View Full Code Here

        if( t != null ) {
          return createHover(t, object, viewer, region);
        }
      }
    } else if( object instanceof Property ) {
      Property p = (Property) object;
      if( p.eContainer() instanceof Element ) {
        Element e = (Element) p.eContainer();
        if( e.getType() != null ) {
          IType t = getJDTType(e.getType().getType());
          if( t != null ) {
            IFXClass fxClass = FXPlugin.getClassmodel().findClass(t.getJavaProject(), t);
            if( fxClass != null ) {
              IFXProperty fxp = fxClass.getProperty(p.getName());
              if( fxp != null ) {
                return createHover(fxp.getJavaElement(), object, viewer, region);
              }
            }
          }
        }
      }
    } else if( object instanceof StaticCallValueProperty ) {
      StaticCallValueProperty sp = (StaticCallValueProperty) object;
      if( sp.getType() != null ) {
        IType t = getJDTType(sp.getType().getType());
        if( t != null ) {
          IFXClass fxClass = FXPlugin.getClassmodel().findClass(t.getJavaProject(), t);
          if( fxClass != null ) {
            IFXProperty fxp = fxClass.getStaticProperty(sp.getName());
            if( fxp != null ) {
              return createHover(fxp.getJavaElement(), object, viewer, region);
            }
          }
        }
      }
    } else if( object instanceof StaticValueProperty ) {
      StaticValueProperty sp = (StaticValueProperty) object;
     
      EObject eo = sp.eContainer();
      Element target = null;
     
      while( eo.eContainer() != null ) {
        if( eo.eContainer() instanceof Element ) {
          target = (Element) eo.eContainer();
          break;
        }
        eo = eo.eContainer();
      }
         
      if( target != null ) {
        if( target.getType() != null ) {
          IType t = getJDTType(target.getType().getType());
          if( t != null ) {
            IFXClass fxClass = FXPlugin.getClassmodel().findClass(t.getJavaProject(), t);
            if( fxClass != null ) {
              IFXProperty fxp = fxClass.getStaticProperty(sp.getName());
              if( fxp != null ) {
                return createHover(fxp.getJavaElement(), object, viewer, region);
              }
            }
          }
        }
      }
    } else if( object instanceof ValueProperty ) {
      if( object instanceof ControllerHandledValueProperty ) {
        ControllerHandledValueProperty cp = (ControllerHandledValueProperty) object;
       
        Model m = (Model) object.eResource().getContents().get(0);
       
        if( m != null ) {
          ComponentDefinition def = m.getComponentDef();
          if( def != null ) {
            if( def.getController() != null && def.getController().getType() != null) {
              IType t = getJDTType(def.getController().getType());
              if( t != null ) {
                IFXCtrlClass fxClass = FXPlugin.getClassmodel().findCtrlClass(t.getJavaProject(), t);
                if( fxClass != null ) {
                  IFXCtrlEventMethod fxp = fxClass.getAllEventMethods().get(cp.getMethodname());
                  if( fxp != null ) {
                    return createHover(fxp.getJavaElement(), object, viewer, region);
                  }
                }
              }
            }
          }
        }
      } else if( object instanceof SimpleValueProperty ) {
        SimpleValueProperty sp = (SimpleValueProperty) object;
        if( sp.eContainer() instanceof Property && sp.getStringValue() != null ) {
          Property p = (Property) sp.eContainer();
         
          if( p.eContainer() instanceof Element ) {
            Element e = (Element) p.eContainer();
            if( e.getType() != null ) {
              IType t = getJDTType(e.getType().getType());
              if( t != null ) {
                IFXClass fxClass = FXPlugin.getClassmodel().findClass(t.getJavaProject(), t);
                if( fxClass != null ) {
                  IFXProperty fxp = fxClass.getProperty(p.getName());
                  if( fxp instanceof IFXEnumProperty ) {
                    IType enumType = ((IFXEnumProperty) fxp).getEnumType();
                    try {
                      for (IField f : enumType.getFields()) {
                        if (Flags.isEnum(f.getFlags())) {
View Full Code Here

    JvmTypeReference controller = ((Model)element.eResource().getContents().get(0)).getComponentDef().getController();
    if( controller != null && element.getMethodname() != null ) {
      IJavaProject javaProject = projectProvider.getJavaProject(element.eResource().getResourceSet());
      try {
        IType ctrlType = javaProject.findType(controller.getQualifiedName());
        Property propertyModel = (Property) element.eContainer();
        Element elementModel = (Element)propertyModel.eContainer();
        IType elType = javaProject.findType(elementModel.getType().getQualifiedName());
       
        IFXCtrlClass fxCtrlClazz = FXPlugin.getClassmodel().findCtrlClass(javaProject, ctrlType);
        IFXClass fxElClass = FXPlugin.getClassmodel().findClass(javaProject, elType);
       
        IFXProperty fxProp = fxElClass.getAllProperties().get(propertyModel.getName());
       
        if( !(fxProp instanceof IFXEventHandlerProperty) ) {
          error("Property is not an event property", propertyModel, FXGraphPackage.Literals.PROPERTY__NAME, -1);
          return;
        }
View Full Code Here

      p.setName(name);
      return p;
    }

    private Property createProperty(String name, ValueProperty value) {
      Property p = createProperty(name);
      p.setValue(value);
      return p;
    }
View Full Code Here

  public ValuePropertyFormatter(Object value) {
    if (value == null) {
      throw new IllegalArgumentException("value must not be null");
    } else if (value instanceof Property) {
      Property p = (Property) value;
      StringBuffer sb = new StringBuffer();
      if ("Integer".equals(p.getName()) || "Double".equals(p.getName())) {
        sb.append(new ValuePropertyFormatter(p.getValue())
            .getFormattedValue().replaceAll("\"", ""));
      } else {
        if (p.getModifier() != null) {
          sb.append(p.getModifier() + " ");
        }
        sb.append(p.getName() + " : ");
        sb.append(new ValuePropertyFormatter(p.getValue())
            .getFormattedValue());
      }
      formattedValue = sb.toString();
    } else if (value instanceof ResourceValueProperty) {
      ResourceValueProperty p = (ResourceValueProperty) value;
      formattedValue = "rstring \"" + p.getValue().getValue() + "\"";
    } else if (value instanceof LocationValueProperty) {
      LocationValueProperty p = (LocationValueProperty) value;
      formattedValue = "location \"" + p.getValue() + "\"";
    } else if (value instanceof BindValueProperty) {
      BindValueProperty p = (BindValueProperty) value;
      formattedValue = "bind " + p.getElementReference().getName() + "#"
          + p.getAttribute();
    } else if (value instanceof ControllerHandledValueProperty) {
      formattedValue = "controllermethod "
          + ((ControllerHandledValueProperty) value).getMethodname();
    } else if (value instanceof ScriptHandlerHandledValueProperty) {
      formattedValue = "scriptmethod "
          + ((ScriptHandlerHandledValueProperty) value)
              .getFunctionname();
    } else if (value instanceof ScriptValueExpression) {
      formattedValue = "scriptexpression "
          + ((ScriptValueExpression) value).getSourcecode();
    } else if (value instanceof ScriptValueReference) {
      formattedValue = "scriptvalue "
          + ((ScriptValueReference) value).getReference();

    } else if (value instanceof StaticValueProperty) {
      StaticValueProperty p = (StaticValueProperty) value;
      StringBuffer sb = new StringBuffer();
      if (p.getModifier() != null) {
        sb.append(p.getModifier() + " ");
      }
      sb.append("static " + p.getName() + " : ");
      sb.append(new ValuePropertyFormatter(p.getValue())
          .getFormattedValue());
      formattedValue = sb.toString();
    } else if (value instanceof StaticCallValueProperty) {
      StaticCallValueProperty p = (StaticCallValueProperty) value;
      StringBuffer sb = new StringBuffer();
      if (p.getModifier() != null) {
        sb.append(p.getModifier() + " ");
      }
      sb.append("call " + p.getType().getSimpleName() + " # "
          + p.getName() + " : ");
      sb.append(new ValuePropertyFormatter(p.getValue())
          .getFormattedValue());
      formattedValue = sb.toString();
    } else if (value instanceof ConstValueProperty) {
      ConstValueProperty p = (ConstValueProperty) value;
      StringBuffer sb = new StringBuffer();
      sb.append("const " + p.getType().getSimpleName() + "#"
          + p.getField());
      formattedValue = sb.toString();
    } else if (value instanceof IncludeValueProperty) {
      IncludeValueProperty inc = (IncludeValueProperty) value;
      formattedValue = "include " + "source=" + inc.getSource()
          + " name=" + inc.getName(); // TODO
View Full Code Here

TOP

Related Classes of at.bestsolution.efxclipse.tooling.fxgraph.fXGraph.Property

Copyright © 2018 www.massapicom. 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.