Package org.eclipse.php.internal.core.model

Examples of org.eclipse.php.internal.core.model.PhpModelAccess


   
    Collection<TypeReference> interfaces = getClassDeclaration().getInterfaceList();
   
    List<IMethod> unimplemented = new ArrayList<IMethod>();   
    IDLTKSearchScope scope = SearchEngine.createSearchScope(project);   
    PhpModelAccess model = PhpModelAccess.getDefault();   
    IType nss = PHPModelUtils.getCurrentNamespace(sourceModule, getClassDeclaration().getNameStart());
    String search = nss != null ? nss.getElementName() + BACK_SLASH + getClassDeclaration().getName() : getClassDeclaration().getName();
     
    IType classType = context != null ? PDTModelUtils.findType(sourceModule, search) : null;
       
    if (classType == null) {
      for (IType t : PDTModelUtils.findTypes(project, search)) {
        classType = t;
        break;
      }
      if (classType == null) {
        return false;
      }
    }
   
   
    Map<String, IMethod> listImported = PDTModelUtils.getImportedMethods(classType);
    // iterate over all interfaces and check if the current class
    // or any of the superclasses implements the method
    if (listImported == null) {
      return true;
    }
    for (TypeReference interf : interfaces) {
     
      if (interf instanceof FullyQualifiedReference) {
       
        FullyQualifiedReference fqr = (FullyQualifiedReference) interf;
        String name = null;
        // we have a namespace
        if (fqr.getNamespace() != null) {
          name = fqr.getNamespace().getName() + BACK_SLASH + fqr.getName();
        } else {
          IEvaluatedType eval = PHPTypeInferenceUtils.resolveExpression(sourceModule, fqr);
          name = eval.getTypeName();
          if (eval.getTypeName().startsWith(BACK_SLASH)) {
            name = eval.getTypeName().replaceFirst("\\\\", "");
          }         
        }
       
        if (name == null) {
          continue;
        }
        IType[] types;
       
        if (PDTModelUtils.findType(sourceModule, name) != null) {
          types = new IType[] {PDTModelUtils.findType(sourceModule, name)};
        } else {
          types = model.findTypes(name, MatchRule.EXACT, 0, 0, scope, new NullProgressMonitor());
        }
       
        if (types.length != 1) {
          continue;
        }
View Full Code Here


    public SearchAllTypesTest() {
      super(getProjectNameWithVersion(map) + "_SearchAllTypesTest");
    }

    public void runTest() throws Throwable {
      final PhpModelAccess modelAccess = PhpModelAccess.getDefault();
      IProject project = getProject(map.get(PROJECT).toString());

      IScriptProject scriptProject = DLTKCore.create(project);
      final IDLTKSearchScope scope = SearchEngine
          .createSearchScope(scriptProject);
      modelAccess.findTypes("", MatchRule.PREFIX, 0, 0, scope, null);
      perfMonitor.execute(getProjectNameWithVersion(map)
          + ".testSearchAllTypes", new Operation() {
        public void run() throws Exception {
          modelAccess.findTypes("", MatchRule.PREFIX, 0, 0, scope,
              null);
        }
      }, 10, 10);
    }
View Full Code Here

    public SearchAllFunctionsTest() {
      super(getProjectNameWithVersion(map) + "_SearchAllFunctionsTest");
    }

    public void runTest() throws Throwable {
      final PhpModelAccess modelAccess = PhpModelAccess.getDefault();
      IProject project = getProject(map.get(PROJECT).toString());

      IScriptProject scriptProject = DLTKCore.create(project);
      final IDLTKSearchScope scope = SearchEngine
          .createSearchScope(scriptProject);
      modelAccess.findMethods("", MatchRule.PREFIX, Modifiers.AccGlobal,
          0, scope, null);
      perfMonitor.execute(getProjectNameWithVersion(map)
          + ".testSearchAllFunctions", new Operation() {
        public void run() throws Exception {
          modelAccess.findMethods("", MatchRule.PREFIX,
              Modifiers.AccGlobal, 0, scope, null);
        }
      }, 10, 10);
    }
View Full Code Here

    public SearchGlobalVariablesTest() {
      super(getProjectNameWithVersion(map) + "_SearchGlobalVariablesTest");
    }

    public void runTest() throws Throwable {
      final PhpModelAccess modelAccess = PhpModelAccess.getDefault();
      IProject project = getProject(map.get(PROJECT).toString());

      IScriptProject scriptProject = DLTKCore.create(project);
      final IDLTKSearchScope scope = SearchEngine
          .createSearchScope(scriptProject);
      modelAccess.findFields("", MatchRule.PREFIX, Modifiers.AccGlobal,
          0, scope, null);
      perfMonitor.execute(getProjectNameWithVersion(map)
          + ".testSearchGlobalVariables", new Operation() {
        public void run() throws Exception {
          modelAccess.findFields("", MatchRule.PREFIX,
              Modifiers.AccGlobal, 0, scope, null);
        }
      }, 10, 10);
    }
View Full Code Here

      super(getProjectNameWithVersion(map)
          + "_SearchIncludeStatementsTest");
    }

    public void runTest() throws Throwable {
      final PhpModelAccess modelAccess = PhpModelAccess.getDefault();
      IProject project = getProject(map.get(PROJECT).toString());

      IScriptProject scriptProject = DLTKCore.create(project);
      final IDLTKSearchScope scope = SearchEngine
          .createSearchScope(scriptProject);
      modelAccess.findIncludes("", MatchRule.PREFIX, scope, null);
      perfMonitor.execute(getProjectNameWithVersion(map)
          + ".testSearchIncludeStatements", new Operation() {
        public void run() throws Exception {
          modelAccess.findIncludes("", MatchRule.PREFIX, scope, null);
        }
      }, 10, 10);
    }
View Full Code Here

            if (wordRegion == null)
                return null;

            String path = document.get(wordRegion.getOffset(), wordRegion.getLength());
            PhpModelAccess model = PhpModelAccess.getDefault();
           
            if (path == null || path.length() == 0) {
                return null;
            }
            IType[] types = model.findTypes(path, MatchRule.EXACT, 0, 0, SearchEngine.createWorkspaceScope(PHPLanguageToolkit.getDefault()), new NullProgressMonitor());
            IWorkbenchPartSite site = Workbench.getInstance().getActiveWorkbenchWindow().getActivePage().getActiveEditor().getSite();

            if (types.length > 10) {
                Logger.debugMSG("Found more than ten (" + types.length +") types during xml hyperlink detection...");
                return null;
View Full Code Here

      parser = new XMLConfigParser(file.getContents());
      parser.parse();
      HashMap<String,Service> services = parser.getServices();
     
      Iterator<String> it = services.keySet().iterator();
      PhpModelAccess model = PhpModelAccess.getDefault();
      IDLTKSearchScope scope = SearchEngine.createSearchScope(scriptProject);
     
      while(it.hasNext()) {
        String key = it.next();
        Service service = services.get(key);
       
        if (service == null) {
          Logger.log(Logger.INFO, "Error setting marker for service " + key);
          continue;
        }
        String phpClass = service.getPHPClass();
       
        if ("synthetic".equals(phpClass)) {
          Logger.log(Logger.INFO, "Error setting marker for synthetic service " + key);
          continue;
        }
       
        IType[] types = model.findTypes(phpClass, MatchRule.EXACT, 0, 0, scope, null);
       
        if (types.length == 0) {
         
                IMarker marker = resource.createMarker(SymfonyMarker.MISSING_SERVICE_CLASS);
                marker.setAttribute(SymfonyMarker.SERVICE_CLASS, phpClass);
View Full Code Here

TOP

Related Classes of org.eclipse.php.internal.core.model.PhpModelAccess

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.