author | ksrini |
Mon, 05 Jun 2017 13:45:34 -0700 | |
changeset 45417 | f7479ee8de69 |
parent 35426 | 374342e56a56 |
permissions | -rw-r--r-- |
10 | 1 |
/* |
45417 | 2 |
* Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved. |
10 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
5520 | 7 |
* published by the Free Software Foundation. Oracle designates this |
10 | 8 |
* particular file as subject to the "Classpath" exception as provided |
5520 | 9 |
* by Oracle in the LICENSE file that accompanied this code. |
10 | 10 |
* |
11 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
12 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
13 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
14 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
15 |
* accompanied this code). |
|
16 |
* |
|
17 |
* You should have received a copy of the GNU General Public License version |
|
18 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
19 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
20 |
* |
|
5520 | 21 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
22 |
* or visit www.oracle.com if you need additional information or have any |
|
23 |
* questions. |
|
10 | 24 |
*/ |
25 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
26 |
package jdk.javadoc.internal.doclets.formats.html; |
10 | 27 |
|
15385 | 28 |
import java.util.List; |
29 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
30 |
import javax.lang.model.element.AnnotationMirror; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
31 |
import javax.lang.model.element.Element; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
32 |
import javax.lang.model.element.TypeElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
33 |
import javax.lang.model.type.TypeMirror; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
34 |
|
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
35 |
import jdk.javadoc.internal.doclets.formats.html.markup.ContentBuilder; |
45417 | 36 |
import jdk.javadoc.internal.doclets.toolkit.BaseConfiguration; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
37 |
import jdk.javadoc.internal.doclets.toolkit.Content; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
38 |
import jdk.javadoc.internal.doclets.toolkit.util.DocPath; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
39 |
import jdk.javadoc.internal.doclets.toolkit.util.Utils; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
40 |
import jdk.javadoc.internal.doclets.toolkit.util.links.LinkFactory; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
41 |
import jdk.javadoc.internal.doclets.toolkit.util.links.LinkInfo; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
42 |
|
10 | 43 |
/** |
44 |
* A factory that returns a link given the information about it. |
|
45 |
* |
|
14260
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14259
diff
changeset
|
46 |
* <p><b>This is NOT part of any supported API. |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14259
diff
changeset
|
47 |
* If you write code that depends on this, you do so at your own risk. |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14259
diff
changeset
|
48 |
* This code and its internal interfaces are subject to change or |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14259
diff
changeset
|
49 |
* deletion without notice.</b> |
727a84636f12
8000665: fix "internal API" comments on javadoc files
jjg
parents:
14259
diff
changeset
|
50 |
* |
10 | 51 |
* @author Jamie Ho |
52 |
*/ |
|
53 |
public class LinkFactoryImpl extends LinkFactory { |
|
54 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
55 |
private final HtmlDocletWriter m_writer; |
10 | 56 |
|
57 |
public LinkFactoryImpl(HtmlDocletWriter writer) { |
|
58 |
m_writer = writer; |
|
59 |
} |
|
60 |
||
61 |
/** |
|
62 |
* {@inheritDoc} |
|
63 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
64 |
@Override |
17559
87c28ee29329
8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents:
17558
diff
changeset
|
65 |
protected Content newContent() { |
87c28ee29329
8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents:
17558
diff
changeset
|
66 |
return new ContentBuilder(); |
10 | 67 |
} |
68 |
||
69 |
/** |
|
70 |
* {@inheritDoc} |
|
71 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
72 |
@Override |
17559
87c28ee29329
8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents:
17558
diff
changeset
|
73 |
protected Content getClassLink(LinkInfo linkInfo) { |
45417 | 74 |
BaseConfiguration configuration = m_writer.configuration; |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
75 |
Utils utils = configuration.utils; |
10 | 76 |
LinkInfoImpl classLinkInfo = (LinkInfoImpl) linkInfo; |
17560 | 77 |
boolean noLabel = linkInfo.label == null || linkInfo.label.isEmpty(); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
78 |
TypeElement typeElement = classLinkInfo.typeElement; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
79 |
// Create a tool tip if we are linking to a class or interface. Don't |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
80 |
// create one if we are linking to a member. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
81 |
String title = ""; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
82 |
if (classLinkInfo.where == null || classLinkInfo.where.length() == 0) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
83 |
boolean isTypeLink = classLinkInfo.type != null && |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
84 |
utils.isTypeVariable(utils.getComponentType(classLinkInfo.type)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
85 |
title = getClassToolTip(typeElement, isTypeLink); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
86 |
} |
17560 | 87 |
Content label = classLinkInfo.getClassLinkLabel(m_writer.configuration); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
88 |
|
17559
87c28ee29329
8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents:
17558
diff
changeset
|
89 |
Content link = new ContentBuilder(); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
90 |
if (utils.isIncluded(typeElement)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
91 |
if (configuration.isGeneratedDoc(typeElement)) { |
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14263
diff
changeset
|
92 |
DocPath filename = getPath(classLinkInfo); |
10 | 93 |
if (linkInfo.linkToSelf || |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
94 |
!(DocPath.forName(utils, typeElement)).equals(m_writer.filename)) { |
17560 | 95 |
link.addContent(m_writer.getHyperLink( |
14358
9eda9239cba0
8000416: refactor javadoc to provide and use an abstraction for relative URIs
jjg
parents:
14357
diff
changeset
|
96 |
filename.fragment(classLinkInfo.where), |
17560 | 97 |
label, |
1787
1aa079321cd2
6786028: Javadoc HTML WCAG 2.0 accessibility issues in standard doclet - Bold tags should be strong
bpatel
parents:
10
diff
changeset
|
98 |
classLinkInfo.isStrong, classLinkInfo.styleName, |
17560 | 99 |
title, classLinkInfo.target)); |
10 | 100 |
if (noLabel && !classLinkInfo.excludeTypeParameterLinks) { |
17559
87c28ee29329
8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents:
17558
diff
changeset
|
101 |
link.addContent(getTypeParameterLinks(linkInfo)); |
10 | 102 |
} |
17559
87c28ee29329
8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents:
17558
diff
changeset
|
103 |
return link; |
10 | 104 |
} |
105 |
} |
|
106 |
} else { |
|
17560 | 107 |
Content crossLink = m_writer.getCrossClassLink( |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
108 |
typeElement.getQualifiedName().toString(), classLinkInfo.where, |
17560 | 109 |
label, classLinkInfo.isStrong, classLinkInfo.styleName, |
10 | 110 |
true); |
111 |
if (crossLink != null) { |
|
17560 | 112 |
link.addContent(crossLink); |
10 | 113 |
if (noLabel && !classLinkInfo.excludeTypeParameterLinks) { |
17559
87c28ee29329
8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents:
17558
diff
changeset
|
114 |
link.addContent(getTypeParameterLinks(linkInfo)); |
10 | 115 |
} |
17559
87c28ee29329
8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents:
17558
diff
changeset
|
116 |
return link; |
10 | 117 |
} |
118 |
} |
|
119 |
// Can't link so just write label. |
|
19497
407ed5b28a44
8017191: Javadoc is confused by @link to imported classes outside of the set of generated packages
jjg
parents:
17570
diff
changeset
|
120 |
link.addContent(label); |
10 | 121 |
if (noLabel && !classLinkInfo.excludeTypeParameterLinks) { |
17559
87c28ee29329
8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents:
17558
diff
changeset
|
122 |
link.addContent(getTypeParameterLinks(linkInfo)); |
10 | 123 |
} |
17559
87c28ee29329
8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents:
17558
diff
changeset
|
124 |
return link; |
10 | 125 |
} |
126 |
||
127 |
/** |
|
128 |
* {@inheritDoc} |
|
129 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
130 |
@Override |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
131 |
protected Content getTypeParameterLink(LinkInfo linkInfo, TypeMirror typeParam) { |
14542 | 132 |
LinkInfoImpl typeLinkInfo = new LinkInfoImpl(m_writer.configuration, |
17558
eee4ccf66cfd
8010440: Replace int constants in LinkInfoImpl with enum
jjg
parents:
16969
diff
changeset
|
133 |
((LinkInfoImpl) linkInfo).getContext(), typeParam); |
10 | 134 |
typeLinkInfo.excludeTypeBounds = linkInfo.excludeTypeBounds; |
135 |
typeLinkInfo.excludeTypeParameterLinks = linkInfo.excludeTypeParameterLinks; |
|
136 |
typeLinkInfo.linkToSelf = linkInfo.linkToSelf; |
|
15385 | 137 |
typeLinkInfo.isJava5DeclarationLocation = false; |
17564
c329fe11193d
8011288: Erratic/inconsistent indentation of signatures
jjg
parents:
17560
diff
changeset
|
138 |
return getLink(typeLinkInfo); |
10 | 139 |
} |
140 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
141 |
@Override |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
142 |
protected Content getTypeAnnotationLink(LinkInfo linkInfo, AnnotationMirror annotation) { |
15385 | 143 |
throw new RuntimeException("Not implemented yet!"); |
144 |
} |
|
145 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
146 |
@Override |
17559
87c28ee29329
8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents:
17558
diff
changeset
|
147 |
public Content getTypeAnnotationLinks(LinkInfo linkInfo) { |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
148 |
Utils utils = ((LinkInfoImpl)linkInfo).utils; |
17559
87c28ee29329
8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents:
17558
diff
changeset
|
149 |
ContentBuilder links = new ContentBuilder(); |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
150 |
List<? extends AnnotationMirror> annotations; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
151 |
if (utils.isAnnotated(linkInfo.type)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
152 |
annotations = linkInfo.type.getAnnotationMirrors(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
153 |
} else if (utils.isTypeVariable(linkInfo.type)) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
154 |
// TODO: use the context for now, and special case for Receiver_Types, |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
155 |
// which takes the default case. |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
156 |
switch (((LinkInfoImpl)linkInfo).context) { |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
157 |
case MEMBER_TYPE_PARAMS: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
158 |
case EXECUTABLE_MEMBER_PARAM: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
159 |
case CLASS_SIGNATURE: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
160 |
Element element = utils.typeUtils.asElement(linkInfo.type); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
161 |
annotations = element.getAnnotationMirrors(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
162 |
break; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
163 |
default: |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
164 |
annotations = linkInfo.type.getAnnotationMirrors(); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
165 |
break; |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
166 |
} |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
167 |
|
15385 | 168 |
} else { |
17559
87c28ee29329
8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents:
17558
diff
changeset
|
169 |
return links; |
15385 | 170 |
} |
171 |
||
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
172 |
if (annotations.isEmpty()) |
17559
87c28ee29329
8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents:
17558
diff
changeset
|
173 |
return links; |
15385 | 174 |
|
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17569
diff
changeset
|
175 |
List<Content> annos = m_writer.getAnnotations(0, annotations, false, linkInfo.isJava5DeclarationLocation); |
15385 | 176 |
|
177 |
boolean isFirst = true; |
|
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17569
diff
changeset
|
178 |
for (Content anno : annos) { |
15385 | 179 |
if (!isFirst) { |
17559
87c28ee29329
8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents:
17558
diff
changeset
|
180 |
links.addContent(" "); |
15385 | 181 |
} |
17570
78512b2899db
8012183: replace some uses of Configuration.getText with Configuration.getResource
jjg
parents:
17569
diff
changeset
|
182 |
links.addContent(anno); |
16969
b58d8a70d921
8009686: Generated javadoc documentation should be able to display type annotation on an array
bpatel
parents:
15385
diff
changeset
|
183 |
isFirst = false; |
15385 | 184 |
} |
185 |
if (!annos.isEmpty()) { |
|
17559
87c28ee29329
8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents:
17558
diff
changeset
|
186 |
links.addContent(" "); |
15385 | 187 |
} |
188 |
||
17559
87c28ee29329
8011642: Remove LinkOutput in favor of direct use of Content
jjg
parents:
17558
diff
changeset
|
189 |
return links; |
15385 | 190 |
} |
191 |
||
10 | 192 |
/** |
193 |
* Given a class, return the appropriate tool tip. |
|
194 |
* |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
195 |
* @param typeElement the class to get the tool tip for. |
10 | 196 |
* @return the tool tip for the appropriate class. |
197 |
*/ |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
198 |
private String getClassToolTip(TypeElement typeElement, boolean isTypeLink) { |
45417 | 199 |
BaseConfiguration configuration = m_writer.configuration; |
25454
376a52c9540c
8039028: [javadoc] refactor the usage of Util.java
ksrini
parents:
19497
diff
changeset
|
200 |
Utils utils = configuration.utils; |
10 | 201 |
if (isTypeLink) { |
202 |
return configuration.getText("doclet.Href_Type_Param_Title", |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
203 |
utils.getSimpleName(typeElement)); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
204 |
} else if (utils.isInterface(typeElement)){ |
10 | 205 |
return configuration.getText("doclet.Href_Interface_Title", |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
206 |
utils.getPackageName(utils.containingPackage(typeElement))); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
207 |
} else if (utils.isAnnotationType(typeElement)) { |
10 | 208 |
return configuration.getText("doclet.Href_Annotation_Title", |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
209 |
utils.getPackageName(utils.containingPackage(typeElement))); |
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
210 |
} else if (utils.isEnum(typeElement)) { |
10 | 211 |
return configuration.getText("doclet.Href_Enum_Title", |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
212 |
utils.getPackageName(utils.containingPackage(typeElement))); |
10 | 213 |
} else { |
214 |
return configuration.getText("doclet.Href_Class_Title", |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
215 |
utils.getPackageName(utils.containingPackage(typeElement))); |
10 | 216 |
} |
217 |
} |
|
218 |
||
219 |
/** |
|
220 |
* Return path to the given file name in the given package. So if the name |
|
221 |
* passed is "Object.html" and the name of the package is "java.lang", and |
|
222 |
* if the relative path is "../.." then returned string will be |
|
223 |
* "../../java/lang/Object.html" |
|
224 |
* |
|
225 |
* @param linkInfo the information about the link. |
|
226 |
*/ |
|
14357
faf9cde2817b
8000741: refactor javadoc to use abstraction to handle relative paths
jjg
parents:
14263
diff
changeset
|
227 |
private DocPath getPath(LinkInfoImpl linkInfo) { |
17558
eee4ccf66cfd
8010440: Replace int constants in LinkInfoImpl with enum
jjg
parents:
16969
diff
changeset
|
228 |
if (linkInfo.context == LinkInfoImpl.Kind.PACKAGE_FRAME) { |
10 | 229 |
//Not really necessary to do this but we want to be consistent |
230 |
//with 1.4.2 output. |
|
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
231 |
return DocPath.forName(linkInfo.utils, linkInfo.typeElement); |
10 | 232 |
} |
35426
374342e56a56
8035473: [javadoc] Revamp the existing Doclet APIs
ksrini
parents:
25874
diff
changeset
|
233 |
return m_writer.pathToRoot.resolve(DocPath.forClass(linkInfo.utils, linkInfo.typeElement)); |
10 | 234 |
} |
235 |
} |