Package com.dubture.symfony.core.model

Examples of com.dubture.symfony.core.model.Service


   
    // show the id of the service in the proposal popup, so
    // the UsestatementInjector can inject to correct fully qualified name
    if (typeProposal.getModelElement() instanceof Service) {
     
      Service service = (Service) typeProposal.getModelElement();
           
      if (service.getId() != null)
        return service.getId();     
     
    }
   
    return super.createTypeProposalLabel(typeProposal);
   
View Full Code Here


  @Override
  public String getReplacementString() {

    if (getModelElement() instanceof Service) {
     
      Service service = (Service) getModelElement();
     
      if (service.getId() != null)
        return service.getId();     
     
    }
   
    return super.getReplacementString();
  }
View Full Code Here

                }
               
                if (viewer.getSelection() instanceof IStructuredSelection) {
                    IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
                    if (selection.getFirstElement() instanceof Service) {
                        Service service = (Service) selection.getFirstElement();
                        if (service.getSourceModule() != null) {
                            openServiceImplementation(service);
                        }
                    }                       
                }
            }
        };
       
        Action openDefinition = new Action("Open definition")
        {
            @Override
            public void run()
            {
                if(viewer.getSelection().isEmpty()) {
                    return;
                }
               
                if (viewer.getSelection() instanceof IStructuredSelection) {
                    IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
                    if (selection.getFirstElement() instanceof Service) {
                        Service service = (Service) selection.getFirstElement();
                        if (service.getSourceModule() != null) {
                            openServiceDefinition(service);
                        }
                    }                       
                }
            }
        };
       
        MenuManager mgr = new MenuManager();
        mgr.add(openImplementation);
        mgr.add(openDefinition);
        Menu menu = mgr.createContextMenu(viewer.getControl());
       
        mgr.addMenuListener(new IMenuListener()
        {
           
            @Override
            public void menuAboutToShow(IMenuManager manager)
            {
                if(viewer.getSelection().isEmpty()) {
                    return;
                }
            }
        });
       
        viewer.getControl().setMenu(menu);

//        viewer.addSelectionChangedListener(new ISelectionChangedListener() {
//            @Override
//            public void selectionChanged(SelectionChangedEvent event)
//            {
//                if (event.getSelection() instanceof IStructuredSelection) {
//                    IStructuredSelection selection = (IStructuredSelection) event.getSelection();
//
//                    if (selection.getFirstElement() instanceof Service) {
////                        detail.updateService((Service) (selection.getFirstElement()));
//                    }
//                }
//            }
//        });


        viewer.addDoubleClickListener(new IDoubleClickListener() {

            @Override
            public void doubleClick(DoubleClickEvent event)
            {
                if (event.getSelection() instanceof IStructuredSelection) {
                    IStructuredSelection selection = (IStructuredSelection) event.getSelection();
                    if (selection.getFirstElement() instanceof Service) {
                        Service service = (Service) selection.getFirstElement();
                        if (service.getSourceModule() != null) {
                            openServiceImplementation(service);
                        }
                    }
                }
            }
View Full Code Here

        @Override
        public boolean select(Viewer viewer, Object parentElement,
                Object element)
        {
            if (element instanceof Service) {
                Service service = (Service) element;
                return service.isPublic();
            }

            return true;
        }
View Full Code Here

        public boolean select(Viewer viewer, Object parentElement,
                Object element)
        {

            if (element instanceof Service) {
                Service service = (Service) element;
                return service.getStringTags().contains(tag);
            }

            return true;
        }
View Full Code Here

                    parent = (ModelElement) serviceTypes[0];
                } else {
                    parent = (ModelElement) context.getSourceModule();
                }

                Service s = new Service(parent, service.getElementName());
                s.setId(service.getId());
                reporter.reportType(s, "", range);
            }
        }
    }
View Full Code Here

          if (first instanceof Scalar && ((Scalar)first).getScalarType() == Scalar.TYPE_STRING) {

            //TODO: check if there are PDT utils for stripping away quotes from
            // string literals.

            Service service = SymfonyModelAccess.getDefault().findService(((Scalar)first).getValue(), path);
           

            // we got a service match, return the goalevaluator.
            if (service != null) {
              return service;
View Full Code Here

            if (PathUtils.isViewPath(literalValue)) {
                //TODO: report viewpath reference
            }

            IPath path = getSourceModule().getModelElement().getScriptProject().getPath();
            Service service = model.findService(literalValue, path);

            if (service != null) {
                fRequestor.acceptTypeReference(service.getFullyQualifiedName(), literal.sourceStart());
            }
        }

        return true;
    }
View Full Code Here

    @Override
    public boolean visit(Assignment s) throws Exception {

        if (inAction) {

            Service service = null;
            if (s.getVariable().getClass() == VariableReference.class) {

                VariableReference var = (VariableReference) s.getVariable();

                // A call expression like $foo = $this->get('bar');
                //
                if (s.getValue().getClass() == PHPCallExpression.class) {

                    PHPCallExpression exp = (PHPCallExpression) s.getValue();

                    // are we requesting a Service?
                    if (exp.getName().equals("get")) {

                        service = ModelUtils.extractServiceFromCall(exp, source.getScriptProject().getPath());



                        if (service != null) {

                            String fqsn =  service.getNamespace() != null ? service.getNamespace().getQualifiedName() : null;

                            TemplateVariable tempVar= new TemplateVariable(currentMethod, var.getName(), exp.sourceStart(), exp.sourceEnd(), fqsn, service.getClassName());
                            deferredVariables.push(tempVar);
                        }

                        // a more complex expression like
                        // $form = $this->get('form.factory')->create(new ContactType());
                    } else if (exp.getReceiver().getClass() == PHPCallExpression.class) {

                        // try to extract a service if it's a Servicecontainer call
                        service = ModelUtils.extractServiceFromCall((PHPCallExpression) exp.getReceiver(), source.getScriptProject().getPath());

                        // nothing found, return
                        if (service == null || exp.getCallName() == null) {
                            return true;
                        }

                        SimpleReference callName = exp.getCallName();

                        //TODO: this is a problematic case, as during a clean build
                        // it's possible that the SourceModule in which the
                        // called method was declared is not yet in the index, so
                        // the return type cannot be evaluated and therefore
                        // the templatevariable won't be created...
                        //
                        // Possible solution: check if there's an event fired when the
                        // build is completed and store those return types in a global
                        // singleton, evaluate them when the whole build process is finished.


                        String fqsn = service.getNamespace() != null ? service.getNamespace().getQualifiedName() : null;
                        TemplateVariable tempVar = null;

                            tempVar = SymfonyModelAccess.getDefault()
                                    .createTemplateVariableByReturnType(source, currentMethod, callName,
                                            service.getClassName(), fqsn, var.getName(), cache);

                        if (tempVar != null) {

                            deferredVariables.push(tempVar);
                        }
View Full Code Here

      cell.setText(styledString.toString());
      cell.setImage(PHPPluginImages.get(PHPPluginImages.IMG_OBJS_PHP_PROJECT));
     
    } else if (element instanceof Service) {

      Service service = (Service) element;
      String name = service.getClassName() != null ? service.getClassName() : service.getId();     
      StyledString styledString = new StyledString(name, style);
     
      String decoration = MessageFormat.format(" [{0}]", new Object[] { service.getId() }); //$NON-NLS-1$
      styledString.append(decoration, StyledString.DECORATIONS_STYLER);
     
     
      cell.setText(styledString.toString());
      cell.setStyleRanges(styledString.getStyleRanges());
     
      if (service.isPublic()) {
        cell.setImage(SymfonyPluginImages.get(SymfonyPluginImages.IMG_OBJS_SERVICE_PUBLIC))
      } else {
        cell.setImage(SymfonyPluginImages.get(SymfonyPluginImages.IMG_OBJS_SERVICE_PRIVATE));
      }
     
View Full Code Here

TOP

Related Classes of com.dubture.symfony.core.model.Service

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.