Package org.eclipse.dltk.core

Examples of org.eclipse.dltk.core.ISourceModule


   */
  @Override
  public void apply(ICompletionReporter reporter) throws Exception {

    SuperclassMethodContext context = (SuperclassMethodContext) getContext();
    ISourceModule module = context.getSourceModule();

    IModelElement element = module.getElementAt(context.getOffset());

    if (!(element instanceof SourceType)) {
      while(element.getParent() != null) {
        element = element.getParent();
        if (element instanceof SourceType) {
          break;
        }
      }
    }

    if (element == null || !(element instanceof SourceType)) {
      return;
    }

    IDLTKSearchScope scope = SearchEngine.createSearchScope(module.getScriptProject());
    SourceType type = (SourceType) element;
    SourceRange range = getReplacementRange(context);
    String prefix = context.getPrefix();

    IType[] projectTypes = PhpModelAccess.getDefault().findTypes(type.getElementName(), MatchRule.EXACT, 0, 0, scope, null);
View Full Code Here


   * @since 0.17.0
   */
  public static IModelElement getSourceElement(IModelElement element, int offset, int length) throws CoreException {
    Assert.isNotNull(element);

    ISourceModule sourceModule = (ISourceModule) element.getAncestor(IModelElement.SOURCE_MODULE);
    if (sourceModule == null) return null;

    return getSourceElement(sourceModule, offset, length);
  }
View Full Code Here

    } else if (el instanceof IProjectFragment ) {
      for (IModelElement sub : ((IProjectFragment) el).getChildren()) {
        rawSearch(list, sub, name);
      }
    } else if (el instanceof ISourceModule){
      ISourceModule mod = (ISourceModule) el;
      for (IType t : mod.getAllTypes()) {
        if (t.getFullyQualifiedName(BACK_SLASH).equals(name)) {
         
          list.add(t);
        }
      }
View Full Code Here

      SearchEngine.createSearchScope(modelElement.getScriptProject()),
      new SearchRequestor() {
        @Override
        public void acceptSearchMatch(final SearchMatch match) throws CoreException {
          if (match instanceof TypeReferenceMatch && match.getElement() instanceof IModelElement) {
            final ISourceModule module = (ISourceModule) ((IModelElement) match.getElement()).getAncestor(IModelElement.SOURCE_MODULE);
            if (module != null && RefactoringAvailabilityTester.isRenameAvailable(module)) {
              ModuleDeclaration moduleDeclaration = SourceParserUtil.getModuleDeclaration(module);
              if (moduleDeclaration != null) {
                try {
                  moduleDeclaration.traverse(new PHPASTVisitor() {
View Full Code Here

        SearchEngine.createSearchScope(modelElement.getScriptProject()),
        new SearchRequestor() {
          @Override
          public void acceptSearchMatch(final SearchMatch match) throws CoreException {
            if (match instanceof MethodReferenceMatch && ((MethodReferenceMatch) match).getNode() instanceof PHPCallExpression && match.getElement() instanceof IModelElement) {
              final ISourceModule module = (ISourceModule) ((IModelElement) match.getElement()).getAncestor(IModelElement.SOURCE_MODULE);
              if (module != null && RefactoringAvailabilityTester.isRenameAvailable(module)) {
                PHPCallExpression expression = (PHPCallExpression) ((MethodReferenceMatch) match).getNode();
                if (expression.getReceiver() == null) {
                  if (expression.getCallName() instanceof FullyQualifiedReference) {
                    int offset;
View Full Code Here

          return false;
        }
       
        project = element.getScriptProject().getProject();
      } else if (receiver instanceof ISourceModule) {
        ISourceModule source = (ISourceModule) receiver;
        project = source.getScriptProject().getProject();
      } else if (receiver instanceof IProject) {
        project = (IProject) receiver;
      } else if (receiver instanceof IAdaptable) {
        IAdaptable adaptable = (IAdaptable) receiver;
        project = ((IResource)adaptable.getAdapter(IResource.class)).getProject();
View Full Code Here

      SearchEngine.createSearchScope(modelElement.getScriptProject()),
      new SearchRequestor() {
        @Override
        public void acceptSearchMatch(SearchMatch match) throws CoreException {
          if (match instanceof FieldReferenceMatch && match.getElement() instanceof IModelElement) {
            ISourceModule module = (ISourceModule) ((IModelElement) match.getElement()).getAncestor(IModelElement.SOURCE_MODULE);
            if (module != null && RefactoringAvailabilityTester.isRenameAvailable(module)) {
              ModuleDeclaration moduleDeclaration = SourceParserUtil.getModuleDeclaration(module);
              if (moduleDeclaration != null) {
                ReferenceFinder referenceFinder = createReferenceFinder(((FieldReferenceMatch) match).getNode(), module);
View Full Code Here

      return;
    }
    if (context.getBuildType() != IBuildContext.RECONCILE_BUILD) {
      ModelManager.getModelManager().getIndexManager().waitUntilReady();
    }
    ISourceModule workingCopy = context.getSourceModule();
    //if (context.getBuildType() == IBuildContext.RECONCILE_BUILD) {
      //try {
        //workingCopy = context.getSourceModule().getWorkingCopy(null);
      //} catch (ModelException e) {
      //  Logger.logException(e);
View Full Code Here

    if (textEditor instanceof PHPStructuredEditor) {
      IModelElement editorElement = ((PHPStructuredEditor) textEditor)
          .getModelElement();
      if (editorElement != null) {
       
        ISourceModule sourceModule = ((ModelElement) editorElement)
            .getSourceModule();
               
        try {

          if (sourceModule.getTypes().length != 1) {
            return;
          }
          ModuleDeclaration module = SourceParserUtil.getModuleDeclaration(sourceModule);
          ImplementationValidator validator = new ImplementationValidator(sourceModule);
          String code = "";
View Full Code Here

      return null;
    }
  }

  private static IModelElement getSourceElement(IModelElement element, int offset, int length) throws CoreException {
    ISourceModule sourceModule = (ISourceModule) element.getAncestor(IModelElement.SOURCE_MODULE);
    if (sourceModule == null) return null;

    return getSourceElement(sourceModule, offset, length);
  }
View Full Code Here

TOP

Related Classes of org.eclipse.dltk.core.ISourceModule

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.