Package com.dubture.symfony.core.model

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


      String literal = document.get(wordRegion.getOffset(), wordRegion.getLength());
     
      if (literal == null)
        return null;
     
      SymfonyModelAccess model = SymfonyModelAccess.getDefault();     
      List<TemplateField> tvars = model.findTemplateVariables(sourceModule, literal);     
      IHyperlink[] links = new IHyperlink[tvars.size()];
     
      int i =0;
      for (TemplateField field : tvars) { 
       
        IMethod method = field.getMethod();
        IDLTKSearchScope scope = SearchEngine.createSearchScope(field.getSourceModule());
        IMethod[] methods = model.findMethods(method.getElementName(), MatchRule.EXACT, 0, 0, scope, null);
       
        if (methods.length == 1) {                   
          links[i++] = new ModelElementHyperlink(wordRegion, methods[0], new OpenAction(editor));;
        }
      }
View Full Code Here


    try {
     
      TemplateVariableCompletionContext ctxt = (TemplateVariableCompletionContext) getContext();
     
      SymfonyModelAccess model = SymfonyModelAccess.getDefault();
      ISourceModule module = ctxt.getSourceModule();
      IType controller = model.findControllerByTemplate(module);
      List<TemplateField>variables = model.findTemplateVariables(controller);
      String viewPath = PathUtils.createViewPathFromTemplate(ctxt.getSourceModule(), true);
     
      SourceRange range = getReplacementRange(ctxt);
     
      // prepend the php dollar variable for the equals check
View Full Code Here

    //TODO: this needs caching!!!
    ISourceModule module = context.getSourceModule();   
    List<Route> routes = SymfonyModelAccess.getDefault().findRoutes(module.getScriptProject());   
    SourceRange range = getReplacementRange(context);
   
    SymfonyModelAccess model = SymfonyModelAccess.getDefault();
   
    String prefix = context.getPrefix();
   
    for (Route route : routes) {

      IType controller = model.findController(route.bundle, route.controller, context.getSourceModule().getScriptProject());
     
      if (controller == null) {
        continue;
      }
     
View Full Code Here

   
    ISourceModule module = context.getSourceModule();   
    List<Route> routes = SymfonyModelAccess.getDefault().findRoutes(module.getScriptProject());   
    SourceRange range = getReplacementRange(context);
   
    SymfonyModelAccess model = SymfonyModelAccess.getDefault();
   
    String prefix = context.getPrefix();
   
    for (Route route : routes) {

      IType controller = model.findController(route.bundle, route.controller, context.getSourceModule().getScriptProject());
     
      if (controller == null)
        continue;
     
      if (CodeAssistUtils.startsWithIgnoreCase(route.name, prefix)) {
View Full Code Here

                if (statementText.toString().indexOf("->") > -1) {
                    return false;
                }

                SymfonyModelAccess model = SymfonyModelAccess.getDefault();
                ISourceModule module = getSourceModule();
                IType controller = model.findControllerByTemplate(module);
                variables = model.findTemplateVariables(controller);
                viewPath = PathUtils.createViewPathFromTemplate(getSourceModule(), false);

                return true;

View Full Code Here

    public void apply(ICompletionReporter reporter) throws BadLocationException {

        ServiceContainerContext context = (ServiceContainerContext) getContext();
        IScriptProject project = context.getSourceModule().getScriptProject();

        SymfonyModelAccess model= SymfonyModelAccess.getDefault();
        List<Service> services = model.findServices(project.getPath());
        SourceRange range = getReplacementRange(context);

        String prefix = context.getPrefix();

        if (services == null) {
            return;
        }

        for(Service service : services) {
            if (CodeAssistUtils.startsWithIgnoreCase(service.getId(), prefix)) {
             
                IType[] serviceTypes = model.findServiceTypes(service, project);
                ModelElement parent = null;
               
                if (serviceTypes.length > 0) {
                    parent = (ModelElement) serviceTypes[0];
                } else {
View Full Code Here

    @Override
    public void apply(ICompletionReporter reporter) throws BadLocationException {

        EntityCompletionContext context = (EntityCompletionContext) getContext();
        SymfonyModelAccess model = SymfonyModelAccess.getDefault();
        IScriptProject project = context.getSourceModule().getScriptProject();
        SourceRange range = getReplacementRange(context);
        IDLTKSearchScope projectScope = SearchEngine.createSearchScope(context.getSourceModule().getScriptProject());
        DoctrineModelAccess doctrineModel =  DoctrineModelAccess.getDefault();
        IModelAccessCache cache = null;
        if (context instanceof IModelCacheContext) {
          cache = ((IModelCacheContext) context).getCache();
        }
        EntityAlias alias = context.getAlias();
        String prefix = context.getPrefix();
       
        if (alias.hasBundle() == false) {
            List<Bundle> bundles = model.findBundles(project);
            for (Bundle b : bundles) {
                IType[] bundleTypes = EMPTY_TYPES;
                if (cache != null) {
                  Collection<IType> types = cache.getTypes(context.getSourceModule(), b.getElementName(), null, null);
                  if (types != null) {
                    bundleTypes = types.toArray(new IType[types.size()]);
                  }
                } else {
                  bundleTypes = PhpModelAccess.getDefault().findTypes(b.getElementName(), MatchRule.EXACT, 0, 0, projectScope, null);
                }
                if (bundleTypes.length == 1) {
                    ModelElement bType = (ModelElement) bundleTypes[0];
                    if (CodeAssistUtils.startsWithIgnoreCase(bType.getElementName(), prefix)) {
                        Bundle bundleType = new Bundle(bType, b.getElementName());
                        reporter.reportType(bundleType, ":", range);
                    }
                }
            }
        } else {
            List<Entity> entities = doctrineModel.getEntities(project);
            //TODO: cache the entities
            for (Entity entity : entities) {
                EntityAlias newAliase = new EntityAlias(alias.getBundleAlias(), entity.getElementName());
                IType type = model.findEntity(newAliase, project);

                if (type != null) {
                    reporter.reportType(new Entity((ModelElement) type, type.getElementName()), "", range);
                }
            }
View Full Code Here

  }
 
  public static IPath webToBundlePath(IPath webpath, IScriptProject project)
  {

      SymfonyModelAccess modelAccess = SymfonyModelAccess.getDefault();
      IPath truncated = webpath.removeFirstSegments(2);
      String bundleName = truncated.segment(0) + "bundle";
      Bundle bundle = modelAccess.findBundle(bundleName, project);
     
      if (bundle == null) {
          return null;
      }
     
View Full Code Here

    }


    public static String createViewPathFromTemplate(ISourceModule sourceModule, boolean keepFileExtension) {

        SymfonyModelAccess model = SymfonyModelAccess.getDefault();

        String viewName = sourceModule.getPath().lastSegment();

        if (keepFileExtension == false)
            viewName = PathUtils.getViewFromTemplatePath(sourceModule.getPath());

        IType controller = model.findControllerByTemplate(sourceModule);

        if (controller == null)
            return null;

        String bundle = ModelUtils.extractBundleName(controller.getFullyQualifiedName());
View Full Code Here

{
   
    @Override
    protected List<String[]> getInput()
    {
        SymfonyModelAccess modelAccess = SymfonyModelAccess.getDefault();
       
        List<Route> routes = modelAccess.findRoutes(project);
        List<String[]> input = new ArrayList<String[]>();
       
        for (Route route : routes) {
            String display = route.getName() + " - " + route.getViewPath();
           
View Full Code Here

TOP

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

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.