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

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


  }

  @Override
  public void completeResourceValueProperty_Value(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
    if( ! model.eResource().getContents().isEmpty() ) {
      Model m = (Model) model.eResource().getContents().get(0);
      if( m.getComponentDef() != null ) {
        if( m.getComponentDef().getPreviewResourceBundle() != null ) {
          File f = RelativeFileLocator.locateFile(model.eResource().getURI(),  m.getComponentDef().getPreviewResourceBundle());
          Properties p = null;
          if (f != null) {
            FileInputStream fi = null;
            try {
              fi = new FileInputStream(f);
View Full Code Here


  }
 
  @Override
  public void completeControllerHandledValueProperty_Methodname(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
    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);
                  for( IFXCtrlEventMethod ctrlMethod : ctrlClass.getAllEventMethods().values() ) {
                    StyledString s = null;
                    if( ! ctrlMethod.hasArgument() ) {
                      s = new StyledString(ctrlMethod.getName()+"()");
View Full Code Here

  }
 
  @Override
  public void completeReferenceValueProperty_Reference(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
    if( ! model.eResource().getContents().isEmpty() ) {
      Model m = (Model) model.eResource().getContents().get(0);
      if( m.getComponentDef() != null) {
        for( Define d : m.getComponentDef().getDefines() ) {
          Element element = d.getElement();
          boolean includeType = false;
          if( element == null ) {
            element = d.getIncludeElement().getSource().getRootNode();
            includeType = true;
View Full Code Here

*
*/
public class FXGraphOutlineTreeProvider extends DefaultOutlineTreeProvider {
  @Override
  protected void _createChildren(DocumentRootNode parentNode, EObject modelElement) {
    Model model = (Model) modelElement;
   
    if( model.getPackage() != null ) {
      createNode(parentNode, model.getPackage());
    } else {
      createEStructuralFeatureNode(parentNode, modelElement, FXGraphPackage.Literals.MODEL__PACKAGE, IconKeys.getIcon(IconKeys.PACKAGE_KEY), "default", true);
    }
   
    if( ! model.getImports().isEmpty() ) {
      createEStructuralFeatureNode(parentNode, modelElement, FXGraphPackage.Literals.MODEL__IMPORTS, IconKeys.getIcon(IconKeys.IMPORT_LIST_KEY), "import declarations", false);
    }
   
    if( model.getComponentDef() != null ) {
      createNode(parentNode, model.getComponentDef())
    }
  }
View Full Code Here

      }
    } 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);
View Full Code Here

        INode currentNode = NodeModelUtils.findLeafNodeAtOffset(n, offset);
        List<INode> l = NodeModelUtils.findNodesForFeature(eo, FXGraphPackage.Literals.CONTROLLER_HANDLED_VALUE_PROPERTY__METHODNAME);
        if( l.contains(currentNode) ) {
          Region region = new Region(currentNode.getOffset(), currentNode.getLength());
         
          Model m = (Model) eo.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);
View Full Code Here

          document.replace(proposal.getReplacementOffset(), proposal.getReplacementLength(), replacementString);
          return;
        }
      }
      // we could create an import statement if there is no conflict
      Model file = (Model) context.getContents().get(0);
      ComponentDefinition clazz = file.getComponentDef();
     
      QualifiedName qualifiedName = qualifiedNameConverter.toQualifiedName(typeName);     
      if (qualifiedName.getSegmentCount() == 1) {
        // type resides in default package - no need to hassle with imports
        proposal.setCursorPosition(proposalReplacementString.length());
        document.replace(proposal.getReplacementOffset(), proposal.getReplacementLength(), proposalReplacementString);
        return;
      }
     
      IEObjectDescription description = scope.getSingleElement(qualifiedName.skipFirst(qualifiedName.getSegmentCount() - 1));
      if (description != null) {
        // there exists a conflict - insert fully qualified name
        proposal.setCursorPosition(proposalReplacementString.length());
        document.replace(proposal.getReplacementOffset(), proposal.getReplacementLength(), proposalReplacementString);
        return;
      }
     
      String fqnName = importConverter.toString(typeName);
      boolean found = false;
      for( Import i : file.getImports() ) {
        if( i.getImportedNamespace().equals(fqnName) ) {
          found = true;
        }
      }
     
      // Import does not introduce ambiguities - add import and insert short name
      String shortName = qualifiedName.getLastSegment();
      int topPixel = -1;
      // store the pixel coordinates to prevent the ui from flickering
      StyledText widget = viewer.getTextWidget();
      if (widget != null)
        topPixel = widget.getTopPixel();
      ITextViewerExtension viewerExtension = null;
      if (viewer instanceof ITextViewerExtension) {
        viewerExtension = (ITextViewerExtension) viewer;
        viewerExtension.setRedraw(false);
      }
      DocumentRewriteSession rewriteSession = null;
      try {
        if (document instanceof IDocumentExtension4) {
          rewriteSession = ((IDocumentExtension4) document).startRewriteSession(DocumentRewriteSessionType.UNRESTRICTED_SMALL);
        }
        // compute import statement's offset
        int offset = 0;
        boolean startWithLineBreak = true;
        boolean endWithLineBreak = false;
        if (file.getImports().isEmpty()) {
          startWithLineBreak = false;
          if (clazz == null) {
            offset = document.getLength();
          } else {
            ICompositeNode node = NodeModelUtils.getNode(clazz);
            offset = node.getOffset();
            endWithLineBreak = true;
          }
        } else {
          ICompositeNode node = NodeModelUtils.getNode(file.getImports().get(file.getImports().size() - 1));
          offset = node.getOffset() + node.getLength();
        }
        offset = Math.min(proposal.getReplacementOffset(), offset);
     
        // apply short proposal
View Full Code Here

  @Override
  protected String convert(IFile outFile, IFile file)
      throws ExecutionException {
    FXMLLoader loader = new FXMLLoader();
    Model m = loader.loadModel(file);
    return new FXGraphConverter().generate(m).toString();
  }
View Full Code Here

  @Override
  public QualifiedName getFullyQualifiedName(EObject obj) {
    if( obj instanceof ComponentDefinition ) {
      if( obj.eContainer() instanceof Model ) {
        ComponentDefinition compDef = (ComponentDefinition) obj;
        Model model = (Model) obj.eContainer();
        PackageDeclaration packageDec = model.getPackage();
        if( packageDec != null ) {
          return qualifiedNameConverter.toQualifiedName(packageDec.getName()+"."+compDef.getName());
        } else {
          return qualifiedNameConverter.toQualifiedName(compDef.getName());
        }
View Full Code Here

 
  public String fullyQualifiedName(final ComponentDefinition cp) {
    Resource _eResource = cp.eResource();
    EList<EObject> _contents = _eResource.getContents();
    EObject _get = _contents.get(0);
    final Model m = ((Model) _get);
    PackageDeclaration _package = m.getPackage();
    boolean _notEquals = (!Objects.equal(_package, null));
    if (_notEquals) {
      PackageDeclaration _package_1 = m.getPackage();
      String _name = _package_1.getName();
      String _plus = (_name + ".");
      String _name_1 = cp.getName();
      return (_plus + _name_1);
    } else {
View Full Code Here

TOP

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

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.