本文整理汇总了Java中com.sun.javadoc.SourcePosition类的典型用法代码示例。如果您正苦于以下问题:Java SourcePosition类的具体用法?Java SourcePosition怎么用?Java SourcePosition使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
SourcePosition类属于com.sun.javadoc包,在下文中一共展示了SourcePosition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSourcePosition
import com.sun.javadoc.SourcePosition; //导入依赖的package包/类
public SourcePosition getSourcePosition() {
return new SourcePosition() {
@Override
public File file() {
return sourceFilePath.toFile();
}
@Override
public int line() {
return 0;
}
@Override
public int column() {
return 0;
}
@Override
public String toString() {
return file().toString();
}
};
}
示例2: expand
import com.sun.javadoc.SourcePosition; //导入依赖的package包/类
private String expand(Tag tag) {
// create the URL
SourcePosition file = tag.position();
String pathAndFile = file.file().toString();
pathAndFile = pathAndFile.substring(pathAndFile.indexOf("src/main"));
pathAndFile = correctSlashes(pathAndFile);
Matcher matcher = pathPattern.matcher(pathAndFile);
if (matcher.matches()) {
String url = "https://github.com/cdk/cdk/tree/" + BRANCH + "/" +
matcher.group(1);
return "<a href=\"" + url + "\" target=\"_blank\">" + BRANCH + "</a>";
} else {
System.out.println("Could not resolve class name from: " + pathAndFile);
}
return "";
}
示例3: showMessage
import com.sun.javadoc.SourcePosition; //导入依赖的package包/类
@Override
public boolean showMessage(SourcePosition pos, String key) {
if (root instanceof RootDocImpl) {
return pos == null || ((RootDocImpl) root).showTagMessages();
}
return true;
}
示例4: printNotice
import com.sun.javadoc.SourcePosition; //导入依赖的package包/类
/**
* Reporter alias method for {@link #info(String, Object...)} with position info.
*
* @param msg The message (without parameters).
* @see #info(String, Object...)
*/
@Override
public void printNotice(SourcePosition pos, String msg) {
try (GlobalPosition gp = new GlobalPosition(pos)) {
info(msg);
}
}
示例5: printWarning
import com.sun.javadoc.SourcePosition; //导入依赖的package包/类
/**
* Reporter alias method for {@link #warn(String, Object...)} with position info.
*
* @param msg The message (without parameters).
* @see #warn(String, Object...)
*/
@Override
public void printWarning(SourcePosition pos, String msg) {
try (GlobalPosition gp = new GlobalPosition(pos)) {
warn(msg);
}
}
示例6: printError
import com.sun.javadoc.SourcePosition; //导入依赖的package包/类
/**
* Reporter alias method for {@link #error(String, Object...)} with position info.
*
* @param msg The message (without parameters).
* @see #error(String, Object...)
*/
@Override
public void printError(SourcePosition pos, String msg) {
try (GlobalPosition gp = new GlobalPosition(pos)) {
error(msg);
}
}
示例7: error
import com.sun.javadoc.SourcePosition; //导入依赖的package包/类
void error(Doc d, String s) {
SourcePosition sp = d != null ? d.position() : null;
if (sp != null) {
root.printError(sp, s);
} else {
root.printError(s);
}
okSoFar = false;
}
示例8: info
import com.sun.javadoc.SourcePosition; //导入依赖的package包/类
void info(Doc d, String s) {
if (verbose) {
SourcePosition sp = d != null ? d.position() : null;
if (log != null) {
log.println((sp != null ? sp.toString() + " : " : "") + s);
log.flush();
}
if (sp != null) {
root.printNotice(sp, s);
} else {
root.printNotice(s);
}
}
}
示例9: notice
import com.sun.javadoc.SourcePosition; //导入依赖的package包/类
void notice(Doc d, String s) {
SourcePosition sp = d != null ? d.position() : null;
if (log != null) {
log.println((sp != null ? sp.toString() + " : " : "") + s);
log.flush();
}
if (sp != null) {
root.printNotice(sp, s);
} else {
root.printNotice(s);
}
}
示例10: getClassName
import com.sun.javadoc.SourcePosition; //导入依赖的package包/类
/**
* Extract the full class name from the tag source position.
*
* @param tag the tag on a given source file
* @return the class name
*/
private static String getClassName(Tag tag){
SourcePosition position = tag.position();
File file = position.file();
String path = file.getPath().replaceAll(File.separator, ".");
return path.substring(path.indexOf("org.openscience.cdk"),
path.lastIndexOf(".java"));
}
示例11: defaultProcess
import com.sun.javadoc.SourcePosition; //导入依赖的package包/类
/**
* Default processing of any documentation node.
*
* @param doc The documentation.
* @param fixLeadingSpaces `true` if leading spaces should be fixed.
*
* @see Options#toHtml(String, boolean)
*/
protected void defaultProcess(Doc doc, boolean fixLeadingSpaces) {
try {
StringBuilder buf = new StringBuilder();
buf.append(getOptions().toHtml(doc.commentText(), fixLeadingSpaces));
buf.append('\n');
for ( Tag tag : doc.tags() ) {
processTag(tag, buf);
buf.append('\n');
}
doc.setRawCommentText(buf.toString());
}
catch ( final ParserRuntimeException e ) {
if ( doc instanceof RootDoc ) {
printError(new SourcePosition() {
@Override
public File file() {
return options.getOverviewFile();
}
@Override
public int line() {
return 0;
}
@Override
public int column() {
return 0;
}
}, e.getMessage());
}
else {
printError(doc.position(), e.getMessage());
}
}
}
示例12: make
import com.sun.javadoc.SourcePosition; //导入依赖的package包/类
public static SourcePosition make(FileObject file, int pos,
Position.LineMap lineMap) {
if (file == null) return null;
return new SourcePositionImpl(file, pos, lineMap);
}
示例13: resolve
import com.sun.javadoc.SourcePosition; //导入依赖的package包/类
private File resolve(String file, SourcePosition source) {
return new File(source.file().getParentFile(), file);
}
示例14: make
import com.sun.javadoc.SourcePosition; //导入依赖的package包/类
public static SourcePosition make(String file, int pos,
Position.LineMap lineMap) {
if (file == null) return null;
return new SourcePositionImpl(file, pos, lineMap);
}
示例15: printError
import com.sun.javadoc.SourcePosition; //导入依赖的package包/类
@Override
public void printError(SourcePosition pos, String msg) {
error();
rootDoc.printError(pos, msg);
}