| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent def074d commit 3b280e6
2 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -712,37 +712,24 @@ protected static String getRelated( ProgramElementDoc doc ) throws IOException | |||
| 712 | 712 | TemplateWriter templateWriter = new TemplateWriter(); | |
| 713 | 713 | ArrayList<HashMap<String, String>> vars = new ArrayList<HashMap<String,String>>(); | |
| 714 | 714 | ||
| 715 | - // it is no longer clear to me what purpose this classMembers mapping serves | ||
| 716 | - // It's left in source for now in case it proves important. However, building the | ||
| 717 | - // entire reference only turned up cases where it overwrites method @see tags | ||
| 718 | - // with field @see tags, which is not something we want. | ||
| 719 | - // Eliminating this fixes github issue 137 | ||
| 720 | - /* | ||
| 721 | - HashMap<String, ProgramElementDoc> classMembers = new HashMap<String, ProgramElementDoc>(); | ||
| 715 | + // keep track of class members so that links to methods in e.g. PGraphics | ||
| 716 | + // that are copied into PApplet are correctly linked. | ||
| 717 | + HashMap<String, ProgramElementDoc> classMethods = new HashMap<String, ProgramElementDoc>(); | ||
| 718 | + HashMap<String, ProgramElementDoc> classFields = new HashMap<String, ProgramElementDoc>(); | ||
| 722 | 719 | if( doc.isMethod() || doc.isField() ) | |
| 723 | - { | ||
| 720 | + { // fill our maps | ||
| 724 | 721 | ClassDoc containingClass = doc.containingClass(); | |
| 725 | - // consider only doing this if we aren't in the core | ||
| 726 | - // doing this in the core protects against errant references to PGraphics | ||
| 727 | - // if( !containingClass.name().equalsIgnoreCase("PApplet") ) | ||
| 728 | - { | ||
| 729 | - for( MethodDoc m : containingClass.methods() ) | ||
| 730 | - { | ||
| 731 | - if( needsWriting( m ) ) | ||
| 732 | - { | ||
| 733 | - classMembers.put( m.name(), m ); | ||
| 734 | - } | ||
| 722 | + for( MethodDoc m : containingClass.methods() ) { | ||
| 723 | + if( needsWriting( m ) ) { | ||
| 724 | + classMethods.put( m.name(), m ); | ||
| 735 | 725 | } | |
| 736 | - for( FieldDoc f : containingClass.fields() ) | ||
| 737 | - { | ||
| 738 | - if( needsWriting( f ) ) | ||
| 739 | - { | ||
| 740 | - classMembers.put( f.name(), f ); | ||
| 741 | - } | ||
| 726 | + } | ||
| 727 | + for( FieldDoc f : containingClass.fields() ) { | ||
| 728 | + if( needsWriting( f ) ) { | ||
| 729 | + classFields.put( f.name(), f ); | ||
| 742 | 730 | } | |
| 743 | 731 | } | |
| 744 | 732 | } | |
| 745 | - //*/ | ||
| 746 | 733 | ||
| 747 | 734 | // add link to each @see item | |
| 748 | 735 | for( SeeTag tag : getAllSeeTags( doc ) ) | |
@@ -752,28 +739,19 @@ protected static String getRelated( ProgramElementDoc doc ) throws IOException | |||
| 752 | 739 | if( tag.referencedMember() != null ) | |
| 753 | 740 | { | |
| 754 | 741 | ref = tag.referencedMember(); | |
| 755 | - /* | ||
| 756 | - if( classMembers.containsKey( ref.name() ) ) | ||
| 757 | - { | ||
| 758 | - ProgramElementDoc prior = classMembers.get( ref.name() ); | ||
| 759 | - String refType = (ref.isMethod() ? " Method()" : " Field"); | ||
| 760 | - String priorType = (prior.isMethod() ? " Method()" : " Field"); | ||
| 761 | - if( !priorType.equals( refType ) ) | ||
| 762 | - { | ||
| 763 | - System.out.println( "\n++++++++++++++++++++++++++++++++++++++++++" ); | ||
| 764 | - System.out.println( "Would collapse " + ref.name() + refType ); | ||
| 765 | - System.out.println( "into " + prior.name() + priorType ); | ||
| 766 | - System.out.println( "++++++++++++++++++++++++++++++++++++++++++\n" ); | ||
| 767 | - } | ||
| 768 | - // previously, we replaced references this way | ||
| 769 | - // doesn't seem to be helpful | ||
| 742 | + if( ref.isMethod() && classMethods.containsKey( ref.name() ) ) { | ||
| 743 | + // link to the member as it is in this class, instead of | ||
| 744 | + // as it is in another class | ||
| 745 | + ProgramElementDoc prior = classMethods.get( ref.name() ); | ||
| 746 | + ref = prior; | ||
| 747 | + } | ||
| 748 | + else if ( ref.isField() && classFields.containsKey( ref.name() ) ) { | ||
| 749 | + ProgramElementDoc prior = classFields.get( ref.name() ); | ||
| 770 | 750 | ref = prior; | |
| 771 | 751 | } | |
| 772 | - */ | ||
| 773 | 752 | } | |
| 774 | 753 | if( needsWriting( ref ) ) | |
| 775 | - { | ||
| 776 | - // add links to things that are actually written | ||
| 754 | + { // add links to things that are actually written | ||
| 777 | 755 | map.put("name", getName( ref )); | |
| 778 | 756 | map.put("anchor", getAnchor( ref )); | |
| 779 | 757 | vars.add(map); | |
@@ -825,9 +803,7 @@ protected static String getRelated( ProgramElementDoc doc ) throws IOException | |||
| 825 | 803 | { | |
| 826 | 804 | e.printStackTrace(); | |
| 827 | 805 | } | |
| 828 | - | ||
| 829 | 806 | } | |
| 830 | - | ||
| 831 | 807 | } | |
| 832 | 808 | ||
| 833 | 809 | return templateWriter.writeLoop("related.partial.html", vars); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments