本文整理汇总了Java中org.eclipse.jdt.internal.compiler.env.ICompilationUnit.getFileName方法的典型用法代码示例。如果您正苦于以下问题:Java ICompilationUnit.getFileName方法的具体用法?Java ICompilationUnit.getFileName怎么用?Java ICompilationUnit.getFileName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jdt.internal.compiler.env.ICompilationUnit
的用法示例。
在下文中一共展示了ICompilationUnit.getFileName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: startLoggingSource
import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; //导入方法依赖的package包/类
public void startLoggingSource(CompilationResult compilationResult) {
if ((this.tagBits & Logger.XML) != 0) {
ICompilationUnit compilationUnit = compilationResult.compilationUnit;
if (compilationUnit != null) {
char[] fileName = compilationUnit.getFileName();
File f = new File(new String(fileName));
if (fileName != null) {
this.parameters.put(Logger.PATH, f.getAbsolutePath());
}
char[][] packageName = compilationResult.packageName;
if (packageName != null) {
this.parameters.put(
Logger.PACKAGE,
new String(CharOperation.concatWith(packageName, File.separatorChar)));
}
CompilationUnit unit = (CompilationUnit) compilationUnit;
String destinationPath = unit.destinationPath;
if (destinationPath == null) {
destinationPath = this.main.destinationPath;
}
if (destinationPath != null && destinationPath != NONE) {
if (File.separatorChar == '/') {
this.parameters.put(Logger.OUTPUT, destinationPath);
} else {
this.parameters.put(Logger.OUTPUT, destinationPath.replace('/', File.separatorChar));
}
}
}
printTag(Logger.SOURCE, this.parameters, true, false);
}
}
示例2: extractDestinationPathFromSourceFile
import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; //导入方法依赖的package包/类
public String extractDestinationPathFromSourceFile(CompilationResult result) {
ICompilationUnit compilationUnit = result.compilationUnit;
if (compilationUnit != null) {
char[] fileName = compilationUnit.getFileName();
int lastIndex = CharOperation.lastIndexOf(java.io.File.separatorChar, fileName);
if (lastIndex != -1) {
final String outputPathName = new String(fileName, 0, lastIndex);
final File output = new File(outputPathName);
if (output.exists() && output.isDirectory()) {
return outputPathName;
}
}
}
return System.getProperty("user.dir"); //$NON-NLS-1$
}
示例3: CompilationResult
import org.eclipse.jdt.internal.compiler.env.ICompilationUnit; //导入方法依赖的package包/类
public CompilationResult(ICompilationUnit compilationUnit, int unitIndex, int totalUnitsKnown, int maxProblemPerUnit){
this.fileName = compilationUnit.getFileName();
this.compilationUnit = compilationUnit;
this.unitIndex = unitIndex;
this.totalUnitsKnown = totalUnitsKnown;
this.maxProblemPerUnit = maxProblemPerUnit;
}