Package org.eclipse.jdt.internal.core

Examples of org.eclipse.jdt.internal.core.SourceMapper


  ISourceRange range = classFile.isOpen() ? binaryMember.getNameRange() : SourceMapper.UNKNOWN_RANGE;
  if (range.getOffset() == -1) {
    BinaryType type = (BinaryType) classFile.getType();
    String sourceFileName = type.sourceFileName(info);
    if (sourceFileName != null) {
      SourceMapper mapper = classFile.getSourceMapper();
      if (mapper != null) {
        char[] contents = mapper.findSource(type, sourceFileName);
        if (contents != null)
          range = mapper.mapSource(type, contents, info, binaryMember);
      }
    }
  }
  if (resource == null) resource =  this.currentPossibleMatch.resource;
  SearchMatch match = newDeclarationMatch(binaryMember, binaryMemberBinding, accuracy, range.getOffset(), range.getLength(), getParticipant(), resource);
View Full Code Here


     */
    public static void installSourceMapper(final IPackageFragmentRoot root) {
        try {
            PackageFragmentRoot packageFragmentRoot = ((PackageFragmentRoot) root);
      if (!isSourceAttached(packageFragmentRoot) && (!isFromJRE(root) || WojServicesHelper.getDefault().isSunSupported())) {
                SourceMapper sourceMapper = packageFragmentRoot.getSourceMapper();
        if(sourceMapper == null ||!(sourceMapper instanceof WojSourceMapper)) {
                    packageFragmentRoot.setSourceMapper(newWojSourceMapper());
                }
            }
        } catch (JavaModelException e) {
View Full Code Here

        if (this.hasNoParameterNamesFromIndex) {

          IPackageFragmentRoot packageFragmentRoot = (IPackageFragmentRoot)type.getAncestor(IJavaElement.PACKAGE_FRAGMENT_ROOT);
          if (packageFragmentRoot.isArchive() ||
              this.completionEngine.openedBinaryTypes < getOpenedBinaryTypesThreshold()) {
            SourceMapper mapper = ((JavaElement)method).getSourceMapper();
            if (mapper != null) {
              char[][] paramNames = mapper.getMethodParameterNames(method);

              // map source and try to find parameter names
              if(paramNames == null) {
                if (!packageFragmentRoot.isArchive()) this.completionEngine.openedBinaryTypes++;
                IBinaryType info = (IBinaryType) ((BinaryType) type).getElementInfo();
                char[] source = mapper.findSource(type, info);
                if (source != null){
                  mapper.mapSource(type, source, info);
                }
                paramNames = mapper.getMethodParameterNames(method);
              }

              if(paramNames != null) {
                parameters = paramNames;
              }
View Full Code Here

  ISourceRange range = classFile.isOpen() ? binaryMember.getNameRange() : SourceMapper.UNKNOWN_RANGE;
  if (range.getOffset() == -1) {
    BinaryType type = (BinaryType) classFile.getType();
    String sourceFileName = type.sourceFileName(info);
    if (sourceFileName != null) {
      SourceMapper mapper = classFile.getSourceMapper();
      if (mapper != null) {
        char[] contents = mapper.findSource(type, sourceFileName);
        if (contents != null)
          range = mapper.mapSource(type, contents, info, binaryMember);
      }
    }
  }
  if (resource == null) resource =  this.currentPossibleMatch.resource;
  SearchMatch match = newDeclarationMatch(binaryMember, binaryMemberBinding, accuracy, range.getOffset(), range.getLength(), getParticipant(), resource);
View Full Code Here

  ISourceRange range = classFile.isOpen() ? binaryMember.getNameRange() : SourceMapper.UNKNOWN_RANGE;
  if (range.getOffset() == -1) {
    BinaryType type = (BinaryType) classFile.getType();
    String sourceFileName = type.sourceFileName(info);
    if (sourceFileName != null) {
      SourceMapper mapper = classFile.getSourceMapper();
      if (mapper != null) {
        char[] contents = mapper.findSource(type, sourceFileName);
        if (contents != null)
          range = mapper.mapSource(type, contents, info, binaryMember);
      }
    }
  }
  if (resource == null) resource =  this.currentPossibleMatch.resource;
  SearchMatch match = newDeclarationMatch(binaryMember, binaryMemberBinding, accuracy, range.getOffset(), range.getLength(), getParticipant(), resource);
View Full Code Here

  public static void doDecompilerAttach(PackageFragmentRoot root)
  {
    try
    {
      Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
      SourceMapper existingMapper = root.getSourceMapper();

      if (existingMapper instanceof RealignmentJDSourceMapper)
      {
        // Remove decompiler attachment
        RealignmentJDSourceMapper jdSourceMapper = (RealignmentJDSourceMapper) existingMapper;
        root.setSourceMapper(null);
        RealignmentJDSourceMapper.clearDecompiled(jdSourceMapper);

        // Re-attach any source which was previously attached
        SourceAttachmentDetails details = jdSourceMapper.sourceDetails;
        if (details != null)
        {
          applySourceAttachment(shell, details.newEntry,
              details.project, details.containerPath,
              details.isReferencedEntry);
        }
      }
      else
      {
        SourceAttachmentDetails details = null;
        if (root.getSourceAttachmentPath() != null)
        {
          AtomicReference<IPath> containerPath = new AtomicReference<IPath>();
          IClasspathEntry entry = getClasspathEntry(root, containerPath);

          // Backup existing attachment details
          CPListElement backupCpElement = CPListElement.createFromExisting(entry,
                                                           root.getJavaProject());
          details = new SourceAttachmentDetails(backupCpElement.getClasspathEntry(),
                                                root.getJavaProject(),
                                                containerPath.get(),
                                                entry.getReferencingEntry() != null);
        }

        // Source copied from
        // jd.ide.eclipse.editors.JDClassFileEditor

        // The location of the archive file containing classes.
        IPath classPath = root.getPath();
        // The location of the archive file containing source.
        IPath sourcePath = root.getSourceAttachmentPath();
        if (sourcePath == null)
          sourcePath = classPath;
        // Specifies the location of the package fragment root
        // within the zip (empty specifies the default root).
        IPath sourceAttachmentRootPath = root.getSourceAttachmentRootPath();
        String sourceRootPath;
        if (sourceAttachmentRootPath == null)
        {
          sourceRootPath = null;
        }
        else
        {
          sourceRootPath = sourceAttachmentRootPath.toString();
          if ((sourceRootPath != null) && (sourceRootPath.length() == 0))
            sourceRootPath = null;
        }
        Map<?, ?> options = root.getJavaProject().getOptions(true);

        // Create source mapper
        SourceMapper mapper = RealignmentJDSourceMapper.newSourceMapper(
                       classPath, sourcePath, sourceRootPath, options, details);
        root.setSourceMapper(mapper);
      }

      // Remove any buffers associated with the root being modified
View Full Code Here

TOP

Related Classes of org.eclipse.jdt.internal.core.SourceMapper

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.